Overview
POL Balance
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
RadarStakingBalance
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.17; // Author: @mizi import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/iRadarStake.sol"; contract RadarStakingBalance is Ownable { constructor() {} /** PUBLIC VARS */ // interface of the staking contract (stateful) iRadarStake public radarStakeContract; /** PUBLIC */ // return totalStaked value unless user has triggered cooldown and that cooldown has expired, then return 0 function balanceOf(address addr) external view returns (uint256) { // users current stake iRadarStake.Stake memory myStake = radarStakeContract.getStake(addr); // calculate the timestamp when the cooldown is over uint256 endOfCooldownTimestamp = myStake.cooldownTriggeredAtTimestamp + myStake.cooldownSeconds; // if cooldown has passed, return 0 staked tokens if (myStake.cooldownTriggeredAtTimestamp > 0 && block.timestamp >= endOfCooldownTimestamp) { return 0; } return myStake.totalStaked; } /** ONLY OWNER */ function setContracts(address radarStakeContractAddr) external onlyOwner { require(address(radarStakeContractAddr) != address(0), "RadarStakingLogic: Staking contract not set"); radarStakeContract = iRadarStake(radarStakeContractAddr); } }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.17; interface iRadarStake { // store lock meta data struct Stake { uint256 totalStaked; uint256 lastStakedTimestamp; uint256 cooldownSeconds; uint256 cooldownTriggeredAtTimestamp; } struct Apr { uint256 startTime; uint256 endTime; uint256 apr; // e.g. 300 => 3% } function getAllAprs() external view returns(Apr[] memory); function getStake(address addr) external view returns (Stake memory); function addToStake(uint256 amount, address addr) external; // onlyStakingLogicContract function triggerUnstake(address addr) external; // onlyStakingLogicContract function removeFromStake(uint256 amount, address addr) external; // onlyStakingLogicContract }
// 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; } }
// 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); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
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":"addr","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"radarStakeContract","outputs":[{"internalType":"contract iRadarStake","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"radarStakeContractAddr","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6104e98061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80638da5cb5b116100505780638da5cb5b146100ba578063d8edfdcd146100df578063f2fde38b146100f257600080fd5b80635a2e2f471461007757806370a082311461008c578063715018a6146100b2575b600080fd5b61008a6100853660046103e8565b610105565b005b61009f61009a3660046103e8565b6101bd565b6040519081526020015b60405180910390f35b61008a61028d565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100a9565b6001546100c7906001600160a01b031681565b61008a6101003660046103e8565b6102a1565b61010d610331565b6001600160a01b03811661018e5760405162461bcd60e51b815260206004820152602b60248201527f52616461725374616b696e674c6f6769633a205374616b696e6720636f6e747260448201527f616374206e6f742073657400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546040517f7a7664600000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000928392911690637a76646090602401608060405180830381865afa158015610224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102489190610418565b9050600081604001518260600151610260919061048c565b9050600082606001511180156102765750804210155b15610285575060009392505050565b505192915050565b610295610331565b61029f600061038b565b565b6102a9610331565b6001600160a01b0381166103255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610185565b61032e8161038b565b50565b6000546001600160a01b0316331461029f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610185565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156103fa57600080fd5b81356001600160a01b038116811461041157600080fd5b9392505050565b60006080828403121561042a57600080fd5b6040516080810181811067ffffffffffffffff8211171561045b57634e487b7160e01b600052604160045260246000fd5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b808201808211156104ad57634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212203724af989d69f1a693f3d89b4af9cca5ad99cf866bd3d99ce0b9c6ec0840741e64736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100725760003560e01c80638da5cb5b116100505780638da5cb5b146100ba578063d8edfdcd146100df578063f2fde38b146100f257600080fd5b80635a2e2f471461007757806370a082311461008c578063715018a6146100b2575b600080fd5b61008a6100853660046103e8565b610105565b005b61009f61009a3660046103e8565b6101bd565b6040519081526020015b60405180910390f35b61008a61028d565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100a9565b6001546100c7906001600160a01b031681565b61008a6101003660046103e8565b6102a1565b61010d610331565b6001600160a01b03811661018e5760405162461bcd60e51b815260206004820152602b60248201527f52616461725374616b696e674c6f6769633a205374616b696e6720636f6e747260448201527f616374206e6f742073657400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546040517f7a7664600000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000928392911690637a76646090602401608060405180830381865afa158015610224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102489190610418565b9050600081604001518260600151610260919061048c565b9050600082606001511180156102765750804210155b15610285575060009392505050565b505192915050565b610295610331565b61029f600061038b565b565b6102a9610331565b6001600160a01b0381166103255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610185565b61032e8161038b565b50565b6000546001600160a01b0316331461029f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610185565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156103fa57600080fd5b81356001600160a01b038116811461041157600080fd5b9392505050565b60006080828403121561042a57600080fd5b6040516080810181811067ffffffffffffffff8211171561045b57634e487b7160e01b600052604160045260246000fd5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b808201808211156104ad57634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212203724af989d69f1a693f3d89b4af9cca5ad99cf866bd3d99ce0b9c6ec0840741e64736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 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.