Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
18100002 | 508 days ago | 0.00122286 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
AllowanceTarget
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2020-12-18 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @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 in 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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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); } } } } // File: contracts/interface/IAllowanceTarget.sol pragma solidity ^0.6.0; interface IAllowanceTarget { function setSpenderWithTimelock(address _newSpender) external; function completeSetSpender() external; function executeCall(address payable _target, bytes calldata _callData) external returns (bytes memory resultData); function teardown() external; } // File: contracts/AllowanceTarget.sol pragma solidity ^0.6.5; /** * @dev AllowanceTarget contract */ contract AllowanceTarget is IAllowanceTarget { using Address for address; uint256 constant private TIME_LOCK_DURATION = 1 days; address public spender; address public newSpender; uint256 public timelockExpirationTime; modifier onlySpender() { require(spender == msg.sender, "AllowanceTarget: not the spender"); _; } constructor(address _spender) public { require(_spender != address(0), "AllowanceTarget: _spender should not be 0"); // Set spender spender = _spender; } function setSpenderWithTimelock(address _newSpender) override external onlySpender { require(_newSpender.isContract(), "AllowanceTarget: new spender not a contract"); require(newSpender == address(0) && timelockExpirationTime == 0, "AllowanceTarget: SetSpender in progress"); timelockExpirationTime = now + TIME_LOCK_DURATION; newSpender = _newSpender; } function completeSetSpender() override external { require(timelockExpirationTime != 0, "AllowanceTarget: no pending SetSpender"); require(now >= timelockExpirationTime, "AllowanceTarget: time lock not expired yet"); // Set new spender spender = newSpender; // Reset timelockExpirationTime = 0; newSpender = address(0); } function teardown() override external onlySpender { selfdestruct(payable(spender)); } /// @dev Execute an arbitrary call. Only an authority can call this. /// @param target The call target. /// @param callData The call data. /// @return resultData The data returned by the call. function executeCall( address payable target, bytes calldata callData ) override external onlySpender returns (bytes memory resultData) { bool success; (success, resultData) = target.call(callData); if (!success) { // Get the error message returned assembly { let ptr := mload(0x40) let size := returndatasize() returndatacopy(ptr, 0, size) revert(ptr, size) } } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_spender","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"completeSetSpender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"executeCall","outputs":[{"internalType":"bytes","name":"resultData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"newSpender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newSpender","type":"address"}],"name":"setSpenderWithTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teardown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelockExpirationTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161070b38038061070b8339818101604052602081101561003357600080fd5b50516001600160a01b03811661007a5760405162461bcd60e51b81526004018080602001828103825260298152602001806106e26029913960400191505060405180910390fd5b600080546001600160a01b039092166001600160a01b0319909216919091179055610638806100aa6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063bca8c7b51161005b578063bca8c7b5146100d6578063be6502e9146101cb578063e8edc816146101d3578063f9c7a0d1146101db5761007d565b806348e196d114610082578063782a533f1461008c5780638c064e19146100b0575b600080fd5b61008a6101f5565b005b6100946102ad565b604080516001600160a01b039092168252519081900360200190f35b61008a600480360360208110156100c657600080fd5b50356001600160a01b03166102bc565b610156600480360360408110156100ec57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561011757600080fd5b82018360208201111561012957600080fd5b8035906020019184600183028401116401000000008311171561014b57600080fd5b5090925090506103f4565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610190578181015183820152602001610178565b50505050905090810190601f1680156101bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61008a6104d8565b610094610545565b6101e3610554565b60408051918252519081900360200190f35b6002546102335760405162461bcd60e51b815260040180806020018281038252602681526020018061058b6026913960400191505060405180910390fd5b6002544210156102745760405162461bcd60e51b815260040180806020018281038252602a815260200180610561602a913960400191505060405180910390fd5b600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b038416178255600291909155169055565b6001546001600160a01b031681565b6000546001600160a01b0316331461031b576040805162461bcd60e51b815260206004820181905260248201527f416c6c6f77616e63655461726765743a206e6f7420746865207370656e646572604482015290519081900360640190fd5b61032d816001600160a01b031661055a565b6103685760405162461bcd60e51b815260040180806020018281038252602b8152602001806105b1602b913960400191505060405180910390fd5b6001546001600160a01b03161580156103815750600254155b6103bc5760405162461bcd60e51b81526004018080602001828103825260278152602001806105dc6027913960400191505060405180910390fd5b6201518042016002556001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546060906001600160a01b03163314610456576040805162461bcd60e51b815260206004820181905260248201527f416c6c6f77616e63655461726765743a206e6f7420746865207370656e646572604482015290519081900360640190fd5b6000846001600160a01b03168484604051808383808284376040519201945060009350909150508083038183865af19150503d80600081146104b4576040519150601f19603f3d011682016040523d82523d6000602084013e6104b9565b606091505b5092509050806104d0576040513d806000833e8082fd5b509392505050565b6000546001600160a01b03163314610537576040805162461bcd60e51b815260206004820181905260248201527f416c6c6f77616e63655461726765743a206e6f7420746865207370656e646572604482015290519081900360640190fd5b6000546001600160a01b0316ff5b6000546001600160a01b031681565b60025481565b3b15159056fe416c6c6f77616e63655461726765743a2074696d65206c6f636b206e6f74206578706972656420796574416c6c6f77616e63655461726765743a206e6f2070656e64696e67205365745370656e646572416c6c6f77616e63655461726765743a206e6577207370656e646572206e6f74206120636f6e7472616374416c6c6f77616e63655461726765743a205365745370656e64657220696e2070726f6772657373a26469706673582212201611b45ed194e38f6715c69ea91e3117814ef98600d350e22144bc44a7fd0ef964736f6c634300060c0033416c6c6f77616e63655461726765743a205f7370656e6465722073686f756c64206e6f7420626520300000000000000000000000003c68dfc45dc92c9c605d92b49858073e10b857a6
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063bca8c7b51161005b578063bca8c7b5146100d6578063be6502e9146101cb578063e8edc816146101d3578063f9c7a0d1146101db5761007d565b806348e196d114610082578063782a533f1461008c5780638c064e19146100b0575b600080fd5b61008a6101f5565b005b6100946102ad565b604080516001600160a01b039092168252519081900360200190f35b61008a600480360360208110156100c657600080fd5b50356001600160a01b03166102bc565b610156600480360360408110156100ec57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561011757600080fd5b82018360208201111561012957600080fd5b8035906020019184600183028401116401000000008311171561014b57600080fd5b5090925090506103f4565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610190578181015183820152602001610178565b50505050905090810190601f1680156101bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61008a6104d8565b610094610545565b6101e3610554565b60408051918252519081900360200190f35b6002546102335760405162461bcd60e51b815260040180806020018281038252602681526020018061058b6026913960400191505060405180910390fd5b6002544210156102745760405162461bcd60e51b815260040180806020018281038252602a815260200180610561602a913960400191505060405180910390fd5b600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b038416178255600291909155169055565b6001546001600160a01b031681565b6000546001600160a01b0316331461031b576040805162461bcd60e51b815260206004820181905260248201527f416c6c6f77616e63655461726765743a206e6f7420746865207370656e646572604482015290519081900360640190fd5b61032d816001600160a01b031661055a565b6103685760405162461bcd60e51b815260040180806020018281038252602b8152602001806105b1602b913960400191505060405180910390fd5b6001546001600160a01b03161580156103815750600254155b6103bc5760405162461bcd60e51b81526004018080602001828103825260278152602001806105dc6027913960400191505060405180910390fd5b6201518042016002556001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546060906001600160a01b03163314610456576040805162461bcd60e51b815260206004820181905260248201527f416c6c6f77616e63655461726765743a206e6f7420746865207370656e646572604482015290519081900360640190fd5b6000846001600160a01b03168484604051808383808284376040519201945060009350909150508083038183865af19150503d80600081146104b4576040519150601f19603f3d011682016040523d82523d6000602084013e6104b9565b606091505b5092509050806104d0576040513d806000833e8082fd5b509392505050565b6000546001600160a01b03163314610537576040805162461bcd60e51b815260206004820181905260248201527f416c6c6f77616e63655461726765743a206e6f7420746865207370656e646572604482015290519081900360640190fd5b6000546001600160a01b0316ff5b6000546001600160a01b031681565b60025481565b3b15159056fe416c6c6f77616e63655461726765743a2074696d65206c6f636b206e6f74206578706972656420796574416c6c6f77616e63655461726765743a206e6f2070656e64696e67205365745370656e646572416c6c6f77616e63655461726765743a206e6577207370656e646572206e6f74206120636f6e7472616374416c6c6f77616e63655461726765743a205365745370656e64657220696e2070726f6772657373a26469706673582212201611b45ed194e38f6715c69ea91e3117814ef98600d350e22144bc44a7fd0ef964736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003c68dfc45dc92c9c605d92b49858073e10b857a6
-----Decoded View---------------
Arg [0] : _spender (address): 0x3c68dfc45dc92C9c605d92B49858073e10b857A6
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000003c68dfc45dc92c9c605d92b49858073e10b857a6
Deployed Bytecode Sourcemap
6581:2287:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7567:390;;;:::i;:::-;;6757:25;;;:::i;:::-;;;;-1:-1:-1;;;;;6757:25:0;;;;;;;;;;;;;;7162:397;;;;;;;;;;;;;;;;-1:-1:-1;7162:397:0;-1:-1:-1;;;;;7162:397:0;;:::i;8289:576::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;8289:576:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8289:576:0;;-1:-1:-1;8289:576:0;-1:-1:-1;8289:576:0;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7967:99;;;:::i;6728:22::-;;;:::i;6789:37::-;;;:::i;:::-;;;;;;;;;;;;;;;;7567:390;7634:22;;7626:78;;;;-1:-1:-1;;;7626:78:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7730:22;;7723:3;:29;;7715:84;;;;-1:-1:-1;;;7715:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7850:10;;;;7840:20;;-1:-1:-1;;7840:20:0;;;-1:-1:-1;;;;;7850:10:0;;7840:20;;;7889:22;:26;;;;7926:23;;;7567:390::o;6757:25::-;;;-1:-1:-1;;;;;6757:25:0;;:::o;7162:397::-;6877:7;;-1:-1:-1;;;;;6877:7:0;6888:10;6877:21;6869:66;;;;;-1:-1:-1;;;6869:66:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7264:24:::1;:11;-1:-1:-1::0;;;;;7264:22:0::1;;:24::i;:::-;7256:80;;;;-1:-1:-1::0;;;7256:80:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7355:10;::::0;-1:-1:-1;;;;;7355:10:0::1;:24:::0;:55;::::1;;;-1:-1:-1::0;7383:22:0::1;::::0;:27;7355:55:::1;7347:107;;;;-1:-1:-1::0;;;7347:107:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6713:6;7492:3;:24;7467:22;:49:::0;7527:10:::1;:24:::0;;-1:-1:-1;;7527:24:0::1;-1:-1:-1::0;;;;;7527:24:0;;;::::1;::::0;;;::::1;::::0;;7162:397::o;8289:576::-;6877:7;;8459:23;;-1:-1:-1;;;;;6877:7:0;6888:10;6877:21;6869:66;;;;;-1:-1:-1;;;6869:66:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8500:12:::1;8547:6;-1:-1:-1::0;;;;;8547:11:0::1;8559:8;;8547:21;;;;;;;;;;::::0;;::::1;::::0;-1:-1:-1;8547:21:0::1;::::0;-1:-1:-1;8547:21:0;;-1:-1:-1;;8547:21:0;;::::1;::::0;;;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1::0;8523:45:0;-1:-1:-1;8523:45:0;-1:-1:-1;8523:45:0;8579:279:::1;;8700:4;8694:11;8735:16;8792:4;8789:1;8784:3;8769:28;8827:4;8822:3;8815:17;8664:183;6946:1;8289:576:::0;;;;;:::o;7967:99::-;6877:7;;-1:-1:-1;;;;;6877:7:0;6888:10;6877:21;6869:66;;;;;-1:-1:-1;;;6869:66:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8049:7:::1;::::0;-1:-1:-1;;;;;8049:7:0::1;8028:30;6728:22:::0;;;-1:-1:-1;;;;;6728:22:0;;:::o;6789:37::-;;;;:::o;797:422::-;1164:20;1203:8;;;797:422::o
Swarm Source
ipfs://1611b45ed194e38f6715c69ea91e3117814ef98600d350e22144bc44a7fd0ef9
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ 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.