More Info
Private Name Tags
ContractCreator
Latest 4 from a total of 4 transactions
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RopeStaking
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /* _ _______ _______ _______ _______ _______ _______ _______ _______ __|_|___( ____ \( ___ )( ____ )( ____ \( ____ )( ___ )( ____ )( ____ \ ( _____/| ( \/| ( ) || ( )|| ( \/| ( )|| ( ) || ( )|| ( \/ | (|_|__ | | | | | || (____)|| (__ | (____)|| | | || (____)|| (__ (_____ )| | | | | || _____)| __) | __)| | | || _____)| __) /\_|_|) || | | | | || ( | ( | (\ ( | | | || ( | ( \_______)| (____/\| (___) || ) | (____/\| ) \ \__| (___) || ) | (____/\ |_| (_______/(_______)|/ (_______/|/ \__/(_______)|/ (_______/ ************************************************ * * * Cope Rope * * https://twitter.com/coperopenft * * * * * ************************************************ */ import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract RopeStaking is Ownable{ mapping(uint256 => uint256) private staked; mapping(uint256 => uint256) private tokensEmitted; mapping(uint256 => uint256) private lastClaimed; address private ropeContract; IERC20 private copeToken; constructor(){} modifier onlyRopeContract { require(msg.sender == ropeContract, "Only rope contract can call this method"); _; } function changeRopeContract(address _ropeContract) external onlyOwner{ ropeContract = _ropeContract; } function changeCopeTokenContract(address _copeTokenContract) external onlyOwner { copeToken = IERC20(_copeTokenContract); } function isStaked(uint256 tokenId) external view returns(bool){ // If above 0, then its currently staked return staked[tokenId] > 0; } function getStakeTime(uint256 tokenId) external view returns(uint256){ return block.timestamp - staked[tokenId]; } function stake(uint256 tokenId) external onlyRopeContract { require(staked[tokenId] == 0, "Already coping"); staked[tokenId] = block.timestamp; lastClaimed[tokenId] = block.timestamp; } function unstake(uint256 tokenId) external onlyRopeContract { uint256 stakedTime = staked[tokenId]; require(stakedTime != 0, "Rope not copping"); require(block.timestamp - stakedTime > 259200, "Minimum 3 day stake"); uint256 tokenReward = (16198 * (10**15)) * (block.timestamp - lastClaimed[tokenId]); // tokensRemaining < tokenReward if((13999999 * (10**18)) - tokensEmitted[tokenId] < tokenReward){ // tokenReward = tokensRemaining tokenReward = (13999999 * (10**18)) - tokensEmitted[tokenId]; } // cap tokenReward if(tokenReward > (13999999 * (10**18))){ tokenReward = (13999999 * (10**18)); } tokensEmitted[tokenId] += tokenReward; copeToken.transfer(tx.origin, tokenReward); lastClaimed[tokenId] = 0; staked[tokenId] = 0; } function claimReward() external onlyRopeContract { copeToken.transfer(tx.origin, 5999999 * (10**18)); } function claim(uint256 tokenId) external onlyRopeContract { require(block.timestamp - lastClaimed[tokenId] > 86400, "24 hours required between cope"); uint256 stakedTime = staked[tokenId]; uint256 tokenReward = (16198 * (10**15)) * (block.timestamp - lastClaimed[tokenId]); // tokensRemaining < tokenReward if((13999999 * (10**18)) - tokensEmitted[tokenId] < tokenReward){ // tokenReward = tokensRemaining tokenReward = (13999999 * (10**18)) - tokensEmitted[tokenId]; } // cap tokenReward if(tokenReward > (13999999 * (10**18))){ tokenReward = (13999999 * (10**18)); } tokensEmitted[tokenId] += tokenReward; copeToken.transfer(tx.origin, tokenReward); lastClaimed[tokenId] = block.timestamp; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"_copeTokenContract","type":"address"}],"name":"changeCopeTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ropeContract","type":"address"}],"name":"changeRopeContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getStakeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610b418061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806381c8d14911610081578063b88a802f1161005b578063b88a802f14610178578063baa51f8614610180578063f2fde38b146101b257600080fd5b806381c8d149146101245780638da5cb5b1461014a578063a694fc3a1461016557600080fd5b80632e17de78116100b25780632e17de78146100f6578063379607f514610109578063715018a61461011c57600080fd5b806307ddea3c146100ce578063256ebc57146100e3575b600080fd5b6100e16100dc366004610a34565b6101c5565b005b6100e16100f1366004610a34565b6101fc565b6100e1610104366004610a64565b610233565b6100e1610117366004610a64565b6104b7565b6100e16106ea565b610137610132366004610a64565b6106fe565b6040519081526020015b60405180910390f35b6000546040516001600160a01b039091168152602001610141565b6100e1610173366004610a64565b61071d565b6100e1610804565b6101a261018e366004610a64565b600090815260016020526040902054151590565b6040519015158152602001610141565b6100e16101c0366004610a34565b6108f0565b6101cd61097d565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61020461097d565b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6004546001600160a01b031633146102a25760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b60648201526084015b60405180910390fd5b600081815260016020526040812054908190036103015760405162461bcd60e51b815260206004820152601060248201527f526f7065206e6f7420636f7070696e67000000000000000000000000000000006044820152606401610299565b6203f48061030f8242610aac565b1161035c5760405162461bcd60e51b815260206004820152601360248201527f4d696e696d756d203320646179207374616b65000000000000000000000000006044820152606401610299565b6000828152600360205260408120546103759042610aac565b6103879067e0cadb2de7c70000610abf565b60008481526002602052604090205490915081906103b0906a0b949d776e7e4b269c0000610aac565b10156103dd576000838152600260205260409020546103da906a0b949d776e7e4b269c0000610aac565b90505b6a0b949d776e7e4b269c00008111156103fe57506a0b949d776e7e4b269c00005b6000838152600260205260408120805483929061041c908490610ad6565b909155505060055460405163a9059cbb60e01b8152326004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104969190610ae9565b50505060009081526003602090815260408083208390556001909152812055565b6004546001600160a01b031633146105215760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b6064820152608401610299565b600081815260036020526040902054620151809061053f9042610aac565b1161058c5760405162461bcd60e51b815260206004820152601e60248201527f323420686f757273207265717569726564206265747765656e20636f706500006044820152606401610299565b60008181526001602090815260408083205460039092528220549091906105b39042610aac565b6105c59067e0cadb2de7c70000610abf565b60008481526002602052604090205490915081906105ee906a0b949d776e7e4b269c0000610aac565b101561061b57600083815260026020526040902054610618906a0b949d776e7e4b269c0000610aac565b90505b6a0b949d776e7e4b269c000081111561063c57506a0b949d776e7e4b269c00005b6000838152600260205260408120805483929061065a908490610ad6565b909155505060055460405163a9059cbb60e01b8152326004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190610ae9565b5050506000908152600360205260409020429055565b6106f261097d565b6106fc60006109d7565b565b6000818152600160205260408120546107179042610aac565b92915050565b6004546001600160a01b031633146107875760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b6064820152608401610299565b600081815260016020526040902054156107e35760405162461bcd60e51b815260206004820152600e60248201527f416c726561647920636f70696e670000000000000000000000000000000000006044820152606401610299565b60009081526001602090815260408083204290819055600390925290912055565b6004546001600160a01b0316331461086e5760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b6064820152608401610299565b60055460405163a9059cbb60e01b81523260048201526a04f68c98f816de1e9c000060248201526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156108c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ed9190610ae9565b50565b6108f861097d565b6001600160a01b0381166109745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610299565b6108ed816109d7565b6000546001600160a01b031633146106fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610299565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610a4657600080fd5b81356001600160a01b0381168114610a5d57600080fd5b9392505050565b600060208284031215610a7657600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561071757610717610a7d565b808202811582820484141761071757610717610a7d565b8082018082111561071757610717610a7d565b600060208284031215610afb57600080fd5b81518015158114610a5d57600080fdfea2646970667358221220fa3e4bb11a293a5658e6f66250b09942065e528699cc2b95cc67d19a474def4d64736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806381c8d14911610081578063b88a802f1161005b578063b88a802f14610178578063baa51f8614610180578063f2fde38b146101b257600080fd5b806381c8d149146101245780638da5cb5b1461014a578063a694fc3a1461016557600080fd5b80632e17de78116100b25780632e17de78146100f6578063379607f514610109578063715018a61461011c57600080fd5b806307ddea3c146100ce578063256ebc57146100e3575b600080fd5b6100e16100dc366004610a34565b6101c5565b005b6100e16100f1366004610a34565b6101fc565b6100e1610104366004610a64565b610233565b6100e1610117366004610a64565b6104b7565b6100e16106ea565b610137610132366004610a64565b6106fe565b6040519081526020015b60405180910390f35b6000546040516001600160a01b039091168152602001610141565b6100e1610173366004610a64565b61071d565b6100e1610804565b6101a261018e366004610a64565b600090815260016020526040902054151590565b6040519015158152602001610141565b6100e16101c0366004610a34565b6108f0565b6101cd61097d565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61020461097d565b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6004546001600160a01b031633146102a25760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b60648201526084015b60405180910390fd5b600081815260016020526040812054908190036103015760405162461bcd60e51b815260206004820152601060248201527f526f7065206e6f7420636f7070696e67000000000000000000000000000000006044820152606401610299565b6203f48061030f8242610aac565b1161035c5760405162461bcd60e51b815260206004820152601360248201527f4d696e696d756d203320646179207374616b65000000000000000000000000006044820152606401610299565b6000828152600360205260408120546103759042610aac565b6103879067e0cadb2de7c70000610abf565b60008481526002602052604090205490915081906103b0906a0b949d776e7e4b269c0000610aac565b10156103dd576000838152600260205260409020546103da906a0b949d776e7e4b269c0000610aac565b90505b6a0b949d776e7e4b269c00008111156103fe57506a0b949d776e7e4b269c00005b6000838152600260205260408120805483929061041c908490610ad6565b909155505060055460405163a9059cbb60e01b8152326004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104969190610ae9565b50505060009081526003602090815260408083208390556001909152812055565b6004546001600160a01b031633146105215760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b6064820152608401610299565b600081815260036020526040902054620151809061053f9042610aac565b1161058c5760405162461bcd60e51b815260206004820152601e60248201527f323420686f757273207265717569726564206265747765656e20636f706500006044820152606401610299565b60008181526001602090815260408083205460039092528220549091906105b39042610aac565b6105c59067e0cadb2de7c70000610abf565b60008481526002602052604090205490915081906105ee906a0b949d776e7e4b269c0000610aac565b101561061b57600083815260026020526040902054610618906a0b949d776e7e4b269c0000610aac565b90505b6a0b949d776e7e4b269c000081111561063c57506a0b949d776e7e4b269c00005b6000838152600260205260408120805483929061065a908490610ad6565b909155505060055460405163a9059cbb60e01b8152326004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190610ae9565b5050506000908152600360205260409020429055565b6106f261097d565b6106fc60006109d7565b565b6000818152600160205260408120546107179042610aac565b92915050565b6004546001600160a01b031633146107875760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b6064820152608401610299565b600081815260016020526040902054156107e35760405162461bcd60e51b815260206004820152600e60248201527f416c726561647920636f70696e670000000000000000000000000000000000006044820152606401610299565b60009081526001602090815260408083204290819055600390925290912055565b6004546001600160a01b0316331461086e5760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920726f706520636f6e74726163742063616e2063616c6c2074686973604482015266081b595d1a1bd960ca1b6064820152608401610299565b60055460405163a9059cbb60e01b81523260048201526a04f68c98f816de1e9c000060248201526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156108c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ed9190610ae9565b50565b6108f861097d565b6001600160a01b0381166109745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610299565b6108ed816109d7565b6000546001600160a01b031633146106fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610299565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610a4657600080fd5b81356001600160a01b0381168114610a5d57600080fd5b9392505050565b600060208284031215610a7657600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561071757610717610a7d565b808202811582820484141761071757610717610a7d565b8082018082111561071757610717610a7d565b600060208284031215610afb57600080fd5b81518015158114610a5d57600080fdfea2646970667358221220fa3e4bb11a293a5658e6f66250b09942065e528699cc2b95cc67d19a474def4d64736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.