Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
WaverIDiamond
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSL pragma solidity ^0.8.17; /** * [BSL License] * @title CM Proxy contract implementation. * @notice Individual contract is created after proposal has been sent to the partner. ETH stake will be deposited to this newly created contract. * @dev The proxy uses Diamond Pattern for modularity. Relevant code was borrowed from Nick Mudge <[email protected]>. * Reimbursement of sponsored TXFee through MinimalForwarder, amounts to full estimated TX Costs of relevant functions. * @author Ismailov Altynbek <[email protected]> */ import "@gnus.ai/contracts-upgradeable-diamond/proxy/utils/Initializable.sol"; import "@gnus.ai/contracts-upgradeable-diamond/security/ReentrancyGuardUpgradeable.sol"; import "@gnus.ai/contracts-upgradeable-diamond/metatx/ERC2771ContextUpgradeable.sol"; import "@gnus.ai/contracts-upgradeable-diamond/metatx/MinimalForwarderUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./handlers/SecuredTokenTransfer.sol"; import "./handlers/DefaultCallbackHandler.sol"; import {LibDiamond} from "./libraries/LibDiamond.sol"; import {IDiamondCut} from "./interfaces/IDiamondCut.sol"; import {VoteProposalLib} from "./libraries/VotingStatusLib.sol"; /*Interface for the Main Contract*/ interface WaverContract { function burn(address _to, uint256 _amount) external; function addFamilyMember(address, uint256) external; function cancel(uint256) external; function deleteFamilyMember(address, uint) external; function divorceUpdate(uint256 _id) external; function addressNFTSplit() external returns (address); function promoDays() external returns (uint); } /*Interface for the NFT Split Contract*/ interface nftSplitInstance { function splitNFT( address _nft_Address, uint256 _tokenID, string memory image, address waver, address proposed, address _implementationAddr, uint shareDivide ) external; } contract WaverIDiamond is Initializable, SecuredTokenTransfer, DefaultCallbackHandler, ERC2771ContextUpgradeable, ReentrancyGuardUpgradeable { string public constant VERSION = "1.0.1"; address immutable diamondcut; /*Constructor to connect Forwarder Address*/ constructor(MinimalForwarderUpgradeable forwarder, address _diamondcut) initializer ERC2771ContextUpgradeable(address(forwarder)) {diamondcut = _diamondcut;} /** * @notice Initialization function of the proxy contract * @dev Initialization params are passed from the main contract. * @param _addressWaveContract Address of the main contract. * @param _id Marriage ID assigned by the main contract. * @param _proposer Address of the prpoposer. * @param _proposer Address of the proposed. * @param _policyDays Cooldown before dissolution * @param _cmFee CM fee, as a small percentage of incoming and outgoing transactions. * @param _divideShare the share that will be divided among partners upon dissolution. */ function initialize( address payable _addressWaveContract, uint256 _id, address _proposer, address _proposed, uint256 _policyDays, uint256 _cmFee, uint256 _minimumDeadline, uint256 _divideShare, uint256 promoDays ) public initializer { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); unchecked { vt.voteid++; } vt.addressWaveContract = _addressWaveContract; vt.marriageStatus = VoteProposalLib.MarriageStatus.Proposed; vt.hasAccess[_proposer] = true; vt.id = _id; vt.proposer = _proposer; vt.proposed = _proposed; vt.cmFee = _cmFee; vt.policyDays = _policyDays; vt.setDeadline = _minimumDeadline; vt.divideShare = _divideShare; vt.promoDays = promoDays; LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); ds.waveAddress=_addressWaveContract; // Add the diamondCut external function from the diamondCutFacet IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1); bytes4[] memory functionSelectors = new bytes4[](1); functionSelectors[0] = IDiamondCut.diamondCut.selector; cut[0] = IDiamondCut.FacetCut({ facetAddress: diamondcut, action: IDiamondCut.FacetCutAction.Add, functionSelectors: functionSelectors }); LibDiamond.diamondCut(cut, address(0), ""); } /** *@notice Proposer can cancel access to the contract if response has not been reveived or accepted. The ETH balance of the contract will be sent to the proposer. *@dev Once trigerred the access to the proxy contract will not be possible from the CM Frontend. Access is preserved from the custom fronted such as Remix. */ function cancel() external { VoteProposalLib.enforceNotYetMarried(); VoteProposalLib.enforceUserHasAccess(_msgSender()); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); vt.marriageStatus = VoteProposalLib.MarriageStatus.Cancelled; WaverContract _wavercContract = WaverContract(vt.addressWaveContract); _wavercContract.cancel(vt.id); VoteProposalLib.processtxn( vt.addressWaveContract, (address(this).balance * vt.cmFee) / 10000 ); VoteProposalLib.processtxn(payable(vt.proposer), address(this).balance); } /** *@notice If the proposal is accepted, triggers this function to be added to the proxy contract. *@dev this function is called from the Main Contract. */ function agreed() external { VoteProposalLib.enforceContractHasAccess(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); vt.marriageStatus = VoteProposalLib.MarriageStatus.Married; vt.marryDate = block.timestamp; vt.hasAccess[vt.proposed] = true; vt.familyMembers = 2; } /** *@notice If the proposal is declined, the status is changed accordingly. *@dev this function is called from the Main Contract. */ function declined() external { VoteProposalLib.enforceContractHasAccess(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); vt.marriageStatus = VoteProposalLib.MarriageStatus.Declined; } error DISSOLUTION_COOLDOWN_NOT_PASSED(uint cooldown); /** * @notice Through this method proposals for voting is created. * @dev All params are required. tokenID for the native currency is 0x0 address. To create proposals it is necessary to have LOVE tokens as it will be used as backing of the proposal. * @param _message String text on details of the proposal. * @param _votetype Type of the proposal as it was listed in enum above. * @param _voteends Timestamp on when the voting ends * @param _numTokens Number of LOVE tokens that is used to back this proposal. * @param _receiver Address of the receiver who will be receiving indicated amounts. * @param _tokenID Address of the ERC20, ERC721 or other tokens. * @param _amount The amount of token that is being sent. Alternatively can be used as NFT ID. */ function createProposal( string calldata _message, uint8 _votetype, uint256 _voteends, uint256 _numTokens, address payable _receiver, address _tokenID, uint256 _amount ) external { address msgSender_ = _msgSender(); VoteProposalLib.enforceUserHasAccess(msgSender_); VoteProposalLib.enforceMarried(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); WaverContract _wavercContract = WaverContract(vt.addressWaveContract); if (_votetype == 4) { //Cooldown has to pass before divorce is proposed. if (vt.marryDate + vt.policyDays > block.timestamp) { revert DISSOLUTION_COOLDOWN_NOT_PASSED(vt.marryDate + vt.policyDays );} //Only partners can propose divorce VoteProposalLib.enforceOnlyPartners(msgSender_); vt.numTokenFor[vt.voteid] = 1e30; _voteends = block.timestamp + 10 days; } else { vt.numTokenFor[vt.voteid] = _numTokens; if (_voteends < block.timestamp + vt.setDeadline) {_voteends = block.timestamp + vt.setDeadline; } //Checking for too short notice } vt.voteProposalAttributes[vt.voteid] = VoteProposalLib.VoteProposal({ id: vt.voteid, proposer: msgSender_, voteType: _votetype, tokenVoteQuantity: _numTokens, voteProposalText: _message, voteStatus: 1, voteends: _voteends, receiver: _receiver, tokenID: _tokenID, amount: _amount, votersLeft: vt.familyMembers - 1 }); vt.votingStatus[vt.voteid][msgSender_] = true; _wavercContract.burn(msgSender_, _numTokens); emit VoteProposalLib.VoteStatus( vt.voteid, msgSender_, 1, block.timestamp ); unchecked { vt.voteid++; } checkForwarder(vt); } /** * @notice Through this method, proposals are voted for/against. * @dev A user cannot vote twice. User cannot vote on voting which has been already passed/declined. Token staked is burnt. There is no explicit ways of identifying votes for or against the vote. * @param _id Vote ID, that is being voted for/against. * @param _numTokens Number of LOVE tokens that is being backed within the vote. * @param responsetype Voting response for/against */ function voteResponse( uint24 _id, uint256 _numTokens, uint8 responsetype ) external { address msgSender_ = _msgSender(); VoteProposalLib.enforceUserHasAccess(msgSender_); VoteProposalLib.enforceNotVoted(_id,msgSender_); VoteProposalLib.enforceProposedStatus(_id); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); WaverContract _wavercContract = WaverContract(vt.addressWaveContract); vt.votingStatus[_id][msgSender_] = true; vt.voteProposalAttributes[_id].votersLeft -= 1; if (responsetype == 2) { vt.numTokenFor[_id] += _numTokens; } else { vt.numTokenAgainst[_id] += _numTokens; } if (vt.voteProposalAttributes[_id].votersLeft == 0) { if (vt.numTokenFor[_id] < vt.numTokenAgainst[_id]) { vt.voteProposalAttributes[_id].voteStatus = 3; } else { vt.voteProposalAttributes[_id].voteStatus = 2; } } _wavercContract.burn(msgSender_, _numTokens); emit VoteProposalLib.VoteStatus( _id, msgSender_, vt.voteProposalAttributes[_id].voteStatus, block.timestamp ); checkForwarder(vt); } /** * @notice The vote can be cancelled by the proposer if it has not been passed. * @dev once cancelled the proposal cannot be voted or executed. * @param _id Vote ID, that is being voted for/against. */ function cancelVoting(uint24 _id) external { address msgSender_ = _msgSender(); VoteProposalLib.enforceProposedStatus(_id); VoteProposalLib.enforceOnlyProposer(_id, msgSender_); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); vt.voteProposalAttributes[_id].voteStatus = 4; emit VoteProposalLib.VoteStatus( _id, msgSender_, vt.voteProposalAttributes[_id].voteStatus, block.timestamp ); checkForwarder(vt); } /** * @notice The vote can be processed if deadline has been passed. * @dev voteend is compounded. The status of the vote proposal depends on number of Tokens voted for/against. * @param _id Vote ID, that is being voted for/against. */ function endVotingByTime(uint24 _id) external { address msgSender_ = _msgSender(); VoteProposalLib.enforceOnlyPartners(msgSender_); VoteProposalLib.enforceProposedStatus(_id); VoteProposalLib.enforceDeadlinePassed(_id); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); if (vt.numTokenFor[_id] < vt.numTokenAgainst[_id]) { vt.voteProposalAttributes[_id].voteStatus = 3; } else { vt.voteProposalAttributes[_id].voteStatus = 7; } emit VoteProposalLib.VoteStatus( _id, msgSender_ , vt.voteProposalAttributes[_id].voteStatus, block.timestamp ); checkForwarder(vt); } error VOTE_ID_NOT_FOUND(); /** * @notice If the proposal has been passed, depending on vote type, the proposal is executed. * @dev Two external protocols are used Uniswap and Compound. * @param _id Vote ID, that is being voted for/against. */ function executeVoting(uint24 _id) external nonReentrant { VoteProposalLib.enforceMarried(); VoteProposalLib.enforceUserHasAccess(msg.sender); VoteProposalLib.enforceAcceptedStatus(_id); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); WaverContract _wavercContract = WaverContract(vt.addressWaveContract); //A small fee for the protocol is deducted here uint256 _amount = (vt.voteProposalAttributes[_id].amount * (10000 - vt.cmFee)) / 10000; uint256 _cmfees = vt.voteProposalAttributes[_id].amount - _amount; // Sending ETH from the contract if (vt.voteProposalAttributes[_id].voteType == 3) { vt.voteProposalAttributes[_id].voteStatus = 5; VoteProposalLib.processtxn(vt.addressWaveContract, _cmfees); VoteProposalLib.processtxn( payable(vt.voteProposalAttributes[_id].receiver), _amount ); } //Sending ERC20 tokens owned by the contract else if (vt.voteProposalAttributes[_id].voteType == 2) { vt.voteProposalAttributes[_id].voteStatus = 5; require( transferToken( vt.voteProposalAttributes[_id].tokenID, vt.addressWaveContract, _cmfees ),"I101" ); require( transferToken( vt.voteProposalAttributes[_id].tokenID, payable(vt.voteProposalAttributes[_id].receiver), _amount ),"I101" ); } else if (vt.voteProposalAttributes[_id].voteType == 3) { VoteProposalLib.processtxn(vt.addressWaveContract, _cmfees); VoteProposalLib.processtxn(payable(vt.voteProposalAttributes[_id].receiver), _amount); vt.voteProposalAttributes[_id].voteStatus = 5; } //This is if two sides decide to divorce, funds are split between partners else if (vt.voteProposalAttributes[_id].voteType == 4) { vt.marriageStatus = VoteProposalLib.MarriageStatus.Divorced; vt.voteProposalAttributes[_id].voteStatus = 6; VoteProposalLib.processtxn( vt.addressWaveContract, (address(this).balance * vt.cmFee) / 10000 ); uint256 shareProposer = address(this).balance * vt.divideShare/10; uint256 shareProposed = address(this).balance - shareProposer; VoteProposalLib.processtxn(payable(vt.proposer), shareProposer); VoteProposalLib.processtxn(payable(vt.proposed), shareProposed); _wavercContract.divorceUpdate(vt.id); //Sending ERC721 tokens owned by the contract } else if (vt.voteProposalAttributes[_id].voteType == 5) { vt.voteProposalAttributes[_id].voteStatus = 10; IERC721(vt.voteProposalAttributes[_id].tokenID).safeTransferFrom( address(this), vt.voteProposalAttributes[_id].receiver, vt.voteProposalAttributes[_id].amount ); } else if (vt.voteProposalAttributes[_id].voteType == 6) { vt.voteProposalAttributes[_id].voteStatus = 11; vt.setDeadline = vt.voteProposalAttributes[_id].amount; } else { revert VOTE_ID_NOT_FOUND(); } emit VoteProposalLib.VoteStatus( _id, msg.sender, vt.voteProposalAttributes[_id].voteStatus, block.timestamp ); } /** * @notice Function to reimburse transactions costs of relayers. * @dev 1050000 is a max gas limit put by the OZ relaying platform. 2400 is .call gas cost that was not taken into account. * @param vt is a storage parameter to process payment. */ function checkForwarder( VoteProposalLib.VoteTracking storage vt ) internal { if (isTrustedForwarder(msg.sender)) { uint Gasleft = (1050000- gasleft() + 2400)* tx.gasprice; VoteProposalLib.processtxn( vt.addressWaveContract, Gasleft ); } } /** * @notice A view function to monitor balance */ function balance() external view returns (uint ETHBalance) { return address(this).balance; } error TOO_MANY_MEMBERS(); /** * @notice Through this method a family member can be invited. Once added, the user needs to accept invitation. * @dev Only partners can add new family member. Partners cannot add their current addresses. * @param _member The address who are being invited to the proxy. */ function addFamilyMember(address _member) external { address msgSender_ = _msgSender(); VoteProposalLib.enforceOnlyPartners(msgSender_); VoteProposalLib.enforceNotPartnerAddr(_member); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); if (vt.familyMembers > 50) {revert TOO_MANY_MEMBERS();} WaverContract _waverContract = WaverContract(vt.addressWaveContract); _waverContract.addFamilyMember(_member, vt.id); checkForwarder(vt); } /** * @notice Through this method a family member is added once invitation is accepted. * @dev This method is called by the main contract. * @param _member The address that is being added. */ function _addFamilyMember(address _member) external { VoteProposalLib.enforceContractHasAccess(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); vt.hasAccess[_member] = true; vt.familyMembers += 1; } /** * @notice Through this method a family member can be deleted. Member can be deleted by partners or by the members own address. * @dev Member looses access and will not be able to access to the proxy contract from the front end. Member address cannot be that of partners'. * @param _member The address who are being deleted. */ function deleteFamilyMember(address _member) external { address msgSender_ = _msgSender(); VoteProposalLib.enforceOnlyPartners(msgSender_); VoteProposalLib.enforceNotPartnerAddr(_member); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); WaverContract _waverContract = WaverContract(vt.addressWaveContract); _waverContract.deleteFamilyMember(_member,vt.id); if (vt.hasAccess[_member] == true) { delete vt.hasAccess[_member]; vt.familyMembers -= 1;} checkForwarder(vt); } /* Divorce settlement. Once Divorce is processed there are other assets that have to be split*/ /** * @notice Once divorced, partners can split ERC20 tokens owned by the proxy contract. * @dev Each partner/or other family member can call this function to transfer ERC20 to respective wallets. * @param _tokenID the address of the ERC20 token that is being split. */ function withdrawERC20(address _tokenID) external { VoteProposalLib.enforceOnlyPartners(msg.sender); VoteProposalLib.enforceDivorced(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); uint256 amount = IERC20Upgradeable(_tokenID).balanceOf(address(this)); uint256 amountFee = (amount * vt.cmFee) / 10000; require( transferToken( _tokenID, vt.addressWaveContract, amountFee ),"I101" ); amount = (amount - amountFee); uint256 shareProposer = amount * vt.divideShare/10; uint256 shareProposed = amount - shareProposer; require(transferToken(_tokenID, vt.proposer, shareProposer),"I101"); require(transferToken(_tokenID, vt.proposed, shareProposed),"I101"); } /** * @notice Before partner user accepts invitiation, initiator can claim ERC20 tokens back. * @dev Only Initiator can claim ERC20 tokens * @param _tokenID the address of the ERC20 token. */ function earlyWithdrawERC20(address _tokenID) external { VoteProposalLib.enforceUserHasAccess(msg.sender); VoteProposalLib.enforceNotYetMarried(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); uint256 amount = IERC20Upgradeable(_tokenID).balanceOf(address(this)); uint256 amountFee = (amount * vt.cmFee) / 10000; require( transferToken( _tokenID, vt.addressWaveContract, amountFee ),"I101" ); amount = (amount - amountFee); require(transferToken(_tokenID, vt.proposer, amount),"I101"); } /** * @notice Once divorced, partners can split ERC721 tokens owned by the proxy contract. * @dev Each partner/or other family member can call this function to split ERC721 token between partners. Two identical copies of ERC721 will be created by the NFT Splitter contract creating a new ERC1155 token. The token will be marked as "Copy". To retreive the original copy, the owner needs to have both copies of the NFT. * @param _tokenAddr the address of the ERC721 token that is being split. * @param _tokenID the ID of the ERC721 token that is being split * @param image the Image of the NFT */ function SplitNFT( address _tokenAddr, uint256 _tokenID, string calldata image ) external { VoteProposalLib.enforceOnlyPartners(msg.sender); VoteProposalLib.enforceDivorced(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); WaverContract _wavercContract = WaverContract(vt.addressWaveContract); address nftSplitAddr = _wavercContract.addressNFTSplit(); //gets NFT splitter address from the main contract nftSplitInstance nftSplit = nftSplitInstance(nftSplitAddr); nftSplit.splitNFT( _tokenAddr, _tokenID, image, vt.proposer, vt.proposed, address(this), vt.divideShare ); //A copy of the NFT is created by the NFT Splitter. } /** * @notice If partner acquires both copies of NFTs, the NFT can be redeemed by that partner through NFT Splitter contract. NFT Splitter uses this function to implement transfer of the token. Only Splitter Contract can call this function. * @param _tokenAddr the address of the ERC721 token that is being joined. * @param _receipent the address of the ERC721 token that is being sent. * @param _tokenID the ID of the ERC721 token that is being sent */ function sendNft( address _tokenAddr, address _receipent, uint256 _tokenID ) external { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); WaverContract _wavercContract = WaverContract(vt.addressWaveContract); if (_wavercContract.addressNFTSplit() != msg.sender) {revert VoteProposalLib.CONTRACT_NOT_AUTHORIZED(msg.sender);} IERC721(_tokenAddr).safeTransferFrom( address(this), _receipent, _tokenID ); } /* Checking and Querying the voting data*/ /* This view function returns how many votes has been created*/ function getVoteLength() external view returns (uint256) { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); return vt.voteid - 1; } /** * @notice This function is used to query votings. * @dev Since there is no limit for the number of voting proposals, the proposals are paginated. Web queries page number to get voting statuses. Each page has 20 vote proposals. * @param _pagenumber A page number queried. */ function getVotingStatuses(uint24 _pagenumber) external view returns (VoteProposalLib.VoteProposal[] memory) { VoteProposalLib.enforceUserHasAccess(msg.sender); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); uint24 length = vt.voteid - 1; uint24 page = length / 20; uint24 size = 0; uint24 start = 0; if (_pagenumber * 20 > length) { size = length % 20; if (size == 0 && page != 0) { size = 20; page -= 1; } start = page * 20 + 1; } else if (_pagenumber * 20 <= length) { size = 20; start = (_pagenumber - 1) * 20 + 1; } VoteProposalLib.VoteProposal[] memory votings = new VoteProposalLib.VoteProposal[](size); for (uint24 i = 0; i < size; i++) { votings[i] = vt.voteProposalAttributes[start + i]; } return votings; } /* Getter of Family Members Number*/ function getFamilyMembersNumber() external view returns (uint256) { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); return vt.familyMembers; } /* Getter of Family Members Number*/ function getCMfee() external view returns (uint256) { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); return vt.cmFee; } /* Getter of cooldown before divorce*/ function getPolicies() external view returns (uint policyDays, uint marryDate, uint divideShare, uint setDeadline, uint promoDays) { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); return (vt.policyDays, vt.marryDate, vt.divideShare, vt.setDeadline, vt.promoDays); } error NOT_IN_PROMO(); error PROMO_NOT_PASSED(); /** * @notice A user may have a promo period with zero comissions * @dev a function may be called externally and triggered by bot to check whether promo period has passed. */ function resetFee() external { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); if (vt.cmFee>0) {revert NOT_IN_PROMO(); } if (vt.marryDate + vt.promoDays < block.timestamp) { vt.cmFee = 100; } else { revert PROMO_NOT_PASSED();} //add else and revert... } /* Getter of marriage status*/ function getMarriageStatus() external view returns (VoteProposalLib.MarriageStatus) { VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); return vt.marriageStatus; } /* Checker of whether Module (Facet) is connected*/ function checkAppConnected(address appAddress) external view returns (bool) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); return ds.connectedApps[appAddress]; } error FACET_DOES_NOT_EXIST(address facet); // Find facet for function that is called and execute the // function if a facet is found and return any value. fallback() external payable { LibDiamond.DiamondStorage storage ds; bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; // get diamond storage assembly { ds.slot := position } // get facet from function selector address facet = ds .facetAddressAndSelectorPosition[msg.sig] .facetAddress; if (facet == address(0)) {revert FACET_DOES_NOT_EXIST(facet);} // Execute external function from facet using delegatecall and return any value. assembly { // copy function selector and any arguments calldatacopy(0, 0, calldatasize()) // execute function call using the facet let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) // get any return value returndatacopy(0, 0, returndatasize()) // return any return value or error back to the caller switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @notice A fallback function that receives native currency. * @dev It is required that the status is not divorced so that funds are not locked. */ receive() external payable { require(msg.value > 0); if (gasleft() > 2300) { VoteProposalLib.enforceNotDivorced(); VoteProposalLib.VoteTracking storage vt = VoteProposalLib .VoteTrackingStorage(); VoteProposalLib.processtxn( vt.addressWaveContract, (msg.value * vt.cmFee) / 10000 ); emit VoteProposalLib.AddStake( msg.sender, address(this), block.timestamp, msg.value ); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; import { InitializableStorage } from "./InitializableStorage.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(InitializableStorage.layout()._initializing ? _isConstructor() : !InitializableStorage.layout()._initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !InitializableStorage.layout()._initializing; if (isTopLevelCall) { InitializableStorage.layout()._initializing = true; InitializableStorage.layout()._initialized = true; } _; if (isTopLevelCall) { InitializableStorage.layout()._initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(InitializableStorage.layout()._initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import { ReentrancyGuardStorage } from "./ReentrancyGuardStorage.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { using ReentrancyGuardStorage for ReentrancyGuardStorage.Layout; // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage.layout()._status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(ReentrancyGuardStorage.layout()._status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail ReentrancyGuardStorage.layout()._status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) ReentrancyGuardStorage.layout()._status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (metatx/ERC2771Context.sol) pragma solidity ^0.8.9; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (metatx/MinimalForwarder.sol) pragma solidity ^0.8.0; import "../utils/cryptography/ECDSAUpgradeable.sol"; import "../utils/cryptography/draft-EIP712Upgradeable.sol"; import { MinimalForwarderStorage } from "./MinimalForwarderStorage.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Simple minimal forwarder to be used together with an ERC2771 compatible contract. See {ERC2771Context}. */ contract MinimalForwarderUpgradeable is Initializable, EIP712Upgradeable { using MinimalForwarderStorage for MinimalForwarderStorage.Layout; using ECDSAUpgradeable for bytes32; struct ForwardRequest { address from; address to; uint256 value; uint256 gas; uint256 nonce; bytes data; } bytes32 private constant _TYPEHASH = keccak256("ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)"); function __MinimalForwarder_init() internal onlyInitializing { __EIP712_init_unchained("MinimalForwarder", "0.0.1"); __MinimalForwarder_init_unchained(); } function __MinimalForwarder_init_unchained() internal onlyInitializing {} function getNonce(address from) public view returns (uint256) { return MinimalForwarderStorage.layout()._nonces[from]; } function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) { address signer = _hashTypedDataV4( keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data))) ).recover(signature); return MinimalForwarderStorage.layout()._nonces[req.from] == req.nonce && signer == req.from; } function execute(ForwardRequest calldata req, bytes calldata signature) public payable returns (bool, bytes memory) { require(verify(req, signature), "MinimalForwarder: signature does not match request"); MinimalForwarderStorage.layout()._nonces[req.from] = req.nonce + 1; (bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}( abi.encodePacked(req.data, req.from) ); // Validate that the relayer has sent enough gas for the call. // See https://ronan.eth.link/blog/ethereum-gas-dangers/ if (gasleft() <= req.gas / 63) { // We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since // neither revert or assert consume all gas since Solidity 0.8.0 // https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require assembly { invalid() } } return (success, returndata); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.0 <0.9.0; /// @title SecuredTokenTransfer - Secure token transfer /// @author Richard Meissner - <[email protected]> contract SecuredTokenTransfer { /// @dev Transfers a token and returns if it was a success /// @param token Token that should be transferred /// @param receiver Receiver to whom the token should be transferred /// @param amount The amount of tokens that should be transferred function transferToken( address token, address receiver, uint256 amount ) internal returns (bool transferred) { if (amount > 0) { // 0xa9059cbb - keccack("transfer(address,uint256)") bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount); // solhint-disable-next-line no-inline-assembly assembly { // We write the return value to scratch space. // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20) switch returndatasize() case 0 { transferred := success } case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(0)))) } default { transferred := 0 } } } else {return true;} } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.17; import "../interfaces/ERC1155TokenReceiver.sol"; import "../interfaces/ERC721TokenReceiver.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {VoteProposalLib} from "../libraries/VotingStatusLib.sol"; /// @title Default Callback Handler - returns true for known token callbacks /// @author Richard Meissner - <[email protected]> contract DefaultCallbackHandler is ERC1155TokenReceiver, ERC721TokenReceiver, IERC165 { function onERC1155Received( address, address, uint256, uint256, bytes calldata ) external view override returns (bytes4) { VoteProposalLib.enforceMarried(); return 0xf23a6e61; } function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) external view override returns (bytes4) { VoteProposalLib.enforceMarried(); return 0xbc197c81; } function onERC721Received( address, address, uint256, bytes calldata ) external view override returns (bytes4) { VoteProposalLib.enforceMarried(); return 0x150b7a02; } function supportsInterface(bytes4 interfaceId) external view virtual override returns (bool) { return interfaceId == type(ERC1155TokenReceiver).interfaceId || interfaceId == type(ERC721TokenReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import { IDiamondCut } from "../interfaces/IDiamondCut.sol"; // Remember to add the loupe functions from DiamondLoupeFacet to the diamond. // The loupe functions are required by the EIP2535 Diamonds standard interface WaverContractCheck { function whiteListedAddresses(address _contract) external view returns (uint); } library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndSelectorPosition { address facetAddress; uint16 selectorPosition; } //event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); struct DiamondStorage { address waveAddress; // function selector => facet address and selector position in selectors array mapping(bytes4 => FacetAddressAndSelectorPosition) facetAddressAndSelectorPosition; bytes4[] selectors; mapping(bytes4 => bool) supportedInterfaces; mapping(address => bool) connectedApps; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } error DIAMOND_ACTION_NOT_FOUND(); // Internal function version of diamondCut function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { DiamondStorage storage ds = diamondStorage(); IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action; if (action == IDiamondCut.FacetCutAction.Add) { addFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors); ds.connectedApps[_diamondCut[facetIndex].facetAddress] = true; } else if (action == IDiamondCut.FacetCutAction.Remove) { ds.connectedApps[ds.facetAddressAndSelectorPosition[_diamondCut[facetIndex].functionSelectors[0]].facetAddress] = false; removeFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors); } else { revert DIAMOND_ACTION_NOT_FOUND(); } } //emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } error FUNCTION_SELECTORS_CANNOT_BE_EMPTY(); error FACET_ADDRESS_CANNOT_BE_EMPTY(); error FACET_ALREADY_EXISTS(); function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { if (_functionSelectors.length == 0) {revert FUNCTION_SELECTORS_CANNOT_BE_EMPTY();} enforceContractIsWhitelisted(_facetAddress); DiamondStorage storage ds = diamondStorage(); uint16 selectorCount = uint16(ds.selectors.length); if (_facetAddress == address(0)) {revert FACET_ADDRESS_CANNOT_BE_EMPTY();} enforceHasContractCode(_facetAddress,""); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; if (oldFacetAddress != address(0)) {revert FACET_ALREADY_EXISTS();} ds.facetAddressAndSelectorPosition[selector] = FacetAddressAndSelectorPosition(_facetAddress, selectorCount); ds.selectors.push(selector); selectorCount++; } } function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { if (_functionSelectors.length == 0) {revert FUNCTION_SELECTORS_CANNOT_BE_EMPTY();} DiamondStorage storage ds = diamondStorage(); uint256 selectorCount = ds.selectors.length; if (_facetAddress != address(0)) {revert FACET_ALREADY_EXISTS();} for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; FacetAddressAndSelectorPosition memory oldFacetAddressAndSelectorPosition = ds.facetAddressAndSelectorPosition[selector]; if (oldFacetAddressAndSelectorPosition.facetAddress == address(0)) {revert FACET_ADDRESS_CANNOT_BE_EMPTY();} // can't remove immutable functions -- functions defined directly in the diamond require(oldFacetAddressAndSelectorPosition.facetAddress != address(this)); // replace selector with last selector selectorCount--; if (oldFacetAddressAndSelectorPosition.selectorPosition != selectorCount) { bytes4 lastSelector = ds.selectors[selectorCount]; ds.selectors[oldFacetAddressAndSelectorPosition.selectorPosition] = lastSelector; ds.facetAddressAndSelectorPosition[lastSelector].selectorPosition = oldFacetAddressAndSelectorPosition.selectorPosition; } // delete last selector ds.selectors.pop(); delete ds.facetAddressAndSelectorPosition[selector]; } } function initializeDiamondCut(address _init, bytes memory _calldata) internal { if (_init == address(0)) { require(_calldata.length == 0); } else { require(_calldata.length > 0); if (_init != address(this)) { enforceHasContractCode(_init,""); } (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up the error revert(string(error)); } else { revert(); } } } } error CONTRACT_NOT_WHITELISTED(address contractAddress); function enforceContractIsWhitelisted(address contractAddress) internal view { DiamondStorage storage ds = diamondStorage(); WaverContractCheck _wavercContract = WaverContractCheck(ds.waveAddress); if (_wavercContract.whiteListedAddresses(contractAddress) == 0) { revert CONTRACT_NOT_WHITELISTED(contractAddress); } } function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } require(contractSize > 0, _errorMessage); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamondCut { enum FacetCutAction {Add, Replace, Remove} // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
// SPDX-License-Identifier: BSL pragma solidity ^0.8.17; /** * [BSL License] * @title Library of the Proxy Contract * @notice Proxy contracts use variables from this libriary. * @dev The proxy uses Diamond Pattern for modularity. Relevant code was borrowed from Nick Mudge. * @author Ismailov Altynbek <[email protected]> */ library VoteProposalLib { bytes32 constant VT_STORAGE_POSITION = keccak256("waverimplementation.VoteTracking.Lib"); //Storing position of the variables struct VoteProposal { uint24 id; address proposer; uint8 voteType; uint256 tokenVoteQuantity; string voteProposalText; uint8 voteStatus; uint256 voteends; address receiver; address tokenID; uint256 amount; uint8 votersLeft; } event VoteStatus( uint24 indexed id, address sender, uint8 voteStatus, uint256 timestamp ); struct VoteTracking { uint8 familyMembers; MarriageStatus marriageStatus; uint24 voteid; //Tracking voting proposals by VOTEID address proposer; address proposed; address payable addressWaveContract; uint nonce; uint256 threshold; uint256 id; uint256 cmFee; uint256 marryDate; uint256 policyDays; uint256 setDeadline; uint256 divideShare; uint256 promoDays; address [] subAccounts; //an Array of Subaccounts; mapping(address => bool) hasAccess; //Addresses that are alowed to use Proxy contract mapping(uint24 => VoteProposal) voteProposalAttributes; //Storage of voting proposals mapping(uint24 => mapping(address => bool)) votingStatus; // Tracking whether address has voted for particular voteid mapping(uint24 => uint256) numTokenFor; //Number of tokens voted for the proposal mapping(uint24 => uint256) numTokenAgainst; //Number of tokens voted against the proposal mapping (uint => uint) indexBook; //Keeping track of indexes mapping(uint => address) addressBook; //To keep Addresses inside mapping(address => uint) subAccountIndex;//To keep track of subAccounts mapping(bytes32 => uint256) signedMessages; mapping(address => mapping(bytes32 => uint256)) approvedHashes; } function VoteTrackingStorage() internal pure returns (VoteTracking storage vt) { bytes32 position = VT_STORAGE_POSITION; assembly { vt.slot := position } } error ALREADY_VOTED(); function enforceNotVoted(uint24 _voteid, address msgSender_) internal view { if (VoteTrackingStorage().votingStatus[_voteid][msgSender_] == true) { revert ALREADY_VOTED(); } } error VOTE_IS_CLOSED(); function enforceProposedStatus(uint24 _voteid) internal view { if ( VoteTrackingStorage().voteProposalAttributes[_voteid].voteStatus != 1 ) { revert VOTE_IS_CLOSED(); } } error VOTE_IS_NOT_PASSED(); function enforceAcceptedStatus(uint24 _voteid) internal view { if ( VoteTrackingStorage().voteProposalAttributes[_voteid].voteStatus != 2 && VoteTrackingStorage().voteProposalAttributes[_voteid].voteStatus != 7 ) { revert VOTE_IS_NOT_PASSED(); } } error VOTE_PROPOSER_ONLY(); function enforceOnlyProposer(uint24 _voteid, address msgSender_) internal view { if ( VoteTrackingStorage().voteProposalAttributes[_voteid].proposer != msgSender_ ) { revert VOTE_PROPOSER_ONLY(); } } error DEADLINE_NOT_PASSED(); function enforceDeadlinePassed(uint24 _voteid) internal view { if ( VoteTrackingStorage().voteProposalAttributes[_voteid].voteends > block.timestamp ) { revert DEADLINE_NOT_PASSED(); } } /* Enum Statuses of the Marriage*/ enum MarriageStatus { Proposed, Declined, Cancelled, Married, Divorced } /* Listening to whether ETH has been received/sent from the contract*/ event AddStake( address indexed from, address indexed to, uint256 timestamp, uint256 amount ); error USER_HAS_NO_ACCESS(address user); function enforceUserHasAccess(address msgSender_) internal view { if (VoteTrackingStorage().hasAccess[msgSender_] != true) { revert USER_HAS_NO_ACCESS(msgSender_); } } error USER_IS_NOT_PARTNER(address user); function enforceOnlyPartners(address msgSender_) internal view { if ( VoteTrackingStorage().proposed != msgSender_ && VoteTrackingStorage().proposer != msgSender_ ) { revert USER_IS_NOT_PARTNER(msgSender_); } } error CANNOT_USE_PARTNERS_ADDRESS(); function enforceNotPartnerAddr(address _member) internal view { if ( VoteTrackingStorage().proposed == _member && VoteTrackingStorage().proposer == _member ) { revert CANNOT_USE_PARTNERS_ADDRESS(); } } error CANNOT_PERFORM_WHEN_PARTNERSHIP_IS_ACTIVE(); function enforceNotYetMarried() internal view { if ( VoteTrackingStorage().marriageStatus != MarriageStatus.Proposed && VoteTrackingStorage().marriageStatus != MarriageStatus.Declined && VoteTrackingStorage().marriageStatus != MarriageStatus.Cancelled ) { revert CANNOT_PERFORM_WHEN_PARTNERSHIP_IS_ACTIVE(); } } error PARNERSHIP_IS_NOT_ESTABLISHED(); function enforceMarried() internal view { if (VoteTrackingStorage().marriageStatus != MarriageStatus.Married) { revert PARNERSHIP_IS_NOT_ESTABLISHED(); } } error PARNERSHIP_IS_DISSOLUTED(); function enforceNotDivorced() internal view { if (VoteTrackingStorage().marriageStatus == MarriageStatus.Divorced) { revert PARNERSHIP_IS_DISSOLUTED(); } } error PARTNERSHIP_IS_NOT_DISSOLUTED(); function enforceDivorced() internal view { if (VoteTrackingStorage().marriageStatus != MarriageStatus.Divorced) { revert PARTNERSHIP_IS_NOT_DISSOLUTED(); } } error CONTRACT_NOT_AUTHORIZED(address contractAddress); function enforceContractHasAccess() internal view { if (msg.sender != VoteTrackingStorage().addressWaveContract) { revert CONTRACT_NOT_AUTHORIZED(msg.sender); } } error COULD_NOT_PROCESS(address _to, uint256 amount); /** * @notice Internal function to process payments. * @dev call method is used to keep process gas limit higher than 2300. Amount of 0 will be skipped, * @param _to Address that will be reveiving payment * @param _amount the amount of payment */ function processtxn(address payable _to, uint256 _amount) internal { if (_amount > 0) { (bool success, ) = _to.call{value: _amount}(""); if (!success) { revert COULD_NOT_PROCESS(_to, _amount); } emit AddStake(address(this), _to, block.timestamp, _amount); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { Initializable } from "./Initializable.sol"; library InitializableStorage { struct Layout { /* * @dev Indicates that the contract has been initialized. */ bool _initialized; /* * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256('openzepplin.contracts.storage.Initializable'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ReentrancyGuardUpgradeable } from "./ReentrancyGuardUpgradeable.sol"; library ReentrancyGuardStorage { struct Layout { uint256 _status; } bytes32 internal constant STORAGE_SLOT = keccak256('openzepplin.contracts.storage.ReentrancyGuard'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import { EIP712Storage } from "./draft-EIP712Storage.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712Upgradeable is Initializable { using EIP712Storage for EIP712Storage.Layout; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); EIP712Storage.layout()._HASHED_NAME = hashedName; EIP712Storage.layout()._HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return EIP712Storage.layout()._HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return EIP712Storage.layout()._HASHED_VERSION; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { MinimalForwarderUpgradeable } from "./MinimalForwarderUpgradeable.sol"; library MinimalForwarderStorage { struct Layout { mapping(address => uint256) _nonces; } bytes32 internal constant STORAGE_SLOT = keccak256('openzepplin.contracts.storage.MinimalForwarder'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { EIP712Upgradeable } from "./draft-EIP712Upgradeable.sol"; library EIP712Storage { struct Layout { /* solhint-disable var-name-mixedcase */ bytes32 _HASHED_NAME; bytes32 _HASHED_VERSION; } bytes32 internal constant STORAGE_SLOT = keccak256('openzepplin.contracts.storage.EIP712'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /** Note: The ERC-165 identifier for this interface is 0x4e2312e0. */ interface ERC1155TokenReceiver { /** @notice Handle the receipt of a single ERC1155 token type. @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated. This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer. This function MUST revert if it rejects the transfer. Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. @param _operator The address which initiated the transfer (i.e. msg.sender) @param _from The address which previously owned the token @param _id The ID of the token being transferred @param _value The amount of tokens being transferred @param _data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` */ function onERC1155Received( address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data ) external returns (bytes4); /** @notice Handle the receipt of multiple ERC1155 token types. @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated. This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s). This function MUST revert if it rejects the transfer(s). Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. @param _operator The address which initiated the batch transfer (i.e. msg.sender) @param _from The address which previously owned the token @param _ids An array containing ids of each token being transferred (order and length must match _values array) @param _values An array containing amounts of each token being transferred (order and length must match _ids array) @param _data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` */ function onERC1155BatchReceived( address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data ) external returns (bytes4); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. interface ERC721TokenReceiver { /// @notice Handle the receipt of an NFT /// @dev The ERC721 smart contract calls this function on the recipient /// after a `transfer`. This function MAY throw to revert and reject the /// transfer. Return of other than the magic value MUST result in the /// transaction being reverted. /// Note: the contract address is always the message sender. /// @param _operator The address which called `safeTransferFrom` function /// @param _from The address which previously owned the token /// @param _tokenId The NFT identifier which is being transferred /// @param _data Additional data with no specified format /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` /// unless throwing function onERC721Received( address _operator, address _from, uint256 _tokenId, bytes calldata _data ) external returns (bytes4); }
{ "optimizer": { "enabled": true, "runs": 100, "details": { "yul": false } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract MinimalForwarderUpgradeable","name":"forwarder","type":"address"},{"internalType":"address","name":"_diamondcut","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ALREADY_VOTED","type":"error"},{"inputs":[],"name":"CANNOT_PERFORM_WHEN_PARTNERSHIP_IS_ACTIVE","type":"error"},{"inputs":[],"name":"CANNOT_USE_PARTNERS_ADDRESS","type":"error"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"CONTRACT_NOT_AUTHORIZED","type":"error"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"CONTRACT_NOT_WHITELISTED","type":"error"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"COULD_NOT_PROCESS","type":"error"},{"inputs":[],"name":"DEADLINE_NOT_PASSED","type":"error"},{"inputs":[],"name":"DIAMOND_ACTION_NOT_FOUND","type":"error"},{"inputs":[{"internalType":"uint256","name":"cooldown","type":"uint256"}],"name":"DISSOLUTION_COOLDOWN_NOT_PASSED","type":"error"},{"inputs":[],"name":"FACET_ADDRESS_CANNOT_BE_EMPTY","type":"error"},{"inputs":[],"name":"FACET_ALREADY_EXISTS","type":"error"},{"inputs":[{"internalType":"address","name":"facet","type":"address"}],"name":"FACET_DOES_NOT_EXIST","type":"error"},{"inputs":[],"name":"FUNCTION_SELECTORS_CANNOT_BE_EMPTY","type":"error"},{"inputs":[],"name":"NOT_IN_PROMO","type":"error"},{"inputs":[],"name":"PARNERSHIP_IS_DISSOLUTED","type":"error"},{"inputs":[],"name":"PARNERSHIP_IS_NOT_ESTABLISHED","type":"error"},{"inputs":[],"name":"PARTNERSHIP_IS_NOT_DISSOLUTED","type":"error"},{"inputs":[],"name":"PROMO_NOT_PASSED","type":"error"},{"inputs":[],"name":"TOO_MANY_MEMBERS","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"USER_HAS_NO_ACCESS","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"USER_IS_NOT_PARTNER","type":"error"},{"inputs":[],"name":"VOTE_ID_NOT_FOUND","type":"error"},{"inputs":[],"name":"VOTE_IS_CLOSED","type":"error"},{"inputs":[],"name":"VOTE_IS_NOT_PASSED","type":"error"},{"inputs":[],"name":"VOTE_PROPOSER_ONLY","type":"error"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"_tokenAddr","type":"address"},{"internalType":"uint256","name":"_tokenID","type":"uint256"},{"internalType":"string","name":"image","type":"string"}],"name":"SplitNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"}],"name":"_addFamilyMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"}],"name":"addFamilyMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"agreed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"ETHBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"_id","type":"uint24"}],"name":"cancelVoting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"appAddress","type":"address"}],"name":"checkAppConnected","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_message","type":"string"},{"internalType":"uint8","name":"_votetype","type":"uint8"},{"internalType":"uint256","name":"_voteends","type":"uint256"},{"internalType":"uint256","name":"_numTokens","type":"uint256"},{"internalType":"address payable","name":"_receiver","type":"address"},{"internalType":"address","name":"_tokenID","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"createProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"declined","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"}],"name":"deleteFamilyMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenID","type":"address"}],"name":"earlyWithdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"_id","type":"uint24"}],"name":"endVotingByTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"_id","type":"uint24"}],"name":"executeVoting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCMfee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFamilyMembersNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarriageStatus","outputs":[{"internalType":"enum VoteProposalLib.MarriageStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPolicies","outputs":[{"internalType":"uint256","name":"policyDays","type":"uint256"},{"internalType":"uint256","name":"marryDate","type":"uint256"},{"internalType":"uint256","name":"divideShare","type":"uint256"},{"internalType":"uint256","name":"setDeadline","type":"uint256"},{"internalType":"uint256","name":"promoDays","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVoteLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"_pagenumber","type":"uint24"}],"name":"getVotingStatuses","outputs":[{"components":[{"internalType":"uint24","name":"id","type":"uint24"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint8","name":"voteType","type":"uint8"},{"internalType":"uint256","name":"tokenVoteQuantity","type":"uint256"},{"internalType":"string","name":"voteProposalText","type":"string"},{"internalType":"uint8","name":"voteStatus","type":"uint8"},{"internalType":"uint256","name":"voteends","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"tokenID","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"votersLeft","type":"uint8"}],"internalType":"struct VoteProposalLib.VoteProposal[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_addressWaveContract","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_proposer","type":"address"},{"internalType":"address","name":"_proposed","type":"address"},{"internalType":"uint256","name":"_policyDays","type":"uint256"},{"internalType":"uint256","name":"_cmFee","type":"uint256"},{"internalType":"uint256","name":"_minimumDeadline","type":"uint256"},{"internalType":"uint256","name":"_divideShare","type":"uint256"},{"internalType":"uint256","name":"promoDays","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resetFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddr","type":"address"},{"internalType":"address","name":"_receipent","type":"address"},{"internalType":"uint256","name":"_tokenID","type":"uint256"}],"name":"sendNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"_id","type":"uint24"},{"internalType":"uint256","name":"_numTokens","type":"uint256"},{"internalType":"uint8","name":"responsetype","type":"uint8"}],"name":"voteResponse","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenID","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c06040523480156200001157600080fd5b50604051620047a3380380620047a3833981016040819052620000349162000234565b6001600160a01b0382166080526200005762000184602090811b6200273d17901c565b54610100900460ff1662000085576200007a6200018460201b6200273d1760201c565b5460ff16156200008f565b6200008f620001a8565b620000b75760405162461bcd60e51b8152600401620000ae9062000277565b60405180910390fd5b6000620000ce6200018460201b6200273d1760201c565b54610100900460ff16159050801562000139576001620000f86200018460201b6200273d1760201c565b60000160016101000a81548160ff0219169083151502179055506001620001296200018460201b6200273d1760201c565b805460ff19169115159190911790555b6001600160a01b03821660a05280156200017b576000620001646200018460201b6200273d1760201c565b80549115156101000261ff00199092169190911790555b505050620002ca565b7f7a9c09dffb400f1c80d0455dcb8e56808aa28f0a58ad6480b85e9ec3328b6d9b90565b6000620001c030620001c660201b620027611760201c565b15905090565b6001600160a01b03163b151590565b60006001600160a01b0382165b92915050565b6000620001e282620001d5565b6200020081620001e8565b81146200020c57600080fd5b50565b8051620001e281620001f5565b6200020081620001d5565b8051620001e2816200021c565b600080604083850312156200024c576200024c600080fd5b60006200025a85856200020f565b92505060206200026d8582860162000227565b9150509250929050565b60208082528101620001e281602e81527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160208201526d191e481a5b9a5d1a585b1a5e995960921b604082015260600190565b60805160a0516144b3620002f060003960006120a50152600061150101526144b36000f3fe60806040526004361061019c5760003560e01c80638e5ed202116100e2578063d33b516211610085578063d33b5162146105da578063e24d3dbc146105fa578063e7cadc381461061a578063ea8a1af01461063a578063f23a6e611461064f578063f4f3b2001461066f578063fcd3f30f1461068f578063ffa1ad74146106a457610246565b80638e5ed202146104f057806390e6ab7614610510578063b54939e214610530578063b69ef8a814610550578063bc197c8114610563578063c00fa0e214610583578063c7ae3948146105a3578063c85fd94d146105b857610246565b8063393e9f521161014a578063393e9f52146103fe5780633b04f6f1146104205780633ee9729614610446578063497cdf89146104665780634d81c77d14610486578063572b6c05146104a6578063727682ad146104c65780637754e56a146104db57610246565b806301ffc9a7146102f9578063086db4391461032f5780630cfcdf801461035c578063150b7a0214610371578063308d8f871461039e5780633128e2eb146103be578063326b70f2146103de57610246565b3661024657600034116101ae57600080fd5b6108fc5a1115610244576101c06106e2565b60006101ca610726565b60028101546006820154919250610204916001600160a01b0390911690612710906101f59034613520565b6101ff9190613555565b61074a565b604051309033907fbfdb56be45f1c753ffaeae6eca195b147d3109ff6bccc18a8ebcc7ec0f92b9949061023a9042903490613575565b60405180910390a3505b005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131d60205260409020547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9081906001600160a01b0316806102d55780604051631792611760e11b81526004016102cc91906135aa565b60405180910390fd5b3660008037600080366000845af43d6000803e8080156102f4573d6000f35b3d6000fd5b34801561030557600080fd5b506103196103143660046135da565b610824565b604051610326919061360b565b60405180910390f35b34801561033b57600080fd5b5061034f61034a36600461362f565b610876565b6040516103269190613816565b34801561036857600080fd5b50610244610bca565b34801561037d57600080fd5b5061039161038c36600461389d565b610bec565b6040516103269190613930565b3480156103aa57600080fd5b506102446103b936600461393e565b610c08565b3480156103ca57600080fd5b506102446103d9366004613973565b610cd5565b3480156103ea57600080fd5b506102446103f9366004613a2f565b6110cf565b34801561040a57600080fd5b506104136111ff565b6040516103269190613a9c565b34801561042c57600080fd5b50610435611214565b604051610326959493929190613aaa565b34801561045257600080fd5b5061024461046136600461393e565b611250565b34801561047257600080fd5b5061024461048136600461393e565b6112bd565b34801561049257600080fd5b506102446104a1366004613aec565b6113ea565b3480156104b257600080fd5b506103196104c136600461393e565b6114ff565b3480156104d257600080fd5b50610244611531565b3480156104e757600080fd5b506104136115a2565b3480156104fc57600080fd5b5061024461050b36600461362f565b6115d4565b34801561051c57600080fd5b5061024461052b366004613b3c565b611b96565b34801561053c57600080fd5b5061024461054b366004613b82565b611e05565b34801561055c57600080fd5b5047610413565b34801561056f57600080fd5b5061039161057e366004613c93565b612145565b34801561058f57600080fd5b5061031961059e36600461393e565b612164565b3480156105af57600080fd5b50610413612194565b3480156105c457600080fd5b506105cd6121a9565b6040516103269190613daf565b3480156105e657600080fd5b506102446105f536600461362f565b6121c3565b34801561060657600080fd5b5061024461061536600461393e565b6122c7565b34801561062657600080fd5b5061024461063536600461362f565b6123dd565b34801561064657600080fd5b50610244612454565b34801561065b57600080fd5b5061039161066a366004613dbd565b612532565b34801561067b57600080fd5b5061024461068a36600461393e565b612550565b34801561069b57600080fd5b506102446126e1565b3480156106b057600080fd5b506106d560405180604001604052806005815260200164312e302e3160d81b81525081565b6040516103269190613e52565b60046106ec610726565b54610100900460ff16600481111561070657610706613d66565b0361072457604051630ac3894760e41b815260040160405180910390fd5b565b7f462413e3153b02b2650a11cb9d0dd9a1c6afa33739e672b96b4b0412e84fde4090565b8015610820576000826001600160a01b03168260405161076990613e66565b60006040518083038185875af1925050503d80600081146107a6576040519150601f19603f3d011682016040523d82523d6000602084013e6107ab565b606091505b50509050806107d1578282604051631663bb0560e01b81526004016102cc929190613e8d565b826001600160a01b0316306001600160a01b03167fbfdb56be45f1c753ffaeae6eca195b147d3109ff6bccc18a8ebcc7ec0f92b9944285604051610816929190613575565b60405180910390a3505b5050565b60006001600160e01b03198216630271189760e51b148061085557506001600160e01b03198216630a85bd0160e11b145b8061087057506001600160e01b031982166301ffc9a760e01b145b92915050565b606061088133612770565b600061088b610726565b80549091506000906108aa9060019062010000900462ffffff16613e9b565b905060006108b9601483613eba565b905060008062ffffff84166108cf886014613ecf565b62ffffff161115610932576108e5601485613ef1565b915062ffffff82161580156108fe575062ffffff831615155b156109155760149150610912600184613e9b565b92505b610920836014613ecf565b61092b906001613f0e565b9050610975565b62ffffff8416610943886014613ecf565b62ffffff1611610975576014915061095c600188613e9b565b610967906014613ecf565b610972906001613f0e565b90505b60008262ffffff166001600160401b0381111561099457610994613f2d565b604051908082528060200260200182016040528015610a1a57816020015b6040805161016081018252600080825260208083018290529282018190526060808301829052608083015260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816109b25790505b50905060005b8362ffffff168162ffffff161015610bbe57600e87016000610a428386613f0e565b62ffffff9081168252602080830193909352604091820160002082516101608101845281549283168152630100000083046001600160a01b031694810194909452600160b81b90910460ff169183019190915260018101546060830152600281018054608084019190610ab490613f59565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae090613f59565b8015610b2d5780601f10610b0257610100808354040283529160200191610b2d565b820191906000526020600020905b815481529060010190602001808311610b1057829003601f168201915b5050509183525050600382015460ff90811660208301526004830154604083015260058301546001600160a01b0390811660608401526006840154166080830152600783015460a083015260089092015490911660c0909101528251839062ffffff8416908110610ba057610ba0613f85565b60200260200101819052508080610bb690613f9b565b915050610a20565b50979650505050505050565b610bd26127bc565b6000610bdc610726565b805461ff00191661010017905550565b6000610bf66127f2565b50630a85bd0160e11b95945050505050565b6000610c12612834565b9050610c1d81612856565b610c26826128c7565b6000610c30610726565b8054909150603260ff9091161115610c5b5760405163113b728960e01b815260040160405180910390fd5b60028101546005820154604051630c3654af60e21b81526001600160a01b039092169182916330d952bc91610c94918891600401613fbc565b600060405180830381600087803b158015610cae57600080fd5b505af1158015610cc2573d6000803e3d6000fd5b50505050610ccf82612931565b50505050565b6000610cdf612834565b9050610cea81612770565b610cf26127f2565b6000610cfc610726565b60028101549091506001600160a01b031660ff8916600403610dab574282600801548360070154610d2d9190613fca565b1115610d615781600801548260070154610d479190613fca565b604051633ca50e2d60e21b81526004016102cc9190613a9c565b610d6a83612856565b815462010000900462ffffff16600090815260108301602052604090206c0c9f2c9cd04674edea400000009055610da442620d2f00613fca565b9750610df3565b815462010000900462ffffff16600090815260108301602052604090208790556009820154610dda9042613fca565b881015610df3576009820154610df09042613fca565b97505b6040518061016001604052808360000160029054906101000a900462ffffff1662ffffff168152602001846001600160a01b031681526020018a60ff1681526020018881526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250600160208201819052604082018b90526001600160a01b03808a1660608401528816608083015260a08201879052845460c090920191610eb7919060ff16613fdd565b60ff908116909152835462ffffff6201000090910481166000908152600e86016020908152604091829020855181549287015193870151909516600160b81b0260ff60b81b196001600160a01b039094166301000000026001600160b81b0319909316959094169490941717161781556060820151600182015560808201516002820190610f4590826140bc565b5060a082015160038201805460ff1990811660ff9384161790915560c084015160048085019190915560e08501516005850180546001600160a01b03199081166001600160a01b03938416179091556101008701516006870180549092169083161790556101208601516007860155610140909501516008909401805483169490931693909317909155845462010000900462ffffff166000908152600f860160209081526040808320898716845290915290819020805490921660011790915551632770a7eb60e21b815291831691639dc29fac916110299187918c9101613fbc565b600060405180830381600087803b15801561104357600080fd5b505af1158015611057573d6000803e3d6000fd5b505083546040516201000090910462ffffff16925060008051602061445e833981519152915061108d908690600190429061418d565b60405180910390a28154600162ffffff62010000808404821692909201160264ffffff0000199091161782556110c282612931565b5050505050505050505050565b6110d833612856565b6110e0612981565b60006110ea610726565b905060008160020160009054906101000a90046001600160a01b031690506000816001600160a01b031663b226821e6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e91906141c0565b83546001850154600a86015460405163539fe7e560e11b815293945084936001600160a01b038086169463a73fcfca946111c3948f948f948f948f94600160281b909104821693911691309190600401614210565b600060405180830381600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b505050505050505050505050565b60008061120a610726565b5460ff1692915050565b600080600080600080611225610726565b60088101546007820154600a8301546009840154600b90940154929a91995097509195509350915050565b6112586127bc565b6000611262610726565b6001600160a01b0383166000908152600d820160205260408120805460ff191660019081179091558254929350918391906112a190849060ff16614281565b92506101000a81548160ff021916908360ff1602179055505050565b6112c633612770565b6112ce6129c3565b60006112d8610726565b90506000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161130891906135aa565b602060405180830381865afa158015611325573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134991906142a9565b905060006127108360060154836113609190613520565b61136a9190613555565b60028401549091506113879085906001600160a01b031683612a63565b6113a35760405162461bcd60e51b81526004016102cc906142e8565b6113ad81836142f8565b83549092506113ce908590600160281b90046001600160a01b031684612a63565b610ccf5760405162461bcd60e51b81526004016102cc906142e8565b60006113f4610726565b600281015460408051635913410f60e11b815290519293506001600160a01b03909116913391839163b226821e9160048082019260209290919082900301816000875af1158015611449573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146d91906141c0565b6001600160a01b0316146114965733604051637b7d071760e11b81526004016102cc91906135aa565b604051632142170760e11b81526001600160a01b038616906342842e0e906114c69030908890889060040161430b565b600060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b505050505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b600061153b610726565b60068101549091501561156157604051630352451b60e61b815260040160405180910390fd5b4281600b015482600701546115769190613fca565b1015611586576064600682015550565b60405163069d601f60e11b815260040160405180910390fd5b50565b6000806115ad610726565b80549091506115c99060019062010000900462ffffff16613e9b565b62ffffff1691505090565b60026115de612b04565b54036115fc5760405162461bcd60e51b81526004016102cc9061435a565b6002611606612b04565b5561160f6127f2565b61161833612770565b61162181612b28565b600061162b610726565b600281015460068201549192506001600160a01b0316906000906127109061165390826142f8565b62ffffff86166000908152600e860160205260409020600701546116779190613520565b6116819190613555565b62ffffff85166000908152600e85016020526040812060070154919250906116aa9083906142f8565b62ffffff86166000908152600e86016020526040902054909150600160b81b900460ff166003036117435762ffffff85166000908152600e850160205260409020600301805460ff191660051790556002840154611711906001600160a01b03168261074a565b62ffffff85166000908152600e8501602052604090206005015461173e906001600160a01b03168361074a565b611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff166002036118205762ffffff85166000908152600e85016020526040902060038101805460ff191660051790556006015460028501546117b0916001600160a01b03908116911683612a63565b6117cc5760405162461bcd60e51b81526004016102cc906142e8565b62ffffff85166000908152600e8501602052604090206006810154600590910154611804916001600160a01b03908116911684612a63565b61173e5760405162461bcd60e51b81526004016102cc906142e8565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff166003036118b6576002840154611860906001600160a01b03168261074a565b62ffffff85166000908152600e8501602052604090206005015461188d906001600160a01b03168361074a565b62ffffff85166000908152600e850160205260409020600301805460ff19166005179055611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff16600403611a0357835461ff00191661040017845562ffffff85166000908152600e850160205260409020600301805460ff19166006908117909155600285015490850154611937916001600160a01b031690612710906101f59047613520565b6000600a85600a01544761194b9190613520565b6119559190613555565b9050600061196382476142f8565b865490915061198290600160281b90046001600160a01b03168361074a565b600186015461199a906001600160a01b03168261074a565b6005860154604051631e3627bd60e31b81526001600160a01b0387169163f1b13de8916119ca9190600401613a9c565b600060405180830381600087803b1580156119e457600080fd5b505af11580156119f8573d6000803e3d6000fd5b505050505050611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff16600503611ac95762ffffff85166000908152600e850160205260409081902060038101805460ff1916600a179055600681015460058201546007909201549251632142170760e11b81526001600160a01b03918216936342842e0e93611a929330939116919060040161430b565b600060405180830381600087803b158015611aac57600080fd5b505af1158015611ac0573d6000803e3d6000fd5b50505050611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff16600603611b245762ffffff85166000908152600e85016020526040902060038101805460ff1916600b179055600701546009850155611b3d565b60405163071eb22160e41b815260040160405180910390fd5b62ffffff85166000818152600e860160205260409081902060030154905160008051602061445e83398151915291611b7c91339160ff1690429061436a565b60405180910390a2505050506001611b92612b04565b5550565b6000611ba0612834565b9050611bab81612770565b611bb58482612ba4565b611bbe84612bfe565b6000611bc8610726565b600281015462ffffff87166000818152600f8401602090815260408083206001600160a01b038981168552908352818420805460ff19166001908117909155948452600e870190925282206008018054959650931693919291611c2f90849060ff16613fdd565b92506101000a81548160ff021916908360ff1602179055508360ff16600203611c835762ffffff8616600090815260108301602052604081208054879290611c78908490613fca565b90915550611caf9050565b62ffffff8616600090815260118301602052604081208054879290611ca9908490613fca565b90915550505b62ffffff86166000908152600e8301602052604081206008015460ff169003611d4d5762ffffff8616600090815260118301602090815260408083205460108601909252909120541015611d285762ffffff86166000908152600e8301602052604090206003908101805460ff19169091179055611d4d565b62ffffff86166000908152600e830160205260409020600301805460ff191660021790555b604051632770a7eb60e21b81526001600160a01b03821690639dc29fac90611d7b9086908990600401613fbc565b600060405180830381600087803b158015611d9557600080fd5b505af1158015611da9573d6000803e3d6000fd5b5050505062ffffff86166000818152600e840160205260409081902060030154905160008051602061445e83398151915291611dec91879160ff1690429061436a565b60405180910390a2611dfd82612931565b505050505050565b611e0d61273d565b54610100900460ff16611e2c57611e2261273d565b5460ff1615611e34565b611e34612c45565b611e505760405162461bcd60e51b81526004016102cc90614385565b6000611e5a61273d565b54610100900460ff161590508015611ea6576001611e7661273d565b80549115156101000261ff00199092169190911790556001611e9661273d565b805460ff19169115159190911790555b6000611eb0610726565b905080600001600281819054906101000a900462ffffff168092919060010191906101000a81548162ffffff021916908362ffffff160217905550508a8160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060008160000160016101000a81548160ff02191690836004811115611f3c57611f3c613d66565b02179055506001600160a01b038981166000818152600d8401602052604081208054600160ff199091168117909155600585018e9055845465010000000000600160c81b031916600160281b90930292909217845590830180546001600160a01b031916928b1692909217909155600682018790556008820188905560098201869055600a8201859055600b8201849055611fd5612c56565b80546001600160a01b0319166001600160a01b038e1617815560408051600180825281830190925291925060009190602082015b604080516060808201835260008083526020830152918101919091528152602001906001900390816120095750506040805160018082528183019092529192506000919060208083019080368337019050509050631f931c1c60e01b8160008151811061207857612078613f85565b6001600160e01b031990921660209283029190910182015260408051606081019091526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681529081016000815260200182815250826000815181106120e8576120e8613f85565b602002602001018190525061210e82600060405180602001604052806000815250612c7a565b50505050801561213957600061212261273d565b80549115156101000261ff00199092169190911790555b50505050505050505050565b600061214f6127f2565b5063bc197c8160e01b98975050505050505050565b60008061216f612c56565b6001600160a01b03909316600090815260049093016020525050604090205460ff1690565b60008061219f610726565b6006015492915050565b6000806121b4610726565b54610100900460ff1692915050565b60006121cd612834565b90506121d881612856565b6121e182612bfe565b6121ea82612e9f565b60006121f4610726565b62ffffff841660009081526011820160209081526040808320546010850190925290912054919250111561224d5762ffffff83166000908152600e8201602052604090206003908101805460ff19169091179055612272565b62ffffff83166000908152600e820160205260409020600301805460ff191660071790555b62ffffff83166000818152600e830160205260409081902060030154905160008051602061445e833981519152916122b191869160ff1690429061436a565b60405180910390a26122c281612931565b505050565b60006122d1612834565b90506122dc81612856565b6122e5826128c7565b60006122ef610726565b600281015460058201546040516306307c0d60e01b81529293506001600160a01b039091169182916306307c0d9161232b918891600401613fbc565b600060405180830381600087803b15801561234557600080fd5b505af1158015612359573d6000803e3d6000fd5b505050506001600160a01b0384166000908152600d8301602052604090205460ff1615156001036123d4576001600160a01b0384166000908152600d830160205260408120805460ff19169055825460019184916123bb90849060ff16613fdd565b92506101000a81548160ff021916908360ff1602179055505b610ccf82612931565b60006123e7612834565b90506123f282612bfe565b6123fc8282612ee3565b6000612406610726565b62ffffff84166000818152600e8301602052604090819020600301805460ff191660049081179091559051929350909160008051602061445e833981519152916122b191869190429061436a565b61245c6129c3565b61246c612467612834565b612770565b6000612476610726565b805461ff001916610200178155600281015460058201546040516340e58ee560e01b81529293506001600160a01b039091169182916340e58ee5916124be9190600401613a9c565b600060405180830381600087803b1580156124d857600080fd5b505af11580156124ec573d6000803e3d6000fd5b5050505060028201546006830154612516916001600160a01b031690612710906101f59047613520565b815461082090600160281b90046001600160a01b03164761074a565b600061253c6127f2565b5063f23a6e6160e01b5b9695505050505050565b61255933612856565b612561612981565b600061256b610726565b90506000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161259b91906135aa565b602060405180830381865afa1580156125b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125dc91906142a9565b905060006127108360060154836125f39190613520565b6125fd9190613555565b600284015490915061261a9085906001600160a01b031683612a63565b6126365760405162461bcd60e51b81526004016102cc906142e8565b61264081836142f8565b91506000600a84600a0154846126569190613520565b6126609190613555565b9050600061266e82856142f8565b855490915061268f908790600160281b90046001600160a01b031684612a63565b6126ab5760405162461bcd60e51b81526004016102cc906142e8565b60018501546126c59087906001600160a01b031683612a63565b611dfd5760405162461bcd60e51b81526004016102cc906142e8565b6126e96127bc565b60006126f3610726565b805461ff0019166103001781554260078201556001808201546001600160a01b03166000908152600d830160205260409020805460ff199081169092179055815416600217905550565b7f7a9c09dffb400f1c80d0455dcb8e56808aa28f0a58ad6480b85e9ec3328b6d9b90565b6001600160a01b03163b151590565b612778610726565b6001600160a01b0382166000908152600d91909101602052604090205460ff16151560011461159f578060405163b8b21ad760e01b81526004016102cc91906135aa565b6127c4610726565b600201546001600160a01b031633146107245733604051637b7d071760e11b81526004016102cc91906135aa565b60036127fc610726565b54610100900460ff16600481111561281657612816613d66565b1461072457604051631b7c274f60e01b815260040160405180910390fd5b600061283f336114ff565b15612851575060131936013560601c90565b503390565b806001600160a01b0316612868610726565b600101546001600160a01b0316148015906128a45750806001600160a01b0316612890610726565b54600160281b90046001600160a01b031614155b1561159f578060405160016201ad3560e31b031981526004016102cc91906135aa565b806001600160a01b03166128d9610726565b600101546001600160a01b03161480156129135750806001600160a01b0316612900610726565b54600160281b90046001600160a01b0316145b1561159f57604051631e738a8160e11b815260040160405180910390fd5b61293a336114ff565b1561159f5760003a5a61295090621005906142f8565b61295c90610960613fca565b6129669190613520565b6002830154909150610820906001600160a01b03168261074a565b600461298b610726565b54610100900460ff1660048111156129a5576129a5613d66565b146107245760405163df1a9c9960e01b815260040160405180910390fd5b60006129cd610726565b54610100900460ff1660048111156129e7576129e7613d66565b14158015612a17575060016129fa610726565b54610100900460ff166004811115612a1457612a14613d66565b14155b8015612a4557506002612a28610726565b54610100900460ff166004811115612a4257612a42613d66565b14155b1561072457604051630c2949f960e31b815260040160405180910390fd5b60008115612af957600063a9059cbb8484604051602401612a85929190613fbc565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050509050602060008251602084016000896127105a03f13d8015612ade5760208114612ae65760009350612af1565b819350612af1565b600051158215171593505b505050612afd565b5060015b9392505050565b7fd59f8a8c0d1463371c77782499276e5cbe466fd192ada543ceaea0a36604c1f290565b612b30610726565b62ffffff82166000908152600e91909101602052604090206003015460ff16600214801590612b865750612b62610726565b62ffffff82166000908152600e91909101602052604090206003015460ff16600714155b1561159f57604051631edb98bd60e01b815260040160405180910390fd5b612bac610726565b62ffffff83166000908152600f91909101602090815260408083206001600160a01b038516845290915290205460ff1615156001036108205760405163eb20971160e01b815260040160405180910390fd5b612c06610726565b62ffffff82166000908152600e91909101602052604090206003015460ff1660011461159f57604051638f6a0f6360e01b815260040160405180910390fd5b6000612c5030612761565b15905090565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b60005b8351811015612e94576000612c90612c56565b90506000858381518110612ca657612ca6613f85565b602002602001015160200151905060006002811115612cc757612cc7613d66565b816002811115612cd957612cd9613d66565b03612d7457612d22868481518110612cf357612cf3613f85565b602002602001015160000151878581518110612d1157612d11613f85565b602002602001015160400151612f3c565b6001826004016000888681518110612d3c57612d3c613f85565b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055612e7f565b6002816002811115612d8857612d88613d66565b03612e665760008260040160008460010160008a8881518110612dad57612dad613f85565b602002602001015160400151600081518110612dcb57612dcb613f85565b6020908102919091018101516001600160e01b03191682528181019290925260409081016000908120546001600160a01b031684529183019390935291019020805460ff19169115159190911790558551612e6190879085908110612e3257612e32613f85565b602002602001015160000151878581518110612e5057612e50613f85565b6020026020010151604001516130f7565b612e7f565b604051631c6511a160e11b815260040160405180910390fd5b50508080612e8c906143d7565b915050612c7d565b506122c2828261336e565b42612ea8610726565b62ffffff83166000908152600e919091016020526040902060040154111561159f576040516355ce8b7960e11b815260040160405180910390fd5b806001600160a01b0316612ef5610726565b62ffffff84166000908152600e919091016020526040902054630100000090046001600160a01b03161461082057604051637dfed05760e01b815260040160405180910390fd5b8051600003612f5e5760405163038ed74960e51b815260040160405180910390fd5b612f678261344a565b6000612f71612c56565b60028101549091506001600160a01b038416612fa057604051637602cc7760e11b815260040160405180910390fd5b612fb984604051806020016040528060008152506134e9565b60005b83518110156130f0576000848281518110612fd957612fd9613f85565b6020908102919091018101516001600160e01b031981166000908152600187019092526040909120549091506001600160a01b0316801561302d57604051632a8a9c2360e01b815260040160405180910390fd5b6040805180820182526001600160a01b03808a16825261ffff80881660208085019182526001600160e01b0319881660009081526001808d018352968120955186549351909416600160a01b026001600160b01b031990931693909416929092171790925560028801805493840181558152206008820401805460e085901c60046007909416939093026101000a92830263ffffffff9093021916919091179055836130d8816143ea565b945050505080806130e8906143d7565b915050612fbc565b5050505050565b80516000036131195760405163038ed74960e51b815260040160405180910390fd5b6000613123612c56565b60028101549091506001600160a01b0384161561315357604051632a8a9c2360e01b815260040160405180910390fd5b60005b83518110156130f057600084828151811061317357613173613f85565b6020908102919091018101516001600160e01b0319811660009081526001870183526040908190208151808301909252546001600160a01b038116808352600160a01b90910461ffff1693820193909352909250906131e557604051637602cc7760e11b815260040160405180910390fd5b8051306001600160a01b03909116036131fd57600080fd5b8361320781614402565b94505083816020015161ffff16146132f057600085600201858154811061323057613230613f85565b90600052602060002090600891828204019190066004029054906101000a900460e01b90508086600201836020015161ffff168154811061327357613273613f85565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c02179055508160200151866001016000836001600160e01b0319166001600160e01b031916815260200190815260200160002060000160146101000a81548161ffff021916908361ffff160217905550505b8460020180548061330357613303614419565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a0219169055919092556001600160e01b0319909316815260018601909252506040902080546001600160b01b031916905580613366816143d7565b915050613156565b6001600160a01b0382166133885780511561082057600080fd5b600081511161339657600080fd5b6001600160a01b03821630146133bf576133bf82604051806020016040528060008152506134e9565b600080836001600160a01b0316836040516133da9190614451565b600060405180830381855af49150503d8060008114613415576040519150601f19603f3d011682016040523d82523d6000602084013e61341a565b606091505b509150915081610ccf57805115613445578060405162461bcd60e51b81526004016102cc9190613e52565b600080fd5b6000613454612c56565b8054604051636c73b9d160e11b81529192506001600160a01b031690819063d8e773a2906134869086906004016135aa565b602060405180830381865afa1580156134a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134c791906142a9565b6000036122c2578260405163d546d22f60e01b81526004016102cc91906135aa565b813b8181610ccf5760405162461bcd60e51b81526004016102cc9190613e52565b634e487b7160e01b600052601160045260246000fd5b8181028082158382048514176135385761353861350a565b5092915050565b634e487b7160e01b600052601260045260246000fd5b6000825b9250826135685761356861353f565b500490565b805b82525050565b60408101613583828561356d565b612afd602083018461356d565b60006001600160a01b038216610870565b61356f81613590565b6020810161087082846135a1565b6001600160e01b031981165b811461159f57600080fd5b8035610870816135b8565b6000602082840312156135ef576135ef600080fd5b60006135fb84846135cf565b949350505050565b80151561356f565b602081016108708284613603565b62ffffff81166135c4565b803561087081613619565b60006020828403121561364457613644600080fd5b60006135fb8484613624565b62ffffff811661356f565b60ff811661356f565b60005b8381101561367f578181015183820152602001613667565b50506000910152565b6000613692825190565b8084526020840193506136a9818560208601613664565b601f19601f8201165b9093019392505050565b80516000906101608401906136d18582613650565b5060208301516136e460208601826135a1565b5060408301516136f7604086018261365b565b50606083015161370a606086018261356d565b50608083015184820360808601526137228282613688565b91505060a083015161373760a086018261365b565b5060c083015161374a60c086018261356d565b5060e083015161375d60e08601826135a1565b506101008301516137726101008601826135a1565b5061012083015161378761012086018261356d565b5061014083015161379c61014086018261365b565b509392505050565b6000612afd83836136bc565b60006137ba825190565b808452602084019350836020820285016137d48560200190565b8060005b8581101561380957848403895281516137f185826137a4565b94506020830160209a909a01999250506001016137d8565b5091979650505050505050565b60208082528101612afd81846137b0565b6135c481613590565b803561087081613827565b806135c4565b80356108708161383b565b60008083601f84011261386157613861600080fd5b5081356001600160401b0381111561387b5761387b600080fd5b60208301915083600182028301111561389657613896600080fd5b9250929050565b6000806000806000608086880312156138b8576138b8600080fd5b60006138c48888613830565b95505060206138d588828901613830565b94505060406138e688828901613841565b93505060608601356001600160401b0381111561390557613905600080fd5b6139118882890161384c565b92509250509295509295909350565b6001600160e01b0319811661356f565b602081016108708284613920565b60006020828403121561395357613953600080fd5b60006135fb8484613830565b60ff81166135c4565b80356108708161395f565b60008060008060008060008060e0898b03121561399257613992600080fd5b88356001600160401b038111156139ab576139ab600080fd5b6139b78b828c0161384c565b985098505060206139ca8b828c01613968565b96505060406139db8b828c01613841565b95505060606139ec8b828c01613841565b94505060806139fd8b828c01613830565b93505060a0613a0e8b828c01613830565b92505060c0613a1f8b828c01613841565b9150509295985092959890939650565b60008060008060608587031215613a4857613a48600080fd5b6000613a548787613830565b9450506020613a6587828801613841565b93505060408501356001600160401b03811115613a8457613a84600080fd5b613a908782880161384c565b95989497509550505050565b60208101610870828461356d565b60a08101613ab8828861356d565b613ac5602083018761356d565b613ad2604083018661356d565b613adf606083018561356d565b612546608083018461356d565b600080600060608486031215613b0457613b04600080fd5b6000613b108686613830565b9350506020613b2186828701613830565b9250506040613b3286828701613841565b9150509250925092565b600080600060608486031215613b5457613b54600080fd5b6000613b608686613624565b9350506020613b7186828701613841565b9250506040613b3286828701613968565b60008060008060008060008060006101208a8c031215613ba457613ba4600080fd5b6000613bb08c8c613830565b9950506020613bc18c828d01613841565b9850506040613bd28c828d01613830565b9750506060613be38c828d01613830565b9650506080613bf48c828d01613841565b95505060a0613c058c828d01613841565b94505060c0613c168c828d01613841565b93505060e0613c278c828d01613841565b925050610100613c398c828d01613841565b9150509295985092959850929598565b60008083601f840112613c5e57613c5e600080fd5b5081356001600160401b03811115613c7857613c78600080fd5b60208301915083602082028301111561389657613896600080fd5b60008060008060008060008060a0898b031215613cb257613cb2600080fd5b6000613cbe8b8b613830565b9850506020613ccf8b828c01613830565b97505060408901356001600160401b03811115613cee57613cee600080fd5b613cfa8b828c01613c49565b965096505060608901356001600160401b03811115613d1b57613d1b600080fd5b613d278b828c01613c49565b945094505060808901356001600160401b03811115613d4857613d48600080fd5b613d548b828c0161384c565b92509250509295985092959890939650565b634e487b7160e01b600052602160045260246000fd5b6005811061159f5761159f613d66565b80613d9681613d7c565b919050565b600061087082613d8c565b61356f81613d9b565b602081016108708284613da6565b60008060008060008060a08789031215613dd957613dd9600080fd5b6000613de58989613830565b9650506020613df689828a01613830565b9550506040613e0789828a01613841565b9450506060613e1889828a01613841565b93505060808701356001600160401b03811115613e3757613e37600080fd5b613e4389828a0161384c565b92509250509295509295509295565b60208082528101612afd8184613688565b90565b600081610870565b600061087082613590565b600061087082613e6e565b61356f81613e79565b604081016135838285613e84565b62ffffff9182169190811690828203908111156108705761087061350a565b600062ffffff8216915062ffffff8316613559565b62ffffff9182169190811690828202908116908181146135385761353861350a565b62ffffff9182169116600082613f0957613f0961353f565b500690565b62ffffff9182169190811690828201908111156108705761087061350a565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052602260045260246000fd5b600281046001821680613f6d57607f821691505b602082108103613f7f57613f7f613f43565b50919050565b634e487b7160e01b600052603260045260246000fd5b62ffffff16600062fffffe198201613fb557613fb561350a565b5060010190565b6040810161358382856135a1565b808201808211156108705761087061350a565b60ff9182169190811690828203908111156108705761087061350a565b6000610870613e638381565b61400f83613ffa565b81546008840282811b60001990911b908116901990911617825550505050565b60006122c2818484614006565b818110156108205761404f60008261402f565b60010161403c565b601f8211156122c2576000818152602090206020601f8501048101602085101561407e5750805b6130f06020601f86010483018261403c565b6000196008929092029190911c191690565b60006140ae8383614090565b600290930290921792915050565b81516001600160401b038111156140d5576140d5613f2d565b6140df8254613f59565b6140ea828285614057565b6020601f83116001811461411857600084156141065750858201515b61411085826140a2565b865550611dfd565b600085815260208120601f198616915b828110156141485788850151825560209485019460019092019101614128565b868310156141655784890151614161601f891682614090565b8355505b600160028802018855505050505050505050565b600060ff8216610870565b61356f81614179565b6060810161419b82866135a1565b6141a86020830185614184565b6135fb604083018461356d565b805161087081613827565b6000602082840312156141d5576141d5600080fd5b60006135fb84846141b5565b82818337506000910152565b81835260006020840193506142038385846141e1565b601f19601f8401166136b2565b60e0810161421e828b6135a1565b61422b602083018a61356d565b818103604083015261423e81888a6141ed565b905061424d60608301876135a1565b61425a60808301866135a1565b61426760a08301856135a1565b61427460c083018461356d565b9998505050505050505050565b60ff9182169190811690828201908111156108705761087061350a565b80516108708161383b565b6000602082840312156142be576142be600080fd5b60006135fb848461429e565b60048152600060208201634931303160e01b815291505b5060200190565b60208082528101610870816142ca565b818103818111156108705761087061350a565b6060810161431982866135a1565b6141a860208301856135a1565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506142e1565b6020808252810161087081614326565b6060810161437882866135a1565b6141a8602083018561365b565b6020808252810161087081602e81527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160208201526d191e481a5b9a5d1a585b1a5e995960921b604082015260600190565b60006000198203613fb557613fb561350a565b61ffff16600061fffe198201613fb557613fb561350a565b6000816144115761441161350a565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000614439825190565b614447818560208601613664565b9290920192915050565b6000612afd828461442f56fe9e96f745d5dbab4ac30a89c73c1ed91d02f25bd8ff428bda3fa14673408de3daa26469706673582212202584c0ff7ef40d0bfda96f8ec2444528ef88e5621d60b7df2d620f75cd0fd46a64736f6c6343000811003300000000000000000000000009fad7d8bee2dbf01391cdecb48b9036b498f86b000000000000000000000000f5d59b319acf4d7de08902c190d61d26919a85af
Deployed Bytecode
0x60806040526004361061019c5760003560e01c80638e5ed202116100e2578063d33b516211610085578063d33b5162146105da578063e24d3dbc146105fa578063e7cadc381461061a578063ea8a1af01461063a578063f23a6e611461064f578063f4f3b2001461066f578063fcd3f30f1461068f578063ffa1ad74146106a457610246565b80638e5ed202146104f057806390e6ab7614610510578063b54939e214610530578063b69ef8a814610550578063bc197c8114610563578063c00fa0e214610583578063c7ae3948146105a3578063c85fd94d146105b857610246565b8063393e9f521161014a578063393e9f52146103fe5780633b04f6f1146104205780633ee9729614610446578063497cdf89146104665780634d81c77d14610486578063572b6c05146104a6578063727682ad146104c65780637754e56a146104db57610246565b806301ffc9a7146102f9578063086db4391461032f5780630cfcdf801461035c578063150b7a0214610371578063308d8f871461039e5780633128e2eb146103be578063326b70f2146103de57610246565b3661024657600034116101ae57600080fd5b6108fc5a1115610244576101c06106e2565b60006101ca610726565b60028101546006820154919250610204916001600160a01b0390911690612710906101f59034613520565b6101ff9190613555565b61074a565b604051309033907fbfdb56be45f1c753ffaeae6eca195b147d3109ff6bccc18a8ebcc7ec0f92b9949061023a9042903490613575565b60405180910390a3505b005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131d60205260409020547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9081906001600160a01b0316806102d55780604051631792611760e11b81526004016102cc91906135aa565b60405180910390fd5b3660008037600080366000845af43d6000803e8080156102f4573d6000f35b3d6000fd5b34801561030557600080fd5b506103196103143660046135da565b610824565b604051610326919061360b565b60405180910390f35b34801561033b57600080fd5b5061034f61034a36600461362f565b610876565b6040516103269190613816565b34801561036857600080fd5b50610244610bca565b34801561037d57600080fd5b5061039161038c36600461389d565b610bec565b6040516103269190613930565b3480156103aa57600080fd5b506102446103b936600461393e565b610c08565b3480156103ca57600080fd5b506102446103d9366004613973565b610cd5565b3480156103ea57600080fd5b506102446103f9366004613a2f565b6110cf565b34801561040a57600080fd5b506104136111ff565b6040516103269190613a9c565b34801561042c57600080fd5b50610435611214565b604051610326959493929190613aaa565b34801561045257600080fd5b5061024461046136600461393e565b611250565b34801561047257600080fd5b5061024461048136600461393e565b6112bd565b34801561049257600080fd5b506102446104a1366004613aec565b6113ea565b3480156104b257600080fd5b506103196104c136600461393e565b6114ff565b3480156104d257600080fd5b50610244611531565b3480156104e757600080fd5b506104136115a2565b3480156104fc57600080fd5b5061024461050b36600461362f565b6115d4565b34801561051c57600080fd5b5061024461052b366004613b3c565b611b96565b34801561053c57600080fd5b5061024461054b366004613b82565b611e05565b34801561055c57600080fd5b5047610413565b34801561056f57600080fd5b5061039161057e366004613c93565b612145565b34801561058f57600080fd5b5061031961059e36600461393e565b612164565b3480156105af57600080fd5b50610413612194565b3480156105c457600080fd5b506105cd6121a9565b6040516103269190613daf565b3480156105e657600080fd5b506102446105f536600461362f565b6121c3565b34801561060657600080fd5b5061024461061536600461393e565b6122c7565b34801561062657600080fd5b5061024461063536600461362f565b6123dd565b34801561064657600080fd5b50610244612454565b34801561065b57600080fd5b5061039161066a366004613dbd565b612532565b34801561067b57600080fd5b5061024461068a36600461393e565b612550565b34801561069b57600080fd5b506102446126e1565b3480156106b057600080fd5b506106d560405180604001604052806005815260200164312e302e3160d81b81525081565b6040516103269190613e52565b60046106ec610726565b54610100900460ff16600481111561070657610706613d66565b0361072457604051630ac3894760e41b815260040160405180910390fd5b565b7f462413e3153b02b2650a11cb9d0dd9a1c6afa33739e672b96b4b0412e84fde4090565b8015610820576000826001600160a01b03168260405161076990613e66565b60006040518083038185875af1925050503d80600081146107a6576040519150601f19603f3d011682016040523d82523d6000602084013e6107ab565b606091505b50509050806107d1578282604051631663bb0560e01b81526004016102cc929190613e8d565b826001600160a01b0316306001600160a01b03167fbfdb56be45f1c753ffaeae6eca195b147d3109ff6bccc18a8ebcc7ec0f92b9944285604051610816929190613575565b60405180910390a3505b5050565b60006001600160e01b03198216630271189760e51b148061085557506001600160e01b03198216630a85bd0160e11b145b8061087057506001600160e01b031982166301ffc9a760e01b145b92915050565b606061088133612770565b600061088b610726565b80549091506000906108aa9060019062010000900462ffffff16613e9b565b905060006108b9601483613eba565b905060008062ffffff84166108cf886014613ecf565b62ffffff161115610932576108e5601485613ef1565b915062ffffff82161580156108fe575062ffffff831615155b156109155760149150610912600184613e9b565b92505b610920836014613ecf565b61092b906001613f0e565b9050610975565b62ffffff8416610943886014613ecf565b62ffffff1611610975576014915061095c600188613e9b565b610967906014613ecf565b610972906001613f0e565b90505b60008262ffffff166001600160401b0381111561099457610994613f2d565b604051908082528060200260200182016040528015610a1a57816020015b6040805161016081018252600080825260208083018290529282018190526060808301829052608083015260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082015282526000199092019101816109b25790505b50905060005b8362ffffff168162ffffff161015610bbe57600e87016000610a428386613f0e565b62ffffff9081168252602080830193909352604091820160002082516101608101845281549283168152630100000083046001600160a01b031694810194909452600160b81b90910460ff169183019190915260018101546060830152600281018054608084019190610ab490613f59565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae090613f59565b8015610b2d5780601f10610b0257610100808354040283529160200191610b2d565b820191906000526020600020905b815481529060010190602001808311610b1057829003601f168201915b5050509183525050600382015460ff90811660208301526004830154604083015260058301546001600160a01b0390811660608401526006840154166080830152600783015460a083015260089092015490911660c0909101528251839062ffffff8416908110610ba057610ba0613f85565b60200260200101819052508080610bb690613f9b565b915050610a20565b50979650505050505050565b610bd26127bc565b6000610bdc610726565b805461ff00191661010017905550565b6000610bf66127f2565b50630a85bd0160e11b95945050505050565b6000610c12612834565b9050610c1d81612856565b610c26826128c7565b6000610c30610726565b8054909150603260ff9091161115610c5b5760405163113b728960e01b815260040160405180910390fd5b60028101546005820154604051630c3654af60e21b81526001600160a01b039092169182916330d952bc91610c94918891600401613fbc565b600060405180830381600087803b158015610cae57600080fd5b505af1158015610cc2573d6000803e3d6000fd5b50505050610ccf82612931565b50505050565b6000610cdf612834565b9050610cea81612770565b610cf26127f2565b6000610cfc610726565b60028101549091506001600160a01b031660ff8916600403610dab574282600801548360070154610d2d9190613fca565b1115610d615781600801548260070154610d479190613fca565b604051633ca50e2d60e21b81526004016102cc9190613a9c565b610d6a83612856565b815462010000900462ffffff16600090815260108301602052604090206c0c9f2c9cd04674edea400000009055610da442620d2f00613fca565b9750610df3565b815462010000900462ffffff16600090815260108301602052604090208790556009820154610dda9042613fca565b881015610df3576009820154610df09042613fca565b97505b6040518061016001604052808360000160029054906101000a900462ffffff1662ffffff168152602001846001600160a01b031681526020018a60ff1681526020018881526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250600160208201819052604082018b90526001600160a01b03808a1660608401528816608083015260a08201879052845460c090920191610eb7919060ff16613fdd565b60ff908116909152835462ffffff6201000090910481166000908152600e86016020908152604091829020855181549287015193870151909516600160b81b0260ff60b81b196001600160a01b039094166301000000026001600160b81b0319909316959094169490941717161781556060820151600182015560808201516002820190610f4590826140bc565b5060a082015160038201805460ff1990811660ff9384161790915560c084015160048085019190915560e08501516005850180546001600160a01b03199081166001600160a01b03938416179091556101008701516006870180549092169083161790556101208601516007860155610140909501516008909401805483169490931693909317909155845462010000900462ffffff166000908152600f860160209081526040808320898716845290915290819020805490921660011790915551632770a7eb60e21b815291831691639dc29fac916110299187918c9101613fbc565b600060405180830381600087803b15801561104357600080fd5b505af1158015611057573d6000803e3d6000fd5b505083546040516201000090910462ffffff16925060008051602061445e833981519152915061108d908690600190429061418d565b60405180910390a28154600162ffffff62010000808404821692909201160264ffffff0000199091161782556110c282612931565b5050505050505050505050565b6110d833612856565b6110e0612981565b60006110ea610726565b905060008160020160009054906101000a90046001600160a01b031690506000816001600160a01b031663b226821e6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e91906141c0565b83546001850154600a86015460405163539fe7e560e11b815293945084936001600160a01b038086169463a73fcfca946111c3948f948f948f948f94600160281b909104821693911691309190600401614210565b600060405180830381600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b505050505050505050505050565b60008061120a610726565b5460ff1692915050565b600080600080600080611225610726565b60088101546007820154600a8301546009840154600b90940154929a91995097509195509350915050565b6112586127bc565b6000611262610726565b6001600160a01b0383166000908152600d820160205260408120805460ff191660019081179091558254929350918391906112a190849060ff16614281565b92506101000a81548160ff021916908360ff1602179055505050565b6112c633612770565b6112ce6129c3565b60006112d8610726565b90506000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161130891906135aa565b602060405180830381865afa158015611325573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134991906142a9565b905060006127108360060154836113609190613520565b61136a9190613555565b60028401549091506113879085906001600160a01b031683612a63565b6113a35760405162461bcd60e51b81526004016102cc906142e8565b6113ad81836142f8565b83549092506113ce908590600160281b90046001600160a01b031684612a63565b610ccf5760405162461bcd60e51b81526004016102cc906142e8565b60006113f4610726565b600281015460408051635913410f60e11b815290519293506001600160a01b03909116913391839163b226821e9160048082019260209290919082900301816000875af1158015611449573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146d91906141c0565b6001600160a01b0316146114965733604051637b7d071760e11b81526004016102cc91906135aa565b604051632142170760e11b81526001600160a01b038616906342842e0e906114c69030908890889060040161430b565b600060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b505050505050505050565b7f00000000000000000000000009fad7d8bee2dbf01391cdecb48b9036b498f86b6001600160a01b0390811691161490565b600061153b610726565b60068101549091501561156157604051630352451b60e61b815260040160405180910390fd5b4281600b015482600701546115769190613fca565b1015611586576064600682015550565b60405163069d601f60e11b815260040160405180910390fd5b50565b6000806115ad610726565b80549091506115c99060019062010000900462ffffff16613e9b565b62ffffff1691505090565b60026115de612b04565b54036115fc5760405162461bcd60e51b81526004016102cc9061435a565b6002611606612b04565b5561160f6127f2565b61161833612770565b61162181612b28565b600061162b610726565b600281015460068201549192506001600160a01b0316906000906127109061165390826142f8565b62ffffff86166000908152600e860160205260409020600701546116779190613520565b6116819190613555565b62ffffff85166000908152600e85016020526040812060070154919250906116aa9083906142f8565b62ffffff86166000908152600e86016020526040902054909150600160b81b900460ff166003036117435762ffffff85166000908152600e850160205260409020600301805460ff191660051790556002840154611711906001600160a01b03168261074a565b62ffffff85166000908152600e8501602052604090206005015461173e906001600160a01b03168361074a565b611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff166002036118205762ffffff85166000908152600e85016020526040902060038101805460ff191660051790556006015460028501546117b0916001600160a01b03908116911683612a63565b6117cc5760405162461bcd60e51b81526004016102cc906142e8565b62ffffff85166000908152600e8501602052604090206006810154600590910154611804916001600160a01b03908116911684612a63565b61173e5760405162461bcd60e51b81526004016102cc906142e8565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff166003036118b6576002840154611860906001600160a01b03168261074a565b62ffffff85166000908152600e8501602052604090206005015461188d906001600160a01b03168361074a565b62ffffff85166000908152600e850160205260409020600301805460ff19166005179055611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff16600403611a0357835461ff00191661040017845562ffffff85166000908152600e850160205260409020600301805460ff19166006908117909155600285015490850154611937916001600160a01b031690612710906101f59047613520565b6000600a85600a01544761194b9190613520565b6119559190613555565b9050600061196382476142f8565b865490915061198290600160281b90046001600160a01b03168361074a565b600186015461199a906001600160a01b03168261074a565b6005860154604051631e3627bd60e31b81526001600160a01b0387169163f1b13de8916119ca9190600401613a9c565b600060405180830381600087803b1580156119e457600080fd5b505af11580156119f8573d6000803e3d6000fd5b505050505050611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff16600503611ac95762ffffff85166000908152600e850160205260409081902060038101805460ff1916600a179055600681015460058201546007909201549251632142170760e11b81526001600160a01b03918216936342842e0e93611a929330939116919060040161430b565b600060405180830381600087803b158015611aac57600080fd5b505af1158015611ac0573d6000803e3d6000fd5b50505050611b3d565b62ffffff85166000908152600e85016020526040902054600160b81b900460ff16600603611b245762ffffff85166000908152600e85016020526040902060038101805460ff1916600b179055600701546009850155611b3d565b60405163071eb22160e41b815260040160405180910390fd5b62ffffff85166000818152600e860160205260409081902060030154905160008051602061445e83398151915291611b7c91339160ff1690429061436a565b60405180910390a2505050506001611b92612b04565b5550565b6000611ba0612834565b9050611bab81612770565b611bb58482612ba4565b611bbe84612bfe565b6000611bc8610726565b600281015462ffffff87166000818152600f8401602090815260408083206001600160a01b038981168552908352818420805460ff19166001908117909155948452600e870190925282206008018054959650931693919291611c2f90849060ff16613fdd565b92506101000a81548160ff021916908360ff1602179055508360ff16600203611c835762ffffff8616600090815260108301602052604081208054879290611c78908490613fca565b90915550611caf9050565b62ffffff8616600090815260118301602052604081208054879290611ca9908490613fca565b90915550505b62ffffff86166000908152600e8301602052604081206008015460ff169003611d4d5762ffffff8616600090815260118301602090815260408083205460108601909252909120541015611d285762ffffff86166000908152600e8301602052604090206003908101805460ff19169091179055611d4d565b62ffffff86166000908152600e830160205260409020600301805460ff191660021790555b604051632770a7eb60e21b81526001600160a01b03821690639dc29fac90611d7b9086908990600401613fbc565b600060405180830381600087803b158015611d9557600080fd5b505af1158015611da9573d6000803e3d6000fd5b5050505062ffffff86166000818152600e840160205260409081902060030154905160008051602061445e83398151915291611dec91879160ff1690429061436a565b60405180910390a2611dfd82612931565b505050505050565b611e0d61273d565b54610100900460ff16611e2c57611e2261273d565b5460ff1615611e34565b611e34612c45565b611e505760405162461bcd60e51b81526004016102cc90614385565b6000611e5a61273d565b54610100900460ff161590508015611ea6576001611e7661273d565b80549115156101000261ff00199092169190911790556001611e9661273d565b805460ff19169115159190911790555b6000611eb0610726565b905080600001600281819054906101000a900462ffffff168092919060010191906101000a81548162ffffff021916908362ffffff160217905550508a8160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060008160000160016101000a81548160ff02191690836004811115611f3c57611f3c613d66565b02179055506001600160a01b038981166000818152600d8401602052604081208054600160ff199091168117909155600585018e9055845465010000000000600160c81b031916600160281b90930292909217845590830180546001600160a01b031916928b1692909217909155600682018790556008820188905560098201869055600a8201859055600b8201849055611fd5612c56565b80546001600160a01b0319166001600160a01b038e1617815560408051600180825281830190925291925060009190602082015b604080516060808201835260008083526020830152918101919091528152602001906001900390816120095750506040805160018082528183019092529192506000919060208083019080368337019050509050631f931c1c60e01b8160008151811061207857612078613f85565b6001600160e01b031990921660209283029190910182015260408051606081019091526001600160a01b037f000000000000000000000000f5d59b319acf4d7de08902c190d61d26919a85af1681529081016000815260200182815250826000815181106120e8576120e8613f85565b602002602001018190525061210e82600060405180602001604052806000815250612c7a565b50505050801561213957600061212261273d565b80549115156101000261ff00199092169190911790555b50505050505050505050565b600061214f6127f2565b5063bc197c8160e01b98975050505050505050565b60008061216f612c56565b6001600160a01b03909316600090815260049093016020525050604090205460ff1690565b60008061219f610726565b6006015492915050565b6000806121b4610726565b54610100900460ff1692915050565b60006121cd612834565b90506121d881612856565b6121e182612bfe565b6121ea82612e9f565b60006121f4610726565b62ffffff841660009081526011820160209081526040808320546010850190925290912054919250111561224d5762ffffff83166000908152600e8201602052604090206003908101805460ff19169091179055612272565b62ffffff83166000908152600e820160205260409020600301805460ff191660071790555b62ffffff83166000818152600e830160205260409081902060030154905160008051602061445e833981519152916122b191869160ff1690429061436a565b60405180910390a26122c281612931565b505050565b60006122d1612834565b90506122dc81612856565b6122e5826128c7565b60006122ef610726565b600281015460058201546040516306307c0d60e01b81529293506001600160a01b039091169182916306307c0d9161232b918891600401613fbc565b600060405180830381600087803b15801561234557600080fd5b505af1158015612359573d6000803e3d6000fd5b505050506001600160a01b0384166000908152600d8301602052604090205460ff1615156001036123d4576001600160a01b0384166000908152600d830160205260408120805460ff19169055825460019184916123bb90849060ff16613fdd565b92506101000a81548160ff021916908360ff1602179055505b610ccf82612931565b60006123e7612834565b90506123f282612bfe565b6123fc8282612ee3565b6000612406610726565b62ffffff84166000818152600e8301602052604090819020600301805460ff191660049081179091559051929350909160008051602061445e833981519152916122b191869190429061436a565b61245c6129c3565b61246c612467612834565b612770565b6000612476610726565b805461ff001916610200178155600281015460058201546040516340e58ee560e01b81529293506001600160a01b039091169182916340e58ee5916124be9190600401613a9c565b600060405180830381600087803b1580156124d857600080fd5b505af11580156124ec573d6000803e3d6000fd5b5050505060028201546006830154612516916001600160a01b031690612710906101f59047613520565b815461082090600160281b90046001600160a01b03164761074a565b600061253c6127f2565b5063f23a6e6160e01b5b9695505050505050565b61255933612856565b612561612981565b600061256b610726565b90506000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161259b91906135aa565b602060405180830381865afa1580156125b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125dc91906142a9565b905060006127108360060154836125f39190613520565b6125fd9190613555565b600284015490915061261a9085906001600160a01b031683612a63565b6126365760405162461bcd60e51b81526004016102cc906142e8565b61264081836142f8565b91506000600a84600a0154846126569190613520565b6126609190613555565b9050600061266e82856142f8565b855490915061268f908790600160281b90046001600160a01b031684612a63565b6126ab5760405162461bcd60e51b81526004016102cc906142e8565b60018501546126c59087906001600160a01b031683612a63565b611dfd5760405162461bcd60e51b81526004016102cc906142e8565b6126e96127bc565b60006126f3610726565b805461ff0019166103001781554260078201556001808201546001600160a01b03166000908152600d830160205260409020805460ff199081169092179055815416600217905550565b7f7a9c09dffb400f1c80d0455dcb8e56808aa28f0a58ad6480b85e9ec3328b6d9b90565b6001600160a01b03163b151590565b612778610726565b6001600160a01b0382166000908152600d91909101602052604090205460ff16151560011461159f578060405163b8b21ad760e01b81526004016102cc91906135aa565b6127c4610726565b600201546001600160a01b031633146107245733604051637b7d071760e11b81526004016102cc91906135aa565b60036127fc610726565b54610100900460ff16600481111561281657612816613d66565b1461072457604051631b7c274f60e01b815260040160405180910390fd5b600061283f336114ff565b15612851575060131936013560601c90565b503390565b806001600160a01b0316612868610726565b600101546001600160a01b0316148015906128a45750806001600160a01b0316612890610726565b54600160281b90046001600160a01b031614155b1561159f578060405160016201ad3560e31b031981526004016102cc91906135aa565b806001600160a01b03166128d9610726565b600101546001600160a01b03161480156129135750806001600160a01b0316612900610726565b54600160281b90046001600160a01b0316145b1561159f57604051631e738a8160e11b815260040160405180910390fd5b61293a336114ff565b1561159f5760003a5a61295090621005906142f8565b61295c90610960613fca565b6129669190613520565b6002830154909150610820906001600160a01b03168261074a565b600461298b610726565b54610100900460ff1660048111156129a5576129a5613d66565b146107245760405163df1a9c9960e01b815260040160405180910390fd5b60006129cd610726565b54610100900460ff1660048111156129e7576129e7613d66565b14158015612a17575060016129fa610726565b54610100900460ff166004811115612a1457612a14613d66565b14155b8015612a4557506002612a28610726565b54610100900460ff166004811115612a4257612a42613d66565b14155b1561072457604051630c2949f960e31b815260040160405180910390fd5b60008115612af957600063a9059cbb8484604051602401612a85929190613fbc565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050509050602060008251602084016000896127105a03f13d8015612ade5760208114612ae65760009350612af1565b819350612af1565b600051158215171593505b505050612afd565b5060015b9392505050565b7fd59f8a8c0d1463371c77782499276e5cbe466fd192ada543ceaea0a36604c1f290565b612b30610726565b62ffffff82166000908152600e91909101602052604090206003015460ff16600214801590612b865750612b62610726565b62ffffff82166000908152600e91909101602052604090206003015460ff16600714155b1561159f57604051631edb98bd60e01b815260040160405180910390fd5b612bac610726565b62ffffff83166000908152600f91909101602090815260408083206001600160a01b038516845290915290205460ff1615156001036108205760405163eb20971160e01b815260040160405180910390fd5b612c06610726565b62ffffff82166000908152600e91909101602052604090206003015460ff1660011461159f57604051638f6a0f6360e01b815260040160405180910390fd5b6000612c5030612761565b15905090565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b60005b8351811015612e94576000612c90612c56565b90506000858381518110612ca657612ca6613f85565b602002602001015160200151905060006002811115612cc757612cc7613d66565b816002811115612cd957612cd9613d66565b03612d7457612d22868481518110612cf357612cf3613f85565b602002602001015160000151878581518110612d1157612d11613f85565b602002602001015160400151612f3c565b6001826004016000888681518110612d3c57612d3c613f85565b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055612e7f565b6002816002811115612d8857612d88613d66565b03612e665760008260040160008460010160008a8881518110612dad57612dad613f85565b602002602001015160400151600081518110612dcb57612dcb613f85565b6020908102919091018101516001600160e01b03191682528181019290925260409081016000908120546001600160a01b031684529183019390935291019020805460ff19169115159190911790558551612e6190879085908110612e3257612e32613f85565b602002602001015160000151878581518110612e5057612e50613f85565b6020026020010151604001516130f7565b612e7f565b604051631c6511a160e11b815260040160405180910390fd5b50508080612e8c906143d7565b915050612c7d565b506122c2828261336e565b42612ea8610726565b62ffffff83166000908152600e919091016020526040902060040154111561159f576040516355ce8b7960e11b815260040160405180910390fd5b806001600160a01b0316612ef5610726565b62ffffff84166000908152600e919091016020526040902054630100000090046001600160a01b03161461082057604051637dfed05760e01b815260040160405180910390fd5b8051600003612f5e5760405163038ed74960e51b815260040160405180910390fd5b612f678261344a565b6000612f71612c56565b60028101549091506001600160a01b038416612fa057604051637602cc7760e11b815260040160405180910390fd5b612fb984604051806020016040528060008152506134e9565b60005b83518110156130f0576000848281518110612fd957612fd9613f85565b6020908102919091018101516001600160e01b031981166000908152600187019092526040909120549091506001600160a01b0316801561302d57604051632a8a9c2360e01b815260040160405180910390fd5b6040805180820182526001600160a01b03808a16825261ffff80881660208085019182526001600160e01b0319881660009081526001808d018352968120955186549351909416600160a01b026001600160b01b031990931693909416929092171790925560028801805493840181558152206008820401805460e085901c60046007909416939093026101000a92830263ffffffff9093021916919091179055836130d8816143ea565b945050505080806130e8906143d7565b915050612fbc565b5050505050565b80516000036131195760405163038ed74960e51b815260040160405180910390fd5b6000613123612c56565b60028101549091506001600160a01b0384161561315357604051632a8a9c2360e01b815260040160405180910390fd5b60005b83518110156130f057600084828151811061317357613173613f85565b6020908102919091018101516001600160e01b0319811660009081526001870183526040908190208151808301909252546001600160a01b038116808352600160a01b90910461ffff1693820193909352909250906131e557604051637602cc7760e11b815260040160405180910390fd5b8051306001600160a01b03909116036131fd57600080fd5b8361320781614402565b94505083816020015161ffff16146132f057600085600201858154811061323057613230613f85565b90600052602060002090600891828204019190066004029054906101000a900460e01b90508086600201836020015161ffff168154811061327357613273613f85565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c02179055508160200151866001016000836001600160e01b0319166001600160e01b031916815260200190815260200160002060000160146101000a81548161ffff021916908361ffff160217905550505b8460020180548061330357613303614419565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a0219169055919092556001600160e01b0319909316815260018601909252506040902080546001600160b01b031916905580613366816143d7565b915050613156565b6001600160a01b0382166133885780511561082057600080fd5b600081511161339657600080fd5b6001600160a01b03821630146133bf576133bf82604051806020016040528060008152506134e9565b600080836001600160a01b0316836040516133da9190614451565b600060405180830381855af49150503d8060008114613415576040519150601f19603f3d011682016040523d82523d6000602084013e61341a565b606091505b509150915081610ccf57805115613445578060405162461bcd60e51b81526004016102cc9190613e52565b600080fd5b6000613454612c56565b8054604051636c73b9d160e11b81529192506001600160a01b031690819063d8e773a2906134869086906004016135aa565b602060405180830381865afa1580156134a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134c791906142a9565b6000036122c2578260405163d546d22f60e01b81526004016102cc91906135aa565b813b8181610ccf5760405162461bcd60e51b81526004016102cc9190613e52565b634e487b7160e01b600052601160045260246000fd5b8181028082158382048514176135385761353861350a565b5092915050565b634e487b7160e01b600052601260045260246000fd5b6000825b9250826135685761356861353f565b500490565b805b82525050565b60408101613583828561356d565b612afd602083018461356d565b60006001600160a01b038216610870565b61356f81613590565b6020810161087082846135a1565b6001600160e01b031981165b811461159f57600080fd5b8035610870816135b8565b6000602082840312156135ef576135ef600080fd5b60006135fb84846135cf565b949350505050565b80151561356f565b602081016108708284613603565b62ffffff81166135c4565b803561087081613619565b60006020828403121561364457613644600080fd5b60006135fb8484613624565b62ffffff811661356f565b60ff811661356f565b60005b8381101561367f578181015183820152602001613667565b50506000910152565b6000613692825190565b8084526020840193506136a9818560208601613664565b601f19601f8201165b9093019392505050565b80516000906101608401906136d18582613650565b5060208301516136e460208601826135a1565b5060408301516136f7604086018261365b565b50606083015161370a606086018261356d565b50608083015184820360808601526137228282613688565b91505060a083015161373760a086018261365b565b5060c083015161374a60c086018261356d565b5060e083015161375d60e08601826135a1565b506101008301516137726101008601826135a1565b5061012083015161378761012086018261356d565b5061014083015161379c61014086018261365b565b509392505050565b6000612afd83836136bc565b60006137ba825190565b808452602084019350836020820285016137d48560200190565b8060005b8581101561380957848403895281516137f185826137a4565b94506020830160209a909a01999250506001016137d8565b5091979650505050505050565b60208082528101612afd81846137b0565b6135c481613590565b803561087081613827565b806135c4565b80356108708161383b565b60008083601f84011261386157613861600080fd5b5081356001600160401b0381111561387b5761387b600080fd5b60208301915083600182028301111561389657613896600080fd5b9250929050565b6000806000806000608086880312156138b8576138b8600080fd5b60006138c48888613830565b95505060206138d588828901613830565b94505060406138e688828901613841565b93505060608601356001600160401b0381111561390557613905600080fd5b6139118882890161384c565b92509250509295509295909350565b6001600160e01b0319811661356f565b602081016108708284613920565b60006020828403121561395357613953600080fd5b60006135fb8484613830565b60ff81166135c4565b80356108708161395f565b60008060008060008060008060e0898b03121561399257613992600080fd5b88356001600160401b038111156139ab576139ab600080fd5b6139b78b828c0161384c565b985098505060206139ca8b828c01613968565b96505060406139db8b828c01613841565b95505060606139ec8b828c01613841565b94505060806139fd8b828c01613830565b93505060a0613a0e8b828c01613830565b92505060c0613a1f8b828c01613841565b9150509295985092959890939650565b60008060008060608587031215613a4857613a48600080fd5b6000613a548787613830565b9450506020613a6587828801613841565b93505060408501356001600160401b03811115613a8457613a84600080fd5b613a908782880161384c565b95989497509550505050565b60208101610870828461356d565b60a08101613ab8828861356d565b613ac5602083018761356d565b613ad2604083018661356d565b613adf606083018561356d565b612546608083018461356d565b600080600060608486031215613b0457613b04600080fd5b6000613b108686613830565b9350506020613b2186828701613830565b9250506040613b3286828701613841565b9150509250925092565b600080600060608486031215613b5457613b54600080fd5b6000613b608686613624565b9350506020613b7186828701613841565b9250506040613b3286828701613968565b60008060008060008060008060006101208a8c031215613ba457613ba4600080fd5b6000613bb08c8c613830565b9950506020613bc18c828d01613841565b9850506040613bd28c828d01613830565b9750506060613be38c828d01613830565b9650506080613bf48c828d01613841565b95505060a0613c058c828d01613841565b94505060c0613c168c828d01613841565b93505060e0613c278c828d01613841565b925050610100613c398c828d01613841565b9150509295985092959850929598565b60008083601f840112613c5e57613c5e600080fd5b5081356001600160401b03811115613c7857613c78600080fd5b60208301915083602082028301111561389657613896600080fd5b60008060008060008060008060a0898b031215613cb257613cb2600080fd5b6000613cbe8b8b613830565b9850506020613ccf8b828c01613830565b97505060408901356001600160401b03811115613cee57613cee600080fd5b613cfa8b828c01613c49565b965096505060608901356001600160401b03811115613d1b57613d1b600080fd5b613d278b828c01613c49565b945094505060808901356001600160401b03811115613d4857613d48600080fd5b613d548b828c0161384c565b92509250509295985092959890939650565b634e487b7160e01b600052602160045260246000fd5b6005811061159f5761159f613d66565b80613d9681613d7c565b919050565b600061087082613d8c565b61356f81613d9b565b602081016108708284613da6565b60008060008060008060a08789031215613dd957613dd9600080fd5b6000613de58989613830565b9650506020613df689828a01613830565b9550506040613e0789828a01613841565b9450506060613e1889828a01613841565b93505060808701356001600160401b03811115613e3757613e37600080fd5b613e4389828a0161384c565b92509250509295509295509295565b60208082528101612afd8184613688565b90565b600081610870565b600061087082613590565b600061087082613e6e565b61356f81613e79565b604081016135838285613e84565b62ffffff9182169190811690828203908111156108705761087061350a565b600062ffffff8216915062ffffff8316613559565b62ffffff9182169190811690828202908116908181146135385761353861350a565b62ffffff9182169116600082613f0957613f0961353f565b500690565b62ffffff9182169190811690828201908111156108705761087061350a565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052602260045260246000fd5b600281046001821680613f6d57607f821691505b602082108103613f7f57613f7f613f43565b50919050565b634e487b7160e01b600052603260045260246000fd5b62ffffff16600062fffffe198201613fb557613fb561350a565b5060010190565b6040810161358382856135a1565b808201808211156108705761087061350a565b60ff9182169190811690828203908111156108705761087061350a565b6000610870613e638381565b61400f83613ffa565b81546008840282811b60001990911b908116901990911617825550505050565b60006122c2818484614006565b818110156108205761404f60008261402f565b60010161403c565b601f8211156122c2576000818152602090206020601f8501048101602085101561407e5750805b6130f06020601f86010483018261403c565b6000196008929092029190911c191690565b60006140ae8383614090565b600290930290921792915050565b81516001600160401b038111156140d5576140d5613f2d565b6140df8254613f59565b6140ea828285614057565b6020601f83116001811461411857600084156141065750858201515b61411085826140a2565b865550611dfd565b600085815260208120601f198616915b828110156141485788850151825560209485019460019092019101614128565b868310156141655784890151614161601f891682614090565b8355505b600160028802018855505050505050505050565b600060ff8216610870565b61356f81614179565b6060810161419b82866135a1565b6141a86020830185614184565b6135fb604083018461356d565b805161087081613827565b6000602082840312156141d5576141d5600080fd5b60006135fb84846141b5565b82818337506000910152565b81835260006020840193506142038385846141e1565b601f19601f8401166136b2565b60e0810161421e828b6135a1565b61422b602083018a61356d565b818103604083015261423e81888a6141ed565b905061424d60608301876135a1565b61425a60808301866135a1565b61426760a08301856135a1565b61427460c083018461356d565b9998505050505050505050565b60ff9182169190811690828201908111156108705761087061350a565b80516108708161383b565b6000602082840312156142be576142be600080fd5b60006135fb848461429e565b60048152600060208201634931303160e01b815291505b5060200190565b60208082528101610870816142ca565b818103818111156108705761087061350a565b6060810161431982866135a1565b6141a860208301856135a1565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506142e1565b6020808252810161087081614326565b6060810161437882866135a1565b6141a8602083018561365b565b6020808252810161087081602e81527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160208201526d191e481a5b9a5d1a585b1a5e995960921b604082015260600190565b60006000198203613fb557613fb561350a565b61ffff16600061fffe198201613fb557613fb561350a565b6000816144115761441161350a565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000614439825190565b614447818560208601613664565b9290920192915050565b6000612afd828461442f56fe9e96f745d5dbab4ac30a89c73c1ed91d02f25bd8ff428bda3fa14673408de3daa26469706673582212202584c0ff7ef40d0bfda96f8ec2444528ef88e5621d60b7df2d620f75cd0fd46a64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000009fad7d8bee2dbf01391cdecb48b9036b498f86b000000000000000000000000f5d59b319acf4d7de08902c190d61d26919a85af
-----Decoded View---------------
Arg [0] : forwarder (address): 0x09FAd7D8bEe2dbf01391CdEcB48b9036B498f86B
Arg [1] : _diamondcut (address): 0xf5d59b319aCF4D7dE08902C190d61D26919A85Af
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000009fad7d8bee2dbf01391cdecb48b9036b498f86b
Arg [1] : 000000000000000000000000f5d59b319acf4d7de08902c190d61d26919a85af
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.