ERC-20
Overview
Max Total Supply
420,000,095,348.26415862 LUNAC
Holders
129
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
127,977,989.941250892977255377 LUNACValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
LunacyDAO
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {ERC20} from "lib/solmate/src/tokens/ERC20.sol"; import {TerraClaimable} from "./TerraClaimable.sol"; contract LunacyDAO is ERC20, TerraClaimable { address immutable minter; mapping(string => bool) public hasClaimed; mapping(address => uint256) public leftToClaim; mapping(address => uint256) public initiallyClaimed; bool public claiming; error Unauthorized(); error ClaimingNotEnabled(); error TooEarlyToClaimRemainder(); error NothingLeftToClaim(); error AlreadyClaimed(); error CannotClaim(); event Claim(address indexed to, uint256 amount); constructor(address _minter) ERC20("LunacyDAO", "LUNAC", 18) { minter = _minter; _mint(msg.sender, 420_000_000_000e18); } function enableClaiming() external { if (msg.sender != minter) revert Unauthorized(); claiming = true; } function claim( uint256 amount, bytes memory _minterSignature, bytes memory _terraSignature, bytes memory _terraPubKey ) external { if (!claiming) revert ClaimingNotEnabled(); string memory terraAddress = addressFromPublicKey(_terraPubKey); if (hasClaimed[terraAddress]) revert AlreadyClaimed(); if (!canClaim(_terraSignature, _terraPubKey)) revert CannotClaim(); bytes32 hashedMessage = sha256(abi.encodePacked(msg.sender, amount, terraAddress)); (uint8 v, bytes32 r, bytes32 s) = splitSignature(_minterSignature); address recoveredAddress = ecrecover(hashedMessage, v, r, s); if (recoveredAddress == address(0)) revert InvalidSignature(); if (recoveredAddress != minter) revert InvalidAddress(); uint256 mintAmount = (amount * 33) / 100; hasClaimed[terraAddress] = true; leftToClaim[msg.sender] = amount - mintAmount; initiallyClaimed[msg.sender] = block.timestamp; _mint(msg.sender, mintAmount); emit Claim(msg.sender, mintAmount); } function claimRemainder() external { uint256 mintAmount = leftToClaim[msg.sender]; if (mintAmount == 0) revert NothingLeftToClaim(); if (block.timestamp - initiallyClaimed[msg.sender] < 7 days) revert TooEarlyToClaimRemainder(); leftToClaim[msg.sender] = 0; _mint(msg.sender, mintAmount); emit Claim(msg.sender, mintAmount); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.4; import {ERC20} from "lib/solmate/src/tokens/ERC20.sol"; import {SafeTransferLib} from "lib/solmate/src/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, 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 time this account started staking mapping(address => uint256) public startedStaking; /// @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 ERC20 public immutable rewardToken; /// @notice The token being staked in the pool ERC20 public immutable stakeToken; /// @notice The length of each reward period, in seconds uint64 public immutable duration; /// ----------------------------------------------------------------------- /// Initialization /// ----------------------------------------------------------------------- /// @notice Initializes the contract /// @param _rewardToken The token to be rewarded to stakers /// @param _stakeToken The token to be staked by stakers /// @param _duration The duration of the staking constructor( ERC20 _rewardToken, ERC20 _stakeToken, uint64 _duration ) { rewardToken =_rewardToken; stakeToken = _stakeToken; duration = _duration; _transferOwnership(msg.sender); } /// ----------------------------------------------------------------------- /// 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; startedStaking[msg.sender] = block.timestamp; /// ----------------------------------------------------------------------- /// 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_ ); } }
// 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 //////////////////////////////////////////////////////////////*/ 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 { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), 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) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { event Debug(bool one, bool two, uint256 retsize); /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument. mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
// 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: 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.5.0; import {ERC20} from "lib/solmate/src/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); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {Bech32} from "./lib/Bech32.sol"; import {EllipticCurve} from "./lib/Secp256k1.sol"; contract TerraClaimable { error InvalidSignatureLength(); error InvalidSignature(); error InvalidAddress(); function canClaim(bytes memory _signature, bytes memory _compPubKey) public view returns (bool) { bytes32 hashedAddress = sha256(abi.encodePacked(msg.sender)); (uint8 v, bytes32 r, bytes32 s) = splitSignature(_signature); address recoveredAddress = ecrecover(hashedAddress, v, r, s); if (recoveredAddress == address(0)) revert InvalidSignature(); bytes memory _pubKey = decompressPubKey(_compPubKey); address computedAddress = address(uint160(uint256(keccak256(_pubKey)))); if (recoveredAddress != computedAddress) revert InvalidAddress(); return true; } function convertToArray(bytes memory _data) internal pure returns (uint256[] memory output) { output = new uint256[](_data.length); for (uint256 i = 0; i < _data.length; i++) { output[i] = uint256(uint8(_data[i])); } } function addressFromPublicKey(bytes memory _compPubKey) public pure returns (string memory result) { bytes memory pubKeyHash = abi.encodePacked(ripemd160(abi.encodePacked(sha256(abi.encodePacked(_compPubKey))))); uint256[] memory pubKeyNumbers = convertToArray(pubKeyHash); uint256[] memory pubKey5BitBase = Bech32.convert(pubKeyNumbers, 8, 5); result = string.concat("terra1", string(Bech32.encode(convertToArray(bytes("terra")), pubKey5BitBase))); } function splitSignature(bytes memory _sig) internal pure returns ( uint8 v, bytes32 r, bytes32 s ) { if (_sig.length != 65) revert InvalidSignatureLength(); assembly { // first 32 bytes, after the length prefix r := mload(add(_sig, 32)) // second 32 bytes s := mload(add(_sig, 64)) // final byte (first byte of the next 32 bytes) v := byte(0, mload(add(_sig, 96))) } } function decompressPubKey(bytes memory _compPubKey) internal pure returns (bytes memory pubKey) { uint8 prefix; uint256 x; assembly { prefix := byte(0, mload(add(_compPubKey, 32))) x := mload(add(_compPubKey, 33)) } uint256 y = EllipticCurve.deriveY(prefix, x); pubKey = bytes.concat(bytes32(x), bytes32(y)); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.5.15; import {BytesLib} from "./BytesLib.sol"; /** @author https://github.com/gregdhill **/ library Bech32 { using BytesLib for bytes; bytes constant CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; function polymod(uint256[] memory values) internal pure returns (uint256) { uint32[5] memory GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3]; uint256 chk = 1; for (uint256 p = 0; p < values.length; p++) { uint256 top = chk >> 25; chk = ((chk & 0x1ffffff) << 5) ^ values[p]; for (uint256 i = 0; i < 5; i++) { if ((top >> i) & 1 == 1) { chk ^= GENERATOR[i]; } } } return chk; } function hrpExpand(uint256[] memory hrp) internal pure returns (uint256[] memory) { uint256[] memory ret = new uint256[](hrp.length + hrp.length + 1); for (uint256 p = 0; p < hrp.length; p++) { ret[p] = hrp[p] >> 5; } ret[hrp.length] = 0; for (uint256 p = 0; p < hrp.length; p++) { ret[p + hrp.length + 1] = hrp[p] & 31; } return ret; } function concat(uint256[] memory left, uint256[] memory right) internal pure returns (uint256[] memory) { uint256[] memory ret = new uint256[](left.length + right.length); uint256 i = 0; for (; i < left.length; i++) { ret[i] = left[i]; } uint256 j = 0; while (j < right.length) { ret[i++] = right[j++]; } return ret; } function extend( uint256[] memory array, uint256 val, uint256 num ) internal pure returns (uint256[] memory) { uint256[] memory ret = new uint256[](array.length + num); uint256 i = 0; for (; i < array.length; i++) { ret[i] = array[i]; } uint256 j = 0; while (j < num) { ret[i++] = val; j++; } return ret; } function createChecksum(uint256[] memory hrp, uint256[] memory data) internal pure returns (uint256[] memory) { uint256[] memory values = extend(concat(hrpExpand(hrp), data), 0, 6); uint256 mod = polymod(values) ^ 1; uint256[] memory ret = new uint256[](6); for (uint256 p = 0; p < 6; p++) { ret[p] = (mod >> (5 * (5 - p))) & 31; } return ret; } function encode(uint256[] memory hrp, uint256[] memory data) internal pure returns (bytes memory) { uint256[] memory combined = concat(data, createChecksum(hrp, data)); bytes memory ret = new bytes(combined.length); for (uint256 p = 0; p < combined.length; p++) { ret[p] = CHARSET[combined[p]]; } return ret; } function convert( uint256[] memory data, uint256 inBits, uint256 outBits ) internal pure returns (uint256[] memory) { uint256 value = 0; uint256 bits = 0; uint256 maxV = (1 << outBits) - 1; uint256[] memory ret = new uint256[](32); uint256 j = 0; for (uint256 i = 0; i < data.length; ++i) { value = (value << inBits) | data[i]; bits += inBits; while (bits >= outBits) { bits -= outBits; ret[j] = (value >> bits) & maxV; j += 1; } } return ret; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; /** @author https://github.com/witnet/elliptic-curve-solidity **/ library EllipticCurve { // Pre-computed constant for 2 ** 255 uint256 private constant U255_MAX_PLUS_1 = 57896044618658097711785492504343953926634992332820282019728792003956564819968; uint256 public constant AA = 0; uint256 public constant BB = 7; uint256 public constant PP = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; /// @dev Modular exponentiation, b^e % _PP. /// Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol /// @param _base base /// @param _exp exponent /// @return r such that r = b**e (mod _PP) function expMod( uint256 _base, uint256 _exp ) internal pure returns (uint256) { require(PP != 0, "Modulus is zero"); if (_base == 0) return 0; if (_exp == 0) return 1; uint256 r = 1; uint256 bit = U255_MAX_PLUS_1; assembly { for { } gt(bit, 0) { } { r := mulmod(mulmod(r, r, PP), exp(_base, iszero(iszero(and(_exp, bit)))), PP) r := mulmod(mulmod(r, r, PP), exp(_base, iszero(iszero(and(_exp, div(bit, 2))))), PP) r := mulmod(mulmod(r, r, PP), exp(_base, iszero(iszero(and(_exp, div(bit, 4))))), PP) r := mulmod(mulmod(r, r, PP), exp(_base, iszero(iszero(and(_exp, div(bit, 8))))), PP) bit := div(bit, 16) } } return r; } /// @dev Derives the y coordinate from a compressed-format point x [[SEC-1]](https://www.secg.org/SEC1-Ver-1.0.pdf). /// @param _prefix parity byte (0x02 even, 0x03 odd) /// @param _x coordinate x /// @return y coordinate y function deriveY(uint8 _prefix, uint256 _x) internal pure returns (uint256) { require(_prefix == 0x02 || _prefix == 0x03, "Invalid compressed EC point prefix"); // x^3 + ax + b uint256 y2 = addmod(mulmod(_x, mulmod(_x, _x, PP), PP), addmod(mulmod(_x, AA, PP), BB, PP), PP); y2 = expMod(y2, (PP + 1) / 4); // uint256 cmp = yBit ^ y_ & 1; uint256 y = (y2 + _prefix) % 2 == 0 ? y2 : PP - y2; return y; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.5.10; /* https://github.com/GNSPS/solidity-bytes-utils/ This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <https://unlicense.org> */ /** @title BytesLib **/ /** @author https://github.com/GNSPS **/ library BytesLib { function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore( 0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. ) ) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory res) { if (_length == 0) { return hex""; } uint256 _end = _start + _length; require(_end > _start && _bytes.length >= _end, "Slice out of bounds"); assembly { // Alloc bytes array with additional 32 bytes afterspace and assign it's size res := mload(0x40) mstore(0x40, add(add(res, 64), _length)) mstore(res, _length) // Compute distance between source and destination pointers let diff := sub(res, add(_bytes, _start)) for { let src := add(add(_bytes, 32), _start) let end := add(src, _length) } lt(src, end) { src := add(src, 32) } { mstore(add(src, diff), mload(src)) } } } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { uint256 _totalLen = _start + 20; require(_totalLen > _start && _bytes.length >= _totalLen, "Address conversion out of bounds."); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { uint256 _totalLen = _start + 32; require(_totalLen > _start && _bytes.length >= _totalLen, "Uint conversion out of bounds."); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint(mc < end) + cb == 2) for { } eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } function toBytes32(bytes memory _source) internal pure returns (bytes32 result) { if (_source.length == 0) { return 0x0; } assembly { result := mload(add(_source, 32)) } } function keccak256Slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes32 result) { uint256 _end = _start + _length; require(_end > _start && _bytes.length >= _end, "Slice out of bounds"); assembly { result := keccak256(add(add(_bytes, 32), _start), _length) } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"CannotClaim","type":"error"},{"inputs":[],"name":"ClaimingNotEnabled","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSignatureLength","type":"error"},{"inputs":[],"name":"NothingLeftToClaim","type":"error"},{"inputs":[],"name":"TooEarlyToClaimRemainder","type":"error"},{"inputs":[],"name":"Unauthorized","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":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","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":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_compPubKey","type":"bytes"}],"name":"addressFromPublicKey","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_signature","type":"bytes"},{"internalType":"bytes","name":"_compPubKey","type":"bytes"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"_minterSignature","type":"bytes"},{"internalType":"bytes","name":"_terraSignature","type":"bytes"},{"internalType":"bytes","name":"_terraPubKey","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRemainder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claiming","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableClaiming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"initiallyClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"leftToClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","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":"permit","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":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b506040516200245638038062002456833981016040819052620000359162000295565b60408051808201825260098152684c756e61637944414f60b81b6020808301918252835180850190945260058452644c554e414360d81b908401528151919291601291620000879160009190620001ef565b5081516200009d906001906020850190620001ef565b5060ff81166080524660a052620000b3620000e6565b60c0525050506001600160a01b03811660e052620000df336c054d17db76321263eca000000062000182565b50620003cd565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516200011a919062000303565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b8060026000828254620001969190620003a6565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001fd90620002c7565b90600052602060002090601f0160209004810192826200022157600085556200026c565b82601f106200023c57805160ff19168380011785556200026c565b828001600101855582156200026c579182015b828111156200026c5782518255916020019190600101906200024f565b506200027a9291506200027e565b5090565b5b808211156200027a57600081556001016200027f565b600060208284031215620002a857600080fd5b81516001600160a01b0381168114620002c057600080fd5b9392505050565b600181811c90821680620002dc57607f821691505b602082108103620002fd57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c9150808316806200032057607f831692505b602080841082036200034057634e487b7160e01b86526022600452602486fd5b818015620003575760018114620003695762000398565b60ff1986168952848901965062000398565b60008a81526020902060005b86811015620003905781548b82015290850190830162000375565b505084890196505b509498975050505050505050565b60008219821115620003c857634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c05160e0516120486200040e600039600081816105b30152610bc4015260006107eb015260006107b6015260006101de01526120486000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c80633644e515116100b8578063a9059cbb1161007c578063a9059cbb146102a3578063ad6c74b2146102b6578063cb54c9eb146102d6578063d505accf146102e9578063dd62ed3e146102fc578063f89d064a1461032757600080fd5b80633644e5151461024057806340fb81ba1461024857806370a082311461025b5780637ecebe001461027b57806395d89b411461029b57600080fd5b80632081a88c116100ff5780632081a88c146101b4578063212abe5b146101be57806323b872dd146101c6578063313ce567146101d9578063363454ee1461021257600080fd5b806306fdde031461013c578063095ea7b31461015a5780630a7a823c1461017d5780630defc08a1461019057806318160ddd1461019d575b600080fd5b610144610347565b6040516101519190611a2b565b60405180910390f35b61016d610168366004611a7a565b6103d5565b6040519015158152602001610151565b61014461018b366004611b57565b610442565b60095461016d9060ff1681565b6101a660025481565b604051908152602001610151565b6101bc6105a8565b005b6101bc6105ff565b61016d6101d4366004611b94565b6106c0565b6102007f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610151565b61016d610220366004611bd0565b805160208183018101805160068252928201919093012091525460ff1681565b6101a66107b2565b61016d610256366004611c19565b61080d565b6101a6610269366004611c7d565b60036020526000908152604090205481565b6101a6610289366004611c7d565b60056020526000908152604090205481565b610144610988565b61016d6102b1366004611a7a565b610995565b6101a66102c4366004611c7d565b60076020526000908152604090205481565b6101bc6102e4366004611c98565b610a0d565b6101bc6102f7366004611d2a565b610cd8565b6101a661030a366004611d9d565b600460209081526000928352604080842090915290825290205481565b6101a6610335366004611c7d565b60086020526000908152604090205481565b6000805461035490611dd0565b80601f016020809104026020016040519081016040528092919081815260200182805461038090611dd0565b80156103cd5780601f106103a2576101008083540402835291602001916103cd565b820191906000526020600020905b8154815290600101906020018083116103b057829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104309086815260200190565b60405180910390a35060015b92915050565b60606000600360028460405160200161045b9190611e04565b60408051601f198184030181529082905261047591611e04565b602060405180830381855afa158015610492573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906104b59190611e20565b6040516020016104c791815260200190565b60408051601f19818403018152908290526104e191611e04565b602060405180830381855afa1580156104fe573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff1916602082015260340190506040516020818303038152906040529050600061053d82610f21565b9050600061054e8260086005610fcd565b905061057f61057960405180604001604052806005815260200164746572726160d81b815250610f21565b826110ab565b60405160200161058f9190611e39565b6040516020818303038152906040529350505050919050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105f0576040516282b42960e81b815260040160405180910390fd5b6009805460ff19166001179055565b33600090815260076020526040812054908190036106305760405163747ea05d60e01b815260040160405180910390fd5b3360009081526008602052604090205462093a809061064f9042611e7d565b101561066e576040516306d213a560e11b815260040160405180910390fd5b3360008181526007602052604081205561068890826111c8565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a250565b6001600160a01b0383166000908152600460209081526040808320338452909152812054600019811461071c576106f78382611e7d565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b03851660009081526003602052604081208054859290610744908490611e7d565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061079f9087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146107e8576107e3611233565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6040516bffffffffffffffffffffffff193360601b166020820152600090819060029060340160408051601f198184030181529082905261084d91611e04565b602060405180830381855afa15801561086a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061088d9190611e20565b9050600080600061089d876112cd565b9250925092506000600185858585604051600081526020016040526040516108e1949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610903573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661093757604051638baa579f60e01b815260040160405180910390fd5b600061094288611310565b805160208201209091506001600160a01b03838116908216146109785760405163e6c4247b60e01b815260040160405180910390fd5b5060019998505050505050505050565b6001805461035490611dd0565b336000908152600360205260408120805483919083906109b6908490611e7d565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104309086815260200190565b60095460ff16610a30576040516371642c7760e11b815260040160405180910390fd5b6000610a3b82610442565b9050600681604051610a4d9190611e04565b9081526040519081900360200190205460ff1615610a7e57604051630c8d9eab60e31b815260040160405180910390fd5b610a88838361080d565b610aa5576040516371f1e92160e11b815260040160405180910390fd5b60006002338784604051602001610abe93929190611e94565b60408051601f1981840301815290829052610ad891611e04565b602060405180830381855afa158015610af5573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610b189190611e20565b90506000806000610b28886112cd565b925092509250600060018585858560405160008152602001604052604051610b6c949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610b8e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610bc257604051638baa579f60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031614610c145760405163e6c4247b60e01b815260040160405180910390fd5b60006064610c238c6021611ed3565b610c2d9190611f08565b90506001600688604051610c419190611e04565b908152604051908190036020019020805491151560ff19909216919091179055610c6b818c611e7d565b336000818152600760209081526040808320949094556008905291909120429055610c9690826111c8565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a25050505050505050505050565b42841015610d2d5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610d396107b2565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610e45573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610e7b5750876001600160a01b0316816001600160a01b0316145b610eb85760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610d24565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6060815167ffffffffffffffff811115610f3d57610f3d611aa4565b604051908082528060200260200182016040528015610f66578160200160208202803683370190505b50905060005b8251811015610fc757828181518110610f8757610f87611f1c565b602001015160f81c60f81b60f81c60ff16828281518110610faa57610faa611f1c565b602090810291909101015280610fbf81611f32565b915050610f6c565b50919050565b606060008080610fe0600180871b611e7d565b604080516020808252610420820190925291925060009190808201610400803683370190505090506000805b895181101561109d5789818151811061102757611027611f1c565b60200260200101518987901b17955088856110429190611f4b565b94505b87851061108d576110568886611e7d565b9450838587901c1683838151811061107057611070611f1c565b6020908102919091010152611086600183611f4b565b9150611045565b61109681611f32565b905061100c565b509098975050505050505050565b606060006110c2836110bd868661134a565b611406565b90506000815167ffffffffffffffff8111156110e0576110e0611aa4565b6040519080825280601f01601f19166020018201604052801561110a576020820181803683370190505b50905060005b82518110156111bf576040518060400160405280602081526020017f71707a7279397838676632747664773073336a6e35346b686365366d7561376c81525083828151811061116157611161611f1c565b60200260200101518151811061117957611179611f1c565b602001015160f81c60f81b82828151811061119657611196611f1c565b60200101906001600160f81b031916908160001a905350806111b781611f32565b915050611110565b50949350505050565b80600260008282546111da9190611f4b565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516112659190611f63565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080600083516041146112f457604051634be6321b60e01b815260040160405180910390fd5b5050506020810151604082015160609092015160001a92909190565b60208101516021820151606091600090811a919061132e838361151b565b604080516020810185905290810182905290915060600161058f565b6060600061136c61136361135d86611619565b85611406565b6000600661176b565b9050600061137982611866565b60408051600680825260e082019092526001929092189250600091906020820160c08036833701905050905060005b60068110156113fc576113bc816005611e7d565b6113c7906005611ed3565b83901c601f168282815181106113df576113df611f1c565b6020908102919091010152806113f481611f32565b9150506113a8565b5095945050505050565b60606000825184516114189190611f4b565b67ffffffffffffffff81111561143057611430611aa4565b604051908082528060200260200182016040528015611459578160200160208202803683370190505b50905060005b84518110156114b15784818151811061147a5761147a611f1c565b602002602001015182828151811061149457611494611f1c565b6020908102919091010152806114a981611f32565b91505061145f565b60005b84518110156115115784816114c881611f32565b9250815181106114da576114da611f1c565b60200260200101518383806114ee90611f32565b94508151811061150057611500611f1c565b6020026020010181815250506114b4565b5090949350505050565b60008260ff166002148061153257508260ff166003145b6115895760405162461bcd60e51b815260206004820152602260248201527f496e76616c696420636f6d7072657373656420454320706f696e7420707265666044820152610d2f60f31b6064820152608401610d24565b60006401000003d0198060076401000003d01960008709086401000003d0198086870986090890506115d78160046115c86401000003d0196001611f4b565b6115d29190611f08565b61194d565b9050600060026115ea60ff871684611f4b565b6115f49190611ffe565b1561160e57611609826401000003d019611e7d565b611610565b815b95945050505050565b606060008251835161162b9190611f4b565b611636906001611f4b565b67ffffffffffffffff81111561164e5761164e611aa4565b604051908082528060200260200182016040528015611677578160200160208202803683370190505b50905060005b83518110156116d357600584828151811061169a5761169a611f1c565b6020026020010151901c8282815181106116b6576116b6611f1c565b6020908102919091010152806116cb81611f32565b91505061167d565b506000818451815181106116e9576116e9611f1c565b60200260200101818152505060005b83518110156117645783818151811061171357611713611f1c565b6020026020010151601f168285518361172c9190611f4b565b611737906001611f4b565b8151811061174757611747611f1c565b60209081029190910101528061175c81611f32565b9150506116f8565b5092915050565b6060600082855161177c9190611f4b565b67ffffffffffffffff81111561179457611794611aa4565b6040519080825280602002602001820160405280156117bd578160200160208202803683370190505b50905060005b8551811015611815578581815181106117de576117de611f1c565b60200260200101518282815181106117f8576117f8611f1c565b60209081029190910101528061180d81611f32565b9150506117c3565b60005b8481101561185b5785838361182c81611f32565b94508151811061183e5761183e611f1c565b60209081029190910101528061185381611f32565b915050611818565b509095945050505050565b6040805160a081018252633b6a57b281526326508e6d6020820152631ea119fa91810191909152633d4233dd6060820152632a1462b360808201526000906001825b8451811015611945576000601983901c90508582815181106118cc576118cc611f1c565b60200260200101516005846301ffffff16901b18925060005b6005811015611930578082901c60011660010361191e5784816005811061190e5761190e611f1c565b602002015163ffffffff16841893505b8061192881611f32565b9150506118e5565b5050808061193d90611f32565b9150506118a8565b509392505050565b60008260000361195f5750600061043c565b8160000361196f5750600161043c565b6001600160ff1b5b8015611945576401000003d0198185161515860a6401000003d0198485090991506401000003d0196002820485161515860a6401000003d0198485090991506401000003d0196004820485161515860a6401000003d0198485090991506401000003d0196008820485161515860a6401000003d01984850909915060109004611977565b60005b83811015611a165781810151838201526020016119fe565b83811115611a25576000848401525b50505050565b6020815260008251806020840152611a4a8160408501602087016119fb565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611a7557600080fd5b919050565b60008060408385031215611a8d57600080fd5b611a9683611a5e565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611ad557611ad5611aa4565b604051601f8501601f19908116603f01168101908282118183101715611afd57611afd611aa4565b81604052809350858152868686011115611b1657600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611b4157600080fd5b611b5083833560208501611aba565b9392505050565b600060208284031215611b6957600080fd5b813567ffffffffffffffff811115611b8057600080fd5b611b8c84828501611b30565b949350505050565b600080600060608486031215611ba957600080fd5b611bb284611a5e565b9250611bc060208501611a5e565b9150604084013590509250925092565b600060208284031215611be257600080fd5b813567ffffffffffffffff811115611bf957600080fd5b8201601f81018413611c0a57600080fd5b611b8c84823560208401611aba565b60008060408385031215611c2c57600080fd5b823567ffffffffffffffff80821115611c4457600080fd5b611c5086838701611b30565b93506020850135915080821115611c6657600080fd5b50611c7385828601611b30565b9150509250929050565b600060208284031215611c8f57600080fd5b611b5082611a5e565b60008060008060808587031215611cae57600080fd5b84359350602085013567ffffffffffffffff80821115611ccd57600080fd5b611cd988838901611b30565b94506040870135915080821115611cef57600080fd5b611cfb88838901611b30565b93506060870135915080821115611d1157600080fd5b50611d1e87828801611b30565b91505092959194509250565b600080600080600080600060e0888a031215611d4557600080fd5b611d4e88611a5e565b9650611d5c60208901611a5e565b95506040880135945060608801359350608088013560ff81168114611d8057600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611db057600080fd5b611db983611a5e565b9150611dc760208401611a5e565b90509250929050565b600181811c90821680611de457607f821691505b602082108103610fc757634e487b7160e01b600052602260045260246000fd5b60008251611e168184602087016119fb565b9190910192915050565b600060208284031215611e3257600080fd5b5051919050565b6574657272613160d01b815260008251611e5a8160068501602087016119fb565b9190910160060192915050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e8f57611e8f611e67565b500390565b6bffffffffffffffffffffffff198460601b16815282601482015260008251611ec48160348501602087016119fb565b91909101603401949350505050565b6000816000190483118215151615611eed57611eed611e67565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611f1757611f17611ef2565b500490565b634e487b7160e01b600052603260045260246000fd5b600060018201611f4457611f44611e67565b5060010190565b60008219821115611f5e57611f5e611e67565b500190565b600080835481600182811c915080831680611f7f57607f831692505b60208084108203611f9e57634e487b7160e01b86526022600452602486fd5b818015611fb25760018114611fc357611ff0565b60ff19861689528489019650611ff0565b60008a81526020902060005b86811015611fe85781548b820152908501908301611fcf565b505084890196505b509498975050505050505050565b60008261200d5761200d611ef2565b50069056fea26469706673582212206b1e389ed9dfa92b252d053ae944463a3203f17ed0ca6c272a36a8885d20735d64736f6c634300080d0033000000000000000000000000d547834953695511c96d8e26376895ba8adae8be
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80633644e515116100b8578063a9059cbb1161007c578063a9059cbb146102a3578063ad6c74b2146102b6578063cb54c9eb146102d6578063d505accf146102e9578063dd62ed3e146102fc578063f89d064a1461032757600080fd5b80633644e5151461024057806340fb81ba1461024857806370a082311461025b5780637ecebe001461027b57806395d89b411461029b57600080fd5b80632081a88c116100ff5780632081a88c146101b4578063212abe5b146101be57806323b872dd146101c6578063313ce567146101d9578063363454ee1461021257600080fd5b806306fdde031461013c578063095ea7b31461015a5780630a7a823c1461017d5780630defc08a1461019057806318160ddd1461019d575b600080fd5b610144610347565b6040516101519190611a2b565b60405180910390f35b61016d610168366004611a7a565b6103d5565b6040519015158152602001610151565b61014461018b366004611b57565b610442565b60095461016d9060ff1681565b6101a660025481565b604051908152602001610151565b6101bc6105a8565b005b6101bc6105ff565b61016d6101d4366004611b94565b6106c0565b6102007f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff9091168152602001610151565b61016d610220366004611bd0565b805160208183018101805160068252928201919093012091525460ff1681565b6101a66107b2565b61016d610256366004611c19565b61080d565b6101a6610269366004611c7d565b60036020526000908152604090205481565b6101a6610289366004611c7d565b60056020526000908152604090205481565b610144610988565b61016d6102b1366004611a7a565b610995565b6101a66102c4366004611c7d565b60076020526000908152604090205481565b6101bc6102e4366004611c98565b610a0d565b6101bc6102f7366004611d2a565b610cd8565b6101a661030a366004611d9d565b600460209081526000928352604080842090915290825290205481565b6101a6610335366004611c7d565b60086020526000908152604090205481565b6000805461035490611dd0565b80601f016020809104026020016040519081016040528092919081815260200182805461038090611dd0565b80156103cd5780601f106103a2576101008083540402835291602001916103cd565b820191906000526020600020905b8154815290600101906020018083116103b057829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104309086815260200190565b60405180910390a35060015b92915050565b60606000600360028460405160200161045b9190611e04565b60408051601f198184030181529082905261047591611e04565b602060405180830381855afa158015610492573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906104b59190611e20565b6040516020016104c791815260200190565b60408051601f19818403018152908290526104e191611e04565b602060405180830381855afa1580156104fe573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff1916602082015260340190506040516020818303038152906040529050600061053d82610f21565b9050600061054e8260086005610fcd565b905061057f61057960405180604001604052806005815260200164746572726160d81b815250610f21565b826110ab565b60405160200161058f9190611e39565b6040516020818303038152906040529350505050919050565b336001600160a01b037f000000000000000000000000d547834953695511c96d8e26376895ba8adae8be16146105f0576040516282b42960e81b815260040160405180910390fd5b6009805460ff19166001179055565b33600090815260076020526040812054908190036106305760405163747ea05d60e01b815260040160405180910390fd5b3360009081526008602052604090205462093a809061064f9042611e7d565b101561066e576040516306d213a560e11b815260040160405180910390fd5b3360008181526007602052604081205561068890826111c8565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a250565b6001600160a01b0383166000908152600460209081526040808320338452909152812054600019811461071c576106f78382611e7d565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b03851660009081526003602052604081208054859290610744908490611e7d565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061079f9087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000146146107e8576107e3611233565b905090565b507f9ec1456076b8628c549f1c94e6b72a72ef217baa620be737aa8130102f0467ac90565b6040516bffffffffffffffffffffffff193360601b166020820152600090819060029060340160408051601f198184030181529082905261084d91611e04565b602060405180830381855afa15801561086a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061088d9190611e20565b9050600080600061089d876112cd565b9250925092506000600185858585604051600081526020016040526040516108e1949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610903573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661093757604051638baa579f60e01b815260040160405180910390fd5b600061094288611310565b805160208201209091506001600160a01b03838116908216146109785760405163e6c4247b60e01b815260040160405180910390fd5b5060019998505050505050505050565b6001805461035490611dd0565b336000908152600360205260408120805483919083906109b6908490611e7d565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104309086815260200190565b60095460ff16610a30576040516371642c7760e11b815260040160405180910390fd5b6000610a3b82610442565b9050600681604051610a4d9190611e04565b9081526040519081900360200190205460ff1615610a7e57604051630c8d9eab60e31b815260040160405180910390fd5b610a88838361080d565b610aa5576040516371f1e92160e11b815260040160405180910390fd5b60006002338784604051602001610abe93929190611e94565b60408051601f1981840301815290829052610ad891611e04565b602060405180830381855afa158015610af5573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610b189190611e20565b90506000806000610b28886112cd565b925092509250600060018585858560405160008152602001604052604051610b6c949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610b8e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610bc257604051638baa579f60e01b815260040160405180910390fd5b7f000000000000000000000000d547834953695511c96d8e26376895ba8adae8be6001600160a01b0316816001600160a01b031614610c145760405163e6c4247b60e01b815260040160405180910390fd5b60006064610c238c6021611ed3565b610c2d9190611f08565b90506001600688604051610c419190611e04565b908152604051908190036020019020805491151560ff19909216919091179055610c6b818c611e7d565b336000818152600760209081526040808320949094556008905291909120429055610c9690826111c8565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a25050505050505050505050565b42841015610d2d5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610d396107b2565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610e45573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610e7b5750876001600160a01b0316816001600160a01b0316145b610eb85760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610d24565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6060815167ffffffffffffffff811115610f3d57610f3d611aa4565b604051908082528060200260200182016040528015610f66578160200160208202803683370190505b50905060005b8251811015610fc757828181518110610f8757610f87611f1c565b602001015160f81c60f81b60f81c60ff16828281518110610faa57610faa611f1c565b602090810291909101015280610fbf81611f32565b915050610f6c565b50919050565b606060008080610fe0600180871b611e7d565b604080516020808252610420820190925291925060009190808201610400803683370190505090506000805b895181101561109d5789818151811061102757611027611f1c565b60200260200101518987901b17955088856110429190611f4b565b94505b87851061108d576110568886611e7d565b9450838587901c1683838151811061107057611070611f1c565b6020908102919091010152611086600183611f4b565b9150611045565b61109681611f32565b905061100c565b509098975050505050505050565b606060006110c2836110bd868661134a565b611406565b90506000815167ffffffffffffffff8111156110e0576110e0611aa4565b6040519080825280601f01601f19166020018201604052801561110a576020820181803683370190505b50905060005b82518110156111bf576040518060400160405280602081526020017f71707a7279397838676632747664773073336a6e35346b686365366d7561376c81525083828151811061116157611161611f1c565b60200260200101518151811061117957611179611f1c565b602001015160f81c60f81b82828151811061119657611196611f1c565b60200101906001600160f81b031916908160001a905350806111b781611f32565b915050611110565b50949350505050565b80600260008282546111da9190611f4b565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516112659190611f63565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080600083516041146112f457604051634be6321b60e01b815260040160405180910390fd5b5050506020810151604082015160609092015160001a92909190565b60208101516021820151606091600090811a919061132e838361151b565b604080516020810185905290810182905290915060600161058f565b6060600061136c61136361135d86611619565b85611406565b6000600661176b565b9050600061137982611866565b60408051600680825260e082019092526001929092189250600091906020820160c08036833701905050905060005b60068110156113fc576113bc816005611e7d565b6113c7906005611ed3565b83901c601f168282815181106113df576113df611f1c565b6020908102919091010152806113f481611f32565b9150506113a8565b5095945050505050565b60606000825184516114189190611f4b565b67ffffffffffffffff81111561143057611430611aa4565b604051908082528060200260200182016040528015611459578160200160208202803683370190505b50905060005b84518110156114b15784818151811061147a5761147a611f1c565b602002602001015182828151811061149457611494611f1c565b6020908102919091010152806114a981611f32565b91505061145f565b60005b84518110156115115784816114c881611f32565b9250815181106114da576114da611f1c565b60200260200101518383806114ee90611f32565b94508151811061150057611500611f1c565b6020026020010181815250506114b4565b5090949350505050565b60008260ff166002148061153257508260ff166003145b6115895760405162461bcd60e51b815260206004820152602260248201527f496e76616c696420636f6d7072657373656420454320706f696e7420707265666044820152610d2f60f31b6064820152608401610d24565b60006401000003d0198060076401000003d01960008709086401000003d0198086870986090890506115d78160046115c86401000003d0196001611f4b565b6115d29190611f08565b61194d565b9050600060026115ea60ff871684611f4b565b6115f49190611ffe565b1561160e57611609826401000003d019611e7d565b611610565b815b95945050505050565b606060008251835161162b9190611f4b565b611636906001611f4b565b67ffffffffffffffff81111561164e5761164e611aa4565b604051908082528060200260200182016040528015611677578160200160208202803683370190505b50905060005b83518110156116d357600584828151811061169a5761169a611f1c565b6020026020010151901c8282815181106116b6576116b6611f1c565b6020908102919091010152806116cb81611f32565b91505061167d565b506000818451815181106116e9576116e9611f1c565b60200260200101818152505060005b83518110156117645783818151811061171357611713611f1c565b6020026020010151601f168285518361172c9190611f4b565b611737906001611f4b565b8151811061174757611747611f1c565b60209081029190910101528061175c81611f32565b9150506116f8565b5092915050565b6060600082855161177c9190611f4b565b67ffffffffffffffff81111561179457611794611aa4565b6040519080825280602002602001820160405280156117bd578160200160208202803683370190505b50905060005b8551811015611815578581815181106117de576117de611f1c565b60200260200101518282815181106117f8576117f8611f1c565b60209081029190910101528061180d81611f32565b9150506117c3565b60005b8481101561185b5785838361182c81611f32565b94508151811061183e5761183e611f1c565b60209081029190910101528061185381611f32565b915050611818565b509095945050505050565b6040805160a081018252633b6a57b281526326508e6d6020820152631ea119fa91810191909152633d4233dd6060820152632a1462b360808201526000906001825b8451811015611945576000601983901c90508582815181106118cc576118cc611f1c565b60200260200101516005846301ffffff16901b18925060005b6005811015611930578082901c60011660010361191e5784816005811061190e5761190e611f1c565b602002015163ffffffff16841893505b8061192881611f32565b9150506118e5565b5050808061193d90611f32565b9150506118a8565b509392505050565b60008260000361195f5750600061043c565b8160000361196f5750600161043c565b6001600160ff1b5b8015611945576401000003d0198185161515860a6401000003d0198485090991506401000003d0196002820485161515860a6401000003d0198485090991506401000003d0196004820485161515860a6401000003d0198485090991506401000003d0196008820485161515860a6401000003d01984850909915060109004611977565b60005b83811015611a165781810151838201526020016119fe565b83811115611a25576000848401525b50505050565b6020815260008251806020840152611a4a8160408501602087016119fb565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611a7557600080fd5b919050565b60008060408385031215611a8d57600080fd5b611a9683611a5e565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611ad557611ad5611aa4565b604051601f8501601f19908116603f01168101908282118183101715611afd57611afd611aa4565b81604052809350858152868686011115611b1657600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611b4157600080fd5b611b5083833560208501611aba565b9392505050565b600060208284031215611b6957600080fd5b813567ffffffffffffffff811115611b8057600080fd5b611b8c84828501611b30565b949350505050565b600080600060608486031215611ba957600080fd5b611bb284611a5e565b9250611bc060208501611a5e565b9150604084013590509250925092565b600060208284031215611be257600080fd5b813567ffffffffffffffff811115611bf957600080fd5b8201601f81018413611c0a57600080fd5b611b8c84823560208401611aba565b60008060408385031215611c2c57600080fd5b823567ffffffffffffffff80821115611c4457600080fd5b611c5086838701611b30565b93506020850135915080821115611c6657600080fd5b50611c7385828601611b30565b9150509250929050565b600060208284031215611c8f57600080fd5b611b5082611a5e565b60008060008060808587031215611cae57600080fd5b84359350602085013567ffffffffffffffff80821115611ccd57600080fd5b611cd988838901611b30565b94506040870135915080821115611cef57600080fd5b611cfb88838901611b30565b93506060870135915080821115611d1157600080fd5b50611d1e87828801611b30565b91505092959194509250565b600080600080600080600060e0888a031215611d4557600080fd5b611d4e88611a5e565b9650611d5c60208901611a5e565b95506040880135945060608801359350608088013560ff81168114611d8057600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611db057600080fd5b611db983611a5e565b9150611dc760208401611a5e565b90509250929050565b600181811c90821680611de457607f821691505b602082108103610fc757634e487b7160e01b600052602260045260246000fd5b60008251611e168184602087016119fb565b9190910192915050565b600060208284031215611e3257600080fd5b5051919050565b6574657272613160d01b815260008251611e5a8160068501602087016119fb565b9190910160060192915050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e8f57611e8f611e67565b500390565b6bffffffffffffffffffffffff198460601b16815282601482015260008251611ec48160348501602087016119fb565b91909101603401949350505050565b6000816000190483118215151615611eed57611eed611e67565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611f1757611f17611ef2565b500490565b634e487b7160e01b600052603260045260246000fd5b600060018201611f4457611f44611e67565b5060010190565b60008219821115611f5e57611f5e611e67565b500190565b600080835481600182811c915080831680611f7f57607f831692505b60208084108203611f9e57634e487b7160e01b86526022600452602486fd5b818015611fb25760018114611fc357611ff0565b60ff19861689528489019650611ff0565b60008a81526020902060005b86811015611fe85781548b820152908501908301611fcf565b505084890196505b509498975050505050505050565b60008261200d5761200d611ef2565b50069056fea26469706673582212206b1e389ed9dfa92b252d053ae944463a3203f17ed0ca6c272a36a8885d20735d64736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d547834953695511c96d8e26376895ba8adae8be
-----Decoded View---------------
Arg [0] : _minter (address): 0xd547834953695511C96D8e26376895bA8AdAe8BE
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d547834953695511c96d8e26376895ba8adae8be
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.