More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 17 from a total of 17 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim Rewards | 21123710 | 48 days ago | IN | 0 ETH | 0.00565024 | ||||
Claim Rewards | 21123694 | 48 days ago | IN | 0 ETH | 0.00624328 | ||||
Distribute Rewar... | 21123643 | 48 days ago | IN | 0 ETH | 0.00024483 | ||||
Claim Rewards | 21123573 | 48 days ago | IN | 0 ETH | 0.00043002 | ||||
Claim Rewards | 21123568 | 48 days ago | IN | 0 ETH | 0.0004071 | ||||
Distribute Rewar... | 21123552 | 48 days ago | IN | 0 ETH | 0.00031075 | ||||
Claim Rewards | 21123542 | 48 days ago | IN | 0 ETH | 0.00049462 | ||||
Set Epoch Durati... | 21123539 | 48 days ago | IN | 0 ETH | 0.00036153 | ||||
Claim Rewards | 21123532 | 48 days ago | IN | 0 ETH | 0.00049276 | ||||
Claim Rewards | 21123525 | 48 days ago | IN | 0 ETH | 0.00094991 | ||||
Stake | 21123397 | 48 days ago | IN | 0 ETH | 0.00078343 | ||||
Stake | 21123181 | 48 days ago | IN | 0 ETH | 0.00142884 | ||||
Update Ecrow Poo... | 21123170 | 48 days ago | IN | 0 ETH | 0.00033694 | ||||
Set Withdraw Fee | 21123169 | 48 days ago | IN | 0 ETH | 0.00055544 | ||||
Set Fee Receiver | 21123169 | 48 days ago | IN | 0 ETH | 0.00056316 | ||||
Change Reward Di... | 21123161 | 48 days ago | IN | 0 ETH | 0.00033577 | ||||
Add Deposit Rewa... | 21123160 | 48 days ago | IN | 0 ETH | 0.00126117 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
ChykLpStaking
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/ILiquidityDistributionManager.sol"; import "./base/AbstractRewards.sol"; import "./interfaces/IEscrow.sol"; contract ChykLpStaking is Ownable, ReentrancyGuard, ERC20, AbstractRewards { using SafeERC20 for IERC20; IERC20 public depositToken; IERC20 public rewardToken; ILiquidityDistributionManager public distributor; address feeReceiver; uint256 public withdrawFee; uint256 constant base = 100; IEscrow public escrowPool; uint256 public escrowPortion; // how much is escrowed 1e18 == 100% struct Epoch { uint256 length; // in seconds uint256 end; // timestamp uint256 distributed; // amount } Epoch public epoch; event Deposited(uint256 amount, address depositor); event Withdrawn(address depositor, uint256 amount); event RewardsClaimed(address _user, uint256 _escrowedAmount, uint256 _nonEscrowedAmount); constructor( string memory poolName, string memory poolSymbol, address _distributor, uint256 _epochLength, address _escrowPool, uint256 _escrowPortion ) ERC20(poolName, poolSymbol) AbstractRewards(balanceOf, totalSupply) Ownable(msg.sender) { distributor = ILiquidityDistributionManager(_distributor); epoch = Epoch({ length: _epochLength, end: block.timestamp, distributed: 0 }); escrowPool = IEscrow(_escrowPool); escrowPortion = _escrowPortion; } function updateEcrowPool(address _escrow) external onlyOwner { require(_escrow != address(0), "zero add"); escrowPool = IEscrow(_escrow); } function mint(address account, uint256 amount) internal { super._update(address(0), account, amount); adjustPoints(account, -int256(amount)); } function burn(address account, uint256 amount) internal { super._update(account,address(0), amount); adjustPoints(account, int256(amount)); } function stake(uint256 amount) external nonReentrant { require(amount > 0, "Amount must be greater than 0"); depositToken.safeTransferFrom(_msgSender(), address(this), amount); // mints staked share mint(_msgSender(), amount); emit Deposited(amount, _msgSender()); } function unstake() external nonReentrant { require( balanceOf(msg.sender) > 0, "Deposit does not exist" ); uint256 amount = balanceOf(msg.sender); // Burn staked share burn(_msgSender(), amount); // withdraw fee uint256 fee = (amount * withdrawFee) / base; if(fee > 0) { depositToken.transfer(feeReceiver, fee); } uint256 userShare = amount - fee; // Return tokens depositToken.safeTransfer(_msgSender(), userShare); emit Withdrawn(_msgSender(), amount); } function setFeeReceiver(address _add) external onlyOwner() { require(_add != address(0), "zero address"); feeReceiver = _add; } function setWithdrawFee(uint256 _fee) external onlyOwner { require(_fee <= 10, "max 10% is allowed"); withdrawFee = _fee; } function distributeRewards() public nonReentrant { if (epoch.end <= block.timestamp) { uint256 timePassed = epoch.length + (block.timestamp - epoch.end); epoch.end = block.timestamp + epoch.length; uint256 amount = distributor.distributor(timePassed); if(amount > 0) { _distributeRewards(amount); epoch.distributed += amount; } } } function claimRewards() external { distributeRewards(); uint256 rewardAmount = setupClaim(_msgSender()); uint256 escrowedRewardAmount = rewardAmount * escrowPortion / 1e18; uint256 nonEscrowedRewardAmount = rewardAmount - escrowedRewardAmount; if(escrowedRewardAmount != 0 && address(escrowPool) != address(0)) { escrowPool.vestingLock(_msgSender(), escrowedRewardAmount); } // ignore dust if(nonEscrowedRewardAmount > 1) { rewardToken.safeTransfer(_msgSender(), nonEscrowedRewardAmount); } emit RewardsClaimed(_msgSender(), escrowedRewardAmount, nonEscrowedRewardAmount); } // disable transfers function _update(address _from, address _to, uint256 _amount) internal override { revert("NON_TRANSFERABLE"); } function addDepositRewardToken(address depositTokenAddress, address rewardTokenAddress) external onlyOwner { require(depositTokenAddress != address(0), "Deposit token must be set"); require(rewardTokenAddress != address(0), "reward token must be set"); depositToken = IERC20(depositTokenAddress); rewardToken = IERC20(rewardTokenAddress); if(rewardTokenAddress != address(0) && address(escrowPool) != address(0)) { IERC20(rewardTokenAddress).approve(address(escrowPool), type(uint256).max); } } function setEpochDuration(uint256 _duration) external onlyOwner { require(_duration > 0, "epoch cannot be zero"); epoch.length = _duration; } function changeRewardDistributor(ILiquidityDistributionManager _add) external onlyOwner { require(address(_add) != address(0), "zero address"); distributor = _add; } }
// 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * 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 returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 default value returned by this function, unless * it's 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 returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * 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. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "../interfaces/IAbstractRewards.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; abstract contract AbstractRewards is IAbstractRewards { using SafeCast for uint128; using SafeCast for uint256; using SafeCast for int256; uint128 public constant SCALING_FACTOR = type(uint128).max; function(address) view returns (uint256) private immutable getAccountBalance; function() view returns (uint256) private immutable getTotalBalance; uint256 public shareBasedPoints; mapping(address => int256) public pointsCorrection; mapping(address => uint256) public withdrawnRewards; constructor( function(address) internal view returns (uint256) getAccountBalance_, function() internal view returns (uint256) getTotalBalance_ ) { getAccountBalance = getAccountBalance_; getTotalBalance = getTotalBalance_; } function getRedeemablePayouts(address _account) public view override returns (uint256) { return getCumulativePayouts(_account) - withdrawnRewards[_account]; } function getRedeemedPayouts(address _account) public view override returns (uint256) { return withdrawnRewards[_account]; } function getCumulativePayouts(address _account) public view override returns (uint256) { return ((shareBasedPoints * getAccountBalance(_account)).toInt256() + pointsCorrection[_account]).toUint256() / SCALING_FACTOR; } function _distributeRewards(uint256 _amount) internal { uint256 totalShares = getTotalBalance(); require(totalShares > 0, "AbstractRewards: total share supply is zero"); if (_amount > 0) { shareBasedPoints = shareBasedPoints + (_amount * SCALING_FACTOR / totalShares); emit RewardsDistributed(msg.sender, _amount); } } function setupClaim(address _account) internal returns (uint256) { uint256 redeemableShare = getRedeemablePayouts(_account); if (redeemableShare > 0) { withdrawnRewards[_account] = withdrawnRewards[_account] + redeemableShare; emit RewardsWithdrawn(_account, redeemableShare); } return redeemableShare; } function adjustPointsForTransfer(address _from, address _to, uint256 _shares) internal { int256 magnitudeCorrection = (shareBasedPoints * _shares).toInt256(); pointsCorrection[_from] = pointsCorrection[_from] + magnitudeCorrection; pointsCorrection[_to] = pointsCorrection[_to] - magnitudeCorrection; } function adjustPoints(address _account, int256 _shares) internal { pointsCorrection[_account] = pointsCorrection[_account] + (_shares * int256(shareBasedPoints)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IAbstractRewards { function getRedeemablePayouts(address _account) external view returns (uint256); function getRedeemedPayouts(address _account) external view returns (uint256); function getCumulativePayouts(address _account) external view returns (uint256); event RewardsDistributed(address indexed recipient, uint256 amount); event RewardsWithdrawn(address indexed recipient, uint256 amount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; interface IEscrow { function vestingLock( address owner, uint256 amount ) external returns (uint256 id); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface ILiquidityDistributionManager { function distributor(uint256 _duration) external returns (uint256); }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"poolName","type":"string"},{"internalType":"string","name":"poolSymbol","type":"string"},{"internalType":"address","name":"_distributor","type":"address"},{"internalType":"uint256","name":"_epochLength","type":"uint256"},{"internalType":"address","name":"_escrowPool","type":"address"},{"internalType":"uint256","name":"_escrowPortion","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"int256","name":"value","type":"int256"}],"name":"SafeCastOverflowedIntToUint","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintToInt","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"depositor","type":"address"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_escrowedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nonEscrowedAmount","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"SCALING_FACTOR","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositTokenAddress","type":"address"},{"internalType":"address","name":"rewardTokenAddress","type":"address"}],"name":"addDepositRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ILiquidityDistributionManager","name":"_add","type":"address"}],"name":"changeRewardDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"contract ILiquidityDistributionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"length","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"distributed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"escrowPool","outputs":[{"internalType":"contract IEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"escrowPortion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getCumulativePayouts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getRedeemablePayouts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getRedeemedPayouts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pointsCorrection","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setEpochDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_add","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shareBasedPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_escrow","type":"address"}],"name":"updateEcrowPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawnRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162001efe38038062001efe833981016040819052620000349162000285565b6200013260201b62000ab3176200014d60201b620005d51787873360006001600160a01b0316816001600160a01b0316036200008a57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000958162000153565b50600180556005620000a88382620003b5565b506006620000b78282620003b5565b5050506001600160401b039182166080521660a052600c80546001600160a01b03199081166001600160a01b0396871617909155604080516060810182528581524260208201819052600091909201819052601195909555601255601393909355600f80549093169190931617905560105550620004819050565b6001600160a01b031660009081526002602052604090205490565b60045490565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001cb57600080fd5b81516001600160401b0380821115620001e857620001e8620001a3565b604051601f8301601f19908116603f01168101908282118183101715620002135762000213620001a3565b816040528381526020925086838588010111156200023057600080fd5b600091505b8382101562000254578582018301518183018401529082019062000235565b600093810190920192909252949350505050565b80516001600160a01b03811681146200028057600080fd5b919050565b60008060008060008060c087890312156200029f57600080fd5b86516001600160401b0380821115620002b757600080fd5b620002c58a838b01620001b9565b97506020890151915080821115620002dc57600080fd5b50620002eb89828a01620001b9565b955050620002fc6040880162000268565b935060608701519250620003136080880162000268565b915060a087015190509295509295509295565b600181811c908216806200033b57607f821691505b6020821081036200035c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003b057600081815260208120601f850160051c810160208610156200038b5750805b601f850160051c820191505b81811015620003ac5782815560010162000397565b5050505b505050565b81516001600160401b03811115620003d157620003d1620001a3565b620003e981620003e2845462000326565b8462000362565b602080601f831160018114620004215760008415620004085750858301515b600019600386901b1c1916600185901b178555620003ac565b600085815260208120601f198616915b82811015620004525788860151825594840194600190910190840162000431565b5085821015620004715787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051611a57620004a7600039600061117501526000610b140152611a576000f3fe608060405234801561001057600080fd5b506004361061021c5760003560e01c8063a694fc3a11610125578063d7e63867116100ad578063e941fa781161007c578063e941fa78146104c1578063ef4cadc5146104ca578063efdcd974146104f0578063f2fde38b14610503578063f7c618c11461051657600080fd5b8063d7e6386714610442578063dd62ed3e14610455578063dd6624e41461048e578063e1b71bdf146104ae57600080fd5b8063b6ac642a116100f4578063b6ac642a146103f7578063bfe109281461040a578063c89039c51461041d578063d03adee914610430578063d1f529831461043957600080fd5b8063a694fc3a14610388578063a9059cbb1461039b578063b178f8cb146103ae578063b182eb91146103d757600080fd5b8063372500ab116101a8578063715018a611610177578063715018a614610327578063866536601461032f5780638da5cb5b14610342578063900cf0cf1461035357806395d89b411461038057600080fd5b8063372500ab146102d957806368570e6a146102e15780636f4a2cd01461030c57806370a082311461031457600080fd5b806323b872dd116101ef57806323b872dd1461028757806328f59f051461029a5780632def6620146102af57806330024dfe146102b7578063313ce567146102ca57600080fd5b806306fdde0314610221578063095ea7b31461023f57806318160ddd1461026257806322e12d4914610274575b600080fd5b610229610529565b6040516102369190611783565b60405180910390f35b61025261024d3660046117cb565b6105bb565b6040519015158152602001610236565b6004545b604051908152602001610236565b6102666102823660046117f7565b6105db565b610252610295366004611814565b610607565b6102ad6102a83660046117f7565b61062d565b005b6102ad6106a1565b6102ad6102c5366004611855565b610826565b60405160128152602001610236565b6102ad61087a565b600f546102f4906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b6102ad6109ca565b6102666103223660046117f7565b610ab3565b6102ad610ace565b61026661033d3660046117f7565b610ae0565b6000546001600160a01b03166102f4565b60115460125460135461036592919083565b60408051938452602084019290925290820152606001610236565b610229610b61565b6102ad610396366004611855565b610b70565b6102526103a93660046117cb565b610c30565b6102666103bc3660046117f7565b6001600160a01b031660009081526009602052604090205490565b6102666103e53660046117f7565b60086020526000908152604090205481565b6102ad610405366004611855565b610c3e565b600c546102f4906001600160a01b031681565b600a546102f4906001600160a01b031681565b61026660075481565b61026660105481565b6102ad6104503660046117f7565b610c91565b61026661046336600461186e565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61026661049c3660046117f7565b60096020526000908152604090205481565b6102ad6104bc36600461186e565b610cfc565b610266600e5481565b6104d86001600160801b0381565b6040516001600160801b039091168152602001610236565b6102ad6104fe3660046117f7565b610e79565b6102ad6105113660046117f7565b610ee8565b600b546102f4906001600160a01b031681565b606060058054610538906118a7565b80601f0160208091040260200160405190810160405280929190818152602001828054610564906118a7565b80156105b15780601f10610586576101008083540402835291602001916105b1565b820191906000526020600020905b81548152906001019060200180831161059457829003601f168201915b5050505050905090565b6000336105c9818585610f23565b60019150505b92915050565b60045490565b6001600160a01b0381166000908152600960205260408120546105fd83610ae0565b6105cf91906118f7565b600033610615858285610f30565b610620858585610fae565b60019150505b9392505050565b61063561100d565b6001600160a01b03811661067f5760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b60448201526064015b60405180910390fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6106a961103a565b60006106b433610ab3565b116106fa5760405162461bcd60e51b815260206004820152601660248201527511195c1bdcda5d08191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610676565b600061070533610ab3565b90506107113382611064565b60006064600e5483610723919061190a565b61072d9190611921565b905080156107b057600a54600d5460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044016020604051808303816000875af115801561078a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ae9190611943565b505b60006107bc82846118f7565b90506107d533600a546001600160a01b0316908361107a565b7f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d533604080516001600160a01b039092168252602082018690520160405180910390a150505061082460018055565b565b61082e61100d565b600081116108755760405162461bcd60e51b815260206004820152601460248201527365706f63682063616e6e6f74206265207a65726f60601b6044820152606401610676565b601155565b6108826109ca565b600061088d336110d9565b90506000670de0b6b3a7640000601054836108a8919061190a565b6108b29190611921565b905060006108c082846118f7565b905081158015906108db5750600f546001600160a01b031615155b1561096557600f546001600160a01b0316637ec90e0f336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af115801561093f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109639190611965565b505b60018111156109855761098533600b546001600160a01b0316908361107a565b604080513381526020810184905280820183905290517fdacbdde355ba930696a362ea6738feb9f8bd52dfb3d81947558fd3217e23e3259181900360600190a1505050565b6109d261103a565b6012544210610aaa576012546000906109eb90426118f7565b6011546109f8919061197e565b601154909150610a08904261197e565b601255600c546040516326f4fe0560e01b8152600481018390526000916001600160a01b0316906326f4fe05906024016020604051808303816000875af1158015610a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7b9190611965565b90508015610aa757610a8c8161116e565b8060116002016000828254610aa1919061197e565b90915550505b50505b61082460018055565b6001600160a01b031660009081526002602052604090205490565b610ad661100d565b610824600061126d565b6001600160a01b0381166000908152600860205260408120546001600160801b0390610b5790610b48610b368663ffffffff7f000000000000000000000000000000000000000000000000000000000000000016565b600754610b43919061190a565b6112bd565b610b529190611991565b6112ee565b6105cf9190611921565b606060068054610538906118a7565b610b7861103a565b60008111610bc85760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610676565b610be033600a546001600160a01b0316903084611314565b610bea338261134d565b6040805182815233602082015281517f21d3f238b5a9e25ffc48b8320bc1d58882b1d90d0b4fcc7ba9707e3aebfedf16929181900390910190a1610c2d60018055565b50565b6000336105c9818585610fae565b610c4661100d565b600a811115610c8c5760405162461bcd60e51b81526020600482015260126024820152711b585e080c4c09481a5cc8185b1b1bddd95960721b6044820152606401610676565b600e55565b610c9961100d565b6001600160a01b038116610cda5760405162461bcd60e51b81526020600482015260086024820152671e995c9bc818591960c21b6044820152606401610676565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b610d0461100d565b6001600160a01b038216610d5a5760405162461bcd60e51b815260206004820152601960248201527f4465706f73697420746f6b656e206d75737420626520736574000000000000006044820152606401610676565b6001600160a01b038116610db05760405162461bcd60e51b815260206004820152601860248201527f72657761726420746f6b656e206d7573742062652073657400000000000000006044820152606401610676565b600a80546001600160a01b038085166001600160a01b031992831617909255600b8054928416929091168217905515801590610df65750600f546001600160a01b031615155b15610e7557600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529082169063095ea7b3906044016020604051808303816000875af1158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e739190611943565b505b5050565b610e8161100d565b6001600160a01b038116610ec65760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b6044820152606401610676565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b610ef061100d565b6001600160a01b038116610f1a57604051631e4fbdf760e01b815260006004820152602401610676565b610c2d8161126d565b610e73838383600161136b565b6001600160a01b038381166000908152600360209081526040808320938616835292905220546000198114610fa85781811015610f9957604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610676565b610fa88484848403600061136b565b50505050565b6001600160a01b038316610fd857604051634b637e8f60e11b815260006004820152602401610676565b6001600160a01b0382166110025760405163ec442f0560e01b815260006004820152602401610676565b610e73838383611440565b6000546001600160a01b031633146108245760405163118cdaa760e01b8152336004820152602401610676565b60026001540361105d57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6110708260008361147b565b610e7582826115a5565b6040516001600160a01b03838116602483015260448201839052610e7391859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506115f5565b6000806110e5836105db565b905080156105cf576001600160a01b03831660009081526009602052604090205461111190829061197e565b6001600160a01b038416600081815260096020526040908190209290925590517f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e503161906111609084815260200190565b60405180910390a292915050565b600061119c7f000000000000000000000000000000000000000000000000000000000000000063ffffffff16565b9050600081116112025760405162461bcd60e51b815260206004820152602b60248201527f4162737472616374526577617264733a20746f74616c2073686172652073757060448201526a706c79206973207a65726f60a81b6064820152608401610676565b8115610e75578061121a6001600160801b038461190a565b6112249190611921565b600754611231919061197e565b60075560405182815233907fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece0869060200160405180910390a25050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001600160ff1b038211156112ea5760405163123baf0360e11b815260048101839052602401610676565b5090565b6000808212156112ea57604051635467221960e11b815260048101839052602401610676565b6040516001600160a01b038481166024830152838116604483015260648201839052610fa89186918216906323b872dd906084016110a7565b6113596000838361147b565b610e7582611366836119b9565b6115a5565b6001600160a01b0384166113955760405163e602df0560e01b815260006004820152602401610676565b6001600160a01b0383166113bf57604051634a1406b160e11b815260006004820152602401610676565b6001600160a01b0380851660009081526003602090815260408083209387168352929052208290558015610fa857826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161143291815260200190565b60405180910390a350505050565b60405162461bcd60e51b815260206004820152601060248201526f4e4f4e5f5452414e5346455241424c4560801b6044820152606401610676565b6001600160a01b0383166114a657806004600082825461149b919061197e565b909155506115189050565b6001600160a01b038316600090815260026020526040902054818110156114f95760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610676565b6001600160a01b03841660009081526002602052604090209082900390555b6001600160a01b03821661153457600480548290039055611553565b6001600160a01b03821660009081526002602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161159891815260200190565b60405180910390a3505050565b6007546115b290826119d5565b6001600160a01b0383166000908152600860205260409020546115d59190611991565b6001600160a01b0390921660009081526008602052604090209190915550565b600061160a6001600160a01b03841683611658565b9050805160001415801561162f57508080602001905181019061162d9190611943565b155b15610e7357604051635274afe760e01b81526001600160a01b0384166004820152602401610676565b60606106268383600084600080856001600160a01b0316848660405161167e9190611a05565b60006040518083038185875af1925050503d80600081146116bb576040519150601f19603f3d011682016040523d82523d6000602084013e6116c0565b606091505b50915091506116d08683836116da565b9695505050505050565b6060826116ef576116ea82611736565b610626565b815115801561170657506001600160a01b0384163b155b1561172f57604051639996b31560e01b81526001600160a01b0385166004820152602401610676565b5080610626565b8051156117465780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60005b8381101561177a578181015183820152602001611762565b50506000910152565b60208152600082518060208401526117a281604085016020870161175f565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610c2d57600080fd5b600080604083850312156117de57600080fd5b82356117e9816117b6565b946020939093013593505050565b60006020828403121561180957600080fd5b8135610626816117b6565b60008060006060848603121561182957600080fd5b8335611834816117b6565b92506020840135611844816117b6565b929592945050506040919091013590565b60006020828403121561186757600080fd5b5035919050565b6000806040838503121561188157600080fd5b823561188c816117b6565b9150602083013561189c816117b6565b809150509250929050565b600181811c908216806118bb57607f821691505b6020821081036118db57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105cf576105cf6118e1565b80820281158282048414176105cf576105cf6118e1565b60008261193e57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561195557600080fd5b8151801515811461062657600080fd5b60006020828403121561197757600080fd5b5051919050565b808201808211156105cf576105cf6118e1565b80820182811260008312801582168215821617156119b1576119b16118e1565b505092915050565b6000600160ff1b82016119ce576119ce6118e1565b5060000390565b80820260008212600160ff1b841416156119f1576119f16118e1565b81810583148215176105cf576105cf6118e1565b60008251611a1781846020870161175f565b919091019291505056fea2646970667358221220c737c9b2dfe32a78539b85f45f5098b6099f49445a626cbd7a9f3ace0d5a014664736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000005eaf5a1d9699ee7672660990e9492044dd4f89ec00000000000000000000000000000000000000000000000000000000000007080000000000000000000000004d17317659a38990bfbce6d9fd8d9748d31d0d4300000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000000000000000000f4368796b204c50205374616b696e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007534368796b4c5000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c8063a694fc3a11610125578063d7e63867116100ad578063e941fa781161007c578063e941fa78146104c1578063ef4cadc5146104ca578063efdcd974146104f0578063f2fde38b14610503578063f7c618c11461051657600080fd5b8063d7e6386714610442578063dd62ed3e14610455578063dd6624e41461048e578063e1b71bdf146104ae57600080fd5b8063b6ac642a116100f4578063b6ac642a146103f7578063bfe109281461040a578063c89039c51461041d578063d03adee914610430578063d1f529831461043957600080fd5b8063a694fc3a14610388578063a9059cbb1461039b578063b178f8cb146103ae578063b182eb91146103d757600080fd5b8063372500ab116101a8578063715018a611610177578063715018a614610327578063866536601461032f5780638da5cb5b14610342578063900cf0cf1461035357806395d89b411461038057600080fd5b8063372500ab146102d957806368570e6a146102e15780636f4a2cd01461030c57806370a082311461031457600080fd5b806323b872dd116101ef57806323b872dd1461028757806328f59f051461029a5780632def6620146102af57806330024dfe146102b7578063313ce567146102ca57600080fd5b806306fdde0314610221578063095ea7b31461023f57806318160ddd1461026257806322e12d4914610274575b600080fd5b610229610529565b6040516102369190611783565b60405180910390f35b61025261024d3660046117cb565b6105bb565b6040519015158152602001610236565b6004545b604051908152602001610236565b6102666102823660046117f7565b6105db565b610252610295366004611814565b610607565b6102ad6102a83660046117f7565b61062d565b005b6102ad6106a1565b6102ad6102c5366004611855565b610826565b60405160128152602001610236565b6102ad61087a565b600f546102f4906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b6102ad6109ca565b6102666103223660046117f7565b610ab3565b6102ad610ace565b61026661033d3660046117f7565b610ae0565b6000546001600160a01b03166102f4565b60115460125460135461036592919083565b60408051938452602084019290925290820152606001610236565b610229610b61565b6102ad610396366004611855565b610b70565b6102526103a93660046117cb565b610c30565b6102666103bc3660046117f7565b6001600160a01b031660009081526009602052604090205490565b6102666103e53660046117f7565b60086020526000908152604090205481565b6102ad610405366004611855565b610c3e565b600c546102f4906001600160a01b031681565b600a546102f4906001600160a01b031681565b61026660075481565b61026660105481565b6102ad6104503660046117f7565b610c91565b61026661046336600461186e565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61026661049c3660046117f7565b60096020526000908152604090205481565b6102ad6104bc36600461186e565b610cfc565b610266600e5481565b6104d86001600160801b0381565b6040516001600160801b039091168152602001610236565b6102ad6104fe3660046117f7565b610e79565b6102ad6105113660046117f7565b610ee8565b600b546102f4906001600160a01b031681565b606060058054610538906118a7565b80601f0160208091040260200160405190810160405280929190818152602001828054610564906118a7565b80156105b15780601f10610586576101008083540402835291602001916105b1565b820191906000526020600020905b81548152906001019060200180831161059457829003601f168201915b5050505050905090565b6000336105c9818585610f23565b60019150505b92915050565b60045490565b6001600160a01b0381166000908152600960205260408120546105fd83610ae0565b6105cf91906118f7565b600033610615858285610f30565b610620858585610fae565b60019150505b9392505050565b61063561100d565b6001600160a01b03811661067f5760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b60448201526064015b60405180910390fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6106a961103a565b60006106b433610ab3565b116106fa5760405162461bcd60e51b815260206004820152601660248201527511195c1bdcda5d08191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610676565b600061070533610ab3565b90506107113382611064565b60006064600e5483610723919061190a565b61072d9190611921565b905080156107b057600a54600d5460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044016020604051808303816000875af115801561078a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ae9190611943565b505b60006107bc82846118f7565b90506107d533600a546001600160a01b0316908361107a565b7f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d533604080516001600160a01b039092168252602082018690520160405180910390a150505061082460018055565b565b61082e61100d565b600081116108755760405162461bcd60e51b815260206004820152601460248201527365706f63682063616e6e6f74206265207a65726f60601b6044820152606401610676565b601155565b6108826109ca565b600061088d336110d9565b90506000670de0b6b3a7640000601054836108a8919061190a565b6108b29190611921565b905060006108c082846118f7565b905081158015906108db5750600f546001600160a01b031615155b1561096557600f546001600160a01b0316637ec90e0f336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af115801561093f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109639190611965565b505b60018111156109855761098533600b546001600160a01b0316908361107a565b604080513381526020810184905280820183905290517fdacbdde355ba930696a362ea6738feb9f8bd52dfb3d81947558fd3217e23e3259181900360600190a1505050565b6109d261103a565b6012544210610aaa576012546000906109eb90426118f7565b6011546109f8919061197e565b601154909150610a08904261197e565b601255600c546040516326f4fe0560e01b8152600481018390526000916001600160a01b0316906326f4fe05906024016020604051808303816000875af1158015610a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7b9190611965565b90508015610aa757610a8c8161116e565b8060116002016000828254610aa1919061197e565b90915550505b50505b61082460018055565b6001600160a01b031660009081526002602052604090205490565b610ad661100d565b610824600061126d565b6001600160a01b0381166000908152600860205260408120546001600160801b0390610b5790610b48610b368663ffffffff7f0000000000000000000000000000000000000000000000000000013200000ab316565b600754610b43919061190a565b6112bd565b610b529190611991565b6112ee565b6105cf9190611921565b606060068054610538906118a7565b610b7861103a565b60008111610bc85760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610676565b610be033600a546001600160a01b0316903084611314565b610bea338261134d565b6040805182815233602082015281517f21d3f238b5a9e25ffc48b8320bc1d58882b1d90d0b4fcc7ba9707e3aebfedf16929181900390910190a1610c2d60018055565b50565b6000336105c9818585610fae565b610c4661100d565b600a811115610c8c5760405162461bcd60e51b81526020600482015260126024820152711b585e080c4c09481a5cc8185b1b1bddd95960721b6044820152606401610676565b600e55565b610c9961100d565b6001600160a01b038116610cda5760405162461bcd60e51b81526020600482015260086024820152671e995c9bc818591960c21b6044820152606401610676565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b610d0461100d565b6001600160a01b038216610d5a5760405162461bcd60e51b815260206004820152601960248201527f4465706f73697420746f6b656e206d75737420626520736574000000000000006044820152606401610676565b6001600160a01b038116610db05760405162461bcd60e51b815260206004820152601860248201527f72657761726420746f6b656e206d7573742062652073657400000000000000006044820152606401610676565b600a80546001600160a01b038085166001600160a01b031992831617909255600b8054928416929091168217905515801590610df65750600f546001600160a01b031615155b15610e7557600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529082169063095ea7b3906044016020604051808303816000875af1158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e739190611943565b505b5050565b610e8161100d565b6001600160a01b038116610ec65760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b6044820152606401610676565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b610ef061100d565b6001600160a01b038116610f1a57604051631e4fbdf760e01b815260006004820152602401610676565b610c2d8161126d565b610e73838383600161136b565b6001600160a01b038381166000908152600360209081526040808320938616835292905220546000198114610fa85781811015610f9957604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610676565b610fa88484848403600061136b565b50505050565b6001600160a01b038316610fd857604051634b637e8f60e11b815260006004820152602401610676565b6001600160a01b0382166110025760405163ec442f0560e01b815260006004820152602401610676565b610e73838383611440565b6000546001600160a01b031633146108245760405163118cdaa760e01b8152336004820152602401610676565b60026001540361105d57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6110708260008361147b565b610e7582826115a5565b6040516001600160a01b03838116602483015260448201839052610e7391859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506115f5565b6000806110e5836105db565b905080156105cf576001600160a01b03831660009081526009602052604090205461111190829061197e565b6001600160a01b038416600081815260096020526040908190209290925590517f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e503161906111609084815260200190565b60405180910390a292915050565b600061119c7f0000000000000000000000000000000000000000000000000000014d000005d563ffffffff16565b9050600081116112025760405162461bcd60e51b815260206004820152602b60248201527f4162737472616374526577617264733a20746f74616c2073686172652073757060448201526a706c79206973207a65726f60a81b6064820152608401610676565b8115610e75578061121a6001600160801b038461190a565b6112249190611921565b600754611231919061197e565b60075560405182815233907fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece0869060200160405180910390a25050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001600160ff1b038211156112ea5760405163123baf0360e11b815260048101839052602401610676565b5090565b6000808212156112ea57604051635467221960e11b815260048101839052602401610676565b6040516001600160a01b038481166024830152838116604483015260648201839052610fa89186918216906323b872dd906084016110a7565b6113596000838361147b565b610e7582611366836119b9565b6115a5565b6001600160a01b0384166113955760405163e602df0560e01b815260006004820152602401610676565b6001600160a01b0383166113bf57604051634a1406b160e11b815260006004820152602401610676565b6001600160a01b0380851660009081526003602090815260408083209387168352929052208290558015610fa857826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161143291815260200190565b60405180910390a350505050565b60405162461bcd60e51b815260206004820152601060248201526f4e4f4e5f5452414e5346455241424c4560801b6044820152606401610676565b6001600160a01b0383166114a657806004600082825461149b919061197e565b909155506115189050565b6001600160a01b038316600090815260026020526040902054818110156114f95760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610676565b6001600160a01b03841660009081526002602052604090209082900390555b6001600160a01b03821661153457600480548290039055611553565b6001600160a01b03821660009081526002602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161159891815260200190565b60405180910390a3505050565b6007546115b290826119d5565b6001600160a01b0383166000908152600860205260409020546115d59190611991565b6001600160a01b0390921660009081526008602052604090209190915550565b600061160a6001600160a01b03841683611658565b9050805160001415801561162f57508080602001905181019061162d9190611943565b155b15610e7357604051635274afe760e01b81526001600160a01b0384166004820152602401610676565b60606106268383600084600080856001600160a01b0316848660405161167e9190611a05565b60006040518083038185875af1925050503d80600081146116bb576040519150601f19603f3d011682016040523d82523d6000602084013e6116c0565b606091505b50915091506116d08683836116da565b9695505050505050565b6060826116ef576116ea82611736565b610626565b815115801561170657506001600160a01b0384163b155b1561172f57604051639996b31560e01b81526001600160a01b0385166004820152602401610676565b5080610626565b8051156117465780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60005b8381101561177a578181015183820152602001611762565b50506000910152565b60208152600082518060208401526117a281604085016020870161175f565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610c2d57600080fd5b600080604083850312156117de57600080fd5b82356117e9816117b6565b946020939093013593505050565b60006020828403121561180957600080fd5b8135610626816117b6565b60008060006060848603121561182957600080fd5b8335611834816117b6565b92506020840135611844816117b6565b929592945050506040919091013590565b60006020828403121561186757600080fd5b5035919050565b6000806040838503121561188157600080fd5b823561188c816117b6565b9150602083013561189c816117b6565b809150509250929050565b600181811c908216806118bb57607f821691505b6020821081036118db57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105cf576105cf6118e1565b80820281158282048414176105cf576105cf6118e1565b60008261193e57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561195557600080fd5b8151801515811461062657600080fd5b60006020828403121561197757600080fd5b5051919050565b808201808211156105cf576105cf6118e1565b80820182811260008312801582168215821617156119b1576119b16118e1565b505092915050565b6000600160ff1b82016119ce576119ce6118e1565b5060000390565b80820260008212600160ff1b841416156119f1576119f16118e1565b81810583148215176105cf576105cf6118e1565b60008251611a1781846020870161175f565b919091019291505056fea2646970667358221220c737c9b2dfe32a78539b85f45f5098b6099f49445a626cbd7a9f3ace0d5a014664736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000005eaf5a1d9699ee7672660990e9492044dd4f89ec00000000000000000000000000000000000000000000000000000000000007080000000000000000000000004d17317659a38990bfbce6d9fd8d9748d31d0d4300000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000000000000000000f4368796b204c50205374616b696e6700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007534368796b4c5000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : poolName (string): Chyk LP Staking
Arg [1] : poolSymbol (string): SChykLP
Arg [2] : _distributor (address): 0x5Eaf5a1d9699eE7672660990e9492044DD4F89eC
Arg [3] : _epochLength (uint256): 1800
Arg [4] : _escrowPool (address): 0x4d17317659a38990bFBce6D9FD8d9748d31d0D43
Arg [5] : _escrowPortion (uint256): 500000000000000000
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 0000000000000000000000005eaf5a1d9699ee7672660990e9492044dd4f89ec
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000708
Arg [4] : 0000000000000000000000004d17317659a38990bfbce6d9fd8d9748d31d0d43
Arg [5] : 00000000000000000000000000000000000000000000000006f05b59d3b20000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [7] : 4368796b204c50205374616b696e670000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [9] : 534368796b4c5000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.