Address Contract Partially Verified
Address
0x1137B822E16fA45916569337Ee5D6367149E11e9
Balance
0 ETH
Nonce
1
Code Size
7537 bytes
Creator
0x3fCD66cf...5EBD at tx 0x75b89b57...426697
Indexed Transactions
0
Contract Bytecode
7537 bytes
0x608060405234801561001057600080fd5b50600436106100b35760003560e01c80638e12befc116100715780638e12befc1461018c578063952d9407146101a8578063e1c3d9ca146101d8578063f2fde38b146101f4578063f750361a14610210578063fc0c546a1461022c576100b3565b8062cc8ad8146100b857806332713211146100e8578063400a139514610118578063715018a6146101345780637fba01921461013e5780638da5cb5b1461016e575b600080fd5b6100d260048036038101906100cd9190611234565b61024a565b6040516100df9190611708565b60405180910390f35b61010260048036038101906100fd9190611234565b610296565b60405161010f9190611708565b60405180910390f35b610132600480360381019061012d9190611234565b610345565b005b61013c610566565b005b61015860048036038101906101539190611234565b6105ee565b6040516101659190611708565b60405180910390f35b610176610718565b6040516101839190611547565b60405180910390f35b6101a660048036038101906101a19190611234565b610741565b005b6101c260048036038101906101bd9190611234565b610865565b6040516101cf9190611708565b60405180910390f35b6101f260048036038101906101ed919061125d565b6108b1565b005b61020e60048036038101906102099190611234565b610b1c565b005b61022a600480360381019061022591906112e9565b610c14565b005b610234610df9565b604051610241919061158b565b60405180910390f35b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060800160405290816000820154815260200160018201548152602001600282015481526020016003820154815250509050600081600001511415610324576000915050610340565b61032d836105ee565b816000015161033c919061186d565b9150505b919050565b61034e8161024a565b610357826105ee565b11610397576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038e906115e8565b60405180910390fd5b60006103a28261024a565b6103ab836105ee565b6103b5919061186d565b9050806103c0610df9565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016103f89190611547565b60206040518083038186803b15801561041057600080fd5b505afa158015610424573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104489190611312565b1015610489576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048090611688565b60405180910390fd5b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008282546104db919061178c565b9250508190555061051482826104ef610df9565b73ffffffffffffffffffffffffffffffffffffffff16610e219092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff167f2633cbe4191fdf74794314ce683537a6e9a7a937779b4a6a0264d3f591e1982e8260405161055a9190611708565b60405180910390a25050565b61056e610ea7565b73ffffffffffffffffffffffffffffffffffffffff1661058c610718565b73ffffffffffffffffffffffffffffffffffffffff16146105e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d990611668565b60405180910390fd5b6105ec6000610eaf565b565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806080016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050905060008160000151141561067c576000915050610713565b80602001514211610691576000915050610713565b80604001514211156106aa578060000151915050610713565b6000620151808260200151426106c0919061186d565b6106ca91906117e2565b9050600062015180836020015184604001516106e6919061186d565b6106f091906117e2565b9050808284600001516107039190611813565b61070d91906117e2565b93505050505b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610749610ea7565b73ffffffffffffffffffffffffffffffffffffffff16610767610718565b73ffffffffffffffffffffffffffffffffffffffff16146107bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b490611668565b60405180910390fd5b600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008082016000905560018201600090556002820160009055600382016000905550508073ffffffffffffffffffffffffffffffffffffffff167f127b5f02ff00d2a9a96603ed9ba67bf9273ad5946b7520a7f3386622b7f21afd60405160405180910390a250565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b6108b9610ea7565b73ffffffffffffffffffffffffffffffffffffffff166108d7610718565b73ffffffffffffffffffffffffffffffffffffffff161461092d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092490611668565b60405180910390fd5b600061093885610865565b14610978576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096f90611648565b60405180910390fd5b62015180826109879190611940565b82610992919061186d565b9150600062015180826109a59190611813565b836109b0919061178c565b90504281116109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb90611628565b60405180910390fd5b60008411610a37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2e906116c8565b60405180910390fd5b60405180608001604052808581526020018481526020018281526020016000815250600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301559050508473ffffffffffffffffffffffffffffffffffffffff167fdfcd239f0eeb0acad741f28afc063b541259e6bf773b1a1cc40e3b1b201ffabf858585604051610b0d93929190611723565b60405180910390a25050505050565b610b24610ea7565b73ffffffffffffffffffffffffffffffffffffffff16610b42610718565b73ffffffffffffffffffffffffffffffffffffffff1614610b98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8f90611668565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bff906115c8565b60405180910390fd5b610c1181610eaf565b50565b610c1c610ea7565b73ffffffffffffffffffffffffffffffffffffffff16610c3a610718565b73ffffffffffffffffffffffffffffffffffffffff1614610c90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8790611668565b60405180910390fd5b6000610c9a610df9565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610cd29190611547565b60206040518083038186803b158015610cea57600080fd5b505afa158015610cfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d229190611312565b905080821115610d67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5e90611688565b60405180910390fd5b610da0610d72610718565b83610d7b610df9565b73ffffffffffffffffffffffffffffffffffffffff16610e219092919063ffffffff16565b610da8610718565b73ffffffffffffffffffffffffffffffffffffffff167f2633cbe4191fdf74794314ce683537a6e9a7a937779b4a6a0264d3f591e1982e83604051610ded9190611708565b60405180910390a25050565b60007f000000000000000000000000f5cfbc74057c610c8ef151a439252680ac68c6dc905090565b610ea28363a9059cbb60e01b8484604051602401610e40929190611562565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610f73565b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000610fd5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661103a9092919063ffffffff16565b90506000815111156110355780806020019051810190610ff591906112c0565b611034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102b906116e8565b60405180910390fd5b5b505050565b60606110498484600085611052565b90509392505050565b606082471015611097576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108e90611608565b60405180910390fd5b6110a085611166565b6110df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d6906116a8565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516111089190611530565b60006040518083038185875af1925050503d8060008114611145576040519150601f19603f3d011682016040523d82523d6000602084013e61114a565b606091505b509150915061115a828286611179565b92505050949350505050565b600080823b905060008111915050919050565b60608315611189578290506111d9565b60008351111561119c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d091906115a6565b60405180910390fd5b9392505050565b6000813590506111ef81611cf6565b92915050565b60008151905061120481611d0d565b92915050565b60008135905061121981611d24565b92915050565b60008151905061122e81611d24565b92915050565b60006020828403121561124657600080fd5b6000611254848285016111e0565b91505092915050565b6000806000806080858703121561127357600080fd5b6000611281878288016111e0565b94505060206112928782880161120a565b93505060406112a38782880161120a565b92505060606112b48782880161120a565b91505092959194509250565b6000602082840312156112d257600080fd5b60006112e0848285016111f5565b91505092915050565b6000602082840312156112fb57600080fd5b60006113098482850161120a565b91505092915050565b60006020828403121561132457600080fd5b60006113328482850161121f565b91505092915050565b611344816118a1565b82525050565b60006113558261175a565b61135f8185611770565b935061136f81856020860161190d565b80840191505092915050565b611384816118e9565b82525050565b600061139582611765565b61139f818561177b565b93506113af81856020860161190d565b6113b8816119cf565b840191505092915050565b60006113d060268361177b565b91506113db826119e0565b604082019050919050565b60006113f360358361177b565b91506113fe82611a2f565b604082019050919050565b600061141660268361177b565b915061142182611a7e565b604082019050919050565b600061143960418361177b565b915061144482611acd565b606082019050919050565b600061145c603e8361177b565b915061146782611b42565b604082019050919050565b600061147f60208361177b565b915061148a82611b91565b602082019050919050565b60006114a260388361177b565b91506114ad82611bba565b604082019050919050565b60006114c5601d8361177b565b91506114d082611c09565b602082019050919050565b60006114e860438361177b565b91506114f382611c32565b606082019050919050565b600061150b602a8361177b565b915061151682611ca7565b604082019050919050565b61152a816118df565b82525050565b600061153c828461134a565b915081905092915050565b600060208201905061155c600083018461133b565b92915050565b6000604082019050611577600083018561133b565b6115846020830184611521565b9392505050565b60006020820190506115a0600083018461137b565b92915050565b600060208201905081810360008301526115c0818461138a565b905092915050565b600060208201905081810360008301526115e1816113c3565b9050919050565b60006020820190508181036000830152611601816113e6565b9050919050565b6000602082019050818103600083015261162181611409565b9050919050565b600060208201905081810360008301526116418161142c565b9050919050565b600060208201905081810360008301526116618161144f565b9050919050565b6000602082019050818103600083015261168181611472565b9050919050565b600060208201905081810360008301526116a181611495565b9050919050565b600060208201905081810360008301526116c1816114b8565b9050919050565b600060208201905081810360008301526116e1816114db565b9050919050565b60006020820190508181036000830152611701816114fe565b9050919050565b600060208201905061171d6000830184611521565b92915050565b60006060820190506117386000830186611521565b6117456020830185611521565b6117526040830184611521565b949350505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611797826118df565b91506117a2836118df565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156117d7576117d6611971565b5b828201905092915050565b60006117ed826118df565b91506117f8836118df565b925082611808576118076119a0565b5b828204905092915050565b600061181e826118df565b9150611829836118df565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561186257611861611971565b5b828202905092915050565b6000611878826118df565b9150611883836118df565b92508282101561189657611895611971565b5b828203905092915050565b60006118ac826118bf565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006118f4826118fb565b9050919050565b6000611906826118bf565b9050919050565b60005b8381101561192b578082015181840152602081019050611910565b8381111561193a576000848401525b50505050565b600061194b826118df565b9150611956836118df565b925082611966576119656119a0565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f537570657276697365644d756c746954696d656c6f636b3a206e6f206d6f726560008201527f2062656e6566697420746f2077697468647261772e0000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f537570657276697365644d756c746954696d656c6f636b3a2072656c6561736560008201527f20656e642074696d65206973206265666f72652063757272656e742074696d6560208201527f2e00000000000000000000000000000000000000000000000000000000000000604082015250565b7f537570657276697365644d756c746954696d656c6f636b3a207468652061646460008201527f7265737320697320616c726561647920612062656e65666963696172792e0000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f537570657276697365644d756c746954696d656c6f636b3a206465706f73697460008201527f656420616d6f756e74206973206e6f7420656e6f7567682e0000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f537570657276697365644d756c746954696d656c6f636b3a2074686520746f7460008201527f616c20616d6f756e742073686f756c642062652067726561746572207468616e60208201527f20302e0000000000000000000000000000000000000000000000000000000000604082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b611cff816118a1565b8114611d0a57600080fd5b50565b611d16816118b3565b8114611d2157600080fd5b50565b611d2d816118df565b8114611d3857600080fd5b5056fea2646970667358221220c2ef32b3c66989673df6a9604007d06043cabf1bd93a11eba30810da984d776964736f6c63430008040033
Verified Source Code Partial Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: No
SupervisedMultiTimelock.sol 633 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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;
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");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @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 Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 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(
IERC20 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'
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(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - 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(IERC20 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
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
struct Benefit {
uint256 totalAmount;
uint256 releaseStartTime;
uint256 releaseEndTime;
uint256 withdrawnAmount;
}
/**
* @dev A token holder contract that will allow a beneficiary to withdraw the
* tokens after a given release time.
*/
contract SupervisedMultiTimelock is Ownable {
using SafeERC20 for IERC20;
// Seconds of a day
uint256 private constant SECONDS_OF_A_DAY = 86400;
// The OctToken contract
IERC20 private immutable _token;
mapping(address => Benefit) _beneficiaries;
event BenefitIsIssued(
address indexed beneficiary,
uint256 amount,
uint256 releaseStartTime,
uint256 daysOfTimelock
);
event BenefitIsWithdrawn(address indexed beneficiary, uint256 amount);
event BenefitIsTerminated(address indexed beneficiary);
constructor(IERC20 token_) {
_token = token_;
}
/**
* @return the token being held.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the issued benefit of a beneficiary
*/
function issuedBenefitOf(address addr) public view returns (uint256) {
return _beneficiaries[addr].totalAmount;
}
/**
* @return the amount which can be withdrawn by a beneficiary at the moment
*/
function releasedAmountOf(address addr) public view returns (uint256) {
Benefit memory benefit = _beneficiaries[addr];
if (benefit.totalAmount == 0) return 0;
if (block.timestamp <= benefit.releaseStartTime) return 0;
if (block.timestamp > benefit.releaseEndTime) {
return benefit.totalAmount;
}
uint256 passedDays = (block.timestamp - benefit.releaseStartTime) /
SECONDS_OF_A_DAY;
uint256 totalDays = (benefit.releaseEndTime -
benefit.releaseStartTime) / SECONDS_OF_A_DAY;
return (benefit.totalAmount * passedDays) / totalDays;
}
/**
* @return the unreleased amount of a beneficiary at the moment
*/
function unreleasedAmountOf(address addr) public view returns (uint256) {
Benefit memory benefit = _beneficiaries[addr];
if (benefit.totalAmount == 0) return 0;
return benefit.totalAmount - releasedAmountOf(addr);
}
/**
* @return the withdrawn amount of a beneficiary at the moment
*/
function withdrawnAmountOf(address addr) public view returns (uint256) {
return _beneficiaries[addr].withdrawnAmount;
}
/**
* @notice Issue a certain amount benefit to a beneficiary.
* An address of a beneficiary can only be used once.
*/
function issueBenefitTo(
address addr,
uint256 totalAmount_,
uint256 releaseStartTime_,
uint256 daysOfTimelock_
) public onlyOwner {
require(
issuedBenefitOf(addr) == 0,
"SupervisedMultiTimelock: the address is already a beneficiary."
);
releaseStartTime_ -= (releaseStartTime_ % SECONDS_OF_A_DAY);
uint256 releaseEndTime = releaseStartTime_ +
daysOfTimelock_ *
SECONDS_OF_A_DAY;
require(
releaseEndTime > block.timestamp,
"SupervisedMultiTimelock: release end time is before current time."
);
require(
totalAmount_ > 0,
"SupervisedMultiTimelock: the total amount should be greater than 0."
);
_beneficiaries[addr] = Benefit({
totalAmount: totalAmount_,
releaseStartTime: releaseStartTime_,
releaseEndTime: releaseEndTime,
withdrawnAmount: 0
});
emit BenefitIsIssued(
addr,
totalAmount_,
releaseStartTime_,
daysOfTimelock_
);
}
/**
* @notice Withdraws benefit of a beneficiary.
* This function can be called by any account.
*/
function withdrawBenefitOf(address addr) public {
require(
releasedAmountOf(addr) > withdrawnAmountOf(addr),
"SupervisedMultiTimelock: no more benefit to withdraw."
);
uint256 amount = releasedAmountOf(addr) - withdrawnAmountOf(addr);
require(
token().balanceOf(address(this)) >= amount,
"SupervisedMultiTimelock: deposited amount is not enough."
);
_beneficiaries[addr].withdrawnAmount += amount;
token().safeTransfer(addr, amount);
emit BenefitIsWithdrawn(addr, amount);
}
/**
* @notice Remove a certain beneficiary from this contract.
* The removed beneficiary can not withdraw benefit from this contract any more.
*/
function terminateBenefitOf(address addr) public onlyOwner {
delete _beneficiaries[addr];
emit BenefitIsTerminated(addr);
}
/**
* @notice Withdraw a certain amount of remaining benefit to the owner.
*/
function withdrawRemainingBenefit(uint256 amount) public onlyOwner {
uint256 remainingAmount = token().balanceOf(address(this));
require(
amount <= remainingAmount,
"SupervisedMultiTimelock: deposited amount is not enough."
);
token().safeTransfer(owner(), amount);
emit BenefitIsWithdrawn(owner(), amount);
}
}
Read Contract
issuedBenefitOf 0x952d9407 → uint256
owner 0x8da5cb5b → address
releasedAmountOf 0x7fba0192 → uint256
token 0xfc0c546a → address
unreleasedAmountOf 0x32713211 → uint256
withdrawnAmountOf 0x00cc8ad8 → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
issueBenefitTo 0xe1c3d9ca
address addr
uint256 totalAmount_
uint256 releaseStartTime_
uint256 daysOfTimelock_
renounceOwnership 0x715018a6
No parameters
terminateBenefitOf 0x8e12befc
address addr
transferOwnership 0xf2fde38b
address newOwner
withdrawBenefitOf 0x400a1395
address addr
withdrawRemainingBenefit 0xf750361a
uint256 amount
Recent Transactions
No transactions found for this address