Address Details
contract
0x05A25740F343c503A8181A85898F2ADECEbf1AA5
- Contract Name
- TimeLockedWalletFactory
- Creator
- 0xf89de3–3140d3 at 0x5af51b–f998c9
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- Fetching transactions...
- Transfers
- Fetching transfers...
- Gas Used
- Fetching gas used...
- Last Balance Update
- 13631400
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- TimeLockedWalletFactory
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 10000000
- EVM Version
- istanbul
- Verified at
- 2022-06-20T15:52:48.821858Z
project:/contracts/TimeLockedWalletFactory.sol
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "./TimeLockedWallet.sol"; contract TimeLockedWalletFactory { TimeLockedWallet[] public wallets; mapping(address => TimeLockedWallet[]) wals; event TimeLockedWalletCreated(address _creator, address _owner); function getWallets(address _user) public view returns (TimeLockedWallet[] memory) { return wals[_user]; } function createTimeLockedWallet( address _owner, IERC20 _token, uint256 _unlockDate ) external { TimeLockedWallet wallet = new TimeLockedWallet( _owner, _token, _unlockDate ); wallets.push(wallet); // Add wallet to sender's wallets. wals[msg.sender].push(wallet); // If owner is the same as sender then add wallet to sender's wallets too. if (msg.sender != _owner) { wals[_owner].push(wallet); } // Emit event. Created(wallet, msg.sender, _owner, block.timestamp, _unlockDate); } // Prevents accidental sending of ether to the factory receive() external payable { revert(); } event Created( TimeLockedWallet wallet, address from, address to, uint256 createdAt, uint256 unlockDate ); }
/_openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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); }
/project_/contracts/TimeLockedWallet.sol
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract TimeLockedWallet { address public owner; address public creator; uint256 public unlockDate; uint256 public createdAt; IERC20 public token; modifier onlyOwner { require(msg.sender == owner); _; } constructor( address _owner, IERC20 _token, uint256 _unlockDate ) public { owner = _owner; creator = msg.sender; unlockDate = _unlockDate; createdAt = block.timestamp; token = _token; } // keep all the ether sent to this address receive() external payable { emit Received(msg.sender, msg.value); } // callable by owner only, after specified time, only for Tokens implementing ERC20 function stake(uint256 _stake) onlyOwner public { require(block.timestamp >= unlockDate, "Valid timestamp required"); //now send all the token balance require(_stake > 0, "You need to send some funds"); token.transferFrom(owner, address(this), _stake); emit StackedTokens(token, msg.sender, _stake); } // callable by owner only, after specified time, only for Tokens implementing ERC20 function withdraw() onlyOwner public { require(block.timestamp >= unlockDate, "Not ready for collection yet"); //now send all the token balance uint256 tokenBalance = token.balanceOf(address(this)); token.transfer(owner, tokenBalance); emit WithdrewTokens(token, msg.sender, tokenBalance); } function info() public view returns(address, address, uint256, uint256, uint256) { uint256 tokenBalance = token.balanceOf(address(this)); return (creator, owner, unlockDate, createdAt, tokenBalance); } event Received(address from, uint256 amount); event Withdrew(address to, uint256 amount); event WithdrewTokens(IERC20 tokenContract, address to, uint256 amount); event StackedTokens(IERC20 tokenContract, address to, uint256 amount); }
Contract ABI
[{"type":"event","name":"Created","inputs":[{"type":"address","name":"wallet","internalType":"contract TimeLockedWallet","indexed":false},{"type":"address","name":"from","internalType":"address","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":false},{"type":"uint256","name":"createdAt","internalType":"uint256","indexed":false},{"type":"uint256","name":"unlockDate","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TimeLockedWalletCreated","inputs":[{"type":"address","name":"_creator","internalType":"address","indexed":false},{"type":"address","name":"_owner","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createTimeLockedWallet","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"uint256","name":"_unlockDate","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"contract TimeLockedWallet[]"}],"name":"getWallets","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract TimeLockedWallet"}],"name":"wallets","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405234801561001057600080fd5b50610cd5806100206000396000f3fe6080604052600436106100385760003560e01c8063422c29a414610047578063638db3d1146100d75780637ad71f721461012957610042565b3661004257600080fd5b600080fd5b34801561005357600080fd5b506100876004803603602081101561006a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661017c565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100c35781810151838201526020016100ab565b505050509050019250505060405180910390f35b3480156100e357600080fd5b50610127600480360360608110156100fa57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561020c565b005b34801561013557600080fd5b506101536004803603602081101561014c57600080fd5b50356103ed565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561020057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116101d5575b50505050509050919050565b600083838360405161021d90610421565b808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051809103906000f08015801561027d573d6000803e3d6000fd5b5060008054600181810183557f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563909101805473ffffffffffffffffffffffffffffffffffffffff8086167fffffffffffffffffffffffff000000000000000000000000000000000000000092831681179093553380865260208581526040872080549687018155875290952090930180549091169091179055919250908516146103845773ffffffffffffffffffffffffffffffffffffffff848116600090815260016020818152604083208054928301815583529091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169183169190911790555b6040805173ffffffffffffffffffffffffffffffffffffffff80841682523360208301528616818301524260608201526080810184905290517ff0f51ce8bf61058e1fe833930823622a4b0e3e7c0cbd93369fbc238b3a59031a9181900360a00190a150505050565b600081815481106103fa57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6108718061042f8339019056fe608060405234801561001057600080fd5b506040516108713803806108718339818101604052606081101561003357600080fd5b5080516020820151604090920151600080546001600160a01b039384166001600160a01b0319918216179091556001805482163317905560029190915542600355600480549290931691161790556107e1806100906000396000f3fe60806040526004361061007f5760003560e01c80638da5cb5b1161004e5780638da5cb5b1461019a578063a694fc3a146101af578063cf09e0d0146101d9578063fc0c546a146101ee576100c0565b806302d05d3f146100c5578063370158ea146101035780633ccfd60b1461015c57806369ac572114610173576100c0565b366100c0576040805133815234602082015281517f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874929181900390910190a1005b600080fd5b3480156100d157600080fd5b506100da610203565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010f57600080fd5b5061011861021f565b6040805173ffffffffffffffffffffffffffffffffffffffff9687168152949095166020850152838501929092526060830152608082015290519081900360a00190f35b34801561016857600080fd5b50610171610314565b005b34801561017f57600080fd5b50610188610556565b60408051918252519081900360200190f35b3480156101a657600080fd5b506100da61055c565b3480156101bb57600080fd5b50610171600480360360208110156101d257600080fd5b5035610578565b3480156101e557600080fd5b50610188610789565b3480156101fa57600080fd5b506100da61078f565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156102b157600080fd5b505afa1580156102c5573d6000803e3d6000fd5b505050506040513d60208110156102db57600080fd5b505160015460005460025460035473ffffffffffffffffffffffffffffffffffffffff9384169b93909216995097509550909350915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461033857600080fd5b6002544210156103a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4e6f7420726561647920666f7220636f6c6c656374696f6e2079657400000000604482015290519081900360640190fd5b60048054604080517f70a0823100000000000000000000000000000000000000000000000000000000815230938101939093525160009273ffffffffffffffffffffffffffffffffffffffff909216916370a08231916024808301926020929190829003018186803b15801561041e57600080fd5b505afa158015610432573d6000803e3d6000fd5b505050506040513d602081101561044857600080fd5b50516004805460008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169581019590955260248501869052519495509091169263a9059cbb926044808201936020939283900390910190829087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050506040513d60208110156104f957600080fd5b50506004546040805173ffffffffffffffffffffffffffffffffffffffff9092168252336020830152818101839052517fa04c965e7d289704527a948915777d68bb4530fb4b08aa935fb958c0b7901ab99181900360600190a150565b60025481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461059c57600080fd5b60025442101561060d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f56616c69642074696d657374616d702072657175697265640000000000000000604482015290519081900360640190fd5b6000811161067c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f596f75206e65656420746f2073656e6420736f6d652066756e64730000000000604482015290519081900360640190fd5b6004805460008054604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169581019590955230602486015260448501869052519216926323b872dd9260648083019360209383900390910190829087803b15801561070257600080fd5b505af1158015610716573d6000803e3d6000fd5b505050506040513d602081101561072c57600080fd5b50506004546040805173ffffffffffffffffffffffffffffffffffffffff9092168252336020830152818101839052517f6e1979e18ab7f9d4f12445c7b6c6c15ddd5fcb3261b349e985d05e7eb2a5d7e19181900360600190a150565b60035481565b60045473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220a8ffa09bf2c684f17067755b6bcc5e6003e79474d5d490d5cbbcce88785efadb64736f6c634300060c0033a2646970667358221220eb4877d6c94611576cf98aa0b4b8106ca88dcd69a329acd4d363d4a67162ffeb64736f6c634300060c0033
Deployed ByteCode
0x6080604052600436106100385760003560e01c8063422c29a414610047578063638db3d1146100d75780637ad71f721461012957610042565b3661004257600080fd5b600080fd5b34801561005357600080fd5b506100876004803603602081101561006a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661017c565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100c35781810151838201526020016100ab565b505050509050019250505060405180910390f35b3480156100e357600080fd5b50610127600480360360608110156100fa57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561020c565b005b34801561013557600080fd5b506101536004803603602081101561014c57600080fd5b50356103ed565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561020057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116101d5575b50505050509050919050565b600083838360405161021d90610421565b808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051809103906000f08015801561027d573d6000803e3d6000fd5b5060008054600181810183557f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563909101805473ffffffffffffffffffffffffffffffffffffffff8086167fffffffffffffffffffffffff000000000000000000000000000000000000000092831681179093553380865260208581526040872080549687018155875290952090930180549091169091179055919250908516146103845773ffffffffffffffffffffffffffffffffffffffff848116600090815260016020818152604083208054928301815583529091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169183169190911790555b6040805173ffffffffffffffffffffffffffffffffffffffff80841682523360208301528616818301524260608201526080810184905290517ff0f51ce8bf61058e1fe833930823622a4b0e3e7c0cbd93369fbc238b3a59031a9181900360a00190a150505050565b600081815481106103fa57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6108718061042f8339019056fe608060405234801561001057600080fd5b506040516108713803806108718339818101604052606081101561003357600080fd5b5080516020820151604090920151600080546001600160a01b039384166001600160a01b0319918216179091556001805482163317905560029190915542600355600480549290931691161790556107e1806100906000396000f3fe60806040526004361061007f5760003560e01c80638da5cb5b1161004e5780638da5cb5b1461019a578063a694fc3a146101af578063cf09e0d0146101d9578063fc0c546a146101ee576100c0565b806302d05d3f146100c5578063370158ea146101035780633ccfd60b1461015c57806369ac572114610173576100c0565b366100c0576040805133815234602082015281517f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874929181900390910190a1005b600080fd5b3480156100d157600080fd5b506100da610203565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010f57600080fd5b5061011861021f565b6040805173ffffffffffffffffffffffffffffffffffffffff9687168152949095166020850152838501929092526060830152608082015290519081900360a00190f35b34801561016857600080fd5b50610171610314565b005b34801561017f57600080fd5b50610188610556565b60408051918252519081900360200190f35b3480156101a657600080fd5b506100da61055c565b3480156101bb57600080fd5b50610171600480360360208110156101d257600080fd5b5035610578565b3480156101e557600080fd5b50610188610789565b3480156101fa57600080fd5b506100da61078f565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156102b157600080fd5b505afa1580156102c5573d6000803e3d6000fd5b505050506040513d60208110156102db57600080fd5b505160015460005460025460035473ffffffffffffffffffffffffffffffffffffffff9384169b93909216995097509550909350915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461033857600080fd5b6002544210156103a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4e6f7420726561647920666f7220636f6c6c656374696f6e2079657400000000604482015290519081900360640190fd5b60048054604080517f70a0823100000000000000000000000000000000000000000000000000000000815230938101939093525160009273ffffffffffffffffffffffffffffffffffffffff909216916370a08231916024808301926020929190829003018186803b15801561041e57600080fd5b505afa158015610432573d6000803e3d6000fd5b505050506040513d602081101561044857600080fd5b50516004805460008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169581019590955260248501869052519495509091169263a9059cbb926044808201936020939283900390910190829087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050506040513d60208110156104f957600080fd5b50506004546040805173ffffffffffffffffffffffffffffffffffffffff9092168252336020830152818101839052517fa04c965e7d289704527a948915777d68bb4530fb4b08aa935fb958c0b7901ab99181900360600190a150565b60025481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461059c57600080fd5b60025442101561060d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f56616c69642074696d657374616d702072657175697265640000000000000000604482015290519081900360640190fd5b6000811161067c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f596f75206e65656420746f2073656e6420736f6d652066756e64730000000000604482015290519081900360640190fd5b6004805460008054604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169581019590955230602486015260448501869052519216926323b872dd9260648083019360209383900390910190829087803b15801561070257600080fd5b505af1158015610716573d6000803e3d6000fd5b505050506040513d602081101561072c57600080fd5b50506004546040805173ffffffffffffffffffffffffffffffffffffffff9092168252336020830152818101839052517f6e1979e18ab7f9d4f12445c7b6c6c15ddd5fcb3261b349e985d05e7eb2a5d7e19181900360600190a150565b60035481565b60045473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220a8ffa09bf2c684f17067755b6bcc5e6003e79474d5d490d5cbbcce88785efadb64736f6c634300060c0033a2646970667358221220eb4877d6c94611576cf98aa0b4b8106ca88dcd69a329acd4d363d4a67162ffeb64736f6c634300060c0033