Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
ERC20StakingPool
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.4; import {Clone} from "@clones/Clone.sol"; import {ERC20} from "solmate/tokens/ERC20.sol"; import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol"; import {Ownable} from "./lib/Ownable.sol"; import {FullMath} from "./lib/FullMath.sol"; import {Multicall} from "./lib/Multicall.sol"; import {SelfPermit} from "./lib/SelfPermit.sol"; /// @title ERC20StakingPool /// @author zefram.eth /// @notice A modern, gas optimized staking pool contract for rewarding ERC20 stakers /// with ERC20 tokens periodically and continuously contract ERC20StakingPool is Ownable, Clone, Multicall, SelfPermit { /// ----------------------------------------------------------------------- /// Library usage /// ----------------------------------------------------------------------- using SafeTransferLib for ERC20; /// ----------------------------------------------------------------------- /// Errors /// ----------------------------------------------------------------------- error Error_ZeroOwner(); error Error_AlreadyInitialized(); error Error_NotRewardDistributor(); error Error_AmountTooLarge(); /// ----------------------------------------------------------------------- /// Events /// ----------------------------------------------------------------------- event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); /// ----------------------------------------------------------------------- /// Constants /// ----------------------------------------------------------------------- uint256 internal constant PRECISION = 1e30; /// ----------------------------------------------------------------------- /// Storage variables /// ----------------------------------------------------------------------- /// @notice The last Unix timestamp (in seconds) when rewardPerTokenStored was updated uint64 public lastUpdateTime; /// @notice The Unix timestamp (in seconds) at which the current reward period ends uint64 public periodFinish; /// @notice The per-second rate at which rewardPerToken increases uint256 public rewardRate; /// @notice The last stored rewardPerToken value uint256 public rewardPerTokenStored; /// @notice The total tokens staked in the pool uint256 public totalSupply; /// @notice Tracks if an address can call notifyReward() mapping(address => bool) public isRewardDistributor; /// @notice The amount of tokens staked by an account mapping(address => uint256) public balanceOf; /// @notice The rewardPerToken value when an account last staked/withdrew/withdrew rewards mapping(address => uint256) public userRewardPerTokenPaid; /// @notice The earned() value when an account last staked/withdrew/withdrew rewards mapping(address => uint256) public rewards; /// ----------------------------------------------------------------------- /// Immutable parameters /// ----------------------------------------------------------------------- /// @notice The token being rewarded to stakers function rewardToken() public pure returns (ERC20 rewardToken_) { return ERC20(_getArgAddress(0)); } /// @notice The token being staked in the pool function stakeToken() public pure returns (ERC20 stakeToken_) { return ERC20(_getArgAddress(0x14)); } /// @notice The length of each reward period, in seconds function DURATION() public pure returns (uint64 DURATION_) { return _getArgUint64(0x28); } /// ----------------------------------------------------------------------- /// Initialization /// ----------------------------------------------------------------------- /// @notice Initializes the owner, called by StakingPoolFactory /// @param initialOwner The initial owner of the contract function initialize(address initialOwner) external { if (owner() != address(0)) { revert Error_AlreadyInitialized(); } if (initialOwner == address(0)) { revert Error_ZeroOwner(); } _transferOwnership(initialOwner); } /// ----------------------------------------------------------------------- /// User actions /// ----------------------------------------------------------------------- /// @notice Stakes tokens in the pool to earn rewards /// @param amount The amount of tokens to stake function stake(uint256 amount) external { /// ----------------------------------------------------------------------- /// Validation /// ----------------------------------------------------------------------- if (amount == 0) { return; } /// ----------------------------------------------------------------------- /// Storage loads /// ----------------------------------------------------------------------- uint256 accountBalance = balanceOf[msg.sender]; uint64 lastTimeRewardApplicable_ = lastTimeRewardApplicable(); uint256 totalSupply_ = totalSupply; uint256 rewardPerToken_ = _rewardPerToken(totalSupply_, lastTimeRewardApplicable_, rewardRate); /// ----------------------------------------------------------------------- /// State updates /// ----------------------------------------------------------------------- // accrue rewards rewardPerTokenStored = rewardPerToken_; lastUpdateTime = lastTimeRewardApplicable_; rewards[msg.sender] = _earned(msg.sender, accountBalance, rewardPerToken_, rewards[msg.sender]); userRewardPerTokenPaid[msg.sender] = rewardPerToken_; // stake totalSupply = totalSupply_ + amount; balanceOf[msg.sender] = accountBalance + amount; /// ----------------------------------------------------------------------- /// Effects /// ----------------------------------------------------------------------- stakeToken().safeTransferFrom(msg.sender, address(this), amount); emit Staked(msg.sender, amount); } /// @notice Withdraws staked tokens from the pool /// @param amount The amount of tokens to withdraw function withdraw(uint256 amount) external { /// ----------------------------------------------------------------------- /// Validation /// ----------------------------------------------------------------------- if (amount == 0) { return; } /// ----------------------------------------------------------------------- /// Storage loads /// ----------------------------------------------------------------------- uint256 accountBalance = balanceOf[msg.sender]; uint64 lastTimeRewardApplicable_ = lastTimeRewardApplicable(); uint256 totalSupply_ = totalSupply; uint256 rewardPerToken_ = _rewardPerToken(totalSupply_, lastTimeRewardApplicable_, rewardRate); /// ----------------------------------------------------------------------- /// State updates /// ----------------------------------------------------------------------- // accrue rewards rewardPerTokenStored = rewardPerToken_; lastUpdateTime = lastTimeRewardApplicable_; rewards[msg.sender] = _earned(msg.sender, accountBalance, rewardPerToken_, rewards[msg.sender]); userRewardPerTokenPaid[msg.sender] = rewardPerToken_; // withdraw stake balanceOf[msg.sender] = accountBalance - amount; // total supply has 1:1 relationship with staked amounts // so can't ever underflow unchecked { totalSupply = totalSupply_ - amount; } /// ----------------------------------------------------------------------- /// Effects /// ----------------------------------------------------------------------- stakeToken().safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); } /// @notice Withdraws all staked tokens and earned rewards function exit() external { /// ----------------------------------------------------------------------- /// Validation /// ----------------------------------------------------------------------- uint256 accountBalance = balanceOf[msg.sender]; /// ----------------------------------------------------------------------- /// Storage loads /// ----------------------------------------------------------------------- uint64 lastTimeRewardApplicable_ = lastTimeRewardApplicable(); uint256 totalSupply_ = totalSupply; uint256 rewardPerToken_ = _rewardPerToken(totalSupply_, lastTimeRewardApplicable_, rewardRate); /// ----------------------------------------------------------------------- /// State updates /// ----------------------------------------------------------------------- // give rewards uint256 reward = _earned(msg.sender, accountBalance, rewardPerToken_, rewards[msg.sender]); if (reward > 0) { rewards[msg.sender] = 0; } // accrue rewards rewardPerTokenStored = rewardPerToken_; lastUpdateTime = lastTimeRewardApplicable_; userRewardPerTokenPaid[msg.sender] = rewardPerToken_; // withdraw stake balanceOf[msg.sender] = 0; // total supply has 1:1 relationship with staked amounts // so can't ever underflow unchecked { totalSupply = totalSupply_ - accountBalance; } /// ----------------------------------------------------------------------- /// Effects /// ----------------------------------------------------------------------- // transfer stake stakeToken().safeTransfer(msg.sender, accountBalance); emit Withdrawn(msg.sender, accountBalance); // transfer rewards if (reward > 0) { rewardToken().safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } /// @notice Withdraws all earned rewards function getReward() external { /// ----------------------------------------------------------------------- /// Storage loads /// ----------------------------------------------------------------------- uint256 accountBalance = balanceOf[msg.sender]; uint64 lastTimeRewardApplicable_ = lastTimeRewardApplicable(); uint256 totalSupply_ = totalSupply; uint256 rewardPerToken_ = _rewardPerToken(totalSupply_, lastTimeRewardApplicable_, rewardRate); /// ----------------------------------------------------------------------- /// State updates /// ----------------------------------------------------------------------- uint256 reward = _earned(msg.sender, accountBalance, rewardPerToken_, rewards[msg.sender]); // accrue rewards rewardPerTokenStored = rewardPerToken_; lastUpdateTime = lastTimeRewardApplicable_; userRewardPerTokenPaid[msg.sender] = rewardPerToken_; // withdraw rewards if (reward > 0) { rewards[msg.sender] = 0; /// ----------------------------------------------------------------------- /// Effects /// ----------------------------------------------------------------------- rewardToken().safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } /// ----------------------------------------------------------------------- /// Getters /// ----------------------------------------------------------------------- /// @notice The latest time at which stakers are earning rewards. function lastTimeRewardApplicable() public view returns (uint64) { return block.timestamp < periodFinish ? uint64(block.timestamp) : periodFinish; } /// @notice The amount of reward tokens each staked token has earned so far function rewardPerToken() external view returns (uint256) { return _rewardPerToken(totalSupply, lastTimeRewardApplicable(), rewardRate); } /// @notice The amount of reward tokens an account has accrued so far. Does not /// include already withdrawn rewards. function earned(address account) external view returns (uint256) { return _earned( account, balanceOf[account], _rewardPerToken(totalSupply, lastTimeRewardApplicable(), rewardRate), rewards[account] ); } /// ----------------------------------------------------------------------- /// Owner actions /// ----------------------------------------------------------------------- /// @notice Lets a reward distributor start a new reward period. The reward tokens must have already /// been transferred to this contract before calling this function. If it is called /// when a reward period is still active, a new reward period will begin from the time /// of calling this function, using the leftover rewards from the old reward period plus /// the newly sent rewards as the reward. /// @dev If the reward amount will cause an overflow when computing rewardPerToken, then /// this function will revert. /// @param reward The amount of reward tokens to use in the new reward period. function notifyRewardAmount(uint256 reward) external { /// ----------------------------------------------------------------------- /// Validation /// ----------------------------------------------------------------------- if (reward == 0) { return; } if (!isRewardDistributor[msg.sender]) { revert Error_NotRewardDistributor(); } /// ----------------------------------------------------------------------- /// Storage loads /// ----------------------------------------------------------------------- uint256 rewardRate_ = rewardRate; uint64 periodFinish_ = periodFinish; uint64 lastTimeRewardApplicable_ = block.timestamp < periodFinish_ ? uint64(block.timestamp) : periodFinish_; uint64 DURATION_ = DURATION(); uint256 totalSupply_ = totalSupply; /// ----------------------------------------------------------------------- /// State updates /// ----------------------------------------------------------------------- // accrue rewards rewardPerTokenStored = _rewardPerToken(totalSupply_, lastTimeRewardApplicable_, rewardRate_); lastUpdateTime = lastTimeRewardApplicable_; // record new reward uint256 newRewardRate; if (block.timestamp >= periodFinish_) { newRewardRate = reward / DURATION_; } else { uint256 remaining = periodFinish_ - block.timestamp; uint256 leftover = remaining * rewardRate_; newRewardRate = (reward + leftover) / DURATION_; } // prevent overflow when computing rewardPerToken if (newRewardRate >= ((type(uint256).max / PRECISION) / DURATION_)) { revert Error_AmountTooLarge(); } rewardRate = newRewardRate; lastUpdateTime = uint64(block.timestamp); periodFinish = uint64(block.timestamp + DURATION_); emit RewardAdded(reward); } /// @notice Lets the owner add/remove accounts from the list of reward distributors. /// Reward distributors can call notifyRewardAmount() /// @param rewardDistributor The account to add/remove /// @param isRewardDistributor_ True to add the account, false to remove the account function setRewardDistributor(address rewardDistributor, bool isRewardDistributor_) external onlyOwner { isRewardDistributor[rewardDistributor] = isRewardDistributor_; } /// ----------------------------------------------------------------------- /// Internal functions /// ----------------------------------------------------------------------- function _earned(address account, uint256 accountBalance, uint256 rewardPerToken_, uint256 accountRewards) internal view returns (uint256) { return FullMath.mulDiv(accountBalance, rewardPerToken_ - userRewardPerTokenPaid[account], PRECISION) + accountRewards; } function _rewardPerToken(uint256 totalSupply_, uint256 lastTimeRewardApplicable_, uint256 rewardRate_) internal view returns (uint256) { if (totalSupply_ == 0) { return rewardPerTokenStored; } return rewardPerTokenStored + FullMath.mulDiv((lastTimeRewardApplicable_ - lastUpdateTime) * PRECISION, rewardRate_, totalSupply_); } function _getImmutableVariablesOffset() internal pure returns (uint256 offset) { assembly { offset := sub(calldatasize(), add(shr(240, calldataload(sub(calldatasize(), 2))), 2)) } } }
// SPDX-License-Identifier: BSD pragma solidity ^0.8.4; /// @title Clone /// @author zefram.eth /// @notice Provides helper functions for reading immutable args from calldata contract Clone { /// @notice Reads an immutable arg with type address /// @param argOffset The offset of the arg in the packed data /// @return arg The arg value function _getArgAddress(uint256 argOffset) internal pure returns (address arg) { uint256 offset = _getImmutableArgsOffset(); // solhint-disable-next-line no-inline-assembly assembly { arg := shr(0x60, calldataload(add(offset, argOffset))) } } /// @notice Reads an immutable arg with type uint256 /// @param argOffset The offset of the arg in the packed data /// @return arg The arg value function _getArgUint256(uint256 argOffset) internal pure returns (uint256 arg) { uint256 offset = _getImmutableArgsOffset(); // solhint-disable-next-line no-inline-assembly assembly { arg := calldataload(add(offset, argOffset)) } } /// @notice Reads a uint256 array stored in the immutable args. /// @param argOffset The offset of the arg in the packed data /// @param arrLen Number of elements in the array /// @return arr The array function _getArgUint256Array(uint256 argOffset, uint64 arrLen) internal pure returns (uint256[] memory arr) { uint256 offset = _getImmutableArgsOffset(); uint256 el; arr = new uint256[](arrLen); for (uint64 i = 0; i < arrLen; i++) { assembly { // solhint-disable-next-line no-inline-assembly el := calldataload(add(add(offset, argOffset), mul(i, 32))) } arr[i] = el; } return arr; } /// @notice Reads an immutable arg with type uint64 /// @param argOffset The offset of the arg in the packed data /// @return arg The arg value function _getArgUint64(uint256 argOffset) internal pure returns (uint64 arg) { uint256 offset = _getImmutableArgsOffset(); // solhint-disable-next-line no-inline-assembly assembly { arg := shr(0xc0, calldataload(add(offset, argOffset))) } } /// @notice Reads an immutable arg with type uint8 /// @param argOffset The offset of the arg in the packed data /// @return arg The arg value function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) { uint256 offset = _getImmutableArgsOffset(); // solhint-disable-next-line no-inline-assembly assembly { arg := shr(0xf8, calldataload(add(offset, argOffset))) } } /// @return offset The offset of the packed immutable args in calldata function _getImmutableArgsOffset() internal pure returns (uint256 offset) { // solhint-disable-next-line no-inline-assembly assembly { offset := sub( calldatasize(), add(shr(240, calldataload(sub(calldatasize(), 2))), 2) ) } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*/////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*/////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*/////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*/////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*/////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Gnosis (https://github.com/gnosis/gp-v2-contracts/blob/main/src/contracts/libraries/GPv2SafeERC20.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. library SafeTransferLib { /*/////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool callStatus; assembly { // Transfer the ETH and store if it succeeded or not. callStatus := call(gas(), to, amount, 0, 0, 0, 0) } require(callStatus, "ETH_TRANSFER_FAILED"); } /*/////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool callStatus; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata to memory piece by piece: mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) // Begin with the function selector. mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "from" argument. mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value. // Call the token and store if it succeeded or not. // We use 100 because the calldata length is 4 + 32 * 3. callStatus := call(gas(), token, 0, freeMemoryPointer, 100, 0, 0) } require(didLastOptionalReturnCallSucceed(callStatus), "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool callStatus; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata to memory piece by piece: mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) // Begin with the function selector. mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value. // Call the token and store if it succeeded or not. // We use 68 because the calldata length is 4 + 32 * 2. callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0) } require(didLastOptionalReturnCallSucceed(callStatus), "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool callStatus; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata to memory piece by piece: mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) // Begin with the function selector. mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value. // Call the token and store if it succeeded or not. // We use 68 because the calldata length is 4 + 32 * 2. callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0) } require(didLastOptionalReturnCallSucceed(callStatus), "APPROVE_FAILED"); } /*/////////////////////////////////////////////////////////////// INTERNAL HELPER LOGIC //////////////////////////////////////////////////////////////*/ function didLastOptionalReturnCallSucceed(bool callStatus) private pure returns (bool success) { assembly { // Get how many bytes the call returned. let returnDataSize := returndatasize() // If the call reverted: if iszero(callStatus) { // Copy the revert message into memory. returndatacopy(0, 0, returnDataSize) // Revert with the same message. revert(0, returnDataSize) } switch returnDataSize case 32 { // Copy the return data into memory. returndatacopy(0, 0, returnDataSize) // Set success to whether it returned true. success := iszero(iszero(mload(0))) } case 0 { // There was no return data. success := 1 } default { // It returned some malformed input. success := 0 } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (type(uint256).max - denominator + 1) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); unchecked { if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.4; /// @title Multicall /// @notice Enables calling multiple methods in a single call to the contract abstract contract Multicall { function multicall(bytes[] calldata data) external payable returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { // Next 5 lines from https://ethereum.stackexchange.com/a/83577 if (result.length < 68) revert(); assembly { result := add(result, 0x04) } revert(abi.decode(result, (string))); } results[i] = result; } } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.4; abstract contract Ownable { error Ownable_NotOwner(); error Ownable_NewOwnerZeroAddress(); address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @dev Returns the address of the current owner. function owner() public view virtual returns (address) { return _owner; } /// @dev Throws if called by any account other than the owner. modifier onlyOwner() { if (owner() != msg.sender) revert Ownable_NotOwner(); _; } /// @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 Ownable_NewOwnerZeroAddress(); _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: AGPL-3.0 pragma solidity >=0.5.0; import {ERC20} from "solmate/tokens/ERC20.sol"; /// @title Self Permit /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route /// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function /// that requires an approval in a single transaction. abstract contract SelfPermit { function selfPermit(ERC20 token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public payable { token.permit(msg.sender, address(this), value, deadline, v, r, s); } function selfPermitIfNecessary(ERC20 token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external payable { if (token.allowance(msg.sender, address(this)) < value) { selfPermit(token, value, deadline, v, r, s); } } }
{ "remappings": [ "@clones/=lib/clones-with-immutable-args/src/", "clones-with-immutable-args/=lib/clones-with-immutable-args/src/", "create3-factory/=lib/create3-factory/src/", "ds-test/=lib/clones-with-immutable-args/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "solmate/=lib/solmate/src/", "weird-erc20/=lib/solmate/lib/weird-erc20/src/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"Error_AlreadyInitialized","type":"error"},{"inputs":[],"name":"Error_AmountTooLarge","type":"error"},{"inputs":[],"name":"Error_NotRewardDistributor","type":"error"},{"inputs":[],"name":"Error_ZeroOwner","type":"error"},{"inputs":[],"name":"Ownable_NewOwnerZeroAddress","type":"error"},{"inputs":[],"name":"Ownable_NotOwner","type":"error"},{"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":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint64","name":"DURATION_","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isRewardDistributor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract ERC20","name":"rewardToken_","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"rewardDistributor","type":"address"},{"internalType":"bool","name":"isRewardDistributor_","type":"bool"}],"name":"setRewardDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeToken","outputs":[{"internalType":"contract ERC20","name":"stakeToken_","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611cfd806100206000396000f3fe6080604052600436106101ab5760003560e01c80638b876347116100ec578063cd3daf9d1161008a578063ebe2b12b11610064578063ebe2b12b146104e1578063f2fde38b14610502578063f3995c6714610522578063f7c618c11461053557600080fd5b8063cd3daf9d146104a1578063df136d65146104b6578063e9fad8ee146104cc57600080fd5b8063ac9650d8116100c6578063ac9650d814610415578063c2e3140a14610435578063c4d66de814610448578063c8f33c911461046857600080fd5b80638b8763471461039d5780638da5cb5b146103ca578063a694fc3a146103f557600080fd5b80633c6b16ab1161015957806370a082311161013357806370a08231146103255780637b0a47ee1461035257806380e59f8d1461036857806380faa57d1461038857600080fd5b80633c6b16ab146102b65780633d18b912146102d657806351ed6a30146102eb57600080fd5b806318160ddd1161018a57806318160ddd146102505780631be05289146102665780632e1a7d4d1461029457600080fd5b80628cc262146101b05780630700037d146101e357806316ed852514610210575b600080fd5b3480156101bc57600080fd5b506101d06101cb3660046117b8565b61054a565b6040519081526020015b60405180910390f35b3480156101ef57600080fd5b506101d06101fe3660046117b8565b60086020526000908152604090205481565b34801561021c57600080fd5b5061024061022b3660046117b8565b60056020526000908152604090205460ff1681565b60405190151581526020016101da565b34801561025c57600080fd5b506101d060045481565b34801561027257600080fd5b5061027b6105c8565b60405167ffffffffffffffff90911681526020016101da565b3480156102a057600080fd5b506102b46102af3660046117d5565b6105d9565b005b3480156102c257600080fd5b506102b46102d13660046117d5565b610736565b3480156102e257600080fd5b506102b46109f0565b3480156102f757600080fd5b50610300610b0a565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101da565b34801561033157600080fd5b506101d06103403660046117b8565b60066020526000908152604090205481565b34801561035e57600080fd5b506101d060025481565b34801561037457600080fd5b506102b46103833660046117ee565b610b16565b34801561039457600080fd5b5061027b610bd9565b3480156103a957600080fd5b506101d06103b83660046117b8565b60076020526000908152604090205481565b3480156103d657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610300565b34801561040157600080fd5b506102b46104103660046117d5565b610c05565b61042861042336600461182c565b610d60565b6040516101da919061190f565b6102b461044336600461198f565b610edb565b34801561045457600080fd5b506102b46104633660046117b8565b610f8d565b34801561047457600080fd5b5060005461027b9074010000000000000000000000000000000000000000900467ffffffffffffffff1681565b3480156104ad57600080fd5b506101d0611036565b3480156104c257600080fd5b506101d060035481565b3480156104d857600080fd5b506102b4611046565b3480156104ed57600080fd5b5060015461027b9067ffffffffffffffff1681565b34801561050e57600080fd5b506102b461051d3660046117b8565b611185565b6102b461053036600461198f565b61123f565b34801561054157600080fd5b506103006112f1565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660205260408120546004546105c291849161059790610585610bd9565b67ffffffffffffffff166002546112fd565b73ffffffffffffffffffffffffffffffffffffffff861660009081526008602052604090205461137a565b92915050565b60006105d460286113d8565b905090565b806000036105e45750565b33600090815260066020526040812054906105fd610bd9565b905060006004549050600061061f828467ffffffffffffffff166002546112fd565b6003819055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff87160217815533808252600860205260409091205491925061068e918690849061137a565b3360009081526008602090815260408083209390935560079052208190556106b68585611a20565b336000818152600660205260409020919091558583036004556106f990866106dc610b0a565b73ffffffffffffffffffffffffffffffffffffffff16919061141b565b60405185815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25050505050565b806000036107415750565b3360009081526005602052604090205460ff1661078a576040517f434e91f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460015467ffffffffffffffff1660004282116107a957816107ab565b425b905060006107b76105c8565b6004549091506107d28167ffffffffffffffff8516876112fd565b6003556000805467ffffffffffffffff80861674010000000000000000000000000000000000000000027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091178255851642106108495761084267ffffffffffffffff841688611a33565b9050610893565b600061085f4267ffffffffffffffff8816611a20565b9050600061086d8883611a6e565b905067ffffffffffffffff8516610884828b611aab565b61088e9190611a33565b925050505b67ffffffffffffffff83166108d56c0c9f2c9cd04674edea400000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611a33565b6108df9190611a33565b8110610917576040517f98bb2e4500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028190556000805467ffffffffffffffff4281811674010000000000000000000000000000000000000000027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff9093169290921790925561097b91851690611aab565b600180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff929092169190911790556040518781527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a150505050505050565b3360009081526006602052604081205490610a09610bd9565b9050600060045490506000610a2b828467ffffffffffffffff166002546112fd565b3360008181526008602052604081205492935091610a4d91908790859061137a565b6003839055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff88160217815533815260076020526040902083905590508015610b035733600081815260086020526040812055610ad190826106dc6112f1565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001610727565b5050505050565b60006105d460146114e8565b33610b3660005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610b83576040517f5eee3ad100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60015460009067ffffffffffffffff164210610c00575060015467ffffffffffffffff1690565b504290565b80600003610c105750565b3360009081526006602052604081205490610c29610bd9565b9050600060045490506000610c4b828467ffffffffffffffff166002546112fd565b6003819055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff871602178155338082526008602052604090912054919250610cba918690849061137a565b336000908152600860209081526040808320939093556007905220819055610ce28583611aab565b600455610cef8585611aab565b33600081815260066020526040902091909155610d2e903087610d10610b0a565b73ffffffffffffffffffffffffffffffffffffffff1692919061152b565b60405185815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610727565b60608167ffffffffffffffff811115610d7b57610d7b611abe565b604051908082528060200260200182016040528015610dae57816020015b6060815260200190600190039081610d995790505b50905060005b82811015610ed45760008030868685818110610dd257610dd2611aed565b9050602002810190610de49190611b1c565b604051610df2929190611b88565b600060405180830381855af49150503d8060008114610e2d576040519150601f19603f3d011682016040523d82523d6000602084013e610e32565b606091505b509150915081610ea157604481511015610e4b57600080fd5b60048101905080806020019051810190610e659190611b98565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e989190611c63565b60405180910390fd5b80848481518110610eb457610eb4611aed565b602002602001018190525050508080610ecc90611c76565b915050610db4565b5092915050565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152859073ffffffffffffffffffffffffffffffffffffffff88169063dd62ed3e90604401602060405180830381865afa158015610f4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f719190611cae565b1015610f8557610f8586868686868661123f565b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1615610fdd576040517fd31b2dd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661102a576040517f1b007b4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6110338161160e565b50565b60006105d4600454610585610bd9565b336000908152600660205260408120549061105f610bd9565b9050600060045490506000611081828467ffffffffffffffff166002546112fd565b33600081815260086020526040812054929350916110a391908790859061137a565b905080156110bc57336000908152600860205260408120555b6003829055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff87160217815533808252600760209081526040808420869055600690915282209190915585840360045561113d90866106dc610b0a565b60405185815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d59060200160405180910390a28015610b0357610ad133826106dc6112f1565b336111a560005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111f2576040517f5eee3ad100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661102a576040517fedf1b1fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018690526064810185905260ff8416608482015260a4810183905260c4810182905273ffffffffffffffffffffffffffffffffffffffff87169063d505accf9060e401600060405180830381600087803b1580156112d157600080fd5b505af11580156112e5573d6000803e3d6000fd5b50505050505050505050565b60006105d460006114e8565b6000836000036113105750600354611373565b600054611363906c0c9f2c9cd04674edea40000000906113529074010000000000000000000000000000000000000000900467ffffffffffffffff1686611a20565b61135c9190611a6e565b8386611683565b6003546113709190611aab565b90505b9392505050565b73ffffffffffffffffffffffffffffffffffffffff841660009081526007602052604081205482906113c59086906113b29087611a20565b6c0c9f2c9cd04674edea40000000611683565b6113cf9190611aab565b95945050505050565b60008061140d7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe368181013560f01c90030190565b929092013560c01c92915050565b60006040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201528260248201526000806044836000895af191505061147c8161174f565b6114e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610e98565b50505050565b60008061151d7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe368181013560f01c90030190565b929092013560601c92915050565b60006040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015273ffffffffffffffffffffffffffffffffffffffff8416602482015282604482015260008060648360008a5af19150506115a88161174f565b610b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610e98565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050806000036116da57600084116116cf57600080fd5b508290049050611373565b8084116116e657600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b60003d8261176157806000803e806000fd5b806020811461177957801561178a576000925061178f565b816000803e6000511515925061178f565b600192505b5050919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461103357600080fd5b6000602082840312156117ca57600080fd5b813561137381611796565b6000602082840312156117e757600080fd5b5035919050565b6000806040838503121561180157600080fd5b823561180c81611796565b91506020830135801515811461182157600080fd5b809150509250929050565b6000806020838503121561183f57600080fd5b823567ffffffffffffffff8082111561185757600080fd5b818501915085601f83011261186b57600080fd5b81358181111561187a57600080fd5b8660208260051b850101111561188f57600080fd5b60209290920196919550909350505050565b60005b838110156118bc5781810151838201526020016118a4565b50506000910152565b600081518084526118dd8160208601602086016118a1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611982577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526119708583516118c5565b94509285019290850190600101611936565b5092979650505050505050565b60008060008060008060c087890312156119a857600080fd5b86356119b381611796565b95506020870135945060408701359350606087013560ff811681146119d757600080fd5b9598949750929560808101359460a0909101359350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156105c2576105c26119f1565b600082611a69577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611aa657611aa66119f1565b500290565b808201808211156105c2576105c26119f1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611b5157600080fd5b83018035915067ffffffffffffffff821115611b6c57600080fd5b602001915036819003821315611b8157600080fd5b9250929050565b8183823760009101908152919050565b600060208284031215611baa57600080fd5b815167ffffffffffffffff80821115611bc257600080fd5b818401915084601f830112611bd657600080fd5b815181811115611be857611be8611abe565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715611c2e57611c2e611abe565b81604052828152876020848701011115611c4757600080fd5b611c588360208301602088016118a1565b979650505050505050565b60208152600061137360208301846118c5565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ca757611ca76119f1565b5060010190565b600060208284031215611cc057600080fd5b505191905056fea26469706673582212208c96feae0e4332631ce5a54a3671619c72a1e589950e455c8d33077c5a9ab84f64736f6c63430008100033
Deployed Bytecode
0x6080604052600436106101ab5760003560e01c80638b876347116100ec578063cd3daf9d1161008a578063ebe2b12b11610064578063ebe2b12b146104e1578063f2fde38b14610502578063f3995c6714610522578063f7c618c11461053557600080fd5b8063cd3daf9d146104a1578063df136d65146104b6578063e9fad8ee146104cc57600080fd5b8063ac9650d8116100c6578063ac9650d814610415578063c2e3140a14610435578063c4d66de814610448578063c8f33c911461046857600080fd5b80638b8763471461039d5780638da5cb5b146103ca578063a694fc3a146103f557600080fd5b80633c6b16ab1161015957806370a082311161013357806370a08231146103255780637b0a47ee1461035257806380e59f8d1461036857806380faa57d1461038857600080fd5b80633c6b16ab146102b65780633d18b912146102d657806351ed6a30146102eb57600080fd5b806318160ddd1161018a57806318160ddd146102505780631be05289146102665780632e1a7d4d1461029457600080fd5b80628cc262146101b05780630700037d146101e357806316ed852514610210575b600080fd5b3480156101bc57600080fd5b506101d06101cb3660046117b8565b61054a565b6040519081526020015b60405180910390f35b3480156101ef57600080fd5b506101d06101fe3660046117b8565b60086020526000908152604090205481565b34801561021c57600080fd5b5061024061022b3660046117b8565b60056020526000908152604090205460ff1681565b60405190151581526020016101da565b34801561025c57600080fd5b506101d060045481565b34801561027257600080fd5b5061027b6105c8565b60405167ffffffffffffffff90911681526020016101da565b3480156102a057600080fd5b506102b46102af3660046117d5565b6105d9565b005b3480156102c257600080fd5b506102b46102d13660046117d5565b610736565b3480156102e257600080fd5b506102b46109f0565b3480156102f757600080fd5b50610300610b0a565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101da565b34801561033157600080fd5b506101d06103403660046117b8565b60066020526000908152604090205481565b34801561035e57600080fd5b506101d060025481565b34801561037457600080fd5b506102b46103833660046117ee565b610b16565b34801561039457600080fd5b5061027b610bd9565b3480156103a957600080fd5b506101d06103b83660046117b8565b60076020526000908152604090205481565b3480156103d657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610300565b34801561040157600080fd5b506102b46104103660046117d5565b610c05565b61042861042336600461182c565b610d60565b6040516101da919061190f565b6102b461044336600461198f565b610edb565b34801561045457600080fd5b506102b46104633660046117b8565b610f8d565b34801561047457600080fd5b5060005461027b9074010000000000000000000000000000000000000000900467ffffffffffffffff1681565b3480156104ad57600080fd5b506101d0611036565b3480156104c257600080fd5b506101d060035481565b3480156104d857600080fd5b506102b4611046565b3480156104ed57600080fd5b5060015461027b9067ffffffffffffffff1681565b34801561050e57600080fd5b506102b461051d3660046117b8565b611185565b6102b461053036600461198f565b61123f565b34801561054157600080fd5b506103006112f1565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660205260408120546004546105c291849161059790610585610bd9565b67ffffffffffffffff166002546112fd565b73ffffffffffffffffffffffffffffffffffffffff861660009081526008602052604090205461137a565b92915050565b60006105d460286113d8565b905090565b806000036105e45750565b33600090815260066020526040812054906105fd610bd9565b905060006004549050600061061f828467ffffffffffffffff166002546112fd565b6003819055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff87160217815533808252600860205260409091205491925061068e918690849061137a565b3360009081526008602090815260408083209390935560079052208190556106b68585611a20565b336000818152600660205260409020919091558583036004556106f990866106dc610b0a565b73ffffffffffffffffffffffffffffffffffffffff16919061141b565b60405185815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25050505050565b806000036107415750565b3360009081526005602052604090205460ff1661078a576040517f434e91f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460015467ffffffffffffffff1660004282116107a957816107ab565b425b905060006107b76105c8565b6004549091506107d28167ffffffffffffffff8516876112fd565b6003556000805467ffffffffffffffff80861674010000000000000000000000000000000000000000027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091178255851642106108495761084267ffffffffffffffff841688611a33565b9050610893565b600061085f4267ffffffffffffffff8816611a20565b9050600061086d8883611a6e565b905067ffffffffffffffff8516610884828b611aab565b61088e9190611a33565b925050505b67ffffffffffffffff83166108d56c0c9f2c9cd04674edea400000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611a33565b6108df9190611a33565b8110610917576040517f98bb2e4500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028190556000805467ffffffffffffffff4281811674010000000000000000000000000000000000000000027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff9093169290921790925561097b91851690611aab565b600180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff929092169190911790556040518781527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a150505050505050565b3360009081526006602052604081205490610a09610bd9565b9050600060045490506000610a2b828467ffffffffffffffff166002546112fd565b3360008181526008602052604081205492935091610a4d91908790859061137a565b6003839055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff88160217815533815260076020526040902083905590508015610b035733600081815260086020526040812055610ad190826106dc6112f1565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001610727565b5050505050565b60006105d460146114e8565b33610b3660005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610b83576040517f5eee3ad100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60015460009067ffffffffffffffff164210610c00575060015467ffffffffffffffff1690565b504290565b80600003610c105750565b3360009081526006602052604081205490610c29610bd9565b9050600060045490506000610c4b828467ffffffffffffffff166002546112fd565b6003819055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff871602178155338082526008602052604090912054919250610cba918690849061137a565b336000908152600860209081526040808320939093556007905220819055610ce28583611aab565b600455610cef8585611aab565b33600081815260066020526040902091909155610d2e903087610d10610b0a565b73ffffffffffffffffffffffffffffffffffffffff1692919061152b565b60405185815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610727565b60608167ffffffffffffffff811115610d7b57610d7b611abe565b604051908082528060200260200182016040528015610dae57816020015b6060815260200190600190039081610d995790505b50905060005b82811015610ed45760008030868685818110610dd257610dd2611aed565b9050602002810190610de49190611b1c565b604051610df2929190611b88565b600060405180830381855af49150503d8060008114610e2d576040519150601f19603f3d011682016040523d82523d6000602084013e610e32565b606091505b509150915081610ea157604481511015610e4b57600080fd5b60048101905080806020019051810190610e659190611b98565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e989190611c63565b60405180910390fd5b80848481518110610eb457610eb4611aed565b602002602001018190525050508080610ecc90611c76565b915050610db4565b5092915050565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152859073ffffffffffffffffffffffffffffffffffffffff88169063dd62ed3e90604401602060405180830381865afa158015610f4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f719190611cae565b1015610f8557610f8586868686868661123f565b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1615610fdd576040517fd31b2dd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661102a576040517f1b007b4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6110338161160e565b50565b60006105d4600454610585610bd9565b336000908152600660205260408120549061105f610bd9565b9050600060045490506000611081828467ffffffffffffffff166002546112fd565b33600081815260086020526040812054929350916110a391908790859061137a565b905080156110bc57336000908152600860205260408120555b6003829055600080547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000067ffffffffffffffff87160217815533808252600760209081526040808420869055600690915282209190915585840360045561113d90866106dc610b0a565b60405185815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d59060200160405180910390a28015610b0357610ad133826106dc6112f1565b336111a560005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111f2576040517f5eee3ad100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661102a576040517fedf1b1fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018690526064810185905260ff8416608482015260a4810183905260c4810182905273ffffffffffffffffffffffffffffffffffffffff87169063d505accf9060e401600060405180830381600087803b1580156112d157600080fd5b505af11580156112e5573d6000803e3d6000fd5b50505050505050505050565b60006105d460006114e8565b6000836000036113105750600354611373565b600054611363906c0c9f2c9cd04674edea40000000906113529074010000000000000000000000000000000000000000900467ffffffffffffffff1686611a20565b61135c9190611a6e565b8386611683565b6003546113709190611aab565b90505b9392505050565b73ffffffffffffffffffffffffffffffffffffffff841660009081526007602052604081205482906113c59086906113b29087611a20565b6c0c9f2c9cd04674edea40000000611683565b6113cf9190611aab565b95945050505050565b60008061140d7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe368181013560f01c90030190565b929092013560c01c92915050565b60006040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201528260248201526000806044836000895af191505061147c8161174f565b6114e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610e98565b50505050565b60008061151d7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe368181013560f01c90030190565b929092013560601c92915050565b60006040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015273ffffffffffffffffffffffffffffffffffffffff8416602482015282604482015260008060648360008a5af19150506115a88161174f565b610b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610e98565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050806000036116da57600084116116cf57600080fd5b508290049050611373565b8084116116e657600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b60003d8261176157806000803e806000fd5b806020811461177957801561178a576000925061178f565b816000803e6000511515925061178f565b600192505b5050919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461103357600080fd5b6000602082840312156117ca57600080fd5b813561137381611796565b6000602082840312156117e757600080fd5b5035919050565b6000806040838503121561180157600080fd5b823561180c81611796565b91506020830135801515811461182157600080fd5b809150509250929050565b6000806020838503121561183f57600080fd5b823567ffffffffffffffff8082111561185757600080fd5b818501915085601f83011261186b57600080fd5b81358181111561187a57600080fd5b8660208260051b850101111561188f57600080fd5b60209290920196919550909350505050565b60005b838110156118bc5781810151838201526020016118a4565b50506000910152565b600081518084526118dd8160208601602086016118a1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611982577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526119708583516118c5565b94509285019290850190600101611936565b5092979650505050505050565b60008060008060008060c087890312156119a857600080fd5b86356119b381611796565b95506020870135945060408701359350606087013560ff811681146119d757600080fd5b9598949750929560808101359460a0909101359350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156105c2576105c26119f1565b600082611a69577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611aa657611aa66119f1565b500290565b808201808211156105c2576105c26119f1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611b5157600080fd5b83018035915067ffffffffffffffff821115611b6c57600080fd5b602001915036819003821315611b8157600080fd5b9250929050565b8183823760009101908152919050565b600060208284031215611baa57600080fd5b815167ffffffffffffffff80821115611bc257600080fd5b818401915084601f830112611bd657600080fd5b815181811115611be857611be8611abe565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715611c2e57611c2e611abe565b81604052828152876020848701011115611c4757600080fd5b611c588360208301602088016118a1565b979650505050505050565b60208152600061137360208301846118c5565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ca757611ca76119f1565b5060010190565b600060208284031215611cc057600080fd5b505191905056fea26469706673582212208c96feae0e4332631ce5a54a3671619c72a1e589950e455c8d33077c5a9ab84f64736f6c63430008100033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.