Address Contract Verified
Address
0xD032E251b5AdE1153Edc64a7467a8046F4eb416C
Balance
0 ETH
Nonce
1
Code Size
6965 bytes
Creator
0x5502121c...E604 at tx 0xd0ace13c...dfb49c
Indexed Transactions
0
Contract Bytecode
6965 bytes
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80639c9b2e2111610097578063b14f2a3911610066578063b14f2a3914610200578063c4f59f9b1461021c578063db2175c61461023a578063f2fde38b14610256576100f5565b80639c9b2e211461017c5780639ed4475d14610198578063a4d5e67c146101c8578063abf091f8146101e4576100f5565b806361d027b3116100d357806361d027b31461012c578063715018a61461014a5780638456cb59146101545780638da5cb5b1461015e576100f5565b8063372500ab146100fa5780633f4ba83a146101045780635c975abb1461010e575b600080fd5b610102610272565b005b61010c6104dc565b005b6101166104ee565b604051610123919061121e565b60405180910390f35b610134610504565b60405161014191906112b8565b60405180910390f35b61015261052a565b005b61015c61053e565b005b610166610550565b60405161017391906112f4565b60405180910390f35b6101966004803603810190610191919061134f565b610579565b005b6101b260048036038101906101ad919061137c565b610711565b6040516101bf91906113d5565b60405180910390f35b6101e260048036038101906101dd919061134f565b610798565b005b6101fe60048036038101906101f991906116b1565b610a5b565b005b61021a600480360381019061021591906117b2565b610c18565b005b610224610c64565b604051610231919061189d565b60405180910390f35b610254600480360381019061024f9190611915565b610cf2565b005b610270600480360381019061026b919061134f565b610de7565b005b61027a610e6d565b6000600480549050905060005b818110156104d8576000600482815481106102a5576102a46119aa565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632fdcfbd28333846040518463ffffffff1660e01b8152600401610434939291906119d9565b600060405180830381600087803b15801561044e57600080fd5b505af1158015610462573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f70eb43c4a8ae8c40502dcf22436c509c28d6ff421cf07c491be56984bd987068836040516104c391906113d5565b60405180910390a38260010192505050610287565b5050565b6104e4610eae565b6104ec610f35565b565b60008060149054906101000a900460ff16905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610532610eae565b61053c6000610f97565b565b610546610eae565b61054e61105b565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610581610eae565b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561061057806040517f75ebc7fd00000000000000000000000000000000000000000000000000000000815260040161060791906112f4565b60405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f1714865bf5baa84e3439536a013c87cfe030b4cd69f344a5f2a4877de3d517ce60405160405180910390a250565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107a0610eae565b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661082f57806040517f1dc1422300000000000000000000000000000000000000000000000000000000815260040161082691906112f4565b60405180910390fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600480549050905060005b81811015610a12576000600482815481106108b2576108b16119aa565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610a065760046001846109219190611a3f565b81548110610932576109316119aa565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048381548110610971576109706119aa565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060048054806109cb576109ca611a73565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055905550610a12565b81600101915050610894565b508273ffffffffffffffffffffffffffffffffffffffff167f963b7c735475147a62c589c2d7cb8ec4b0a6b7af4f97373d79ebfa42ab8aa7dc60405160405180910390a2505050565b610a63610eae565b6000838390509050600082519050808214610ab75781816040517f6daf7aaa000000000000000000000000000000000000000000000000000000008152600401610aae929190611aa2565b60405180910390fd5b600087879050905060005b83811015610be1576000858281518110610adf57610ade6119aa565b5b6020026020010151905080518314610b31578281516040517f6daf7aaa000000000000000000000000000000000000000000000000000000008152600401610b28929190611aa2565b60405180910390fd5b60005b83811015610bd457610bc9898985818110610b5257610b516119aa565b5b9050602002016020810190610b67919061134f565b8c8c84818110610b7a57610b796119aa565b5b9050602002016020810190610b8f919061134f565b898681518110610ba257610ba16119aa565b5b60200260200101518481518110610bbc57610bbb6119aa565b5b60200260200101516110be565b806001019050610b34565b5081600101915050610ac2565b507f58c5a7aba7052a54eeac525c81ac095f2e6bb3d50736bef0af6bb6badc99421660405160405180910390a15050505050505050565b610c20610eae565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606004805480602002602001604051908101604052809291908181526020018280548015610ce857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610c9e575b5050505050905090565b610cfa610eae565b60008484905090506000838390509050808214610d505781816040517f6daf7aaa000000000000000000000000000000000000000000000000000000008152600401610d47929190611aa2565b60405180910390fd5b60005b82811015610db157610da6878783818110610d7157610d706119aa565b5b9050602002016020810190610d86919061134f565b89878785818110610d9a57610d996119aa565b5b905060200201356110be565b806001019050610d53565b507f58c5a7aba7052a54eeac525c81ac095f2e6bb3d50736bef0af6bb6badc99421660405160405180910390a150505050505050565b610def610eae565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610e615760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610e5891906112f4565b60405180910390fd5b610e6a81610f97565b50565b610e756104ee565b15610eac576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b610eb66111bb565b73ffffffffffffffffffffffffffffffffffffffff16610ed4610550565b73ffffffffffffffffffffffffffffffffffffffff1614610f3357610ef76111bb565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610f2a91906112f4565b60405180910390fd5b565b610f3d6111c3565b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610f806111bb565b604051610f8d91906112f4565b60405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611063610e6d565b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110a76111bb565b6040516110b491906112f4565b60405180910390a1565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461114a9190611acb565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fa41f5bd7891c57f6f64860c1a11cd8bc4ce2bc7323fc62d93a9c258377fa0a63836040516111ae91906113d5565b60405180910390a3505050565b600033905090565b6111cb6104ee565b611201576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60008115159050919050565b61121881611203565b82525050565b6000602082019050611233600083018461120f565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061127e61127961127484611239565b611259565b611239565b9050919050565b600061129082611263565b9050919050565b60006112a282611285565b9050919050565b6112b281611297565b82525050565b60006020820190506112cd60008301846112a9565b92915050565b60006112de82611239565b9050919050565b6112ee816112d3565b82525050565b600060208201905061130960008301846112e5565b92915050565b6000604051905090565b600080fd5b600080fd5b61132c816112d3565b811461133757600080fd5b50565b60008135905061134981611323565b92915050565b60006020828403121561136557611364611319565b5b60006113738482850161133a565b91505092915050565b6000806040838503121561139357611392611319565b5b60006113a18582860161133a565b92505060206113b28582860161133a565b9150509250929050565b6000819050919050565b6113cf816113bc565b82525050565b60006020820190506113ea60008301846113c6565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611415576114146113f0565b5b8235905067ffffffffffffffff811115611432576114316113f5565b5b60208301915083602082028301111561144e5761144d6113fa565b5b9250929050565b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61149e82611455565b810181811067ffffffffffffffff821117156114bd576114bc611466565b5b80604052505050565b60006114d061130f565b90506114dc8282611495565b919050565b600067ffffffffffffffff8211156114fc576114fb611466565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561152857611527611466565b5b602082029050602081019050919050565b611542816113bc565b811461154d57600080fd5b50565b60008135905061155f81611539565b92915050565b60006115786115738461150d565b6114c6565b9050808382526020820190506020840283018581111561159b5761159a6113fa565b5b835b818110156115c457806115b08882611550565b84526020840193505060208101905061159d565b5050509392505050565b600082601f8301126115e3576115e26113f0565b5b81356115f3848260208601611565565b91505092915050565b600061160f61160a846114e1565b6114c6565b90508083825260208201905060208402830185811115611632576116316113fa565b5b835b8181101561167957803567ffffffffffffffff811115611657576116566113f0565b5b80860161166489826115ce565b85526020850194505050602081019050611634565b5050509392505050565b600082601f830112611698576116976113f0565b5b81356116a88482602086016115fc565b91505092915050565b6000806000806000606086880312156116cd576116cc611319565b5b600086013567ffffffffffffffff8111156116eb576116ea61131e565b5b6116f7888289016113ff565b9550955050602086013567ffffffffffffffff81111561171a5761171961131e565b5b611726888289016113ff565b9350935050604086013567ffffffffffffffff8111156117495761174861131e565b5b61175588828901611683565b9150509295509295909350565b600061176d82611239565b9050919050565b600061177f82611762565b9050919050565b61178f81611774565b811461179a57600080fd5b50565b6000813590506117ac81611786565b92915050565b6000602082840312156117c8576117c7611319565b5b60006117d68482850161179d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611814816112d3565b82525050565b6000611826838361180b565b60208301905092915050565b6000602082019050919050565b600061184a826117df565b61185481856117ea565b935061185f836117fb565b8060005b83811015611890578151611877888261181a565b975061188283611832565b925050600181019050611863565b5085935050505092915050565b600060208201905081810360008301526118b7818461183f565b905092915050565b60008083601f8401126118d5576118d46113f0565b5b8235905067ffffffffffffffff8111156118f2576118f16113f5565b5b60208301915083602082028301111561190e5761190d6113fa565b5b9250929050565b60008060008060006060868803121561193157611930611319565b5b600061193f8882890161133a565b955050602086013567ffffffffffffffff8111156119605761195f61131e565b5b61196c888289016113ff565b9450945050604086013567ffffffffffffffff81111561198f5761198e61131e565b5b61199b888289016118bf565b92509250509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006060820190506119ee60008301866112e5565b6119fb60208301856112e5565b611a0860408301846113c6565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611a4a826113bc565b9150611a55836113bc565b9250828203905081811115611a6d57611a6c611a10565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000604082019050611ab760008301856113c6565b611ac460208301846113c6565b9392505050565b6000611ad6826113bc565b9150611ae1836113bc565b9250828201905080821115611af957611af8611a10565b5b9291505056fea2646970667358221220d64b4fa380a7f52f59232e4c63aaeea5372f772a8f1599e822600590567ddc9d64736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: paris
Optimization: No
CasStakingPool.sol 200 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./interfaces/ITreasury.sol";
contract CasStakingPool is Ownable, Pausable {
ITreasury public treasury;
mapping(address reward => bool) private _activeRewards;
mapping(address user => mapping(address token => uint256))
private _userRewards;
address[] private _rewardTokens;
error CasStakingPool_RewardNotExists(address reward);
error CasStakingPool_RewardAlreadyExists(address reward);
error CasStakingPool_InvalidArrayLength(
uint256 userLength,
uint256 rewardLength
);
event Claim(address indexed token, address indexed user, uint256 amount);
event AddReward(address indexed token);
event RemoveReward(address indexed token);
event RewardUpdate(
address indexed token,
address indexed user,
uint256 amount
);
event RewardDistribution();
modifier isActiveReward(address rewardToken) {
if (!_activeRewards[rewardToken]) {
revert CasStakingPool_RewardNotExists(rewardToken);
}
_;
}
constructor(address _owner, ITreasury _treasury) Ownable(_owner) {
treasury = _treasury;
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function changeTreasury(ITreasury _treasury) external onlyOwner {
treasury = _treasury;
}
function addReward(address rewardToken) external onlyOwner {
if (_activeRewards[rewardToken]) {
revert CasStakingPool_RewardAlreadyExists(rewardToken);
}
_activeRewards[rewardToken] = true;
_rewardTokens.push(rewardToken);
emit AddReward(rewardToken);
}
function removeReward(
address rewardToken
) external onlyOwner isActiveReward(rewardToken) {
_activeRewards[rewardToken] = false;
uint256 length = _rewardTokens.length;
for (uint256 i; i < length; ) {
address reward = _rewardTokens[i];
if (reward == rewardToken) {
_rewardTokens[i] = _rewardTokens[length - 1];
_rewardTokens.pop();
break;
}
unchecked {
++i;
}
}
emit RemoveReward(rewardToken);
}
function updateUsersRewardsBatch(
address[] calldata rewardTokens,
address[] calldata users,
uint256[][] memory rewardAmounts
) external onlyOwner {
uint256 userLength = users.length;
uint256 rewardAmountsLength = rewardAmounts.length;
if (userLength != rewardAmountsLength) {
revert CasStakingPool_InvalidArrayLength(
userLength,
rewardAmountsLength
);
}
uint256 rewardsLength = rewardTokens.length;
for (uint256 i; i < userLength; ) {
uint256[] memory amounts = rewardAmounts[i];
if (rewardsLength != amounts.length) {
revert CasStakingPool_InvalidArrayLength(
rewardsLength,
amounts.length
);
}
for (uint256 j; j < rewardsLength; ) {
_updateUserReward(
users[i],
rewardTokens[j],
rewardAmounts[i][j]
);
unchecked {
++j;
}
}
unchecked {
++i;
}
}
emit RewardDistribution();
}
function updateUsersRewards(
address rewardToken,
address[] calldata users,
uint256[] calldata rewardAmounts
) external onlyOwner {
uint256 userLength = users.length;
uint256 rewardLength = rewardAmounts.length;
if (userLength != rewardLength) {
revert CasStakingPool_InvalidArrayLength(userLength, rewardLength);
}
for (uint256 i; i < userLength; ) {
_updateUserReward(users[i], rewardToken, rewardAmounts[i]);
unchecked {
++i;
}
}
emit RewardDistribution();
}
function _updateUserReward(
address user,
address rewardToken,
uint256 amount
) internal {
_userRewards[user][rewardToken] += amount;
emit RewardUpdate(rewardToken, user, amount);
}
function claimRewards() external whenNotPaused {
uint256 length = _rewardTokens.length;
for (uint256 i; i < length; ) {
address rewardToken = _rewardTokens[i];
uint256 reward = _userRewards[msg.sender][rewardToken];
_userRewards[msg.sender][rewardToken] = 0;
treasury.sendToken(rewardToken, msg.sender, reward);
emit Claim(rewardToken, msg.sender, reward);
unchecked {
++i;
}
}
}
function getRewardTokens() external view returns (address[] memory) {
return _rewardTokens;
}
function getUserRewardAmount(
address user,
address reward
) external view returns (uint256) {
return _userRewards[user][reward];
}
}
ITreasury.sol 18 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface ITreasury {
function sendToken(address token, address to, uint256 amount) external;
function sendNative(uint256 amount, address to) external;
function whiteslists(address) external view returns (bool);
function withdraw(address token, uint256 amount) external;
function withdrawNative(uint256 amount) external;
receive() external payable;
fallback() external;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
Pausable.sol 119 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
Read Contract
getRewardTokens 0xc4f59f9b → address[]
getUserRewardAmount 0x9ed4475d → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
treasury 0x61d027b3 → address
Write Contract 10 functions
These functions modify contract state and require a wallet transaction to execute.
addReward 0x9c9b2e21
address rewardToken
changeTreasury 0xb14f2a39
address _treasury
claimRewards 0x372500ab
No parameters
pause 0x8456cb59
No parameters
removeReward 0xa4d5e67c
address rewardToken
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateUsersRewards 0xdb2175c6
address rewardToken
address[] users
uint256[] rewardAmounts
updateUsersRewardsBatch 0xabf091f8
address[] rewardTokens
address[] users
uint256[][] rewardAmounts
Recent Transactions
No transactions found for this address