More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 600 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Unstake | 65380991 | 1 hr ago | IN | 0 POL | 0.00165924 | ||||
Unstake | 65380986 | 1 hr ago | IN | 0 POL | 0.00221205 | ||||
Unstake | 65380832 | 1 hr ago | IN | 0 POL | 0.00165924 | ||||
Unstake | 65380828 | 1 hr ago | IN | 0 POL | 0.00217188 | ||||
Unstake | 65305460 | 46 hrs ago | IN | 0 POL | 0.0021762 | ||||
Unstake | 65305460 | 46 hrs ago | IN | 0 POL | 0.00839748 | ||||
Unstake | 64846867 | 13 days ago | IN | 0 POL | 0.00217224 | ||||
Unstake | 64815132 | 14 days ago | IN | 0 POL | 0.00165924 | ||||
Unstake | 64074412 | 32 days ago | IN | 0 POL | 0.0050743 | ||||
Unstake | 63663402 | 43 days ago | IN | 0 POL | 0.01582675 | ||||
Unstake | 63663387 | 43 days ago | IN | 0 POL | 0.02091408 | ||||
Unstake | 63462383 | 48 days ago | IN | 0 POL | 0.02252964 | ||||
Unstake | 63352000 | 50 days ago | IN | 0 POL | 0.00253294 | ||||
Unstake | 63135618 | 56 days ago | IN | 0 POL | 0.00193135 | ||||
Unstake | 61718003 | 91 days ago | IN | 0 POL | 0.00079848 | ||||
Unstake | 61718003 | 91 days ago | IN | 0 POL | 0.00165924 | ||||
Unstake | 61486840 | 96 days ago | IN | 0 POL | 0.00217307 | ||||
Unstake | 61331943 | 100 days ago | IN | 0 POL | 0.00165924 | ||||
Unstake | 60867201 | 112 days ago | IN | 0 POL | 0.00271571 | ||||
Unstake | 60866433 | 112 days ago | IN | 0 POL | 0.00279693 | ||||
Unstake | 60866354 | 112 days ago | IN | 0 POL | 0.00349364 | ||||
Unstake | 60827953 | 113 days ago | IN | 0 POL | 0.0144816 | ||||
Unstake | 60823543 | 113 days ago | IN | 0 POL | 0.00165924 | ||||
Unstake | 60822515 | 113 days ago | IN | 0 POL | 0.00217224 | ||||
Unstake | 60736323 | 115 days ago | IN | 0 POL | 0.00217224 |
Loading...
Loading
Contract Name:
GenesisStaker
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract GenesisStaker { address public constant CRE = 0xe81432473290F4ffCFc5E823F8069Db83e8A677B; address public constant CREPE = 0x5516d551Af482B4eef4B909138d5e48e05a7f50a; struct StakeConfig { uint32 start; uint32 end; uint128 exchangeRate; uint256 totalStaked; uint256 totalStaker; } mapping(uint8 => StakeConfig) public stakeConfigs; mapping(uint8 => mapping(address => uint256)) public userStakedAmount; event Stake(address indexed staker, uint8 stakeId, uint256 indexed unstakedAmount, uint256 indexed stakedAmount); event Unstake(address indexed staker, uint8 stakeId, uint256 indexed unstakedAmount); constructor(uint32[3] memory start_, uint32[3] memory end_) { stakeConfigs[0] = StakeConfig({start: start_[0], end: end_[0], exchangeRate: 104 * 1e16, totalStaked: 0, totalStaker: 0}); stakeConfigs[1] = StakeConfig({start: start_[1], end: end_[1], exchangeRate: 112 * 1e16, totalStaked: 0, totalStaker: 0}); stakeConfigs[2] = StakeConfig({start: start_[2], end: end_[2], exchangeRate: 136 * 1e16, totalStaked: 0, totalStaker: 0}); } /// @notice burn CREPE tokens and record the balance for paying rewards in CRE tokens /// @param stakeId ID to identify lockup period(3, 6, 12 month) /// @param amount amount of CREPE token function stake(uint8 stakeId, uint256 amount) external { require(amount > 0, "GenesisStaker: invalid amount"); require(stakeConfigs[stakeId].start > block.timestamp, "GenesisStaker: already started"); unchecked { if (userStakedAmount[stakeId][msg.sender] == 0) { stakeConfigs[stakeId].totalStaker++; } // Since the total amount of CREPE tokens issued does not exceed the overflow range of uint256 type // there is no need to check overflow. userStakedAmount[stakeId][msg.sender] += amount; stakeConfigs[stakeId].totalStaked += amount; } IERC20(CREPE).transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, amount); emit Stake(msg.sender, stakeId, lockedCreToken(stakeId), amount); } function lockedCreToken(uint8 stakeId) public view returns (uint256) { unchecked { return userStakedAmount[stakeId][msg.sender] * stakeConfigs[stakeId].exchangeRate / 1e18; } } /// @notice claim staking rewards after lockup period /// @param stakeId ID to identify lock-up period(3, 6, 12 month) function unstake(uint8 stakeId) external { require(stakeConfigs[stakeId].end <= block.timestamp, "GenesisStaker: not ended"); uint256 lockedCreAmount = lockedCreToken(stakeId); uint256 stakedAmount = userStakedAmount[stakeId][msg.sender]; require(stakedAmount > 0, "GenesisStaker: not enough stake amount"); unchecked { userStakedAmount[stakeId][msg.sender] = 0; stakeConfigs[stakeId].totalStaked -= stakedAmount; stakeConfigs[stakeId].totalStaker -= 1; } IERC20(CRE).transfer(msg.sender, lockedCreAmount); emit Unstake(msg.sender, stakeId, lockedCreAmount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
{ "remappings": [ "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/=lib/openzeppelin-contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint32[3]","name":"start_","type":"uint32[3]"},{"internalType":"uint32[3]","name":"end_","type":"uint32[3]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint8","name":"stakeId","type":"uint8"},{"indexed":true,"internalType":"uint256","name":"unstakedAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"stakedAmount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint8","name":"stakeId","type":"uint8"},{"indexed":true,"internalType":"uint256","name":"unstakedAmount","type":"uint256"}],"name":"Unstake","type":"event"},{"inputs":[],"name":"CRE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CREPE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"stakeId","type":"uint8"}],"name":"lockedCreToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"stakeId","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"stakeConfigs","outputs":[{"internalType":"uint32","name":"start","type":"uint32"},{"internalType":"uint32","name":"end","type":"uint32"},{"internalType":"uint128","name":"exchangeRate","type":"uint128"},{"internalType":"uint256","name":"totalStaked","type":"uint256"},{"internalType":"uint256","name":"totalStaker","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"stakeId","type":"uint8"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"userStakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610ac6380380610ac683398101604081905261002f9161036e565b6040805160a08082018352845163ffffffff9081168352845181166020808501918252670e6ed27d66680000858701908152600060608088018281526080808a0184815284805284875299517fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5805498519651918a166001600160401b0319998a1617640100000000978b16880217600160401b600160c01b0319908116680100000000000000006001600160801b0394851681029190911790925593517fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb6559a517fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb7558b51808b018d52878f01518a1681528d8801518a16818901908152670f8b0a10e4700000828f0190815282870188815283860189815260018a52898c5293517fada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7d805494519351918f16948e1694909417928e168b029290921787169185168f0291909117909155517fada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7e55517fada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7f558b51998a018c529c8b0151881689529a8a015187168886019081526712dfb0cb5e8800009a89019a8b529188018381529a8801838152600284529290945295517fabbb5caa7dda850e60932de0934eb1f9d0f59695050f761dc64e443e5030a569805497519951918716979095169690961797909416029590951790941691909516909102179055517fabbb5caa7dda850e60932de0934eb1f9d0f59695050f761dc64e443e5030a56a55517fabbb5caa7dda850e60932de0934eb1f9d0f59695050f761dc64e443e5030a56b556103a3565b805163ffffffff811681146102e757600080fd5b919050565b600082601f8301126102fd57600080fd5b604051606081016001600160401b038111828210171561032d57634e487b7160e01b600052604160045260246000fd5b60405280606084018581111561034257600080fd5b845b8181101561036357610355816102d3565b835260209283019201610344565b509195945050505050565b60008060c0838503121561038157600080fd5b61038b84846102ec565b915061039a84606085016102ec565b90509250929050565b610714806103b26000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806387a021721161005b57806387a02172146100f6578063dd752e551461010b578063fc5a88551461011e578063febda9f31461014957600080fd5b806337956f19146100825780633af21a35146100ba578063653bba64146100db575b600080fd5b61009d735516d551af482b4eef4b909138d5e48e05a7f50a81565b6040516001600160a01b0390911681526020015b60405180910390f35b6100cd6100c836600461062d565b6101d9565b6040519081526020016100b1565b61009d73e81432473290f4ffcfc5e823f8069db83e8a677b81565b61010961010436600461062d565b61021f565b005b61010961011936600461064f565b61041b565b6100cd61012c366004610679565b600160209081526000928352604080842090915290825290205481565b61019b61015736600461062d565b60006020819052908152604090208054600182015460029092015463ffffffff80831693640100000000840490911692600160401b90046001600160801b03169185565b6040805163ffffffff96871681529590941660208601526001600160801b03909216928401929092526060830191909152608082015260a0016100b1565b60ff81166000908152602081815260408083205460018352818420338552909252822054670de0b6b3a764000091600160401b90046001600160801b0316020492915050565b60ff81166000908152602081905260409020544264010000000090910463ffffffff1611156102955760405162461bcd60e51b815260206004820152601860248201527f47656e657369735374616b65723a206e6f7420656e646564000000000000000060448201526064015b60405180910390fd5b60006102a0826101d9565b60ff831660009081526001602090815260408083203384529091529020549091508061031d5760405162461bcd60e51b815260206004820152602660248201527f47656e657369735374616b65723a206e6f7420656e6f756768207374616b6520604482015265185b5bdd5b9d60d21b606482015260840161028c565b60ff831660008181526001602081815260408084203380865290835281852085905594845290839052918290209081018054859003905560020180546000190190555163a9059cbb60e01b815260048101919091526024810183905273e81432473290f4ffcfc5e823f8069db83e8a677b9063a9059cbb906044016020604051808303816000875af11580156103b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103db91906106bc565b5060405160ff84168152829033907fe1def031b88ae1ebcc087e477df1bce22ebf4b87493f61e4cf1e80a0c763a07d9060200160405180910390a3505050565b6000811161046b5760405162461bcd60e51b815260206004820152601d60248201527f47656e657369735374616b65723a20696e76616c696420616d6f756e74000000604482015260640161028c565b60ff82166000908152602081905260409020544263ffffffff909116116104d45760405162461bcd60e51b815260206004820152601e60248201527f47656e657369735374616b65723a20616c726561647920737461727465640000604482015260640161028c565b60ff8216600090815260016020908152604080832033845290915281205490036105155760ff82166000908152602081905260409020600201805460010190555b60ff8216600081815260016020818152604080842033808652908352818520805488019055948452908390529182902001805484019055516323b872dd60e01b8152600481019190915261dead602482015260448101829052735516d551af482b4eef4b909138d5e48e05a7f50a906323b872dd906064016020604051808303816000875af11580156105ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d091906106bc565b50806105db836101d9565b60405160ff8516815233907f7fa17a908208bbfb241756b0066a3f36c8a3b1e5a99930243d37da3212ed42bf9060200160405180910390a45050565b803560ff8116811461062857600080fd5b919050565b60006020828403121561063f57600080fd5b61064882610617565b9392505050565b6000806040838503121561066257600080fd5b61066b83610617565b946020939093013593505050565b6000806040838503121561068c57600080fd5b61069583610617565b915060208301356001600160a01b03811681146106b157600080fd5b809150509250929050565b6000602082840312156106ce57600080fd5b8151801515811461064857600080fdfea264697066735822122053469712f16525822b92b952b9774ac5969a43af2c0a6b5bb537204a36ee98dd64736f6c634300081300330000000000000000000000000000000000000000000000000000000064a20f800000000000000000000000000000000000000000000000000000000064a20f800000000000000000000000000000000000000000000000000000000064a20f80000000000000000000000000000000000000000000000000000000006518b6800000000000000000000000000000000000000000000000000000000065920080000000000000000000000000000000000000000000000000000000006681f180
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806387a021721161005b57806387a02172146100f6578063dd752e551461010b578063fc5a88551461011e578063febda9f31461014957600080fd5b806337956f19146100825780633af21a35146100ba578063653bba64146100db575b600080fd5b61009d735516d551af482b4eef4b909138d5e48e05a7f50a81565b6040516001600160a01b0390911681526020015b60405180910390f35b6100cd6100c836600461062d565b6101d9565b6040519081526020016100b1565b61009d73e81432473290f4ffcfc5e823f8069db83e8a677b81565b61010961010436600461062d565b61021f565b005b61010961011936600461064f565b61041b565b6100cd61012c366004610679565b600160209081526000928352604080842090915290825290205481565b61019b61015736600461062d565b60006020819052908152604090208054600182015460029092015463ffffffff80831693640100000000840490911692600160401b90046001600160801b03169185565b6040805163ffffffff96871681529590941660208601526001600160801b03909216928401929092526060830191909152608082015260a0016100b1565b60ff81166000908152602081815260408083205460018352818420338552909252822054670de0b6b3a764000091600160401b90046001600160801b0316020492915050565b60ff81166000908152602081905260409020544264010000000090910463ffffffff1611156102955760405162461bcd60e51b815260206004820152601860248201527f47656e657369735374616b65723a206e6f7420656e646564000000000000000060448201526064015b60405180910390fd5b60006102a0826101d9565b60ff831660009081526001602090815260408083203384529091529020549091508061031d5760405162461bcd60e51b815260206004820152602660248201527f47656e657369735374616b65723a206e6f7420656e6f756768207374616b6520604482015265185b5bdd5b9d60d21b606482015260840161028c565b60ff831660008181526001602081815260408084203380865290835281852085905594845290839052918290209081018054859003905560020180546000190190555163a9059cbb60e01b815260048101919091526024810183905273e81432473290f4ffcfc5e823f8069db83e8a677b9063a9059cbb906044016020604051808303816000875af11580156103b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103db91906106bc565b5060405160ff84168152829033907fe1def031b88ae1ebcc087e477df1bce22ebf4b87493f61e4cf1e80a0c763a07d9060200160405180910390a3505050565b6000811161046b5760405162461bcd60e51b815260206004820152601d60248201527f47656e657369735374616b65723a20696e76616c696420616d6f756e74000000604482015260640161028c565b60ff82166000908152602081905260409020544263ffffffff909116116104d45760405162461bcd60e51b815260206004820152601e60248201527f47656e657369735374616b65723a20616c726561647920737461727465640000604482015260640161028c565b60ff8216600090815260016020908152604080832033845290915281205490036105155760ff82166000908152602081905260409020600201805460010190555b60ff8216600081815260016020818152604080842033808652908352818520805488019055948452908390529182902001805484019055516323b872dd60e01b8152600481019190915261dead602482015260448101829052735516d551af482b4eef4b909138d5e48e05a7f50a906323b872dd906064016020604051808303816000875af11580156105ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d091906106bc565b50806105db836101d9565b60405160ff8516815233907f7fa17a908208bbfb241756b0066a3f36c8a3b1e5a99930243d37da3212ed42bf9060200160405180910390a45050565b803560ff8116811461062857600080fd5b919050565b60006020828403121561063f57600080fd5b61064882610617565b9392505050565b6000806040838503121561066257600080fd5b61066b83610617565b946020939093013593505050565b6000806040838503121561068c57600080fd5b61069583610617565b915060208301356001600160a01b03811681146106b157600080fd5b809150509250929050565b6000602082840312156106ce57600080fd5b8151801515811461064857600080fdfea264697066735822122053469712f16525822b92b952b9774ac5969a43af2c0a6b5bb537204a36ee98dd64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000064a20f800000000000000000000000000000000000000000000000000000000064a20f800000000000000000000000000000000000000000000000000000000064a20f80000000000000000000000000000000000000000000000000000000006518b6800000000000000000000000000000000000000000000000000000000065920080000000000000000000000000000000000000000000000000000000006681f180
-----Decoded View---------------
Arg [0] : start_ (uint32[3]): 1688342400,1688342400,1688342400
Arg [1] : end_ (uint32[3]): 1696118400,1704067200,1719792000
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000064a20f80
Arg [1] : 0000000000000000000000000000000000000000000000000000000064a20f80
Arg [2] : 0000000000000000000000000000000000000000000000000000000064a20f80
Arg [3] : 000000000000000000000000000000000000000000000000000000006518b680
Arg [4] : 0000000000000000000000000000000000000000000000000000000065920080
Arg [5] : 000000000000000000000000000000000000000000000000000000006681f180
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.