Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60e06040 | 13223035 | 1123 days ago | IN | 0 ETH | 0.16849872 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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:
SmartWallet
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 100000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../iface/ILoopringWalletV2.sol"; import "../lib/EIP712.sol"; import "../lib/ERC20.sol"; import "../lib/ERC1271.sol"; import "../lib/ReentrancyGuard.sol"; import "../thirdparty/erc165/IERC165.sol"; import "../thirdparty/erc1155/ERC1155Holder.sol"; import "../thirdparty/erc721/ERC721Holder.sol"; import "./libwallet/ERC20Lib.sol"; import "./libwallet/ERC1271Lib.sol"; import "./libwallet/WalletData.sol"; import "./libwallet/LockLib.sol"; import "./libwallet/GuardianLib.sol"; import "./libwallet/InheritanceLib.sol"; import "./libwallet/MetaTxLib.sol"; import "./libwallet/WhitelistLib.sol"; import "./libwallet/QuotaLib.sol"; import "./libwallet/RecoverLib.sol"; import "./libwallet/UpgradeLib.sol"; /// @title SmartWallet /// @dev Main smart wallet contract /// @author Brecht Devos - <[email protected]> contract SmartWallet is ILoopringWalletV2, ERC1271, IERC165, ERC721Holder, ERC1155Holder { using ERC20Lib for Wallet; using ERC1271Lib for Wallet; using LockLib for Wallet; using GuardianLib for Wallet; using InheritanceLib for Wallet; using MetaTxLib for Wallet; using WhitelistLib for Wallet; using QuotaLib for Wallet; using RecoverLib for Wallet; using UpgradeLib for Wallet; bytes32 public immutable DOMAIN_SEPARATOR; PriceOracle public immutable priceOracle; address public immutable blankOwner; // WARNING: Do not delete wallet state data to make this implementation // compatible with early versions. // // ----- DATA LAYOUT BEGINS ----- // Always needs to be first address internal masterCopy; bool internal isImplementationContract; Wallet public wallet; // ----- DATA LAYOUT ENDS ----- /// @dev We need to make sure the implemenation contract cannot be initialized /// and used to do delegate calls to arbitrary contracts. modifier disableInImplementationContract { require(!isImplementationContract, "DISALLOWED_ON_IMPLEMENTATION_CONTRACT"); _; } modifier onlyFromWalletOrOwnerWhenUnlocked() { // If the wallet's signature verfication passes, the wallet must be unlocked. require( msg.sender == address(this) || (msg.sender == wallet.owner && !wallet.locked), "NOT_FROM_WALLET_OR_OWNER_OR_WALLET_LOCKED" ); wallet.touchLastActiveWhenRequired(); _; } modifier canTransferOwnership() { require( msg.sender == blankOwner && wallet.owner == blankOwner, "NOT_ALLOWED_TO_SET_OWNER" ); _; } constructor( PriceOracle _priceOracle, address _blankOwner ) { isImplementationContract = true; DOMAIN_SEPARATOR = EIP712.hash( EIP712.Domain("LoopringWallet", "2.0.0", address(this)) ); priceOracle = _priceOracle; blankOwner = _blankOwner; } /// @dev Set up this wallet. /// /// Note that calling this method more than once will throw. /// /// @param owner The owner of this wallet, must not be address(0). /// @param guardians The guardians of this wallet. function initialize( address owner, address[] calldata guardians, uint quota, address inheritor, address feeRecipient, address feeToken, uint feeAmount ) external override disableInImplementationContract { require(wallet.owner == address(0), "INITIALIZED_ALREADY"); require(owner != address(0), "INVALID_OWNER"); wallet.owner = owner; wallet.creationTimestamp = uint64(block.timestamp); wallet.addGuardiansImmediately(guardians); if (quota != 0) { wallet.setQuota(quota, 0); } if (inheritor != address(0)) { wallet.setInheritor(inheritor, 365 days); } // Pay for the wallet creation using wallet funds if (feeRecipient != address(0) && feeAmount > 0) { ERC20Lib.transfer(feeToken, feeRecipient, feeAmount); } } receive() external payable { } function getOwner() public view override returns (address) { return wallet.owner; } function getCreationTimestamp() public view override returns (uint64) { return wallet.creationTimestamp; } // // Owner // function transferOwnership( address _owner ) external canTransferOwnership { require(_owner != address(0), "INVALID_OWNER"); wallet.owner = _owner; } // // ERC1271 // function isValidSignature( bytes32 signHash, bytes memory signature ) public view override returns (bytes4 magicValue) { return wallet.isValidSignature( ERC1271_MAGICVALUE, signHash, signature ); } // // Upgrade // function changeMasterCopy( Approval calldata approval, address newMasterCopy ) external returns (bytes32 approvedHash) { approvedHash = wallet.changeMasterCopy( DOMAIN_SEPARATOR, approval, newMasterCopy ); masterCopy = newMasterCopy; } function getMasterCopy() public view returns (address) { return masterCopy; } // // Guardians // function addGuardian( address guardian ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.addGuardian(guardian); } function addGuardianWA( Approval calldata approval, address guardian ) external returns (bytes32 approvedHash) { approvedHash = wallet.addGuardianWA(DOMAIN_SEPARATOR, approval, guardian); } function removeGuardian( address guardian ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.removeGuardian(guardian); } function removeGuardianWA( Approval calldata approval, address guardian ) external returns (bytes32 approvedHash) { approvedHash = wallet.removeGuardianWA(DOMAIN_SEPARATOR, approval, guardian); } function resetGuardians( address[] calldata newGuardians ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.resetGuardians(newGuardians); } function resetGuardiansWA( Approval calldata approval, address[] calldata newGuardians ) external returns (bytes32 approvedHash) { approvedHash = wallet.resetGuardiansWA(DOMAIN_SEPARATOR, approval, newGuardians); } function isGuardian(address addr, bool includePendingAddition) public view returns (bool) { return wallet.isGuardian(addr, includePendingAddition); } function getGuardians(bool includePendingAddition) public view returns (Guardian[] memory ) { return GuardianLib.guardians(wallet, includePendingAddition); } // // Inheritance // function setInheritor( address inheritor, uint32 waitingPeriod ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.setInheritor(inheritor, waitingPeriod); } function inherit( address newOwner ) external { wallet.inherit(newOwner); } // // Lock // function lock() external { wallet.lock(); } function unlock( Approval calldata approval ) external returns (bytes32 approvedHash) { approvedHash = wallet.unlock(DOMAIN_SEPARATOR, approval); } // // Quota // function changeDailyQuota( uint newQuota ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.changeDailyQuota(newQuota); } function changeDailyQuotaWA( Approval calldata approval, uint newQuota ) external returns (bytes32 approvedHash) { approvedHash = wallet.changeDailyQuotaWA(DOMAIN_SEPARATOR, approval, newQuota); } // // MetaTx // function executeMetaTx( address to, uint nonce, address gasToken, uint gasPrice, uint gasLimit, uint gasOverhead, address feeRecipient, bool requiresSuccess, bytes calldata data, bytes memory signature ) external returns (bool) { MetaTxLib.MetaTx memory metaTx = MetaTxLib.MetaTx( to, nonce, gasToken, gasPrice, gasLimit, gasOverhead, feeRecipient, requiresSuccess, data, signature ); return wallet.executeMetaTx( DOMAIN_SEPARATOR, priceOracle, metaTx ); } function selfBatchCall( bytes[] calldata data ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.selfBatchCall(data); } // // Recover // function recover( Approval calldata approval, address newOwner, address[] calldata newGuardians ) external returns (bytes32 approvedHash) { approvedHash = wallet.recover( DOMAIN_SEPARATOR, approval, newOwner, newGuardians ); } // // Whitelist // function addToWhitelist( address addr ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.addToWhitelist(addr); } function addToWhitelistWA( Approval calldata approval, address addr ) external returns (bytes32 approvedHash) { approvedHash = wallet.addToWhitelistWA( DOMAIN_SEPARATOR, approval, addr ); } function removeFromWhitelist( address addr ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.removeFromWhitelist(addr); } function getWhitelistEffectiveTime( address addr ) public view returns (uint) { return wallet.whitelisted[addr]; } function isWhitelisted( address addr ) public view returns (bool) { return wallet.isAddressWhitelisted(addr); } // // ERC20 // function transferToken( address token, address to, uint amount, bytes calldata logdata, bool forceUseQuota ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.transferToken( priceOracle, token, to, amount, logdata, forceUseQuota ); } function transferTokenWA( Approval calldata approval, address token, address to, uint amount, bytes calldata logdata ) external returns (bytes32 approvedHash) { approvedHash = wallet.transferTokenWA( DOMAIN_SEPARATOR, approval, token, to, amount, logdata ); } function callContract( address to, uint value, bytes calldata data, bool forceUseQuota ) external onlyFromWalletOrOwnerWhenUnlocked returns (bytes memory) { return wallet.callContract( priceOracle, to, value, data, forceUseQuota ); } function callContractWA( Approval calldata approval, address to, uint value, bytes calldata data ) external returns (bytes32 approvedHash, bytes memory returnData) { (approvedHash, returnData) = wallet.callContractWA( DOMAIN_SEPARATOR, approval, to, value, data ); } function approveToken( address token, address to, uint amount, bool forceUseQuota ) external onlyFromWalletOrOwnerWhenUnlocked { wallet.approveToken( priceOracle, token, to, amount, forceUseQuota ); } function approveTokenWA( Approval calldata approval, address token, address to, uint amount ) external returns (bytes32 approvedHash) { approvedHash = wallet.approveTokenWA( DOMAIN_SEPARATOR, approval, token, to, amount ); } function approveThenCallContract( address token, address to, uint amount, uint value, bytes calldata data, bool forceUseQuota ) external onlyFromWalletOrOwnerWhenUnlocked returns (bytes memory) { return wallet.approveThenCallContract( priceOracle, token, to, amount, value, data, forceUseQuota ); } function approveThenCallContractWA( Approval calldata approval, address token, address to, uint amount, uint value, bytes calldata data ) external returns (bytes32 approvedHash, bytes memory returnData) { (approvedHash, returnData) = wallet.approveThenCallContractWA( DOMAIN_SEPARATOR, approval, token, to, amount, value, data ); } // ERC165 function supportsInterface( bytes4 interfaceId ) external pure override returns (bool) { return interfaceId == type(ERC1271).interfaceId || interfaceId == type(IERC165).interfaceId || interfaceId == type(IERC721Receiver).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId; } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Loopring SmartWallet V2 interface /// @author Brecht Devos - <[email protected]> abstract contract ILoopringWalletV2 { /// @dev Initializes the smart wallet. /// @param owner The wallet owner address. /// @param guardians The initial wallet guardians. /// @param quota The initial wallet quota. /// @param inheritor The inheritor of the wallet. /// @param feeRecipient The address receiving the fee for creating the wallet. /// @param feeToken The token to use for the fee payment. /// @param feeAmount The amount of tokens paid to the fee recipient. function initialize( address owner, address[] calldata guardians, uint quota, address inheritor, address feeRecipient, address feeToken, uint feeAmount ) external virtual; /// @dev Returns the timestamp the wallet was created. /// @return The timestamp the wallet was created. function getCreationTimestamp() public view virtual returns (uint64); /// @dev Returns the current wallet owner. /// @return The current wallet owner. function getOwner() public view virtual returns (address); }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; library EIP712 { struct Domain { string name; string version; address verifyingContract; } bytes32 constant internal EIP712_DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); string constant internal EIP191_HEADER = "\x19\x01"; function hash(Domain memory domain) internal pure returns (bytes32) { uint _chainid; assembly { _chainid := chainid() } return keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(domain.name)), keccak256(bytes(domain.version)), _chainid, domain.verifyingContract ) ); } function hashPacked( bytes32 domainSeparator, bytes32 dataHash ) internal pure returns (bytes32) { return keccak256( abi.encodePacked( EIP191_HEADER, domainSeparator, dataHash ) ); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title ERC20 Token Interface /// @dev see https://github.com/ethereum/EIPs/issues/20 /// @author Daniel Wang - <[email protected]> abstract contract ERC20 { function totalSupply() public view virtual returns (uint); function balanceOf( address who ) public view virtual returns (uint); function allowance( address owner, address spender ) public view virtual returns (uint); function transfer( address to, uint value ) public virtual returns (bool); function transferFrom( address from, address to, uint value ) public virtual returns (bool); function approve( address spender, uint value ) public virtual returns (bool); }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; abstract contract ERC1271 { // bytes4(keccak256("isValidSignature(bytes32,bytes)") bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e; function isValidSignature( bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4 magicValue); }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title ReentrancyGuard /// @author Brecht Devos - <[email protected]> /// @dev Exposes a modifier that guards a function against reentrancy /// Changing the value of the same storage value multiple times in a transaction /// is cheap (starting from Istanbul) so there is no need to minimize /// the number of times the value is changed contract ReentrancyGuard { //The default value must be 0 in order to work behind a proxy. uint private _guardValue; modifier nonReentrant() { require(_guardValue == 0, "REENTRANCY"); _guardValue = 1; _; _guardValue = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.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: MIT pragma solidity ^0.7.0; import "./IERC1155Receiver.sol"; /** * @dev _Available since v3.1._ */ contract ERC1155Holder is IERC1155Receiver { function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual override pure returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) public virtual override pure returns (bytes4) { return this.onERC1155BatchReceived.selector; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./IERC721Receiver.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received(address, address, uint256, bytes memory) public virtual override pure returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../../thirdparty/SafeERC20.sol"; import "../../lib/ERC20.sol"; import "../../lib/MathUint.sol"; import "../../lib/AddressUtil.sol"; import "../../iface/PriceOracle.sol"; import "./WhitelistLib.sol"; import "./QuotaLib.sol"; import "./ApprovalLib.sol"; /// @title ERC20Lib /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> library ERC20Lib { using AddressUtil for address; using MathUint for uint; using WhitelistLib for Wallet; using QuotaLib for Wallet; using ApprovalLib for Wallet; using SafeERC20 for ERC20; event Transfered (address token, address to, uint amount, bytes logdata); event Approved (address token, address spender, uint amount); event ContractCalled (address to, uint value, bytes data); bytes32 public constant TRANSFER_TOKEN_TYPEHASH = keccak256( "transferToken(address wallet,uint256 validUntil,address token,address to,uint256 amount,bytes logdata)" ); bytes32 public constant APPROVE_TOKEN_TYPEHASH = keccak256( "approveToken(address wallet,uint256 validUntil,address token,address to,uint256 amount)" ); bytes32 public constant CALL_CONTRACT_TYPEHASH = keccak256( "callContract(address wallet,uint256 validUntil,address to,uint256 value,bytes data)" ); bytes32 public constant APPROVE_THEN_CALL_CONTRACT_TYPEHASH = keccak256( "approveThenCallContract(address wallet,uint256 validUntil,address token,address to,uint256 amount,uint256 value,bytes data)" ); function transferToken( Wallet storage wallet, PriceOracle priceOracle, address token, address to, uint amount, bytes calldata logdata, bool forceUseQuota ) external { if (forceUseQuota || !wallet.isAddressWhitelisted(to)) { wallet.checkAndAddToSpent(priceOracle, token, amount); } _transferWithEvent(token, to, amount, logdata); } function transferTokenWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address token, address to, uint amount, bytes calldata logdata ) external returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( TRANSFER_TOKEN_TYPEHASH, approval.wallet, approval.validUntil, token, to, amount, keccak256(logdata) ) ); _transferWithEvent(token, to, amount, logdata); } function callContract( Wallet storage wallet, PriceOracle priceOracle, address to, uint value, bytes calldata data, bool forceUseQuota ) external returns (bytes memory returnData) { if (forceUseQuota || !wallet.isAddressWhitelisted(to)) { wallet.checkAndAddToSpent(priceOracle, address(0), value); } return _callContractInternal(to, value, data, priceOracle); } function callContractWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address to, uint value, bytes calldata data ) external returns (bytes32 approvedHash, bytes memory returnData) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( CALL_CONTRACT_TYPEHASH, approval.wallet, approval.validUntil, to, value, keccak256(data) ) ); returnData = _callContractInternal(to, value, data, PriceOracle(0)); } function approveToken( Wallet storage wallet, PriceOracle priceOracle, address token, address to, uint amount, bool forceUseQuota ) external { uint additionalAllowance = _approveInternal(token, to, amount); if (forceUseQuota || !wallet.isAddressWhitelisted(to)) { wallet.checkAndAddToSpent(priceOracle, token, additionalAllowance); } } function approveTokenWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address token, address to, uint amount ) external returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( APPROVE_TOKEN_TYPEHASH, approval.wallet, approval.validUntil, token, to, amount ) ); _approveInternal(token, to, amount); } function approveThenCallContract( Wallet storage wallet, PriceOracle priceOracle, address token, address to, uint amount, uint value, bytes calldata data, bool forceUseQuota ) external returns (bytes memory returnData) { uint additionalAllowance = _approveInternal(token, to, amount); if (forceUseQuota || !wallet.isAddressWhitelisted(to)) { wallet.checkAndAddToSpent(priceOracle, token, additionalAllowance); wallet.checkAndAddToSpent(priceOracle, address(0), value); } return _callContractInternal(to, value, data, priceOracle); } function approveThenCallContractWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address token, address to, uint amount, uint value, bytes calldata data ) external returns (bytes32 approvedHash, bytes memory returnData) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( APPROVE_THEN_CALL_CONTRACT_TYPEHASH, approval.wallet, approval.validUntil, token, to, amount, value, keccak256(data) ) ); _approveInternal(token, to, amount); returnData = _callContractInternal(to, value, data, PriceOracle(0)); } function transfer( address token, address to, uint amount ) public { if (token == address(0)) { to.sendETHAndVerify(amount, gasleft()); } else { ERC20(token).safeTransfer(to, amount); } } // --- Internal functions --- function _transferWithEvent( address token, address to, uint amount, bytes calldata logdata ) private { transfer(token, to, amount); emit Transfered(token, to, amount, logdata); } function _approveInternal( address token, address spender, uint amount ) private returns (uint additionalAllowance) { // Current allowance uint allowance = ERC20(token).allowance(address(this), spender); if (amount != allowance) { // First reset the approved amount if needed if (allowance > 0) { ERC20(token).safeApprove(spender, 0); } // Now approve the requested amount ERC20(token).safeApprove(spender, amount); } // If we increased the allowance, calculate by how much if (amount > allowance) { additionalAllowance = amount.sub(allowance); } emit Approved(token, spender, amount); } function _callContractInternal( address to, uint value, bytes calldata txData, PriceOracle priceOracle ) private returns (bytes memory returnData) { require(to != address(this), "SELF_CALL_DISALLOWED"); if (priceOracle != PriceOracle(0)) { // Disallow general calls to token contracts (for tokens that have price data // so the quota is actually used). require(priceOracle.tokenValue(to, 1e18) == 0, "CALL_DISALLOWED"); } bool success; (success, returnData) = to.call{value: value}(txData); require(success, "CALL_FAILED"); emit ContractCalled(to, value, txData); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../../lib/SignatureUtil.sol"; import "./WalletData.sol"; /// @title ERC1271Lib /// @author Brecht Devos - <[email protected]> library ERC1271Lib { using SignatureUtil for bytes32; // Note that we allow chained wallet ownership: // Wallet1 owned by Wallet2, Wallet2 owned by Wallet3, ..., WaleltN owned by an EOA. // The verificaiton of Wallet1's signature will succeed if the final EOA's signature is // valid. function isValidSignature( Wallet storage wallet, bytes4 ERC1271_MAGICVALUE, bytes32 signHash, bytes memory signature ) public view returns (bytes4 magicValue) { if (wallet.locked) { return 0; } if (signHash.verifySignature(wallet.owner, signature)) { return ERC1271_MAGICVALUE; } else { return 0; } } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; enum SigRequirement { MAJORITY_OWNER_NOT_ALLOWED, MAJORITY_OWNER_ALLOWED, MAJORITY_OWNER_REQUIRED, OWNER_OR_ANY_GUARDIAN, ANY_GUARDIAN } struct Approval { address[] signers; bytes[] signatures; uint validUntil; address wallet; } // Optimized to fit into 64 bytes (2 slots) struct Quota { uint128 currentQuota; uint128 pendingQuota; uint128 spentAmount; uint64 spentTimestamp; uint64 pendingUntil; } enum GuardianStatus { REMOVE, // Being removed or removed after validUntil timestamp ADD // Being added or added after validSince timestamp. } // Optimized to fit into 32 bytes (1 slot) struct Guardian { address addr; uint8 status; uint64 timestamp; // validSince if status = ADD; validUntil if adding = REMOVE; } struct Wallet { address owner; uint64 creationTimestamp; // relayer => nonce uint nonce; // hash => consumed mapping (bytes32 => bool) hashes; bool locked; Guardian[] guardians; mapping (address => uint) guardianIdx; address inheritor; uint32 inheritWaitingPeriod; uint64 lastActive; // the latest timestamp the owner is considered to be active Quota quota; // whitelisted address => effective timestamp mapping (address => uint) whitelisted; }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./ApprovalLib.sol"; import "./WalletData.sol"; import "./GuardianLib.sol"; /// @title LockLib /// @author Brecht Devos - <[email protected]> library LockLib { using GuardianLib for Wallet; using ApprovalLib for Wallet; event WalletLocked ( address by, bool locked ); bytes32 public constant LOCK_TYPEHASH = keccak256( "lock(address wallet,uint256 validUntil)" ); bytes32 public constant UNLOCK_TYPEHASH = keccak256( "unlock(address wallet,uint256 validUntil)" ); function lock(Wallet storage wallet) public { require( msg.sender == address(this) || msg.sender == wallet.owner || wallet.isGuardian(msg.sender, false), "NOT_FROM_WALLET_OR_OWNER_OR_GUARDIAN" ); setLock(wallet, msg.sender, true); } function unlock( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval ) public returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( UNLOCK_TYPEHASH, approval.wallet, approval.validUntil ) ); setLock(wallet, msg.sender, false); } function setLock( Wallet storage wallet, address by, bool locked ) internal { wallet.locked = locked; emit WalletLocked(by, locked); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./WalletData.sol"; import "./ApprovalLib.sol"; import "../../lib/SignatureUtil.sol"; import "../../thirdparty/SafeCast.sol"; /// @title GuardianModule /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> library GuardianLib { using AddressUtil for address; using SafeCast for uint; using SignatureUtil for bytes32; using ApprovalLib for Wallet; uint public constant MAX_GUARDIANS = 10; uint public constant GUARDIAN_PENDING_PERIOD = 3 days; bytes32 public constant ADD_GUARDIAN_TYPEHASH = keccak256( "addGuardian(address wallet,uint256 validUntil,address guardian)" ); bytes32 public constant REMOVE_GUARDIAN_TYPEHASH = keccak256( "removeGuardian(address wallet,uint256 validUntil,address guardian)" ); bytes32 public constant RESET_GUARDIANS_TYPEHASH = keccak256( "resetGuardians(address wallet,uint256 validUntil,address[] guardians)" ); event GuardianAdded (address guardian, uint effectiveTime); event GuardianRemoved (address guardian, uint effectiveTime); function addGuardiansImmediately( Wallet storage wallet, address[] memory _guardians ) external { address guardian = address(0); for (uint i = 0; i < _guardians.length; i++) { require(_guardians[i] > guardian, "INVALID_ORDERING"); guardian = _guardians[i]; _addGuardian(wallet, guardian, 0, true); } } function addGuardian( Wallet storage wallet, address guardian ) external { _addGuardian(wallet, guardian, GUARDIAN_PENDING_PERIOD, false); } function addGuardianWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address guardian ) external returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( ADD_GUARDIAN_TYPEHASH, approval.wallet, approval.validUntil, guardian ) ); _addGuardian(wallet, guardian, 0, true); } function removeGuardian( Wallet storage wallet, address guardian ) external { _removeGuardian(wallet, guardian, GUARDIAN_PENDING_PERIOD, false); } function removeGuardianWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address guardian ) external returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( REMOVE_GUARDIAN_TYPEHASH, approval.wallet, approval.validUntil, guardian ) ); _removeGuardian(wallet, guardian, 0, true); } function resetGuardians( Wallet storage wallet, address[] calldata newGuardians ) external { Guardian[] memory allGuardians = guardians(wallet, true); for (uint i = 0; i < allGuardians.length; i++) { _removeGuardian(wallet, allGuardians[i].addr, GUARDIAN_PENDING_PERIOD, false); } for (uint j = 0; j < newGuardians.length; j++) { _addGuardian(wallet, newGuardians[j], GUARDIAN_PENDING_PERIOD, false); } } function resetGuardiansWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address[] calldata newGuardians ) external returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( RESET_GUARDIANS_TYPEHASH, approval.wallet, approval.validUntil, keccak256(abi.encodePacked(newGuardians)) ) ); removeAllGuardians(wallet); for (uint i = 0; i < newGuardians.length; i++) { _addGuardian(wallet, newGuardians[i], 0, true); } } function requireMajority( Wallet storage wallet, address[] memory signers, SigRequirement requirement ) internal view returns (bool) { // We always need at least one signer if (signers.length == 0) { return false; } // Calculate total group sizes Guardian[] memory allGuardians = guardians(wallet, false); require(allGuardians.length > 0, "NO_GUARDIANS"); address lastSigner; bool walletOwnerSigned = false; address owner = wallet.owner; for (uint i = 0; i < signers.length; i++) { // Check for duplicates require(signers[i] > lastSigner, "INVALID_SIGNERS_ORDER"); lastSigner = signers[i]; if (signers[i] == owner) { walletOwnerSigned = true; } else { bool _isGuardian = false; for (uint j = 0; j < allGuardians.length; j++) { if (allGuardians[j].addr == signers[i]) { _isGuardian = true; break; } } require(_isGuardian, "SIGNER_NOT_GUARDIAN"); } } if (requirement == SigRequirement.OWNER_OR_ANY_GUARDIAN) { return signers.length == 1; } else if (requirement == SigRequirement.ANY_GUARDIAN) { require(!walletOwnerSigned, "WALLET_OWNER_SIGNATURE_NOT_ALLOWED"); return signers.length == 1; } // Check owner requirements if (requirement == SigRequirement.MAJORITY_OWNER_REQUIRED) { require(walletOwnerSigned, "WALLET_OWNER_SIGNATURE_REQUIRED"); } else if (requirement == SigRequirement.MAJORITY_OWNER_NOT_ALLOWED) { require(!walletOwnerSigned, "WALLET_OWNER_SIGNATURE_NOT_ALLOWED"); } uint numExtendedSigners = allGuardians.length; if (walletOwnerSigned) { numExtendedSigners += 1; require(signers.length > 1, "NO_GUARDIAN_SIGNED_BESIDES_OWNER"); } return signers.length >= (numExtendedSigners >> 1) + 1; } function isGuardian( Wallet storage wallet, address addr, bool includePendingAddition ) public view returns (bool) { Guardian memory g = _getGuardian(wallet, addr); return _isActiveOrPendingAddition(g, includePendingAddition); } function guardians( Wallet storage wallet, bool includePendingAddition ) public view returns (Guardian[] memory _guardians) { _guardians = new Guardian[](wallet.guardians.length); uint index = 0; for (uint i = 0; i < wallet.guardians.length; i++) { Guardian memory g = wallet.guardians[i]; if (_isActiveOrPendingAddition(g, includePendingAddition)) { _guardians[index] = g; index++; } } assembly { mstore(_guardians, index) } } function numGuardians( Wallet storage wallet, bool includePendingAddition ) public view returns (uint count) { for (uint i = 0; i < wallet.guardians.length; i++) { Guardian memory g = wallet.guardians[i]; if (_isActiveOrPendingAddition(g, includePendingAddition)) { count++; } } } function removeAllGuardians( Wallet storage wallet ) internal { uint size = wallet.guardians.length; if (size == 0) return; for (uint i = 0; i < wallet.guardians.length; i++) { delete wallet.guardianIdx[wallet.guardians[i].addr]; } delete wallet.guardians; } function cancelPendingGuardians(Wallet storage wallet) internal { bool cancelled = false; for (uint i = 0; i < wallet.guardians.length; i++) { Guardian memory g = wallet.guardians[i]; if (_isPendingAddition(g)) { wallet.guardians[i].status = uint8(GuardianStatus.REMOVE); wallet.guardians[i].timestamp = 0; cancelled = true; } if (_isPendingRemoval(g)) { wallet.guardians[i].status = uint8(GuardianStatus.ADD); wallet.guardians[i].timestamp = 0; cancelled = true; } } _cleanRemovedGuardians(wallet, true); } function storeGuardian( Wallet storage wallet, address addr, uint validSince, bool alwaysOverride ) internal returns (uint) { require(validSince >= block.timestamp, "INVALID_VALID_SINCE"); require(addr != address(0), "ZERO_ADDRESS"); require(addr != address(this), "INVALID_ADDRESS"); uint pos = wallet.guardianIdx[addr]; if (pos == 0) { // Add the new guardian Guardian memory _g = Guardian( addr, uint8(GuardianStatus.ADD), validSince.toUint64() ); wallet.guardians.push(_g); wallet.guardianIdx[addr] = wallet.guardians.length; _cleanRemovedGuardians(wallet, false); return validSince; } Guardian memory g = wallet.guardians[pos - 1]; if (_isRemoved(g)) { wallet.guardians[pos - 1].status = uint8(GuardianStatus.ADD); wallet.guardians[pos - 1].timestamp = validSince.toUint64(); return validSince; } if (_isPendingRemoval(g)) { wallet.guardians[pos - 1].status = uint8(GuardianStatus.ADD); wallet.guardians[pos - 1].timestamp = 0; return 0; } if (_isPendingAddition(g)) { if (!alwaysOverride) return g.timestamp; wallet.guardians[pos - 1].timestamp = validSince.toUint64(); return validSince; } require(_isAdded(g), "UNEXPECTED_RESULT"); return 0; } function deleteGuardian( Wallet storage wallet, address addr, uint validUntil, bool alwaysOverride ) internal returns (uint) { require(validUntil >= block.timestamp, "INVALID_VALID_UNTIL"); require(addr != address(0), "ZERO_ADDRESS"); uint pos = wallet.guardianIdx[addr]; require(pos > 0, "GUARDIAN_NOT_EXISTS"); Guardian memory g = wallet.guardians[pos - 1]; if (_isAdded(g)) { wallet.guardians[pos - 1].status = uint8(GuardianStatus.REMOVE); wallet.guardians[pos - 1].timestamp = validUntil.toUint64(); return validUntil; } if (_isPendingAddition(g)) { wallet.guardians[pos - 1].status = uint8(GuardianStatus.REMOVE); wallet.guardians[pos - 1].timestamp = 0; return 0; } if (_isPendingRemoval(g)) { if (!alwaysOverride) return g.timestamp; wallet.guardians[pos - 1].timestamp = validUntil.toUint64(); return validUntil; } require(_isRemoved(g), "UNEXPECTED_RESULT"); return 0; } // --- Internal functions --- function _addGuardian( Wallet storage wallet, address guardian, uint pendingPeriod, bool alwaysOverride ) internal { uint _numGuardians = numGuardians(wallet, true); require(_numGuardians < MAX_GUARDIANS, "TOO_MANY_GUARDIANS"); require(guardian != wallet.owner, "GUARDIAN_CAN_NOT_BE_OWNER"); uint validSince = block.timestamp; if (_numGuardians >= 2) { validSince = block.timestamp + pendingPeriod; } validSince = storeGuardian(wallet, guardian, validSince, alwaysOverride); emit GuardianAdded(guardian, validSince); } function _removeGuardian( Wallet storage wallet, address guardian, uint pendingPeriod, bool alwaysOverride ) private { uint validUntil = block.timestamp + pendingPeriod; validUntil = deleteGuardian(wallet, guardian, validUntil, alwaysOverride); emit GuardianRemoved(guardian, validUntil); } function _getGuardian( Wallet storage wallet, address addr ) private view returns (Guardian memory guardian) { uint pos = wallet.guardianIdx[addr]; if (pos > 0) { guardian = wallet.guardians[pos - 1]; } } function _isAdded(Guardian memory guardian) private view returns (bool) { return guardian.status == uint8(GuardianStatus.ADD) && guardian.timestamp <= block.timestamp; } function _isPendingAddition(Guardian memory guardian) private view returns (bool) { return guardian.status == uint8(GuardianStatus.ADD) && guardian.timestamp > block.timestamp; } function _isRemoved(Guardian memory guardian) private view returns (bool) { return guardian.status == uint8(GuardianStatus.REMOVE) && guardian.timestamp <= block.timestamp; } function _isPendingRemoval(Guardian memory guardian) private view returns (bool) { return guardian.status == uint8(GuardianStatus.REMOVE) && guardian.timestamp > block.timestamp; } function _isActive(Guardian memory guardian) private view returns (bool) { return _isAdded(guardian) || _isPendingRemoval(guardian); } function _isActiveOrPendingAddition( Guardian memory guardian, bool includePendingAddition ) private view returns (bool) { return _isActive(guardian) || includePendingAddition && _isPendingAddition(guardian); } function _cleanRemovedGuardians( Wallet storage wallet, bool force ) private { uint count = wallet.guardians.length; if (!force && count < 10) return; for (int i = int(count) - 1; i >= 0; i--) { Guardian memory g = wallet.guardians[uint(i)]; if (_isRemoved(g)) { Guardian memory lastGuardian = wallet.guardians[wallet.guardians.length - 1]; if (g.addr != lastGuardian.addr) { wallet.guardians[uint(i)] = lastGuardian; wallet.guardianIdx[lastGuardian.addr] = uint(i) + 1; } wallet.guardians.pop(); delete wallet.guardianIdx[g.addr]; } } } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./WalletData.sol"; import "./GuardianLib.sol"; import "./LockLib.sol"; import "./Utils.sol"; /// @title InheritanceLib /// @author Brecht Devos - <[email protected]> library InheritanceLib { using GuardianLib for Wallet; using InheritanceLib for Wallet; using LockLib for Wallet; using Utils for address; // The minimal number of guardians for recovery and locking. uint public constant TOUCH_GRACE_PERIOD = 30 days; event Inherited( address inheritor, address newOwner ); event InheritorChanged( address inheritor, uint32 waitingPeriod ); function touchLastActiveWhenRequired(Wallet storage wallet) internal { if (wallet.inheritor != address(0) && block.timestamp > wallet.lastActive + TOUCH_GRACE_PERIOD) { wallet.lastActive = uint64(block.timestamp); } } function setInheritor( Wallet storage wallet, address inheritor, uint32 waitingPeriod ) internal { wallet.inheritor = inheritor; wallet.inheritWaitingPeriod = waitingPeriod; wallet.lastActive = uint64(block.timestamp); } function inherit( Wallet storage wallet, address newOwner ) external { require(wallet.inheritor == msg.sender, "UNAUTHORIZED"); require(wallet.owner != newOwner, "IS_WALLET_OWNER"); require(newOwner.isValidWalletOwner(), "INVALID_NEW_WALLET_OWNER"); require(uint(wallet.lastActive) + uint(wallet.inheritWaitingPeriod) <= block.timestamp, "TOO_EARLY"); wallet.removeAllGuardians(); wallet.setInheritor(address(0), 0); wallet.setLock(address(this), false); wallet.owner = newOwner; emit Inherited(wallet.inheritor, newOwner); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../../lib/AddressUtil.sol"; import "../../lib/EIP712.sol"; import "../../lib/ERC20.sol"; import "../../lib/MathUint.sol"; import "../../lib/SignatureUtil.sol"; import "../../thirdparty/BytesUtil.sol"; import "./WalletData.sol"; import "./ERC20Lib.sol"; import "./QuotaLib.sol"; import "../SmartWallet.sol"; /// @title MetaTxLib /// @dev A module to support wallet meta-transactions. library MetaTxLib { using AddressUtil for address; using BytesUtil for bytes; using MathUint for uint; using SignatureUtil for bytes32; using QuotaLib for Wallet; using ERC20Lib for Wallet; bytes32 public constant META_TX_TYPEHASH = keccak256( "MetaTx(address to,uint256 nonce,address gasToken,uint256 gasPrice,uint256 gasLimit,uint256 gasOverhead,address feeRecipient,bytes data,bytes32 approvedHash)" ); event MetaTxExecuted( uint nonce, bytes32 approvedHash, bytes32 metaTxHash, bool success, uint gasUsed ); struct MetaTx { address to; uint nonce; address gasToken; uint gasPrice; uint gasLimit; uint gasOverhead; address feeRecipient; bool requiresSuccess; bytes data; bytes signature; } function validateMetaTx( Wallet storage wallet, bytes32 DOMAIN_SEPARATOR, MetaTx memory metaTx, bool success, bytes memory returnData ) public view returns (bytes32) { // If this is a dataless meta-tx the user only signs the function selector, // not the full function calldata. bytes memory data = metaTx.nonce == 0 ? metaTx.data.slice(0, 4) : metaTx.data; // Extracted the approved hash for dataless transactions // The approved hash always needs to be the first value returned by the called function // If the call failed we cannot deduce the approved hash so throw a nice // error message here instead of failing in the signature check. require(success || metaTx.nonce != 0, "APPROVED_HASH_UNKNOWN"); bytes32 approvedHash = metaTx.nonce == 0 ? returnData.toBytes32(0) : bytes32(0); bytes32 encodedHash = keccak256( abi.encode( META_TX_TYPEHASH, metaTx.to, metaTx.nonce, metaTx.gasToken, metaTx.gasPrice, metaTx.gasLimit, metaTx.gasOverhead, metaTx.feeRecipient, metaTx.requiresSuccess, keccak256(data), approvedHash ) ); bytes32 metaTxHash = EIP712.hashPacked(DOMAIN_SEPARATOR, encodedHash); require( metaTxHash.verifySignature(wallet.owner, metaTx.signature), "METATX_INVALID_SIGNATURE" ); return metaTxHash; } function executeMetaTx( Wallet storage wallet, bytes32 DOMAIN_SEPARATOR, PriceOracle priceOracle, MetaTx memory metaTx ) public returns (bool success) { uint gasLeft = gasleft(); require(gasLeft >= (metaTx.gasLimit.mul(64) / 63), "OPERATOR_INSUFFICIENT_GAS"); require(msg.sender != address(this), "RECURSIVE_METATXS_DISALLOWED"); // Only self calls allowed for now require(metaTx.to == address(this)); // Update the nonce before the call to protect against reentrancy require(isNonceValid(wallet, metaTx), "INVALID_NONCE"); if (metaTx.nonce != 0) { wallet.nonce = metaTx.nonce; } // Do the actual call bytes memory returnData; (success, returnData) = metaTx.to.call{gas: metaTx.gasLimit}(metaTx.data); // These checks are done afterwards to use the latest state post meta-tx call require(!wallet.locked, "WALLET_LOCKED"); bytes32 metaTxHash = validateMetaTx( wallet, DOMAIN_SEPARATOR, metaTx, success, returnData ); uint gasUsed = gasLeft - gasleft() + metaTx.gasOverhead; // Reimburse if (metaTx.gasPrice > 0 && (!metaTx.requiresSuccess || success)) { uint gasToReimburse = gasUsed <= metaTx.gasLimit ? gasUsed : metaTx.gasLimit; uint gasCost = gasToReimburse.mul(metaTx.gasPrice); wallet.checkAndAddToSpent( priceOracle, metaTx.gasToken, gasCost ); ERC20Lib.transfer(metaTx.gasToken, metaTx.feeRecipient, gasCost); } emit MetaTxExecuted( metaTx.nonce, metaTx.nonce == 0 ? returnData.toBytes32(0) : bytes32(0), metaTxHash, success, gasUsed ); } function selfBatchCall( Wallet storage /*wallet*/, bytes[] calldata data ) public { for (uint i = 0; i < data.length; i++) { (bool success, ) = address(this).call(data[i]); require(success, "BATCHED_CALL_FAILED"); } } function isNonceValid( Wallet storage wallet, MetaTx memory metaTx ) public view returns (bool) { return (metaTx.nonce > wallet.nonce && (metaTx.nonce >> 128) <= block.number) || isDataless(metaTx); } function isDataless( MetaTx memory metaTx ) public pure returns (bool) { // We don't require any data in the meta tx when // - the meta-tx has no nonce // - the meta-tx needs to be successful // - a function is called that requires a majority of guardians and fails when replayed bytes4 methodId = metaTx.data.toBytes4(0); return metaTx.nonce == 0 && metaTx.requiresSuccess && (methodId == SmartWallet.changeMasterCopy.selector || methodId == SmartWallet.addGuardianWA.selector || methodId == SmartWallet.removeGuardianWA.selector || methodId == SmartWallet.resetGuardiansWA.selector || methodId == SmartWallet.unlock.selector || methodId == SmartWallet.changeDailyQuotaWA.selector || methodId == SmartWallet.recover.selector || methodId == SmartWallet.addToWhitelistWA.selector || methodId == SmartWallet.transferTokenWA.selector || methodId == SmartWallet.callContractWA.selector || methodId == SmartWallet.approveTokenWA.selector || methodId == SmartWallet.approveThenCallContractWA.selector); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./ApprovalLib.sol"; import "./WalletData.sol"; import "../../lib/MathUint.sol"; /// @title WhitelistLib /// @dev This store maintains a wallet's whitelisted addresses. library WhitelistLib { using MathUint for uint; using WhitelistLib for Wallet; using ApprovalLib for Wallet; uint public constant WHITELIST_PENDING_PERIOD = 1 days; bytes32 public constant ADD_TO_WHITELIST_TYPEHASH = keccak256( "addToWhitelist(address wallet,uint256 validUntil,address addr)" ); event Whitelisted( address addr, bool whitelisted, uint effectiveTime ); function addToWhitelist( Wallet storage wallet, address addr ) external { wallet._addToWhitelist( addr, block.timestamp.add(WHITELIST_PENDING_PERIOD) ); } function addToWhitelistWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address addr ) external returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( ADD_TO_WHITELIST_TYPEHASH, approval.wallet, approval.validUntil, addr ) ); wallet._addToWhitelist( addr, block.timestamp ); } function removeFromWhitelist( Wallet storage wallet, address addr ) external { wallet._removeFromWhitelist(addr); } function isAddressWhitelisted( Wallet storage wallet, address addr ) internal view returns (bool) { uint effectiveTime = wallet.whitelisted[addr]; return effectiveTime > 0 && effectiveTime <= block.timestamp; } // --- Internal functions --- function _addToWhitelist( Wallet storage wallet, address addr, uint effectiveTime ) internal { require(wallet.whitelisted[addr] == 0, "ADDRESS_ALREADY_WHITELISTED"); uint effective = effectiveTime >= block.timestamp ? effectiveTime : block.timestamp; wallet.whitelisted[addr] = effective; emit Whitelisted(addr, true, effective); } function _removeFromWhitelist( Wallet storage wallet, address addr ) internal { delete wallet.whitelisted[addr]; emit Whitelisted(addr, false, 0); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./ApprovalLib.sol"; import "./WalletData.sol"; import "../../iface/PriceOracle.sol"; import "../../lib/MathUint.sol"; import "../../thirdparty/SafeCast.sol"; /// @title QuotaLib /// @dev This store maintains daily spending quota for each wallet. /// A rolling daily limit is used. library QuotaLib { using MathUint for uint; using SafeCast for uint; using ApprovalLib for Wallet; uint128 public constant MAX_QUOTA = uint128(-1); uint public constant QUOTA_PENDING_PERIOD = 1 days; bytes32 public constant CHANGE_DAILY_QUOTE_TYPEHASH = keccak256( "changeDailyQuota(address wallet,uint256 validUntil,uint256 newQuota)" ); event QuotaScheduled( address wallet, uint pendingQuota, uint64 pendingUntil ); function changeDailyQuota( Wallet storage wallet, uint newQuota ) public { setQuota(wallet, newQuota, block.timestamp.add(QUOTA_PENDING_PERIOD)); } function changeDailyQuotaWA( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, uint newQuota ) public returns (bytes32 approvedHash) { approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( CHANGE_DAILY_QUOTE_TYPEHASH, approval.wallet, approval.validUntil, newQuota ) ); setQuota(wallet, newQuota, 0); } function checkAndAddToSpent( Wallet storage wallet, PriceOracle priceOracle, address token, uint amount ) internal { Quota memory q = wallet.quota; uint available = _availableQuota(q); if (available != MAX_QUOTA) { uint value = (token == address(0)) ? amount : ((address(priceOracle) == address(0)) ? 0 : priceOracle.tokenValue(token, amount)); if (value > 0) { require(available >= value, "QUOTA_EXCEEDED"); _addToSpent(wallet, q, value); } } } // 0 for newQuota indicates unlimited quota, or daily quota is disabled. function setQuota( Wallet storage wallet, uint newQuota, uint effectiveTime ) internal { require(newQuota <= MAX_QUOTA, "INVALID_VALUE"); if (newQuota == MAX_QUOTA) { newQuota = 0; } uint __currentQuota = currentQuota(wallet); // Always allow the quota to be changed immediately when the quota doesn't increase if ((__currentQuota >= newQuota && newQuota != 0) || __currentQuota == 0) { effectiveTime = 0; } Quota storage quota = wallet.quota; quota.currentQuota = __currentQuota.toUint128(); quota.pendingQuota = newQuota.toUint128(); quota.pendingUntil = effectiveTime.toUint64(); emit QuotaScheduled( address(this), newQuota, quota.pendingUntil ); } // Returns 0 to indiciate unlimited quota function currentQuota(Wallet storage wallet) internal view returns (uint) { return _currentQuota(wallet.quota); } // Returns 0 to indiciate unlimited quota function pendingQuota(Wallet storage wallet) internal view returns ( uint __pendingQuota, uint __pendingUntil ) { return _pendingQuota(wallet.quota); } function spentQuota(Wallet storage wallet) internal view returns (uint) { return _spentQuota(wallet.quota); } function availableQuota(Wallet storage wallet) internal view returns (uint) { return _availableQuota(wallet.quota); } function hasEnoughQuota( Wallet storage wallet, uint requiredAmount ) internal view returns (bool) { return _hasEnoughQuota(wallet.quota, requiredAmount); } // --- Internal functions --- function _currentQuota(Quota memory q) private view returns (uint) { return q.pendingUntil <= block.timestamp ? q.pendingQuota : q.currentQuota; } function _pendingQuota(Quota memory q) private view returns ( uint __pendingQuota, uint __pendingUntil ) { if (q.pendingUntil > 0 && q.pendingUntil > block.timestamp) { __pendingQuota = q.pendingQuota; __pendingUntil = q.pendingUntil; } } function _spentQuota(Quota memory q) private view returns (uint) { uint timeSinceLastSpent = block.timestamp.sub(q.spentTimestamp); if (timeSinceLastSpent < 1 days) { return uint(q.spentAmount).sub(timeSinceLastSpent.mul(q.spentAmount) / 1 days); } else { return 0; } } function _availableQuota(Quota memory q) private view returns (uint) { uint quota = _currentQuota(q); if (quota == 0) { return MAX_QUOTA; } uint spent = _spentQuota(q); return quota > spent ? quota - spent : 0; } function _hasEnoughQuota( Quota memory q, uint requiredAmount ) private view returns (bool) { return _availableQuota(q) >= requiredAmount; } function _addToSpent( Wallet storage wallet, Quota memory q, uint amount ) private { Quota storage s = wallet.quota; s.spentAmount = _spentQuota(q).add(amount).toUint128(); s.spentTimestamp = uint64(block.timestamp); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./ApprovalLib.sol"; import "./WalletData.sol"; import "./GuardianLib.sol"; import "./LockLib.sol"; import "./Utils.sol"; /// @title RecoverLib /// @author Brecht Devos - <[email protected]> library RecoverLib { using GuardianLib for Wallet; using LockLib for Wallet; using ApprovalLib for Wallet; using Utils for address; event Recovered(address newOwner); bytes32 public constant RECOVER_TYPEHASH = keccak256( "recover(address wallet,uint256 validUntil,address newOwner,address[] newGuardians)" ); /// @dev Recover a wallet by setting a new owner and guardians. /// @param approval The approval. /// @param newOwner The new owner address to set. /// @param newGuardians The new guardians addresses to set. function recover( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address newOwner, address[] calldata newGuardians ) external returns (bytes32 approvedHash) { require(wallet.owner != newOwner, "IS_SAME_OWNER"); require(newOwner.isValidWalletOwner(), "INVALID_NEW_WALLET_OWNER"); approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_NOT_ALLOWED, approval, abi.encode( RECOVER_TYPEHASH, approval.wallet, approval.validUntil, newOwner, keccak256(abi.encodePacked(newGuardians)) ) ); wallet.owner = newOwner; wallet.setLock(address(this), false); if (newGuardians.length > 0) { for (uint i = 0; i < newGuardians.length; i++) { require(newGuardians[i] != newOwner, "INVALID_NEW_WALLET_GUARDIAN"); } wallet.removeAllGuardians(); wallet.addGuardiansImmediately(newGuardians); } else { if (wallet.isGuardian(newOwner, true)) { wallet.deleteGuardian(newOwner, block.timestamp, true); } wallet.cancelPendingGuardians(); } emit Recovered(newOwner); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./ApprovalLib.sol"; import "./WalletData.sol"; /// @title UpgradeLib /// @author Brecht Devos - <[email protected]> library UpgradeLib { using ApprovalLib for Wallet; event ChangedMasterCopy (address masterCopy); bytes32 public constant CHANGE_MASTER_COPY_TYPEHASH = keccak256( "changeMasterCopy(address wallet,uint256 validUntil,address masterCopy)" ); function changeMasterCopy( Wallet storage wallet, bytes32 domainSeparator, Approval calldata approval, address newMasterCopy ) external returns (bytes32 approvedHash) { require(newMasterCopy != address(0), "INVALID_MASTER_COPY"); approvedHash = wallet.verifyApproval( domainSeparator, SigRequirement.MAJORITY_OWNER_REQUIRED, approval, abi.encode( CHANGE_MASTER_COPY_TYPEHASH, approval.wallet, approval.validUntil, newMasterCopy ) ); emit ChangedMasterCopy(newMasterCopy); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * _Available since v3.1._ */ interface IERC1155Receiver { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @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)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @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)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); }
// SPDX-License-Identifier: MIT // Taken from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol pragma solidity >=0.6.0 <0.8.0; import "./Address.sol"; import "../lib/ERC20.sol"; import "../lib/MathUint.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using MathUint for uint256; using Address for address; function safeTransfer(ERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(ERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(ERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(ERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(ERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Utility Functions for uint /// @author Daniel Wang - <[email protected]> library MathUint { function mul( uint a, uint b ) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b, "MUL_OVERFLOW"); } function sub( uint a, uint b ) internal pure returns (uint) { require(b <= a, "SUB_UNDERFLOW"); return a - b; } function add( uint a, uint b ) internal pure returns (uint c) { c = a + b; require(c >= a, "ADD_OVERFLOW"); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Utility Functions for addresses /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]> library AddressUtil { using AddressUtil for *; function isContract( address addr ) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(addr) } return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470); } function toPayable( address addr ) internal pure returns (address payable) { return payable(addr); } // Works like address.send but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETH( address to, uint amount, uint gasLimit ) internal returns (bool success) { if (amount == 0) { return true; } address payable recipient = to.toPayable(); /* solium-disable-next-line */ (success,) = recipient.call{value: amount, gas: gasLimit}(""); } // Works like address.transfer but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETHAndVerify( address to, uint amount, uint gasLimit ) internal returns (bool success) { success = to.sendETH(amount, gasLimit); require(success, "TRANSFER_FAILURE"); } // Works like call but is slightly more efficient when data // needs to be copied from memory to do the call. function fastCall( address to, uint gasLimit, uint value, bytes memory data ) internal returns (bool success, bytes memory returnData) { if (to != address(0)) { assembly { // Do the call success := call(gasLimit, to, value, add(data, 32), mload(data), 0, 0) // Copy the return data let size := returndatasize() returnData := mload(0x40) mstore(returnData, size) returndatacopy(add(returnData, 32), 0, size) // Update free memory pointer mstore(0x40, add(returnData, add(32, size))) } } } // Like fastCall, but throws when the call is unsuccessful. function fastCallAndVerify( address to, uint gasLimit, uint value, bytes memory data ) internal returns (bytes memory returnData) { bool success; (success, returnData) = fastCall(to, gasLimit, value, data); if (!success) { assembly { revert(add(returnData, 32), mload(returnData)) } } } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title PriceOracle interface PriceOracle { // @dev Return's the token's value in ETH function tokenValue(address token, uint amount) external view returns (uint value); }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../../lib/EIP712.sol"; import "../../lib/SignatureUtil.sol"; import "./GuardianLib.sol"; import "./WalletData.sol"; /// @title ApprovalLib /// @dev Utility library for better handling of signed wallet requests. /// This library must be deployed and linked to other modules. /// /// @author Daniel Wang - <[email protected]> library ApprovalLib { using SignatureUtil for bytes32; function verifyApproval( Wallet storage wallet, bytes32 domainSeparator, SigRequirement sigRequirement, Approval memory approval, bytes memory encodedRequest ) internal returns (bytes32 approvedHash) { require(address(this) == approval.wallet, "INVALID_WALLET"); require(block.timestamp <= approval.validUntil, "EXPIRED_SIGNED_REQUEST"); approvedHash = EIP712.hashPacked(domainSeparator, keccak256(encodedRequest)); // Save hash to prevent replay attacks require(!wallet.hashes[approvedHash], "HASH_EXIST"); wallet.hashes[approvedHash] = true; require( approvedHash.verifySignatures(approval.signers, approval.signatures), "INVALID_SIGNATURES" ); require( GuardianLib.requireMajority( wallet, approval.signers, sigRequirement ), "PERMISSION_DENIED" ); } }
// SPDX-License-Identifier: MIT // Token from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/90ed1af972299070f51bf4665a85da56ac4d355e/contracts/utils/Address.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 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"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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"); // solhint-disable-next-line avoid-low-level-calls (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"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../thirdparty/BytesUtil.sol"; import "./AddressUtil.sol"; import "./ERC1271.sol"; import "./MathUint.sol"; /// @title SignatureUtil /// @author Daniel Wang - <[email protected]> /// @dev This method supports multihash standard. Each signature's last byte indicates /// the signature's type. library SignatureUtil { using BytesUtil for bytes; using MathUint for uint; using AddressUtil for address; enum SignatureType { ILLEGAL, INVALID, EIP_712, ETH_SIGN, WALLET // deprecated } bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e; function verifySignatures( bytes32 signHash, address[] memory signers, bytes[] memory signatures ) internal view returns (bool) { require(signers.length == signatures.length, "BAD_SIGNATURE_DATA"); address lastSigner; for (uint i = 0; i < signers.length; i++) { require(signers[i] > lastSigner, "INVALID_SIGNERS_ORDER"); lastSigner = signers[i]; if (!verifySignature(signHash, signers[i], signatures[i])) { return false; } } return true; } function verifySignature( bytes32 signHash, address signer, bytes memory signature ) internal view returns (bool) { if (signer == address(0)) { return false; } return signer.isContract()? verifyERC1271Signature(signHash, signer, signature): verifyEOASignature(signHash, signer, signature); } function recoverECDSASigner( bytes32 signHash, bytes memory signature ) internal pure returns (address) { if (signature.length != 65) { return address(0); } bytes32 r; bytes32 s; uint8 v; // we jump 32 (0x20) as the first slot of bytes contains the length // we jump 65 (0x41) per signature // for v we load 32 bytes ending with v (the first 31 come from s) then apply a mask assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := and(mload(add(signature, 0x41)), 0xff) } // See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return address(0); } if (v == 27 || v == 28) { return ecrecover(signHash, v, r, s); } else { return address(0); } } function verifyEOASignature( bytes32 signHash, address signer, bytes memory signature ) private pure returns (bool success) { if (signer == address(0)) { return false; } uint signatureTypeOffset = signature.length.sub(1); SignatureType signatureType = SignatureType(signature.toUint8(signatureTypeOffset)); // Strip off the last byte of the signature by updating the length assembly { mstore(signature, signatureTypeOffset) } if (signatureType == SignatureType.EIP_712) { success = (signer == recoverECDSASigner(signHash, signature)); } else if (signatureType == SignatureType.ETH_SIGN) { bytes32 hash = keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", signHash) ); success = (signer == recoverECDSASigner(hash, signature)); } else { success = false; } // Restore the signature length assembly { mstore(signature, add(signatureTypeOffset, 1)) } return success; } function verifyERC1271Signature( bytes32 signHash, address signer, bytes memory signature ) private view returns (bool) { bytes memory callData = abi.encodeWithSelector( ERC1271.isValidSignature.selector, signHash, signature ); (bool success, bytes memory result) = signer.staticcall(callData); return ( success && result.length == 32 && result.toBytes4(0) == ERC1271_MAGICVALUE ); } }
// SPDX-License-Identifier: UNLICENSED // Taken from https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol pragma solidity ^0.7.0; library BytesUtil { function slice( bytes memory _bytes, uint _start, uint _length ) internal pure returns (bytes memory) { require(_bytes.length >= (_start + _length)); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) { require(_bytes.length >= (_start + 20)); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint _start) internal pure returns (uint8) { require(_bytes.length >= (_start + 1)); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint _start) internal pure returns (uint16) { require(_bytes.length >= (_start + 2)); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint24(bytes memory _bytes, uint _start) internal pure returns (uint24) { require(_bytes.length >= (_start + 3)); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint _start) internal pure returns (uint32) { require(_bytes.length >= (_start + 4)); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint _start) internal pure returns (uint64) { require(_bytes.length >= (_start + 8)); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint _start) internal pure returns (uint96) { require(_bytes.length >= (_start + 12)); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint _start) internal pure returns (uint128) { require(_bytes.length >= (_start + 16)); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint(bytes memory _bytes, uint _start) internal pure returns (uint256) { require(_bytes.length >= (_start + 32)); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes4(bytes memory _bytes, uint _start) internal pure returns (bytes4) { require(_bytes.length >= (_start + 4)); bytes4 tempBytes4; assembly { tempBytes4 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes4; } function toBytes32(bytes memory _bytes, uint _start) internal pure returns (bytes32) { require(_bytes.length >= (_start + 32)); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function fastSHA256( bytes memory data ) internal view returns (bytes32) { bytes32[] memory result = new bytes32[](1); bool success; assembly { let ptr := add(data, 32) success := staticcall(sub(gas(), 2000), 2, ptr, mload(data), add(result, 32), 32) } require(success, "SHA256_FAILED"); return result[0]; } }
// SPDX-License-Identifier: MIT // Taken from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/SafeCast.sol pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value < 2**96, "SafeCast: value doesn\'t fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "SafeCast: value doesn\'t fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./WalletData.sol"; import "../../lib/AddressUtil.sol"; /// @title Utils /// @author Brecht Devos - <[email protected]> library Utils { using AddressUtil for address; function isValidWalletOwner(address addr) view internal returns (bool) { return addr != address(0) && !addr.isContract(); } }
{ "optimizer": { "enabled": true, "runs": 100000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": { "contracts/base/libwallet/ERC1271Lib.sol": { "ERC1271Lib": "0xdc6a946525c4075a0bff457ac2c282cde3b897b3" }, "contracts/base/libwallet/ERC20Lib.sol": { "ERC20Lib": "0x9d7c436db65ad7a02bb03ca727d027bd34789958" }, "contracts/base/libwallet/GuardianLib.sol": { "GuardianLib": "0x68d9686e4b4706c425e91e4cf762c09d7686cde7" }, "contracts/base/libwallet/InheritanceLib.sol": { "InheritanceLib": "0x1bc026940dbf2559c6fceb609915b00937178bf9" }, "contracts/base/libwallet/LockLib.sol": { "LockLib": "0xbf4e84150748ff8eafb3d8008c1272ac6c08f300" }, "contracts/base/libwallet/MetaTxLib.sol": { "MetaTxLib": "0x90e978eaec76291fcda3c727d022c3589d74be43" }, "contracts/base/libwallet/QuotaLib.sol": { "QuotaLib": "0x55542a24968e4933fd56eeb96634c9dbe17b0efa" }, "contracts/base/libwallet/RecoverLib.sol": { "RecoverLib": "0x6ed0788a7bac3c8a551da44e1a747c4415c9842d" }, "contracts/base/libwallet/UpgradeLib.sol": { "UpgradeLib": "0x747240559d31f56bb6b92f7817785a65d24163e6" }, "contracts/base/libwallet/WhitelistLib.sol": { "WhitelistLib": "0x0bb6c344138c785d426435bfc733e7f9b76f28cf" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract PriceOracle","name":"_priceOracle","type":"address"},{"internalType":"address","name":"_blankOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"guardian","type":"address"}],"name":"addGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"guardian","type":"address"}],"name":"addGuardianWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"addToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"addr","type":"address"}],"name":"addToWhitelistWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"forceUseQuota","type":"bool"}],"name":"approveThenCallContract","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"approveThenCallContractWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"forceUseQuota","type":"bool"}],"name":"approveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveTokenWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blankOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"forceUseQuota","type":"bool"}],"name":"callContract","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callContractWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newQuota","type":"uint256"}],"name":"changeDailyQuota","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"uint256","name":"newQuota","type":"uint256"}],"name":"changeDailyQuotaWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"newMasterCopy","type":"address"}],"name":"changeMasterCopy","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"gasToken","type":"address"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"bool","name":"requiresSuccess","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"executeMetaTx","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCreationTimestamp","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"includePendingAddition","type":"bool"}],"name":"getGuardians","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint8","name":"status","type":"uint8"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"internalType":"struct Guardian[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMasterCopy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getWhitelistEffectiveTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"inherit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address[]","name":"guardians","type":"address[]"},{"internalType":"uint256","name":"quota","type":"uint256"},{"internalType":"address","name":"inheritor","type":"address"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"address","name":"feeToken","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"includePendingAddition","type":"bool"}],"name":"isGuardian","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"signHash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock","outputs":[],"stateMutability":"nonpayable","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":"pure","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":"pure","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":"pure","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"contract PriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"address[]","name":"newGuardians","type":"address[]"}],"name":"recover","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"removeFromWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"guardian","type":"address"}],"name":"removeGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"guardian","type":"address"}],"name":"removeGuardianWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"newGuardians","type":"address[]"}],"name":"resetGuardians","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address[]","name":"newGuardians","type":"address[]"}],"name":"resetGuardiansWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"selfBatchCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inheritor","type":"address"},{"internalType":"uint32","name":"waitingPeriod","type":"uint32"}],"name":"setInheritor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"logdata","type":"bytes"},{"internalType":"bool","name":"forceUseQuota","type":"bool"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"logdata","type":"bytes"}],"name":"transferTokenWA","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"internalType":"struct Approval","name":"approval","type":"tuple"}],"name":"unlock","outputs":[{"internalType":"bytes32","name":"approvedHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wallet","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint64","name":"creationTimestamp","type":"uint64"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"address","name":"inheritor","type":"address"},{"internalType":"uint32","name":"inheritWaitingPeriod","type":"uint32"},{"internalType":"uint64","name":"lastActive","type":"uint64"},{"components":[{"internalType":"uint128","name":"currentQuota","type":"uint128"},{"internalType":"uint128","name":"pendingQuota","type":"uint128"},{"internalType":"uint128","name":"spentAmount","type":"uint128"},{"internalType":"uint64","name":"spentTimestamp","type":"uint64"},{"internalType":"uint64","name":"pendingUntil","type":"uint64"}],"internalType":"struct Quota","name":"quota","type":"tuple"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162004dae38038062004dae83398101604081905262000034916200014e565b6000805460ff60a01b1916600160a01b1790556040805160a081018252600e606082019081526d131bdbdc1c9a5b99d5d85b1b195d60921b608083015281528151808301835260058152640322e302e360dc1b602082810191909152808301919091523092820192909252620000b39162002a26620000d5821b17901c565b6080526001600160601b0319606092831b811660a052911b1660c052620001d1565b6000804690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f836000015180519060200120846020015180519060200120838660400151604051602001620001309594939291906200018c565b60405160208183030381529060405280519060200120915050919050565b6000806040838503121562000161578182fd5b82516200016e81620001b8565b60208401519092506200018181620001b8565b809150509250929050565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6001600160a01b0381168114620001ce57600080fd5b50565b60805160a05160601c60c05160601c614b46620002686000398061208052806127575280612784525080610d745280610fc552806111875280611a3e5280611e6052806129ca5250806109a55280610d525280610f4752806110355280611286528061134052806113bd52806115e052806118d4528061194e5280611c065280611d765280611f9d528061259d5250614b466000f3fe6080604052600436106102f55760003560e01c80638fbbddc41161018f578063c274298f116100e1578063e9f8db041161008a578063f2fde38b11610064578063f2fde38b1461087c578063f83d08ba1461089c578063ff06ff56146108b1576102fc565b8063e9f8db041461081c578063f1b43ae41461083c578063f23a6e611461085c576102fc565b8063e43252d7116100bb578063e43252d7146107bc578063e4c3d6b2146107dc578063e913d278146107fc576102fc565b8063c274298f14610765578063c948bb8a14610787578063d6bb65c21461079c576102fc565b8063ab0b90f811610143578063ba324ac61161011d578063ba324ac614610705578063bb64cabe14610725578063bc197c8114610745576102fc565b8063ab0b90f8146106a5578063b6aa057e146106c5578063b9806d99146106e5576102fc565b8063a1d7876f11610174578063a1d7876f14610645578063a526d83b14610665578063a79c930c14610685576102fc565b80638fbbddc4146106055780639a792d4614610625576102fc565b80632e9feb7911610248578063521eb273116101fc578063893d20e8116101d6578063893d20e8146105b05780638ab1d681146105c55780638f22edf3146105e5576102fc565b8063521eb2731461054757806371404156146105705780637be5fdc314610590576102fc565b80633644e5151161022d5780633644e515146104f25780633af32abf1461050757806351953ea614610527576102fc565b80632e9feb791461049757806331ea76b1146104c4576102fc565b806309779927116102aa57806324db3d021161028457806324db3d02146104425780632630c12f1461046257806326e1c97814610477576102fc565b806309779927146103d5578063150b7a02146103f55780631626ba7e14610422576102fc565b806301ffc9a7116102db57806301ffc9a7146103595780630206b4401461038657806304e80e90146103b3576102fc565b8062cbe5631461030157806301a44c2514610323576102fc565b366102fc57005b600080fd5b34801561030d57600080fd5b5061032161031c366004613162565b6108d1565b005b34801561032f57600080fd5b5061034361033e366004613c42565b610957565b60405161035091906140f1565b60405180910390f35b34801561036557600080fd5b506103796103743660046138bb565b610a2b565b60405161035091906140e6565b34801561039257600080fd5b506103a66103a13660046137eb565b610b5e565b6040516103509190614077565b3480156103bf57600080fd5b506103c8610c26565b6040516103509190613f37565b3480156103e157600080fd5b506103796103f0366004613534565b610c42565b34801561040157600080fd5b506104156104103660046132fd565b610dff565b604051610350919061414c565b34801561042e57600080fd5b5061041561043d36600461383b565b610e28565b34801561044e57600080fd5b5061034361045d366004613959565b610ef9565b34801561046e57600080fd5b506103c8610fc3565b34801561048357600080fd5b5061034361049236600461399e565b610fe7565b3480156104a357600080fd5b506104b76104b236600461360b565b6110be565b6040516103509190614179565b3480156104d057600080fd5b506104e46104df366004613aa0565b611235565b604051610350929190614133565b3480156104fe57600080fd5b5061034361133e565b34801561051357600080fd5b50610379610522366004613162565b611362565b34801561053357600080fd5b50610343610542366004613ca8565b61136f565b34801561055357600080fd5b5061055c6113e9565b604051610350989796959493929190613fc1565b34801561057c57600080fd5b5061032161058b366004613162565b6114cc565b34801561059c57600080fd5b506103436105ab366004613959565b611592565b3480156105bc57600080fd5b506103c86116a8565b3480156105d157600080fd5b506103216105e0366004613162565b6116c4565b3480156105f157600080fd5b506103216106003660046136b2565b61178a565b34801561061157600080fd5b50610343610620366004613959565b611886565b34801561063157600080fd5b50610343610640366004613b44565b611900565b34801561065157600080fd5b506104b7610660366004613367565b61197e565b34801561067157600080fd5b50610321610680366004613162565b611af2565b34801561069157600080fd5b506103436106a0366004613926565b611bb8565b3480156106b157600080fd5b506103796106c03660046134fc565b611c80565b3480156106d157600080fd5b506103436106e0366004613959565b611d28565b3480156106f157600080fd5b5061032161070036600461327a565b611da2565b34801561071157600080fd5b5061032161072036600461367d565b611ecc565b34801561073157600080fd5b50610343610740366004613a06565b611f4f565b34801561075157600080fd5b5061041561076036600461317e565b61202c565b34801561077157600080fd5b5061077a612056565b604051610350919061493c565b34801561079357600080fd5b506103c861207e565b3480156107a857600080fd5b506103216107b736600461345c565b6120a2565b3480156107c857600080fd5b506103216107d7366004613162565b612396565b3480156107e857600080fd5b506103216107f73660046136b2565b61245c565b34801561080857600080fd5b50610343610817366004613162565b612524565b34801561082857600080fd5b506104e4610837366004613bbc565b61254c565b34801561084857600080fd5b50610321610857366004613ceb565b61264f565b34801561086857600080fd5b506104156108773660046133f5565b612715565b34801561088857600080fd5b50610321610897366004613162565b61273f565b3480156108a857600080fd5b50610321612889565b3480156108bd57600080fd5b506103216108cc366004613228565b61290c565b6040517f898fa939000000000000000000000000000000000000000000000000000000008152731bc026940dbf2559c6fceb609915b00937178bf99063898fa93990610924906001908590600401614322565b60006040518083038186803b15801561093c57600080fd5b505af4158015610950573d6000803e3d6000fd5b5050505050565b6040517f3140f8cf0000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde790633140f8cf906109d3906001907f000000000000000000000000000000000000000000000000000000000000000090899089908990600401614702565b60206040518083038186803b1580156109eb57600080fd5b505af41580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613823565b949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f1626ba7e000000000000000000000000000000000000000000000000000000001480610abe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000145b80610b0a57507fffffffff0000000000000000000000000000000000000000000000000000000082167f150b7a0200000000000000000000000000000000000000000000000000000000145b80610b5657507fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e000000000000000000000000000000000000000000000000000000000145b90505b919050565b6040517f18d9ad710000000000000000000000000000000000000000000000000000000081526060907368d9686e4b4706c425e91e4cf762c09d7686cde7906318d9ad7190610bb490600190869060040161492c565b60006040518083038186803b158015610bcc57600080fd5b505af4158015610be0573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610b5691908101906136f2565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000806040518061014001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d81526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018a81526020018981526020018873ffffffffffffffffffffffffffffffffffffffff168152602001871515815260200186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020018490526040517f531020c20000000000000000000000000000000000000000000000000000000081529091507390e978eaec76291fcda3c727d022c3589d74be439063531020c290610d9e906001907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009087906004016143a8565b60206040518083038186803b158015610db657600080fd5b505af4158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee9190613807565b9d9c50505050505050505050505050565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517f7d631ea100000000000000000000000000000000000000000000000000000000815260009073dc6a946525c4075a0bff457ac2c282cde3b897b390637d631ea190610ea2906001907f1626ba7e000000000000000000000000000000000000000000000000000000009088908890600401614764565b60206040518083038186803b158015610eba57600080fd5b505af4158015610ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef291906138d7565b9392505050565b6040517f912fce540000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde79063912fce5490610f73906001907f000000000000000000000000000000000000000000000000000000000000000090889088906004016144cb565b60206040518083038186803b158015610f8b57600080fd5b505af4158015610f9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190613823565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fe2e24927000000000000000000000000000000000000000000000000000000008152600090739d7c436db65ad7a02bb03ca727d027bd347899589063e2e2492790611065906001907f0000000000000000000000000000000000000000000000000000000000000000908a908a908a908a90600401614511565b60206040518083038186803b15801561107d57600080fd5b505af4158015611091573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b59190613823565b95945050505050565b6060333014806110f3575060015473ffffffffffffffffffffffffffffffffffffffff16331480156110f3575060045460ff16155b611132576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b60405180910390fd5b61113c6001612a9d565b6040517ffc55b679000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd347899589063fc55b679906111b9906001907f0000000000000000000000000000000000000000000000000000000000000000908b908b908b908b908b906004016148c2565b60006040518083038186803b1580156111d157600080fd5b505af41580156111e5573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261122b91908101906138f3565b9695505050505050565b6040517fd77c3b5d000000000000000000000000000000000000000000000000000000008152600090606090739d7c436db65ad7a02bb03ca727d027bd347899589063d77c3b5d906112bc906001907f0000000000000000000000000000000000000000000000000000000000000000908e908e908e908e908e908e908e906004016145ce565b60006040518083038186803b1580156112d457600080fd5b505af41580156112e8573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261132e9190810190613880565b909a909950975050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000610b56600183612b47565b6040517f2d5d461a0000000000000000000000000000000000000000000000000000000081526000907355542a24968e4933fd56eeb96634c9dbe17b0efa90632d5d461a90610f73906001907f00000000000000000000000000000000000000000000000000000000000000009088908890600401614734565b6001546002546004546007546040805160a0810182526008546fffffffffffffffffffffffffffffffff808216835270010000000000000000000000000000000091829004811660208401526009549081169383019390935267ffffffffffffffff908304811660608301527801000000000000000000000000000000000000000000000000928390048116608083015273ffffffffffffffffffffffffffffffffffffffff8088169774010000000000000000000000000000000000000000908190048316979660ff16959182169490820463ffffffff169391049091169088565b333014806114ff575060015473ffffffffffffffffffffffffffffffffffffffff16331480156114ff575060045460ff16155b611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b61153f6001612a9d565b6040517fee3da3e30000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde79063ee3da3e390610924906001908590600401614322565b6040517fec08e14400000000000000000000000000000000000000000000000000000000815260009073747240559d31f56bb6b92f7817785a65d24163e69063ec08e1449061160c906001907f000000000000000000000000000000000000000000000000000000000000000090889088906004016144cb565b60206040518083038186803b15801561162457600080fd5b505af4158015611638573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165c9190613823565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff949094169390931790925550919050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b333014806116f7575060015473ffffffffffffffffffffffffffffffffffffffff16331480156116f7575060045460ff16155b61172d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6117376001612a9d565b6040517f9509eea5000000000000000000000000000000000000000000000000000000008152730bb6c344138c785d426435bfc733e7f9b76f28cf90639509eea590610924906001908590600401614322565b333014806117bd575060015473ffffffffffffffffffffffffffffffffffffffff16331480156117bd575060045460ff16155b6117f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6117fd6001612a9d565b6040517f28c809350000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde7906328c80935906118529060019086908690600401614374565b60006040518083038186803b15801561186a57600080fd5b505af415801561187e573d6000803e3d6000fd5b505050505050565b6040517f1b8b0ce9000000000000000000000000000000000000000000000000000000008152600090730bb6c344138c785d426435bfc733e7f9b76f28cf90631b8b0ce990610f73906001907f000000000000000000000000000000000000000000000000000000000000000090889088906004016144cb565b6040517fc089037e000000000000000000000000000000000000000000000000000000008152600090736ed0788a7bac3c8a551da44e1a747c4415c9842d9063c089037e90611065906001907f0000000000000000000000000000000000000000000000000000000000000000908a908a908a908a90600401614645565b6060333014806119b3575060015473ffffffffffffffffffffffffffffffffffffffff16331480156119b3575060045460ff16155b6119e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6119f36001612a9d565b6040517f2b84eece000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd3478995890632b84eece90611a74906001907f0000000000000000000000000000000000000000000000000000000000000000908d908d908d908d908d908d908d90600401614854565b60006040518083038186803b158015611a8c57600080fd5b505af4158015611aa0573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611ae691908101906138f3565b98975050505050505050565b33301480611b25575060015473ffffffffffffffffffffffffffffffffffffffff1633148015611b25575060045460ff16155b611b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b611b656001612a9d565b6040517fb9d8df140000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde79063b9d8df1490610924906001908590600401614322565b6040517ffbcfc53c00000000000000000000000000000000000000000000000000000000815260009073bf4e84150748ff8eafb3d8008c1272ac6c08f3009063fbcfc53c90611c30906001907f00000000000000000000000000000000000000000000000000000000000000009087906004016144ac565b60206040518083038186803b158015611c4857600080fd5b505af4158015611c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b569190613823565b6040517fa643b1070000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde79063a643b10790611cd89060019087908790600401614346565b60206040518083038186803b158015611cf057600080fd5b505af4158015611d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190613807565b6040517f9668d94c0000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde790639668d94c90610f73906001907f000000000000000000000000000000000000000000000000000000000000000090889088906004016144cb565b33301480611dd5575060015473ffffffffffffffffffffffffffffffffffffffff1633148015611dd5575060045460ff16155b611e0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b611e156001612a9d565b6040517fc5354f8b000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd347899589063c5354f8b90611e94906001907f0000000000000000000000000000000000000000000000000000000000000000908b908b908b908b908b908b906004016147ef565b60006040518083038186803b158015611eac57600080fd5b505af4158015611ec0573d6000803e3d6000fd5b50505050505050505050565b33301480611eff575060015473ffffffffffffffffffffffffffffffffffffffff1633148015611eff575060045460ff16155b611f35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b611f3f6001612a9d565b611f4b60018383612b83565b5050565b6040517faed40479000000000000000000000000000000000000000000000000000000008152600090739d7c436db65ad7a02bb03ca727d027bd347899589063aed4047990611fd1906001907f0000000000000000000000000000000000000000000000000000000000000000908c908c908c908c908c908c90600401614562565b60206040518083038186803b158015611fe957600080fd5b505af4158015611ffd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120219190613823565b979650505050505050565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b60015474010000000000000000000000000000000000000000900467ffffffffffffffff1690565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005474010000000000000000000000000000000000000000900460ff16156120f7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906141c3565b60015473ffffffffffffffffffffffffffffffffffffffff1615612147576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111299061418c565b73ffffffffffffffffffffffffffffffffffffffff8816612194576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906142b4565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a16177fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000004267ffffffffffffffff16021781556040517fb4f212fa0000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde79163b4f212fa9161226c91908b908b90600401614374565b60006040518083038186803b15801561228457600080fd5b505af4158015612298573d6000803e3d6000fd5b50505050846000146122b1576122b16001866000612c57565b73ffffffffffffffffffffffffffffffffffffffff8416156122dd576122dd6001856301e13380612b83565b73ffffffffffffffffffffffffffffffffffffffff8316158015906123025750600081115b1561238c576040517fbeabacc8000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd347899589063beabacc89061235b90859087908690600401613f58565b60006040518083038186803b15801561237357600080fd5b505af4158015612387573d6000803e3d6000fd5b505050505b5050505050505050565b333014806123c9575060015473ffffffffffffffffffffffffffffffffffffffff16331480156123c9575060045460ff16155b6123ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6124096001612a9d565b6040517ff42a9d41000000000000000000000000000000000000000000000000000000008152730bb6c344138c785d426435bfc733e7f9b76f28cf9063f42a9d4190610924906001908590600401614322565b3330148061248f575060015473ffffffffffffffffffffffffffffffffffffffff163314801561248f575060045460ff16155b6124c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6124cf6001612a9d565b6040517f8b8365960000000000000000000000000000000000000000000000000000000081527390e978eaec76291fcda3c727d022c3589d74be4390638b83659690611852906001908690869060040161438e565b73ffffffffffffffffffffffffffffffffffffffff166000908152600a602052604090205490565b6040517ff9fa74e6000000000000000000000000000000000000000000000000000000008152600090606090739d7c436db65ad7a02bb03ca727d027bd347899589063f9fa74e6906125cf906001907f0000000000000000000000000000000000000000000000000000000000000000908c908c908c908c908c906004016146a0565b60006040518083038186803b1580156125e757600080fd5b505af41580156125fb573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526126419190810190613880565b909890975095505050505050565b33301480612682575060015473ffffffffffffffffffffffffffffffffffffffff1633148015612682575060045460ff16155b6126b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6126c26001612a9d565b6040517fe522f1680000000000000000000000000000000000000000000000000000000081527355542a24968e4933fd56eeb96634c9dbe17b0efa9063e522f1689061092490600190859060040161491e565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161480156127bf57506001547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff9081169116145b6127f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111299061427d565b73ffffffffffffffffffffffffffffffffffffffff8116612842576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906142b4565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6040517f686d7c3700000000000000000000000000000000000000000000000000000000815273bf4e84150748ff8eafb3d8008c1272ac6c08f3009063686d7c37906128da906001906004016140f1565b60006040518083038186803b1580156128f257600080fd5b505af4158015612906573d6000803e3d6000fd5b50505050565b3330148061293f575060015473ffffffffffffffffffffffffffffffffffffffff163314801561293f575060045460ff16155b612975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b61297f6001612a9d565b6040517f3b39d10d000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd3478995890633b39d10d906129fa906001907f00000000000000000000000000000000000000000000000000000000000000009089908990899089906004016147ab565b60006040518083038186803b158015612a1257600080fd5b505af415801561238c573d6000803e3d6000fd5b6000804690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f836000015180519060200120846020015180519060200120838660400151604051602001612a7f9594939291906140fa565b60405160208183030381529060405280519060200120915050919050565b600681015473ffffffffffffffffffffffffffffffffffffffff1615801590612af55750600681015467ffffffffffffffff78010000000000000000000000000000000000000000000000009091041662278d000142115b15612b445760068101805477ffffffffffffffffffffffffffffffffffffffffffffffff1678010000000000000000000000000000000000000000000000004267ffffffffffffffff16021790555b50565b73ffffffffffffffffffffffffffffffffffffffff811660009081526009830160205260408120548015801590610a2357504210159392505050565b6006909201805467ffffffffffffffff421678010000000000000000000000000000000000000000000000000277ffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff90951674010000000000000000000000000000000000000000027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff9095167fffffffffffffffffffffffff000000000000000000000000000000000000000090931692909217939093161792909216179055565b6fffffffffffffffffffffffffffffffff821115612ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906142eb565b6fffffffffffffffffffffffffffffffff821415612cbe57600091505b6000612cc984612e0d565b9050828110158015612cda57508215155b80612ce3575080155b15612ced57600091505b60078401612cfa82612ea2565b81547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff91909116178155612d3f84612ea2565b81546fffffffffffffffffffffffffffffffff918216700100000000000000000000000000000000029116178155612d7683612f11565b60018201805477ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000067ffffffffffffffff938416810291909117918290556040517ff4109b774ae6f56e72fe6cb9396e75bc9017595ac0797f852334dbd0db2fa5b693612dfe9330938a93910490911690613f89565b60405180910390a15050505050565b6040805160a08101825260078301546fffffffffffffffffffffffffffffffff8082168352700100000000000000000000000000000000918290048116602084015260088501549081169383019390935267ffffffffffffffff9083048116606083015278010000000000000000000000000000000000000000000000009092049091166080820152600090610b5690612f74565b60007001000000000000000000000000000000008210612f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614ac46027913960400191505060405180910390fd5b5090565b6000680100000000000000008210612f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614aeb6026913960400191505060405180910390fd5b600042826080015167ffffffffffffffff161115612f93578151612f99565b81602001515b6fffffffffffffffffffffffffffffffff1692915050565b8035610b5981614a65565b60008083601f840112612fcd578182fd5b50813567ffffffffffffffff811115612fe4578182fd5b6020830191508360208083028501011115612ffe57600080fd5b9250929050565b600082601f830112613015578081fd5b8135602061302a61302583614975565b614951565b8281528181019085830183850287018401881015613046578586fd5b855b8581101561306457813584529284019290840190600101613048565b5090979650505050505050565b8035610b5981614a87565b60008083601f84011261308d578182fd5b50813567ffffffffffffffff8111156130a4578182fd5b602083019150836020828501011115612ffe57600080fd5b600082601f8301126130cc578081fd5b81356130da61302582614993565b8181528460208386010111156130ee578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613118578081fd5b815161312661302582614993565b81815284602083860101111561313a578283fd5b610a23826020830160208701614a39565b60006080828403121561315c578081fd5b50919050565b600060208284031215613173578081fd5b8135610ef281614a65565b600080600080600060a08688031215613195578081fd5b85356131a081614a65565b945060208601356131b081614a65565b9350604086013567ffffffffffffffff808211156131cc578283fd5b6131d889838a01613005565b945060608801359150808211156131ed578283fd5b6131f989838a01613005565b9350608088013591508082111561320e578283fd5b5061321b888289016130bc565b9150509295509295909350565b6000806000806080858703121561323d578182fd5b843561324881614a65565b9350602085013561325881614a65565b925060408501359150606085013561326f81614a87565b939692955090935050565b60008060008060008060a08789031215613292578384fd5b863561329d81614a65565b955060208701356132ad81614a65565b945060408701359350606087013567ffffffffffffffff8111156132cf578182fd5b6132db89828a0161307c565b90945092505060808701356132ef81614a87565b809150509295509295509295565b60008060008060808587031215613312578182fd5b843561331d81614a65565b9350602085013561332d81614a65565b925060408501359150606085013567ffffffffffffffff81111561334f578182fd5b61335b878288016130bc565b91505092959194509250565b600080600080600080600060c0888a031215613381578485fd5b873561338c81614a65565b9650602088013561339c81614a65565b95506040880135945060608801359350608088013567ffffffffffffffff8111156133c5578182fd5b6133d18a828b0161307c565b90945092505060a08801356133e581614a87565b8091505092959891949750929550565b600080600080600060a0868803121561340c578283fd5b853561341781614a65565b9450602086013561342781614a65565b93506040860135925060608601359150608086013567ffffffffffffffff811115613450578182fd5b61321b888289016130bc565b60008060008060008060008060e0898b031215613477578182fd5b883561348281614a65565b9750602089013567ffffffffffffffff81111561349d578283fd5b6134a98b828c01612fbc565b9098509650506040890135945060608901356134c481614a65565b935060808901356134d481614a65565b925060a08901356134e481614a65565b8092505060c089013590509295985092959890939650565b6000806040838503121561350e578182fd5b823561351981614a65565b9150602083013561352981614a87565b809150509250929050565b60008060008060008060008060008060006101408c8e031215613555578485fd5b61355e8c612fb1565b9a5060208c0135995061357360408d01612fb1565b985060608c0135975060808c0135965060a08c0135955061359660c08d01612fb1565b94506135a460e08d01613071565b935067ffffffffffffffff806101008e013511156135c0578384fd5b6135d18e6101008f01358f0161307c565b90945092506101208d01358110156135e7578182fd5b506135f98d6101208e01358e016130bc565b90509295989b509295989b9093969950565b600080600080600060808688031215613622578283fd5b853561362d81614a65565b945060208601359350604086013567ffffffffffffffff81111561364f578384fd5b61365b8882890161307c565b909450925050606086013561366f81614a87565b809150509295509295909350565b6000806040838503121561368f578182fd5b823561369a81614a65565b9150602083013563ffffffff81168114613529578182fd5b600080602083850312156136c4578182fd5b823567ffffffffffffffff8111156136da578283fd5b6136e685828601612fbc565b90969095509350505050565b60006020808385031215613704578182fd5b825167ffffffffffffffff8082111561371b578384fd5b818501915085601f83011261372e578384fd5b815161373c61302582614975565b818152848101908486016060808502870188018b101561375a578889fd5b8896505b848710156137dc5780828c031215613774578889fd5b60408051828101818110898211171561378957fe5b8252835161379681614a65565b8152838a015160ff811681146137aa578b8cfd5b818b01528382015188811681146137bf578b8cfd5b91810191909152845260019690960195928701929081019061375e565b50909998505050505050505050565b6000602082840312156137fc578081fd5b8135610ef281614a87565b600060208284031215613818578081fd5b8151610ef281614a87565b600060208284031215613834578081fd5b5051919050565b6000806040838503121561384d578182fd5b82359150602083013567ffffffffffffffff81111561386a578182fd5b613876858286016130bc565b9150509250929050565b60008060408385031215613892578182fd5b82519150602083015167ffffffffffffffff8111156138af578182fd5b61387685828601613108565b6000602082840312156138cc578081fd5b8135610ef281614a95565b6000602082840312156138e8578081fd5b8151610ef281614a95565b600060208284031215613904578081fd5b815167ffffffffffffffff81111561391a578182fd5b610a2384828501613108565b600060208284031215613937578081fd5b813567ffffffffffffffff81111561394d578182fd5b610a238482850161314b565b6000806040838503121561396b578182fd5b823567ffffffffffffffff811115613981578283fd5b61398d8582860161314b565b925050602083013561352981614a65565b600080600080608085870312156139b3578182fd5b843567ffffffffffffffff8111156139c9578283fd5b6139d58782880161314b565b94505060208501356139e681614a65565b925060408501356139f681614a65565b9396929550929360600135925050565b60008060008060008060a08789031215613a1e578384fd5b863567ffffffffffffffff80821115613a35578586fd5b613a418a838b0161314b565b975060208901359150613a5382614a65565b909550604088013590613a6582614a65565b9094506060880135935060808801359080821115613a81578384fd5b50613a8e89828a0161307c565b979a9699509497509295939492505050565b600080600080600080600060c0888a031215613aba578081fd5b873567ffffffffffffffff80821115613ad1578283fd5b613add8b838c0161314b565b985060208a01359150613aef82614a65565b909650604089013590613b0182614a65565b909550606089013594506080890135935060a08901359080821115613b24578283fd5b50613b318a828b0161307c565b989b979a50959850939692959293505050565b60008060008060608587031215613b59578182fd5b843567ffffffffffffffff80821115613b70578384fd5b613b7c8883890161314b565b955060208701359150613b8e82614a65565b90935060408601359080821115613ba3578384fd5b50613bb087828801612fbc565b95989497509550505050565b600080600080600060808688031215613bd3578283fd5b853567ffffffffffffffff80821115613bea578485fd5b613bf689838a0161314b565b965060208801359150613c0882614a65565b9094506040870135935060608701359080821115613c24578283fd5b50613c318882890161307c565b969995985093965092949392505050565b600080600060408486031215613c56578081fd5b833567ffffffffffffffff80821115613c6d578283fd5b613c798783880161314b565b94506020860135915080821115613c8e578283fd5b50613c9b86828701612fbc565b9497909650939450505050565b60008060408385031215613cba578182fd5b823567ffffffffffffffff811115613cd0578283fd5b613cdc8582860161314b565b95602094909401359450505050565b600060208284031215613cfc578081fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff169052565b60008284526020808501945082825b85811015613d67578135613d3f81614a65565b73ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613d2c565b509495945050505050565b818352602080840193600091908185020181018584845b87811015613e0e57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112613dc7578687fd5b8701803567ffffffffffffffff811115613ddf578788fd5b803603891315613ded578788fd5b613dfa8682898501613e21565b9a87019a9550505090840190600101613d89565b5091979650505050505050565b15159052565b600082845282826020860137806020848601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011685010190509392505050565b60008151808452613e81816020860160208601614a39565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000613ebf82836149d3565b60808552613ed1608086018284613d1d565b915050613ee160208401846149d3565b8583036020870152613ef4838284613d72565b92505050604083013560408501526060830135613f1081614a65565b73ffffffffffffffffffffffffffffffffffffffff81166060860152508091505092915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff939093168352602083019190915267ffffffffffffffff16604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff988916815267ffffffffffffffff978816602080830191909152604080830198909852951515606080830191909152949098166080808a019190915263ffffffff9390931660a089015290861660c088015280516fffffffffffffffffffffffffffffffff90811660e08901529381015184166101008801529384015190921661012086015282015183166101408501520151166101608201526101800190565b602080825282518282018190526000919060409081850190868401855b82811015613e0e578151805173ffffffffffffffffffffffffffffffffffffffff1685528681015160ff168786015285015167ffffffffffffffff168585015260609093019290850190600101614094565b901515815260200190565b90815260200190565b94855260208501939093526040840191909152606083015273ffffffffffffffffffffffffffffffffffffffff16608082015260a00190565b600083825260406020830152610a236040830184613e69565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b600060208252610ef26020830184613e69565b60208082526013908201527f494e495449414c495a45445f414c524541445900000000000000000000000000604082015260600190565b60208082526025908201527f444953414c4c4f5745445f4f4e5f494d504c454d454e544154494f4e5f434f4e60408201527f5452414354000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f4e4f545f46524f4d5f57414c4c45545f4f525f4f574e45525f4f525f57414c4c60408201527f45545f4c4f434b45440000000000000000000000000000000000000000000000606082015260800190565b60208082526018908201527f4e4f545f414c4c4f5745445f544f5f5345545f4f574e45520000000000000000604082015260600190565b6020808252600d908201527f494e56414c49445f4f574e455200000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f494e56414c49445f56414c554500000000000000000000000000000000000000604082015260600190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b92835273ffffffffffffffffffffffffffffffffffffffff9190911660208301521515604082015260600190565b6000848252604060208301526110b5604083018486613d1d565b6000848252604060208301526110b5604083018486613d72565b600085825284602083015273ffffffffffffffffffffffffffffffffffffffff84166040830152608060608301526143e4608083018451613d03565b602083015160a0830152604083015161440060c0840182613d03565b50606083015160e08301526080830151610100818185015260a08501519150610120828186015260c0860151925061014061443d81870185613d03565b60e08701519350614452610160870185613e1b565b828701519350806101808701525061446e6101c0860184613e69565b9250808601519150507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80848303016101a0850152611ae68282613e69565b6000848252836020830152606060408301526110b56060830184613eb3565b6000858252846020830152608060408301526144ea6080830185613eb3565b905073ffffffffffffffffffffffffffffffffffffffff8316606083015295945050505050565b600087825286602083015260c0604083015261453060c0830187613eb3565b73ffffffffffffffffffffffffffffffffffffffff958616606084015293909416608082015260a00152949350505050565b600089825288602083015260e0604083015261458160e0830189613eb3565b73ffffffffffffffffffffffffffffffffffffffff88811660608501528716608084015260a0830186905282810360c08401526145bf818587613e21565b9b9a5050505050505050505050565b60006101008b83528a60208401528060408401526145ee8184018b613eb3565b905073ffffffffffffffffffffffffffffffffffffffff808a1660608501528089166080850152508660a08401528560c084015282810360e0840152614635818587613e21565b9c9b505050505050505050505050565b600087825286602083015260a0604083015261466460a0830187613eb3565b73ffffffffffffffffffffffffffffffffffffffff861660608401528281036080840152614693818587613d1d565b9998505050505050505050565b600088825287602083015260c060408301526146bf60c0830188613eb3565b73ffffffffffffffffffffffffffffffffffffffff8716606084015285608084015282810360a08401526146f4818587613e21565b9a9950505050505050505050565b6000868252856020830152608060408301526147216080830186613eb3565b8281036060840152611ae6818587613d1d565b6000858252846020830152608060408301526147536080830185613eb3565b905082606083015295945050505050565b60008582527fffffffff00000000000000000000000000000000000000000000000000000000851660208301528360408301526080606083015261122b6080830184613e69565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529284166040860152921660608401526080830191909152151560a082015260c00190565b600089825273ffffffffffffffffffffffffffffffffffffffff808a166020840152808916604084015280881660608401525085608083015260e060a083015261483d60e083018587613e21565b905082151560c08301529998505050505050505050565b60006101008b835273ffffffffffffffffffffffffffffffffffffffff808c166020850152808b166040850152808a166060850152508760808401528660a08401528060c08401526148a98184018688613e21565b91505082151560e08301529a9950505050505050505050565b600088825273ffffffffffffffffffffffffffffffffffffffff808916602084015280881660408401525085606083015260c0608083015261490860c083018587613e21565b905082151560a083015298975050505050505050565b918252602082015260400190565b9182521515602082015260400190565b67ffffffffffffffff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561496d57fe5b604052919050565b600067ffffffffffffffff82111561498957fe5b5060209081020190565b600067ffffffffffffffff8211156149a757fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614a07578283fd5b830160208101925035905067ffffffffffffffff811115614a2757600080fd5b602081023603831315612ffe57600080fd5b60005b83811015614a54578181015183820152602001614a3c565b838111156129065750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612b4457600080fd5b8015158114612b4457600080fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114612b4457600080fdfe53616665436173743a2076616c756520646f65736e27742066697420696e20313238206269747353616665436173743a2076616c756520646f65736e27742066697420696e2036342062697473a2646970667358221220547821518258cd22f401eb04b10d89acc4bbf422d797acbd86f7420dac05481464736f6c63430007060033000000000000000000000000b124190942976431d8181fbe183e44584253da68000000000000000000000000b7390a217cee03545b5e2b33c6f6ce6012d9b9bd
Deployed Bytecode
0x6080604052600436106102f55760003560e01c80638fbbddc41161018f578063c274298f116100e1578063e9f8db041161008a578063f2fde38b11610064578063f2fde38b1461087c578063f83d08ba1461089c578063ff06ff56146108b1576102fc565b8063e9f8db041461081c578063f1b43ae41461083c578063f23a6e611461085c576102fc565b8063e43252d7116100bb578063e43252d7146107bc578063e4c3d6b2146107dc578063e913d278146107fc576102fc565b8063c274298f14610765578063c948bb8a14610787578063d6bb65c21461079c576102fc565b8063ab0b90f811610143578063ba324ac61161011d578063ba324ac614610705578063bb64cabe14610725578063bc197c8114610745576102fc565b8063ab0b90f8146106a5578063b6aa057e146106c5578063b9806d99146106e5576102fc565b8063a1d7876f11610174578063a1d7876f14610645578063a526d83b14610665578063a79c930c14610685576102fc565b80638fbbddc4146106055780639a792d4614610625576102fc565b80632e9feb7911610248578063521eb273116101fc578063893d20e8116101d6578063893d20e8146105b05780638ab1d681146105c55780638f22edf3146105e5576102fc565b8063521eb2731461054757806371404156146105705780637be5fdc314610590576102fc565b80633644e5151161022d5780633644e515146104f25780633af32abf1461050757806351953ea614610527576102fc565b80632e9feb791461049757806331ea76b1146104c4576102fc565b806309779927116102aa57806324db3d021161028457806324db3d02146104425780632630c12f1461046257806326e1c97814610477576102fc565b806309779927146103d5578063150b7a02146103f55780631626ba7e14610422576102fc565b806301ffc9a7116102db57806301ffc9a7146103595780630206b4401461038657806304e80e90146103b3576102fc565b8062cbe5631461030157806301a44c2514610323576102fc565b366102fc57005b600080fd5b34801561030d57600080fd5b5061032161031c366004613162565b6108d1565b005b34801561032f57600080fd5b5061034361033e366004613c42565b610957565b60405161035091906140f1565b60405180910390f35b34801561036557600080fd5b506103796103743660046138bb565b610a2b565b60405161035091906140e6565b34801561039257600080fd5b506103a66103a13660046137eb565b610b5e565b6040516103509190614077565b3480156103bf57600080fd5b506103c8610c26565b6040516103509190613f37565b3480156103e157600080fd5b506103796103f0366004613534565b610c42565b34801561040157600080fd5b506104156104103660046132fd565b610dff565b604051610350919061414c565b34801561042e57600080fd5b5061041561043d36600461383b565b610e28565b34801561044e57600080fd5b5061034361045d366004613959565b610ef9565b34801561046e57600080fd5b506103c8610fc3565b34801561048357600080fd5b5061034361049236600461399e565b610fe7565b3480156104a357600080fd5b506104b76104b236600461360b565b6110be565b6040516103509190614179565b3480156104d057600080fd5b506104e46104df366004613aa0565b611235565b604051610350929190614133565b3480156104fe57600080fd5b5061034361133e565b34801561051357600080fd5b50610379610522366004613162565b611362565b34801561053357600080fd5b50610343610542366004613ca8565b61136f565b34801561055357600080fd5b5061055c6113e9565b604051610350989796959493929190613fc1565b34801561057c57600080fd5b5061032161058b366004613162565b6114cc565b34801561059c57600080fd5b506103436105ab366004613959565b611592565b3480156105bc57600080fd5b506103c86116a8565b3480156105d157600080fd5b506103216105e0366004613162565b6116c4565b3480156105f157600080fd5b506103216106003660046136b2565b61178a565b34801561061157600080fd5b50610343610620366004613959565b611886565b34801561063157600080fd5b50610343610640366004613b44565b611900565b34801561065157600080fd5b506104b7610660366004613367565b61197e565b34801561067157600080fd5b50610321610680366004613162565b611af2565b34801561069157600080fd5b506103436106a0366004613926565b611bb8565b3480156106b157600080fd5b506103796106c03660046134fc565b611c80565b3480156106d157600080fd5b506103436106e0366004613959565b611d28565b3480156106f157600080fd5b5061032161070036600461327a565b611da2565b34801561071157600080fd5b5061032161072036600461367d565b611ecc565b34801561073157600080fd5b50610343610740366004613a06565b611f4f565b34801561075157600080fd5b5061041561076036600461317e565b61202c565b34801561077157600080fd5b5061077a612056565b604051610350919061493c565b34801561079357600080fd5b506103c861207e565b3480156107a857600080fd5b506103216107b736600461345c565b6120a2565b3480156107c857600080fd5b506103216107d7366004613162565b612396565b3480156107e857600080fd5b506103216107f73660046136b2565b61245c565b34801561080857600080fd5b50610343610817366004613162565b612524565b34801561082857600080fd5b506104e4610837366004613bbc565b61254c565b34801561084857600080fd5b50610321610857366004613ceb565b61264f565b34801561086857600080fd5b506104156108773660046133f5565b612715565b34801561088857600080fd5b50610321610897366004613162565b61273f565b3480156108a857600080fd5b50610321612889565b3480156108bd57600080fd5b506103216108cc366004613228565b61290c565b6040517f898fa939000000000000000000000000000000000000000000000000000000008152731bc026940dbf2559c6fceb609915b00937178bf99063898fa93990610924906001908590600401614322565b60006040518083038186803b15801561093c57600080fd5b505af4158015610950573d6000803e3d6000fd5b5050505050565b6040517f3140f8cf0000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde790633140f8cf906109d3906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a790899089908990600401614702565b60206040518083038186803b1580156109eb57600080fd5b505af41580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613823565b949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f1626ba7e000000000000000000000000000000000000000000000000000000001480610abe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000145b80610b0a57507fffffffff0000000000000000000000000000000000000000000000000000000082167f150b7a0200000000000000000000000000000000000000000000000000000000145b80610b5657507fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e000000000000000000000000000000000000000000000000000000000145b90505b919050565b6040517f18d9ad710000000000000000000000000000000000000000000000000000000081526060907368d9686e4b4706c425e91e4cf762c09d7686cde7906318d9ad7190610bb490600190869060040161492c565b60006040518083038186803b158015610bcc57600080fd5b505af4158015610be0573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610b5691908101906136f2565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000806040518061014001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d81526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018a81526020018981526020018873ffffffffffffffffffffffffffffffffffffffff168152602001871515815260200186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020018490526040517f531020c20000000000000000000000000000000000000000000000000000000081529091507390e978eaec76291fcda3c727d022c3589d74be439063531020c290610d9e906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a7907f000000000000000000000000b124190942976431d8181fbe183e44584253da689087906004016143a8565b60206040518083038186803b158015610db657600080fd5b505af4158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee9190613807565b9d9c50505050505050505050505050565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517f7d631ea100000000000000000000000000000000000000000000000000000000815260009073dc6a946525c4075a0bff457ac2c282cde3b897b390637d631ea190610ea2906001907f1626ba7e000000000000000000000000000000000000000000000000000000009088908890600401614764565b60206040518083038186803b158015610eba57600080fd5b505af4158015610ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef291906138d7565b9392505050565b6040517f912fce540000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde79063912fce5490610f73906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a790889088906004016144cb565b60206040518083038186803b158015610f8b57600080fd5b505af4158015610f9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190613823565b7f000000000000000000000000b124190942976431d8181fbe183e44584253da6881565b6040517fe2e24927000000000000000000000000000000000000000000000000000000008152600090739d7c436db65ad7a02bb03ca727d027bd347899589063e2e2492790611065906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a7908a908a908a908a90600401614511565b60206040518083038186803b15801561107d57600080fd5b505af4158015611091573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b59190613823565b95945050505050565b6060333014806110f3575060015473ffffffffffffffffffffffffffffffffffffffff16331480156110f3575060045460ff16155b611132576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b60405180910390fd5b61113c6001612a9d565b6040517ffc55b679000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd347899589063fc55b679906111b9906001907f000000000000000000000000b124190942976431d8181fbe183e44584253da68908b908b908b908b908b906004016148c2565b60006040518083038186803b1580156111d157600080fd5b505af41580156111e5573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261122b91908101906138f3565b9695505050505050565b6040517fd77c3b5d000000000000000000000000000000000000000000000000000000008152600090606090739d7c436db65ad7a02bb03ca727d027bd347899589063d77c3b5d906112bc906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a7908e908e908e908e908e908e908e906004016145ce565b60006040518083038186803b1580156112d457600080fd5b505af41580156112e8573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261132e9190810190613880565b909a909950975050505050505050565b7f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a781565b6000610b56600183612b47565b6040517f2d5d461a0000000000000000000000000000000000000000000000000000000081526000907355542a24968e4933fd56eeb96634c9dbe17b0efa90632d5d461a90610f73906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a79088908890600401614734565b6001546002546004546007546040805160a0810182526008546fffffffffffffffffffffffffffffffff808216835270010000000000000000000000000000000091829004811660208401526009549081169383019390935267ffffffffffffffff908304811660608301527801000000000000000000000000000000000000000000000000928390048116608083015273ffffffffffffffffffffffffffffffffffffffff8088169774010000000000000000000000000000000000000000908190048316979660ff16959182169490820463ffffffff169391049091169088565b333014806114ff575060015473ffffffffffffffffffffffffffffffffffffffff16331480156114ff575060045460ff16155b611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b61153f6001612a9d565b6040517fee3da3e30000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde79063ee3da3e390610924906001908590600401614322565b6040517fec08e14400000000000000000000000000000000000000000000000000000000815260009073747240559d31f56bb6b92f7817785a65d24163e69063ec08e1449061160c906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a790889088906004016144cb565b60206040518083038186803b15801561162457600080fd5b505af4158015611638573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165c9190613823565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff949094169390931790925550919050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b333014806116f7575060015473ffffffffffffffffffffffffffffffffffffffff16331480156116f7575060045460ff16155b61172d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6117376001612a9d565b6040517f9509eea5000000000000000000000000000000000000000000000000000000008152730bb6c344138c785d426435bfc733e7f9b76f28cf90639509eea590610924906001908590600401614322565b333014806117bd575060015473ffffffffffffffffffffffffffffffffffffffff16331480156117bd575060045460ff16155b6117f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6117fd6001612a9d565b6040517f28c809350000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde7906328c80935906118529060019086908690600401614374565b60006040518083038186803b15801561186a57600080fd5b505af415801561187e573d6000803e3d6000fd5b505050505050565b6040517f1b8b0ce9000000000000000000000000000000000000000000000000000000008152600090730bb6c344138c785d426435bfc733e7f9b76f28cf90631b8b0ce990610f73906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a790889088906004016144cb565b6040517fc089037e000000000000000000000000000000000000000000000000000000008152600090736ed0788a7bac3c8a551da44e1a747c4415c9842d9063c089037e90611065906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a7908a908a908a908a90600401614645565b6060333014806119b3575060015473ffffffffffffffffffffffffffffffffffffffff16331480156119b3575060045460ff16155b6119e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6119f36001612a9d565b6040517f2b84eece000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd3478995890632b84eece90611a74906001907f000000000000000000000000b124190942976431d8181fbe183e44584253da68908d908d908d908d908d908d908d90600401614854565b60006040518083038186803b158015611a8c57600080fd5b505af4158015611aa0573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611ae691908101906138f3565b98975050505050505050565b33301480611b25575060015473ffffffffffffffffffffffffffffffffffffffff1633148015611b25575060045460ff16155b611b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b611b656001612a9d565b6040517fb9d8df140000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde79063b9d8df1490610924906001908590600401614322565b6040517ffbcfc53c00000000000000000000000000000000000000000000000000000000815260009073bf4e84150748ff8eafb3d8008c1272ac6c08f3009063fbcfc53c90611c30906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a79087906004016144ac565b60206040518083038186803b158015611c4857600080fd5b505af4158015611c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b569190613823565b6040517fa643b1070000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde79063a643b10790611cd89060019087908790600401614346565b60206040518083038186803b158015611cf057600080fd5b505af4158015611d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190613807565b6040517f9668d94c0000000000000000000000000000000000000000000000000000000081526000907368d9686e4b4706c425e91e4cf762c09d7686cde790639668d94c90610f73906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a790889088906004016144cb565b33301480611dd5575060015473ffffffffffffffffffffffffffffffffffffffff1633148015611dd5575060045460ff16155b611e0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b611e156001612a9d565b6040517fc5354f8b000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd347899589063c5354f8b90611e94906001907f000000000000000000000000b124190942976431d8181fbe183e44584253da68908b908b908b908b908b908b906004016147ef565b60006040518083038186803b158015611eac57600080fd5b505af4158015611ec0573d6000803e3d6000fd5b50505050505050505050565b33301480611eff575060015473ffffffffffffffffffffffffffffffffffffffff1633148015611eff575060045460ff16155b611f35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b611f3f6001612a9d565b611f4b60018383612b83565b5050565b6040517faed40479000000000000000000000000000000000000000000000000000000008152600090739d7c436db65ad7a02bb03ca727d027bd347899589063aed4047990611fd1906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a7908c908c908c908c908c908c90600401614562565b60206040518083038186803b158015611fe957600080fd5b505af4158015611ffd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120219190613823565b979650505050505050565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b60015474010000000000000000000000000000000000000000900467ffffffffffffffff1690565b7f000000000000000000000000b7390a217cee03545b5e2b33c6f6ce6012d9b9bd81565b60005474010000000000000000000000000000000000000000900460ff16156120f7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906141c3565b60015473ffffffffffffffffffffffffffffffffffffffff1615612147576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111299061418c565b73ffffffffffffffffffffffffffffffffffffffff8816612194576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906142b4565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a16177fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000004267ffffffffffffffff16021781556040517fb4f212fa0000000000000000000000000000000000000000000000000000000081527368d9686e4b4706c425e91e4cf762c09d7686cde79163b4f212fa9161226c91908b908b90600401614374565b60006040518083038186803b15801561228457600080fd5b505af4158015612298573d6000803e3d6000fd5b50505050846000146122b1576122b16001866000612c57565b73ffffffffffffffffffffffffffffffffffffffff8416156122dd576122dd6001856301e13380612b83565b73ffffffffffffffffffffffffffffffffffffffff8316158015906123025750600081115b1561238c576040517fbeabacc8000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd347899589063beabacc89061235b90859087908690600401613f58565b60006040518083038186803b15801561237357600080fd5b505af4158015612387573d6000803e3d6000fd5b505050505b5050505050505050565b333014806123c9575060015473ffffffffffffffffffffffffffffffffffffffff16331480156123c9575060045460ff16155b6123ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6124096001612a9d565b6040517ff42a9d41000000000000000000000000000000000000000000000000000000008152730bb6c344138c785d426435bfc733e7f9b76f28cf9063f42a9d4190610924906001908590600401614322565b3330148061248f575060015473ffffffffffffffffffffffffffffffffffffffff163314801561248f575060045460ff16155b6124c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6124cf6001612a9d565b6040517f8b8365960000000000000000000000000000000000000000000000000000000081527390e978eaec76291fcda3c727d022c3589d74be4390638b83659690611852906001908690869060040161438e565b73ffffffffffffffffffffffffffffffffffffffff166000908152600a602052604090205490565b6040517ff9fa74e6000000000000000000000000000000000000000000000000000000008152600090606090739d7c436db65ad7a02bb03ca727d027bd347899589063f9fa74e6906125cf906001907f2a84fff36568628ba172624fb2c1c6e8c1364df1cc2437a97510ff577eaa09a7908c908c908c908c908c906004016146a0565b60006040518083038186803b1580156125e757600080fd5b505af41580156125fb573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526126419190810190613880565b909890975095505050505050565b33301480612682575060015473ffffffffffffffffffffffffffffffffffffffff1633148015612682575060045460ff16155b6126b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b6126c26001612a9d565b6040517fe522f1680000000000000000000000000000000000000000000000000000000081527355542a24968e4933fd56eeb96634c9dbe17b0efa9063e522f1689061092490600190859060040161491e565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b7390a217cee03545b5e2b33c6f6ce6012d9b9bd161480156127bf57506001547f000000000000000000000000b7390a217cee03545b5e2b33c6f6ce6012d9b9bd73ffffffffffffffffffffffffffffffffffffffff9081169116145b6127f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111299061427d565b73ffffffffffffffffffffffffffffffffffffffff8116612842576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906142b4565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6040517f686d7c3700000000000000000000000000000000000000000000000000000000815273bf4e84150748ff8eafb3d8008c1272ac6c08f3009063686d7c37906128da906001906004016140f1565b60006040518083038186803b1580156128f257600080fd5b505af4158015612906573d6000803e3d6000fd5b50505050565b3330148061293f575060015473ffffffffffffffffffffffffffffffffffffffff163314801561293f575060045460ff16155b612975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112990614220565b61297f6001612a9d565b6040517f3b39d10d000000000000000000000000000000000000000000000000000000008152739d7c436db65ad7a02bb03ca727d027bd3478995890633b39d10d906129fa906001907f000000000000000000000000b124190942976431d8181fbe183e44584253da689089908990899089906004016147ab565b60006040518083038186803b158015612a1257600080fd5b505af415801561238c573d6000803e3d6000fd5b6000804690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f836000015180519060200120846020015180519060200120838660400151604051602001612a7f9594939291906140fa565b60405160208183030381529060405280519060200120915050919050565b600681015473ffffffffffffffffffffffffffffffffffffffff1615801590612af55750600681015467ffffffffffffffff78010000000000000000000000000000000000000000000000009091041662278d000142115b15612b445760068101805477ffffffffffffffffffffffffffffffffffffffffffffffff1678010000000000000000000000000000000000000000000000004267ffffffffffffffff16021790555b50565b73ffffffffffffffffffffffffffffffffffffffff811660009081526009830160205260408120548015801590610a2357504210159392505050565b6006909201805467ffffffffffffffff421678010000000000000000000000000000000000000000000000000277ffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff90951674010000000000000000000000000000000000000000027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff9095167fffffffffffffffffffffffff000000000000000000000000000000000000000090931692909217939093161792909216179055565b6fffffffffffffffffffffffffffffffff821115612ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611129906142eb565b6fffffffffffffffffffffffffffffffff821415612cbe57600091505b6000612cc984612e0d565b9050828110158015612cda57508215155b80612ce3575080155b15612ced57600091505b60078401612cfa82612ea2565b81547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff91909116178155612d3f84612ea2565b81546fffffffffffffffffffffffffffffffff918216700100000000000000000000000000000000029116178155612d7683612f11565b60018201805477ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000067ffffffffffffffff938416810291909117918290556040517ff4109b774ae6f56e72fe6cb9396e75bc9017595ac0797f852334dbd0db2fa5b693612dfe9330938a93910490911690613f89565b60405180910390a15050505050565b6040805160a08101825260078301546fffffffffffffffffffffffffffffffff8082168352700100000000000000000000000000000000918290048116602084015260088501549081169383019390935267ffffffffffffffff9083048116606083015278010000000000000000000000000000000000000000000000009092049091166080820152600090610b5690612f74565b60007001000000000000000000000000000000008210612f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614ac46027913960400191505060405180910390fd5b5090565b6000680100000000000000008210612f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614aeb6026913960400191505060405180910390fd5b600042826080015167ffffffffffffffff161115612f93578151612f99565b81602001515b6fffffffffffffffffffffffffffffffff1692915050565b8035610b5981614a65565b60008083601f840112612fcd578182fd5b50813567ffffffffffffffff811115612fe4578182fd5b6020830191508360208083028501011115612ffe57600080fd5b9250929050565b600082601f830112613015578081fd5b8135602061302a61302583614975565b614951565b8281528181019085830183850287018401881015613046578586fd5b855b8581101561306457813584529284019290840190600101613048565b5090979650505050505050565b8035610b5981614a87565b60008083601f84011261308d578182fd5b50813567ffffffffffffffff8111156130a4578182fd5b602083019150836020828501011115612ffe57600080fd5b600082601f8301126130cc578081fd5b81356130da61302582614993565b8181528460208386010111156130ee578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613118578081fd5b815161312661302582614993565b81815284602083860101111561313a578283fd5b610a23826020830160208701614a39565b60006080828403121561315c578081fd5b50919050565b600060208284031215613173578081fd5b8135610ef281614a65565b600080600080600060a08688031215613195578081fd5b85356131a081614a65565b945060208601356131b081614a65565b9350604086013567ffffffffffffffff808211156131cc578283fd5b6131d889838a01613005565b945060608801359150808211156131ed578283fd5b6131f989838a01613005565b9350608088013591508082111561320e578283fd5b5061321b888289016130bc565b9150509295509295909350565b6000806000806080858703121561323d578182fd5b843561324881614a65565b9350602085013561325881614a65565b925060408501359150606085013561326f81614a87565b939692955090935050565b60008060008060008060a08789031215613292578384fd5b863561329d81614a65565b955060208701356132ad81614a65565b945060408701359350606087013567ffffffffffffffff8111156132cf578182fd5b6132db89828a0161307c565b90945092505060808701356132ef81614a87565b809150509295509295509295565b60008060008060808587031215613312578182fd5b843561331d81614a65565b9350602085013561332d81614a65565b925060408501359150606085013567ffffffffffffffff81111561334f578182fd5b61335b878288016130bc565b91505092959194509250565b600080600080600080600060c0888a031215613381578485fd5b873561338c81614a65565b9650602088013561339c81614a65565b95506040880135945060608801359350608088013567ffffffffffffffff8111156133c5578182fd5b6133d18a828b0161307c565b90945092505060a08801356133e581614a87565b8091505092959891949750929550565b600080600080600060a0868803121561340c578283fd5b853561341781614a65565b9450602086013561342781614a65565b93506040860135925060608601359150608086013567ffffffffffffffff811115613450578182fd5b61321b888289016130bc565b60008060008060008060008060e0898b031215613477578182fd5b883561348281614a65565b9750602089013567ffffffffffffffff81111561349d578283fd5b6134a98b828c01612fbc565b9098509650506040890135945060608901356134c481614a65565b935060808901356134d481614a65565b925060a08901356134e481614a65565b8092505060c089013590509295985092959890939650565b6000806040838503121561350e578182fd5b823561351981614a65565b9150602083013561352981614a87565b809150509250929050565b60008060008060008060008060008060006101408c8e031215613555578485fd5b61355e8c612fb1565b9a5060208c0135995061357360408d01612fb1565b985060608c0135975060808c0135965060a08c0135955061359660c08d01612fb1565b94506135a460e08d01613071565b935067ffffffffffffffff806101008e013511156135c0578384fd5b6135d18e6101008f01358f0161307c565b90945092506101208d01358110156135e7578182fd5b506135f98d6101208e01358e016130bc565b90509295989b509295989b9093969950565b600080600080600060808688031215613622578283fd5b853561362d81614a65565b945060208601359350604086013567ffffffffffffffff81111561364f578384fd5b61365b8882890161307c565b909450925050606086013561366f81614a87565b809150509295509295909350565b6000806040838503121561368f578182fd5b823561369a81614a65565b9150602083013563ffffffff81168114613529578182fd5b600080602083850312156136c4578182fd5b823567ffffffffffffffff8111156136da578283fd5b6136e685828601612fbc565b90969095509350505050565b60006020808385031215613704578182fd5b825167ffffffffffffffff8082111561371b578384fd5b818501915085601f83011261372e578384fd5b815161373c61302582614975565b818152848101908486016060808502870188018b101561375a578889fd5b8896505b848710156137dc5780828c031215613774578889fd5b60408051828101818110898211171561378957fe5b8252835161379681614a65565b8152838a015160ff811681146137aa578b8cfd5b818b01528382015188811681146137bf578b8cfd5b91810191909152845260019690960195928701929081019061375e565b50909998505050505050505050565b6000602082840312156137fc578081fd5b8135610ef281614a87565b600060208284031215613818578081fd5b8151610ef281614a87565b600060208284031215613834578081fd5b5051919050565b6000806040838503121561384d578182fd5b82359150602083013567ffffffffffffffff81111561386a578182fd5b613876858286016130bc565b9150509250929050565b60008060408385031215613892578182fd5b82519150602083015167ffffffffffffffff8111156138af578182fd5b61387685828601613108565b6000602082840312156138cc578081fd5b8135610ef281614a95565b6000602082840312156138e8578081fd5b8151610ef281614a95565b600060208284031215613904578081fd5b815167ffffffffffffffff81111561391a578182fd5b610a2384828501613108565b600060208284031215613937578081fd5b813567ffffffffffffffff81111561394d578182fd5b610a238482850161314b565b6000806040838503121561396b578182fd5b823567ffffffffffffffff811115613981578283fd5b61398d8582860161314b565b925050602083013561352981614a65565b600080600080608085870312156139b3578182fd5b843567ffffffffffffffff8111156139c9578283fd5b6139d58782880161314b565b94505060208501356139e681614a65565b925060408501356139f681614a65565b9396929550929360600135925050565b60008060008060008060a08789031215613a1e578384fd5b863567ffffffffffffffff80821115613a35578586fd5b613a418a838b0161314b565b975060208901359150613a5382614a65565b909550604088013590613a6582614a65565b9094506060880135935060808801359080821115613a81578384fd5b50613a8e89828a0161307c565b979a9699509497509295939492505050565b600080600080600080600060c0888a031215613aba578081fd5b873567ffffffffffffffff80821115613ad1578283fd5b613add8b838c0161314b565b985060208a01359150613aef82614a65565b909650604089013590613b0182614a65565b909550606089013594506080890135935060a08901359080821115613b24578283fd5b50613b318a828b0161307c565b989b979a50959850939692959293505050565b60008060008060608587031215613b59578182fd5b843567ffffffffffffffff80821115613b70578384fd5b613b7c8883890161314b565b955060208701359150613b8e82614a65565b90935060408601359080821115613ba3578384fd5b50613bb087828801612fbc565b95989497509550505050565b600080600080600060808688031215613bd3578283fd5b853567ffffffffffffffff80821115613bea578485fd5b613bf689838a0161314b565b965060208801359150613c0882614a65565b9094506040870135935060608701359080821115613c24578283fd5b50613c318882890161307c565b969995985093965092949392505050565b600080600060408486031215613c56578081fd5b833567ffffffffffffffff80821115613c6d578283fd5b613c798783880161314b565b94506020860135915080821115613c8e578283fd5b50613c9b86828701612fbc565b9497909650939450505050565b60008060408385031215613cba578182fd5b823567ffffffffffffffff811115613cd0578283fd5b613cdc8582860161314b565b95602094909401359450505050565b600060208284031215613cfc578081fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff169052565b60008284526020808501945082825b85811015613d67578135613d3f81614a65565b73ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613d2c565b509495945050505050565b818352602080840193600091908185020181018584845b87811015613e0e57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112613dc7578687fd5b8701803567ffffffffffffffff811115613ddf578788fd5b803603891315613ded578788fd5b613dfa8682898501613e21565b9a87019a9550505090840190600101613d89565b5091979650505050505050565b15159052565b600082845282826020860137806020848601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011685010190509392505050565b60008151808452613e81816020860160208601614a39565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000613ebf82836149d3565b60808552613ed1608086018284613d1d565b915050613ee160208401846149d3565b8583036020870152613ef4838284613d72565b92505050604083013560408501526060830135613f1081614a65565b73ffffffffffffffffffffffffffffffffffffffff81166060860152508091505092915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff939093168352602083019190915267ffffffffffffffff16604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff988916815267ffffffffffffffff978816602080830191909152604080830198909852951515606080830191909152949098166080808a019190915263ffffffff9390931660a089015290861660c088015280516fffffffffffffffffffffffffffffffff90811660e08901529381015184166101008801529384015190921661012086015282015183166101408501520151166101608201526101800190565b602080825282518282018190526000919060409081850190868401855b82811015613e0e578151805173ffffffffffffffffffffffffffffffffffffffff1685528681015160ff168786015285015167ffffffffffffffff168585015260609093019290850190600101614094565b901515815260200190565b90815260200190565b94855260208501939093526040840191909152606083015273ffffffffffffffffffffffffffffffffffffffff16608082015260a00190565b600083825260406020830152610a236040830184613e69565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b600060208252610ef26020830184613e69565b60208082526013908201527f494e495449414c495a45445f414c524541445900000000000000000000000000604082015260600190565b60208082526025908201527f444953414c4c4f5745445f4f4e5f494d504c454d454e544154494f4e5f434f4e60408201527f5452414354000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f4e4f545f46524f4d5f57414c4c45545f4f525f4f574e45525f4f525f57414c4c60408201527f45545f4c4f434b45440000000000000000000000000000000000000000000000606082015260800190565b60208082526018908201527f4e4f545f414c4c4f5745445f544f5f5345545f4f574e45520000000000000000604082015260600190565b6020808252600d908201527f494e56414c49445f4f574e455200000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f494e56414c49445f56414c554500000000000000000000000000000000000000604082015260600190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b92835273ffffffffffffffffffffffffffffffffffffffff9190911660208301521515604082015260600190565b6000848252604060208301526110b5604083018486613d1d565b6000848252604060208301526110b5604083018486613d72565b600085825284602083015273ffffffffffffffffffffffffffffffffffffffff84166040830152608060608301526143e4608083018451613d03565b602083015160a0830152604083015161440060c0840182613d03565b50606083015160e08301526080830151610100818185015260a08501519150610120828186015260c0860151925061014061443d81870185613d03565b60e08701519350614452610160870185613e1b565b828701519350806101808701525061446e6101c0860184613e69565b9250808601519150507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80848303016101a0850152611ae68282613e69565b6000848252836020830152606060408301526110b56060830184613eb3565b6000858252846020830152608060408301526144ea6080830185613eb3565b905073ffffffffffffffffffffffffffffffffffffffff8316606083015295945050505050565b600087825286602083015260c0604083015261453060c0830187613eb3565b73ffffffffffffffffffffffffffffffffffffffff958616606084015293909416608082015260a00152949350505050565b600089825288602083015260e0604083015261458160e0830189613eb3565b73ffffffffffffffffffffffffffffffffffffffff88811660608501528716608084015260a0830186905282810360c08401526145bf818587613e21565b9b9a5050505050505050505050565b60006101008b83528a60208401528060408401526145ee8184018b613eb3565b905073ffffffffffffffffffffffffffffffffffffffff808a1660608501528089166080850152508660a08401528560c084015282810360e0840152614635818587613e21565b9c9b505050505050505050505050565b600087825286602083015260a0604083015261466460a0830187613eb3565b73ffffffffffffffffffffffffffffffffffffffff861660608401528281036080840152614693818587613d1d565b9998505050505050505050565b600088825287602083015260c060408301526146bf60c0830188613eb3565b73ffffffffffffffffffffffffffffffffffffffff8716606084015285608084015282810360a08401526146f4818587613e21565b9a9950505050505050505050565b6000868252856020830152608060408301526147216080830186613eb3565b8281036060840152611ae6818587613d1d565b6000858252846020830152608060408301526147536080830185613eb3565b905082606083015295945050505050565b60008582527fffffffff00000000000000000000000000000000000000000000000000000000851660208301528360408301526080606083015261122b6080830184613e69565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529284166040860152921660608401526080830191909152151560a082015260c00190565b600089825273ffffffffffffffffffffffffffffffffffffffff808a166020840152808916604084015280881660608401525085608083015260e060a083015261483d60e083018587613e21565b905082151560c08301529998505050505050505050565b60006101008b835273ffffffffffffffffffffffffffffffffffffffff808c166020850152808b166040850152808a166060850152508760808401528660a08401528060c08401526148a98184018688613e21565b91505082151560e08301529a9950505050505050505050565b600088825273ffffffffffffffffffffffffffffffffffffffff808916602084015280881660408401525085606083015260c0608083015261490860c083018587613e21565b905082151560a083015298975050505050505050565b918252602082015260400190565b9182521515602082015260400190565b67ffffffffffffffff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561496d57fe5b604052919050565b600067ffffffffffffffff82111561498957fe5b5060209081020190565b600067ffffffffffffffff8211156149a757fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614a07578283fd5b830160208101925035905067ffffffffffffffff811115614a2757600080fd5b602081023603831315612ffe57600080fd5b60005b83811015614a54578181015183820152602001614a3c565b838111156129065750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612b4457600080fd5b8015158114612b4457600080fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114612b4457600080fdfe53616665436173743a2076616c756520646f65736e27742066697420696e20313238206269747353616665436173743a2076616c756520646f65736e27742066697420696e2036342062697473a2646970667358221220547821518258cd22f401eb04b10d89acc4bbf422d797acbd86f7420dac05481464736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b124190942976431d8181fbe183e44584253da68000000000000000000000000b7390a217cee03545b5e2b33c6f6ce6012d9b9bd
-----Decoded View---------------
Arg [0] : _priceOracle (address): 0xB124190942976431d8181fbe183E44584253Da68
Arg [1] : _blankOwner (address): 0xB7390a217cEE03545B5E2B33c6F6cE6012d9b9Bd
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b124190942976431d8181fbe183e44584253da68
Arg [1] : 000000000000000000000000b7390a217cee03545b5e2b33c6f6ce6012d9b9bd
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
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.