Address Contract Partially Verified
Address
0x0DeBa57F372dee1A023F240dEF3ec06515f94e3A
Balance
0 ETH
Nonce
1
Code Size
8741 bytes
Creator
0x5881C0Cb...bA49 at tx 0x6738a7f9...df991f
Indexed Transactions
0
Contract Bytecode
8741 bytes
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80637fa76e43116100b8578063c4ae31681161007c578063c4ae316814610314578063e1ae37db1461031e578063e449f3411461034e578063f2fde38b1461036a578063f345075114610386578063f5081b3d146103b657610137565b80637fa76e4314610270578063802e9c9e1461028c57806382bfefc8146102a85780638da5cb5b146102c6578063a0f45b69146102e457610137565b8063624d7b72116100ff578063624d7b72146101e057806369d03738146102105780636f23d6961461022c578063715018a6146102485780637c0b8de21461025257610137565b80630a42f0491461013c5780630fbf0a931461016c578063150b7a02146101885780634e71d92d146101b85780635c975abb146101c2575b600080fd5b610156600480360381019061015191906118e7565b6103d4565b6040516101639190611c8e565b60405180910390f35b6101866004803603810190610181919061186d565b6103ec565b005b6101a2600480360381019061019d91906117ea565b6106dd565b6040516101af9190611b7d565b60405180910390f35b6101c0610781565b005b6101ca6109d3565b6040516101d79190611b62565b60405180910390f35b6101fa60048036038101906101f59190611790565b6109e6565b6040516102079190611c8e565b60405180910390f35b61022a60048036038101906102259190611790565b6109fe565b005b610246600480360381019061024191906118e7565b610abe565b005b610250610b44565b005b61025a610bcc565b6040516102679190611bb3565b60405180910390f35b61028a600480360381019061028591906118ba565b610bf2565b005b6102a660048036038101906102a19190611790565b610cb4565b005b6102b0610d74565b6040516102bd9190611b98565b60405180910390f35b6102ce610d9a565b6040516102db9190611ac5565b60405180910390f35b6102fe60048036038101906102f991906118e7565b610dc3565b60405161030b9190611ac5565b60405180910390f35b61031c610df6565b005b61033860048036038101906103339190611790565b610e9e565b6040516103459190611b40565b60405180910390f35b6103686004803603810190610363919061186d565b610f35565b005b610384600480360381019061037f9190611790565b610f8c565b005b6103a0600480360381019061039b91906118e7565b611084565b6040516103ad9190611c8e565b60405180910390f35b6103be6111b0565b6040516103cb9190611c8e565b60405180910390f35b60026020528060005260406000206000915090505481565b600560009054906101000a900460ff161561043c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043390611bce565b60405180910390fd5b60005b828290508110156106d857600083838381811061045f5761045e612001565b5b905060200201359050610470611293565b73ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016104e19190611c8e565b60206040518083038186803b1580156104f957600080fd5b505afa15801561050d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053191906117bd565b73ffffffffffffffffffffffffffffffffffffffff1614156106c45742600260008381526020019081526020016000208190555061056d611293565b6001600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd610604611293565b30846040518463ffffffff1660e01b815260040161062493929190611ae0565b600060405180830381600087803b15801561063e57600080fd5b505af1158015610652573d6000803e3d6000fd5b5050505060046000610662611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150506001900390600052602060002001600090919091909150555b5080806106d090611f5a565b91505061043f565b505050565b60008473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076690611c0e565b60405180910390fd5b63150b7a0260e01b9050949350505050565b600560009054906101000a900460ff16156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890611bce565b60405180910390fd5b60006107e36107de611293565b610e9e565b90506000805b82518110156108aa57600083828151811061080757610806612001565b5b60200260200101519050610819611293565b73ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156108965761088881611084565b836108939190611d49565b92505b5080806108a290611f5a565b9150506107e9565b50600081116108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e590611c2e565b60405180910390fd5b42600360006108fb611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663449a52f861097f611293565b836040518363ffffffff1660e01b815260040161099d929190611b17565b600060405180830381600087803b1580156109b757600080fd5b505af11580156109cb573d6000803e3d6000fd5b505050505050565b600560009054906101000a900460ff1681565b60036020528060005260406000206000915090505481565b610a06611293565b73ffffffffffffffffffffffffffffffffffffffff16610a24610d9a565b73ffffffffffffffffffffffffffffffffffffffff1614610a7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7190611c4e565b60405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610ac6611293565b73ffffffffffffffffffffffffffffffffffffffff16610ae4610d9a565b73ffffffffffffffffffffffffffffffffffffffff1614610b3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3190611c4e565b60405180910390fd5b8060078190555050565b610b4c611293565b73ffffffffffffffffffffffffffffffffffffffff16610b6a610d9a565b73ffffffffffffffffffffffffffffffffffffffff1614610bc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb790611c4e565b60405180910390fd5b610bca600061129b565b565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610c04610bff611293565b610e9e565b90508115610c1557610c14610781565b5b60005b8151811015610c5d576000828281518110610c3657610c35612001565b5b60200260200101519050610c498161135f565b508080610c5590611f5a565b915050610c18565b5060046000610c6a611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610cb09190611638565b5050565b610cbc611293565b73ffffffffffffffffffffffffffffffffffffffff16610cda610d9a565b73ffffffffffffffffffffffffffffffffffffffff1614610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611c4e565b60405180910390fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610dfe611293565b73ffffffffffffffffffffffffffffffffffffffff16610e1c610d9a565b73ffffffffffffffffffffffffffffffffffffffff1614610e72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6990611c4e565b60405180910390fd5b600560009054906101000a900460ff1615600560006101000a81548160ff021916908315150217905550565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610f2957602002820191906000526020600020905b815481526020019060010190808311610f15575b50505050509050919050565b60005b82829050811015610f87576000838383818110610f5857610f57612001565b5b905060200201359050610f6a8161135f565b610f73816114f5565b508080610f7f90611f5a565b915050610f38565b505050565b610f94611293565b73ffffffffffffffffffffffffffffffffffffffff16610fb2610d9a565b73ffffffffffffffffffffffffffffffffffffffff1614611008576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fff90611c4e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106f90611bee565b60405180910390fd5b6110818161129b565b50565b600080600260008481526020019081526020016000205414806110a8575060065482145b156110b657600090506111ab565b6000600360006110c4611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546002600085815260200190815260200160002054116111645760036000611124611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611179565b60026000848152602001908152602001600020545b90506000610e10824261118c9190611e2a565b6111969190611d9f565b9050600754816111a69190611dd0565b925050505b919050565b6000806111c36111be611293565b610e9e565b90506000805b825181101561128a5760008382815181106111e7576111e6612001565b5b602002602001015190506111f9611293565b73ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156112765761126881611084565b836112739190611d49565b92505b50808061128290611f5a565b9150506111c9565b50809250505090565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611367611293565b73ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611407576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fe90611c6e565b60405180910390fd5b60006001600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd306114a1611293565b846040518463ffffffff1660e01b81526004016114c093929190611ae0565b600060405180830381600087803b1580156114da57600080fd5b505af11580156114ee573d6000803e3d6000fd5b5050505050565b60005b60046000611504611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015611634578160046000611556611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106115a2576115a1612001565b5b9060005260206000200154141561162157600654600460006115c2611293565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061160e5761160d612001565b5b9060005260206000200181905550611634565b808061162c90611f5a565b9150506114f8565b5050565b50805460008255906000526020600020908101906116569190611659565b50565b5b8082111561167257600081600090555060010161165a565b5090565b600061168961168484611cce565b611ca9565b9050828152602081018484840111156116a5576116a461206e565b5b6116b0848285611f1a565b509392505050565b6000813590506116c7816121aa565b92915050565b6000815190506116dc816121aa565b92915050565b60008083601f8401126116f8576116f7612064565b5b8235905067ffffffffffffffff8111156117155761171461205f565b5b60208301915083602082028301111561173157611730612069565b5b9250929050565b600081359050611747816121c1565b92915050565b600082601f83011261176257611761612064565b5b8135611772848260208601611676565b91505092915050565b60008135905061178a816121d8565b92915050565b6000602082840312156117a6576117a5612078565b5b60006117b4848285016116b8565b91505092915050565b6000602082840312156117d3576117d2612078565b5b60006117e1848285016116cd565b91505092915050565b6000806000806080858703121561180457611803612078565b5b6000611812878288016116b8565b9450506020611823878288016116b8565b93505060406118348782880161177b565b925050606085013567ffffffffffffffff81111561185557611854612073565b5b6118618782880161174d565b91505092959194509250565b6000806020838503121561188457611883612078565b5b600083013567ffffffffffffffff8111156118a2576118a1612073565b5b6118ae858286016116e2565b92509250509250929050565b6000602082840312156118d0576118cf612078565b5b60006118de84828501611738565b91505092915050565b6000602082840312156118fd576118fc612078565b5b600061190b8482850161177b565b91505092915050565b60006119208383611aa7565b60208301905092915050565b61193581611e5e565b82525050565b600061194682611d0f565b6119508185611d27565b935061195b83611cff565b8060005b8381101561198c5781516119738882611914565b975061197e83611d1a565b92505060018101905061195f565b5085935050505092915050565b6119a281611e70565b82525050565b6119b181611e7c565b82525050565b6119c081611ed2565b82525050565b6119cf81611ef6565b82525050565b60006119e2600683611d38565b91506119ed8261208e565b602082019050919050565b6000611a05602683611d38565b9150611a10826120b7565b604082019050919050565b6000611a28600b83611d38565b9150611a3382612106565b602082019050919050565b6000611a4b601483611d38565b9150611a568261212f565b602082019050919050565b6000611a6e602083611d38565b9150611a7982612158565b602082019050919050565b6000611a91601083611d38565b9150611a9c82612181565b602082019050919050565b611ab081611ec8565b82525050565b611abf81611ec8565b82525050565b6000602082019050611ada600083018461192c565b92915050565b6000606082019050611af5600083018661192c565b611b02602083018561192c565b611b0f6040830184611ab6565b949350505050565b6000604082019050611b2c600083018561192c565b611b396020830184611ab6565b9392505050565b60006020820190508181036000830152611b5a818461193b565b905092915050565b6000602082019050611b776000830184611999565b92915050565b6000602082019050611b9260008301846119a8565b92915050565b6000602082019050611bad60008301846119b7565b92915050565b6000602082019050611bc860008301846119c6565b92915050565b60006020820190508181036000830152611be7816119d5565b9050919050565b60006020820190508181036000830152611c07816119f8565b9050919050565b60006020820190508181036000830152611c2781611a1b565b9050919050565b60006020820190508181036000830152611c4781611a3e565b9050919050565b60006020820190508181036000830152611c6781611a61565b9050919050565b60006020820190508181036000830152611c8781611a84565b9050919050565b6000602082019050611ca36000830184611ab6565b92915050565b6000611cb3611cc4565b9050611cbf8282611f29565b919050565b6000604051905090565b600067ffffffffffffffff821115611ce957611ce8612030565b5b611cf28261207d565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000611d5482611ec8565b9150611d5f83611ec8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611d9457611d93611fa3565b5b828201905092915050565b6000611daa82611ec8565b9150611db583611ec8565b925082611dc557611dc4611fd2565b5b828204905092915050565b6000611ddb82611ec8565b9150611de683611ec8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e1f57611e1e611fa3565b5b828202905092915050565b6000611e3582611ec8565b9150611e4083611ec8565b925082821015611e5357611e52611fa3565b5b828203905092915050565b6000611e6982611ea8565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611edd82611ee4565b9050919050565b6000611eef82611ea8565b9050919050565b6000611f0182611f08565b9050919050565b6000611f1382611ea8565b9050919050565b82818337600083830152505050565b611f328261207d565b810181811067ffffffffffffffff82111715611f5157611f50612030565b5b80604052505050565b6000611f6582611ec8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611f9857611f97611fa3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5041555345440000000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f6e6f7420616c6c6f776564000000000000000000000000000000000000000000600082015250565b7f5749544844524157205a45524f20544f4b454e53000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f6f776e657273686970206661696c656400000000000000000000000000000000600082015250565b6121b381611e5e565b81146121be57600080fd5b50565b6121ca81611e70565b81146121d557600080fd5b50565b6121e181611ec8565b81146121ec57600080fd5b5056fea2646970667358221220e375c5fb39a30438e79f9e2ba38993c19f27274589eddba45942badfd61d73a664736f6c63430008060033
Verified Source Code Partial Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: No
FXY.sol 37 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./Administration.sol";
contract FXY is ERC20, Administration {
uint256 private _initialTokens = 10000000000 ether;
constructor() ERC20("FXY", "FXY") {}
function initialMint() external onlyAdmin {
require(totalSupply() == 0, "ERROR: Assets found");
_mint(owner(), _initialTokens);
}
function mintTokens(uint amount) public onlyAdmin {
_mint(owner(), amount);
}
function mintTo(address to, uint amount) public onlyAdmin {
_mint(to, amount);
}
function burnTokens(uint amount) external onlyAdmin {
_burn(owner(), amount);
}
function buy(address from, uint amount) external onlyAdmin {
_burn(from, amount);
}
function withdraw() external onlyOwner {
payable(_msgSender()).transfer(address(this).balance);
}
}
Staker.sol 141 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./FXY.sol";
contract Staker is Ownable, IERC721Receiver {
mapping (uint => address) public ownership;
mapping(uint => uint) public stakeTime;
mapping(address => uint) public lastWithdraw;
mapping (address => uint[]) private _qty;
bool public paused = false;
uint nullToken = 1 ether;
uint tokensHour = 1;
IERC721 public NFT;
FXY public TOKEN;
modifier notPaused(){
require(!paused, "PAUSED");
_;
}
constructor() {
}
function setTokenshour(uint new_) external onlyOwner {
tokensHour = new_;
}
function togglePause() public onlyOwner {
paused = !paused;
}
function setNFTAddress(address new_) external onlyOwner {
NFT = IERC721(new_);
}
function setCOINAddress(address new_) external onlyOwner {
TOKEN = FXY(new_);
}
function getAssetsByHolder(address holder) public view returns (uint[] memory){
return _qty[holder];
}
function getProfits(uint tokenId) public view returns(uint) {
if(stakeTime[tokenId] == 0 || tokenId == nullToken){
return 0;
}
uint lWithdraw = stakeTime[tokenId] > lastWithdraw[_msgSender()] ? stakeTime[tokenId] : lastWithdraw[_msgSender()];
uint sTime = (block.timestamp - lWithdraw) / 1 hours;
return sTime * tokensHour;
}
function getAllProfits() public view returns(uint) {
uint[] memory tokenIds = getAssetsByHolder(_msgSender());
uint profits = 0 ;
for(uint i=0; i< tokenIds.length; i++){
uint tokenId = tokenIds[i];
if(ownership[tokenId] == _msgSender()){
profits += getProfits(tokenId);
}
}
return profits;
}
function stake(uint[] calldata tokenIds) public notPaused {
for(uint i=0; i < tokenIds.length; i++){
uint tokenId = tokenIds[i];
if(NFT.ownerOf(tokenId) == _msgSender()){
stakeTime[tokenId] = block.timestamp;
ownership[tokenId] = _msgSender();
NFT.transferFrom(_msgSender(), address(this), tokenId);
_qty[_msgSender()].push(tokenId);
}
}
}
function unstake(uint[] calldata tokenIds) public {
for(uint i=0; i< tokenIds.length; i++){
uint tokenId = tokenIds[i];
recover(tokenId);
removeToken(tokenId);
}
}
function unstakeAll(bool wd) public {
uint[] memory tokenIds = getAssetsByHolder(_msgSender());
if(wd){
claim();
}
for(uint i=0; i< tokenIds.length; i++){
uint tokenId = tokenIds[i];
recover(tokenId);
}
delete _qty[_msgSender()];
}
function recover(uint tokenId) internal {
require(ownership[tokenId] == _msgSender(), "ownership failed");
ownership[tokenId] = address(0);
NFT.transferFrom(address(this), _msgSender(), tokenId);
}
function removeToken(uint tokenId) internal {
for(uint i=0;i<_qty[_msgSender()].length;i++){
if(_qty[_msgSender()][i] == tokenId){
_qty[_msgSender()][i] = nullToken;
break;
}
}
}
function claim() public notPaused {
uint[] memory tokenIds = getAssetsByHolder(_msgSender());
uint profits = 0 ;
for(uint i=0; i< tokenIds.length; i++){
uint tokenId = tokenIds[i];
if(ownership[tokenId] == _msgSender()){
profits += getProfits(tokenId);
}
}
require(profits > 0, "WITHDRAW ZERO TOKENS");
lastWithdraw[_msgSender()] = block.timestamp;
TOKEN.mintTo(_msgSender(), profits);
}
function onERC721Received(
address operator,
address,
uint256,
bytes memory
) public virtual override returns (bytes4) {
require(address(NFT) == operator, "not allowed");
return this.onERC721Received.selector;
}
}
Administration.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Administration is Ownable {
event SetAdmin(address indexed admin, bool active);
mapping (address => bool) private admins;
modifier onlyAdmin(){
require(admins[_msgSender()] || owner() == _msgSender(), "Admin: caller is not an admin");
_;
}
function setAdmin(address admin, bool active) external onlyOwner {
admins[admin] = active;
emit SetAdmin(admin, active);
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
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;
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
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() {
_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);
}
}
ERC20.sol 355 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
IERC20.sol 81 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);
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC20Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Read Contract
NFT 0x7c0b8de2 → address
TOKEN 0x82bfefc8 → address
getAllProfits 0xf5081b3d → uint256
getAssetsByHolder 0xe1ae37db → uint256[]
getProfits 0xf3450751 → uint256
lastWithdraw 0x624d7b72 → uint256
owner 0x8da5cb5b → address
ownership 0xa0f45b69 → address
paused 0x5c975abb → bool
stakeTime 0x0a42f049 → uint256
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
claim 0x4e71d92d
No parameters
onERC721Received 0x150b7a02
address operator
address
uint256
bytes
returns: bytes4
renounceOwnership 0x715018a6
No parameters
setCOINAddress 0x802e9c9e
address new_
setNFTAddress 0x69d03738
address new_
setTokenshour 0x6f23d696
uint256 new_
stake 0x0fbf0a93
uint256[] tokenIds
togglePause 0xc4ae3168
No parameters
transferOwnership 0xf2fde38b
address newOwner
unstake 0xe449f341
uint256[] tokenIds
unstakeAll 0x7fa76e43
bool wd
Recent Transactions
No transactions found for this address