Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 893 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Stake Our DXN | 21435266 | 4 days ago | IN | 0 ETH | 0.00136508 | ||||
Collect Fees | 21435264 | 4 days ago | IN | 0 ETH | 0.00456041 | ||||
Stake Our DXN | 21427824 | 5 days ago | IN | 0 ETH | 0.0012376 | ||||
Collect Fees | 21427821 | 5 days ago | IN | 0 ETH | 0.00450345 | ||||
Stake Our DXN | 21420353 | 6 days ago | IN | 0 ETH | 0.00144031 | ||||
Collect Fees | 21420351 | 6 days ago | IN | 0 ETH | 0.00420375 | ||||
Collect Fees | 21406317 | 8 days ago | IN | 0 ETH | 0.0025544 | ||||
Collect Fees | 21402961 | 8 days ago | IN | 0 ETH | 0.0028766 | ||||
Collect Fees | 21399782 | 9 days ago | IN | 0 ETH | 0.00062852 | ||||
Stake Our DXN | 21399149 | 9 days ago | IN | 0 ETH | 0.00021171 | ||||
Collect Fees | 21399148 | 9 days ago | IN | 0 ETH | 0.00426419 | ||||
Withdraw Referra... | 21392058 | 10 days ago | IN | 0 ETH | 0.00061439 | ||||
Stake Our DXN | 21391688 | 10 days ago | IN | 0 ETH | 0.00151177 | ||||
Collect Fees | 21391687 | 10 days ago | IN | 0 ETH | 0.0045693 | ||||
Stake Our DXN | 21385124 | 11 days ago | IN | 0 ETH | 0.00035983 | ||||
Stake Our DXN | 21384821 | 11 days ago | IN | 0 ETH | 0.00186087 | ||||
Collect Fees | 21384521 | 11 days ago | IN | 0 ETH | 0.00652008 | ||||
Collect Fees | 21359001 | 14 days ago | IN | 0 ETH | 0.00672647 | ||||
Stake Our DXN | 21356170 | 15 days ago | IN | 0 ETH | 0.00111158 | ||||
Collect Fees | 21356168 | 15 days ago | IN | 0 ETH | 0.00371593 | ||||
Stake Our DXN | 21348714 | 16 days ago | IN | 0 ETH | 0.00190407 | ||||
Collect Fees | 21348713 | 16 days ago | IN | 0 ETH | 0.00695272 | ||||
Stake Our DXN | 21337319 | 17 days ago | IN | 0 ETH | 0.00266341 | ||||
Collect Fees | 21337318 | 17 days ago | IN | 0 ETH | 0.01153727 | ||||
Stake Our DXN | 21320074 | 20 days ago | IN | 0 ETH | 0.00220717 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21460537 | 18 hrs ago | 0.01535979 ETH | ||||
21460537 | 18 hrs ago | 0.08703881 ETH | ||||
21460537 | 18 hrs ago | 0.10239861 ETH | ||||
21452746 | 44 hrs ago | 0.01368842 ETH | ||||
21452746 | 44 hrs ago | 0.07756775 ETH | ||||
21452746 | 44 hrs ago | 0.09125617 ETH | ||||
21446388 | 2 days ago | 0.00613839 ETH | ||||
21446388 | 2 days ago | 0.03478425 ETH | ||||
21446388 | 2 days ago | 0.04092265 ETH | ||||
21438988 | 3 days ago | 0.0135364 ETH | ||||
21438988 | 3 days ago | 0.07670627 ETH | ||||
21438988 | 3 days ago | 0.09024267 ETH | ||||
21435264 | 4 days ago | 0.01128647 ETH | ||||
21435264 | 4 days ago | 0.06395667 ETH | ||||
21435264 | 4 days ago | 0.07524315 ETH | ||||
21427821 | 5 days ago | 0.01247779 ETH | ||||
21427821 | 5 days ago | 0.07070749 ETH | ||||
21427821 | 5 days ago | 0.08318528 ETH | ||||
21420351 | 6 days ago | 0.01049356 ETH | ||||
21420351 | 6 days ago | 0.05946352 ETH | ||||
21420351 | 6 days ago | 0.06995708 ETH | ||||
21408420 | 8 days ago | 0.015332 ETH | ||||
21408420 | 8 days ago | 0.08688134 ETH | ||||
21408420 | 8 days ago | 0.10221334 ETH | ||||
21406317 | 8 days ago | 0.01399938 ETH |
Loading...
Loading
Contract Name:
NXDProtocol
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.13; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IDBXen.sol"; import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; import "./interfaces/IV3Oracle.sol"; import "./interfaces/INXDStakingVault.sol"; import "./V2Oracle.sol"; import "./NXDERC20.sol"; import "./NXDStakingVault.sol"; import "./Vesting.sol"; import "./dbxen/interfaces/IDBXenViews.sol"; /** * @dev Implementation of a fundraiser contract for the NXD Protocol. * This contract will accept DXN and mint NXD at a rate that decreases linearly over time. * The Capped Staking Period (CSP) will run for 14 days, starting at a rate of 1 DXN = 1 NXD and ending at a rate of 1 DXN = 0.5 NXD. */ contract NXDProtocol { error NotInitialized(); error PoolAlreadyCreated(); error GotNothing(); error InvalidAmount(); error SendETHFail(); error CSPOngoing(); error NoAutoReferral(); error CSPHasEnded(); error ReferralCodeAlreadySet(); error InvalidReferralCode(); error NoRewards(); error NXDMaxSupplyMinted(); error NotAuthorized(); event PoolCreated(address uniswapV2Pair, uint256 nxdDesired, uint256 dxnDesired); event Deposit(address indexed from, uint256 amount, uint256 amountReceived, uint256 referralCode); event ReferralCodeSet(uint256 referralCode, address indexed user); event ReferralRewardsWithdrawn(address indexed user, uint256 amount); event HandleRewards( uint256 ethReceived, uint256 dxnAmountReceived, uint256 dxnBurned, uint256 dxnToStake, uint256 nxdBurned, uint256 ethToStakingVault ); IERC20 public dxn = block.chainid == 11155111 ? IERC20(0x24AEdC58Ec49861EC31dd01BE1b9E176ce2529e6) // DXN token : IERC20(0x80f0C1c49891dcFDD40b6e0F960F84E6042bcB6F); IDBXen public immutable dbxen; NXDERC20 public immutable nxd; NXDStakingVault public immutable nxdStakingVault; ISwapRouter public UNISWAP_V3_ROUTER = block.chainid == 11155111 ? ISwapRouter(payable(0x3a71158eb1f7ec993510d4628402062CD919B665)) : ISwapRouter(payable(0xE592427A0AEce92De3Edee1F18E0157C05861564)); IUniswapV2Router02 public UNISWAP_V2_ROUTER = block.chainid == 11155111 ? IUniswapV2Router02(0x42f6460304545B48E788F6e8478Fbf5E7dd7CDe0) : IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public UNISWAP_V2_FACTORY = block.chainid == 11155111 ? 0xdAF1b15AC3CA069Bf811553170Bad5b23342A4D6 : 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; address public constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address public constant DXN_WETH_POOL = 0x7F808fD904FFA3eb6A6F259e6965Fb1466A05372; address public constant DEADBEEF = 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF; uint256 initialRate = 1 ether; // starts 1:1 DXN:NXD (1 DXN = 1 NXD) uint256 finalRate = 0.5 ether; // ends 1:0.5 DXN:NXD (1 DXN = 0.5 NXD) uint256 public startTime = block.timestamp; uint256 public endTime = startTime + 14 days; // calculated using the following formula = ((initialRate - finalRate) * 1e18) / (endTime - startTime); uint256 public constant decreasePerSecond = 413359788359788359788359788360; mapping(uint256 => address) public referralCodes; mapping(address => uint256) public userToReferralCode; mapping(address => uint256) public referredRewards; mapping(address => uint256) public referrerRewards; // for ui purposes mapping(address => uint256) public userTotalMintedNoBonus; mapping(address => uint256) public userTotalBonus; IDBXenViews public immutable dbxenViews; // TWAP Oracle for DXN/WETH pair IV3Oracle public immutable v3Oracle; // Simple TWAP Oracle for NXD/DXN pair V2Oracle public v2Oracle; uint256 public pendingDXNToStake; Vesting public immutable vesting; address public devAllocMinter; uint256 public totalUnclaimedReferralRewards; uint256 public totalDXNDepositedLMP; uint256 public totalNXDBurned; uint256 public totalDXNStaked; uint256 public totalDXNBurned; uint256 public totalETHToStakingVault; constructor( uint256 initialSupply, address _dbxen, address _dbxenViews, address _v3Oracle, address _governance, address _devFeeTo, address _devAllocMinter ) { dbxen = IDBXen(_dbxen); vesting = new Vesting(); nxd = new NXDERC20(initialSupply, msg.sender, IERC20(dxn), _governance, address(vesting), _devFeeTo); // deployer gets initial supply of NXD to create LP vesting.setToken(address(nxd)); nxdStakingVault = new NXDStakingVault(nxd); // NXD is whitelisted for tax when sending and when receiving. nxd.updateTaxWhitelist(address(nxdStakingVault), true, true); dbxenViews = IDBXenViews(_dbxenViews); v3Oracle = IV3Oracle(_v3Oracle); devAllocMinter = _devAllocMinter; } /** * @dev Creates a pool for the NXD/DXN pair and initializes the V2Oracle contract. Reverts if the pool has already been created. This can only be called by deployer of this contract as they are the only ones who have NXD to create the pool. * @param nxdDesired NXD desired to add to the pool. * @param dxnDesired DXN desired to add to the pool. * @param to LP token recipient. * @param deadline Deadline for the transaction. */ function createPool(uint256 nxdDesired, uint256 dxnDesired, address to, uint256 deadline) external returns (uint256 liquidity) { if (nxdDesired == 0 || dxnDesired == 0) { revert InvalidAmount(); } if (address(v2Oracle) != address(0x0)) { revert PoolAlreadyCreated(); } nxd.transferFrom(msg.sender, address(this), nxdDesired); dxn.transferFrom(msg.sender, address(this), dxnDesired); nxd.approve(address(UNISWAP_V2_ROUTER), nxdDesired); dxn.approve(address(UNISWAP_V2_ROUTER), dxnDesired); // Create a pool for the NXD/DXN pair (,, liquidity) = UNISWAP_V2_ROUTER.addLiquidity(address(nxd), address(dxn), nxdDesired, dxnDesired, 0, 0, to, deadline); // Initialize the V2Oracle contract v2Oracle = new V2Oracle(UNISWAP_V2_FACTORY, address(nxd), address(dxn)); address uniswapV2Pair = IUniswapV2Factory(UNISWAP_V2_FACTORY).getPair(address(nxd), address(dxn)); // Set the pair and oracle for the NXD contract nxd.setUniswapV2Pair(uniswapV2Pair); nxd.setV2Oracle(address(v2Oracle)); emit PoolCreated(uniswapV2Pair, nxdDesired, dxnDesired); } /** * @dev Returns the current rate of DXN to NXD. */ function currentRate() public view returns (uint256) { uint256 secondsPassed = block.timestamp - startTime; return ((initialRate) - ((secondsPassed * decreasePerSecond)) / 1e18); } /** * @dev Returns the amount of DXN that this contract has earned in fees in the DBXen Protocol. */ function ourClaimableFees() public view returns (uint256) { return dbxenViews.getUnclaimedFees(address(this)); } /** * @dev Returns the referral bonuses for the referrer and the user. * @param amount The amount of DXN to deposit. * @return referrerAmount referrerAmount The amount of NXD to be minted as a referral bonus for the referrer. * @return userAmount userAmount The amount of NXD to be minted as a referral bonus for the user. */ function getReferralBonuses(uint256 amount) public pure returns (uint256 referrerAmount, uint256 userAmount) { referrerAmount = (amount * 5000) / 100000; userAmount = (amount * 10000) / 100000; } /** * @dev Deposits DXN and mints NXD. If a referral code is provided, the referrer will receive a 5% bonus. The user will receive a 10% bonus. Reverts if the fundraiser has ended or minted NXD exceeds max supply. * @param _amount The amount of DXN to deposit. * @param _referralCode The referral code of the user who referred this user. 0 if no referral. * @param _allowDynamicAmount If true, the amount of DXN to deposit will be adjusted based on whether the max supply of NXD will be exceeded. If false, the amount will not be adjusted and the transaction will revert if the max supply of NXD will be exceeded. */ function deposit(uint256 _amount, uint256 _referralCode, bool _allowDynamicAmount) external { if (address(v2Oracle) == address(0x0)) { revert NotInitialized(); } if (block.timestamp > endTime) { revert CSPHasEnded(); } if (_amount == 0) { revert InvalidAmount(); } uint256 _currentRate = currentRate(); uint256 amountReceived = (_amount * _currentRate) / 1e18; uint256 referrerAmount = 0; uint256 userBonusAmount = 0; address referrer = referralCodes[_referralCode]; if (referrer == msg.sender) { revert NoAutoReferral(); } // Check if referral code is valid if (referrer != address(0x0)) { // // 5% referral bonus // // 10% bonus for referred users (referrerAmount, userBonusAmount) = getReferralBonuses(amountReceived); } // Check that amounts do not exceed max supply if ( nxd.totalSupply() + amountReceived + referrerAmount + userBonusAmount > nxd.maxSupply() - nxd.MAX_DEV_ALLOC() - totalUnclaimedReferralRewards ) { // Change the _amount to the amount that can be minted without exceeding max supply uint256 remainingSupply = nxd.maxSupply() - nxd.totalSupply() - nxd.MAX_DEV_ALLOC() - totalUnclaimedReferralRewards; if (remainingSupply == 0 || !_allowDynamicAmount) { revert NXDMaxSupplyMinted(); } // amountReceived is maximum amount of NXD before bonuses that the user can mint. // if has referrer then take into consideration 15% bonus (10% for user, 5% for referrer) amountReceived = referrer != address(0x0) ? remainingSupply - ((((remainingSupply * 1.15 ether - (remainingSupply * 1e18)) * 1e18) / 1.15 ether) / 1e18) // Doing it this way to avoid precision loss errors : remainingSupply; // Get the amount of DXN that needs to be deposited to mint the remaining supply of NXD. _amount = (amountReceived * 1e18) / _currentRate; // Recalculate bonuses (referrerAmount, userBonusAmount) = getReferralBonuses(amountReceived); } referrerRewards[referrer] += referrerAmount; userTotalBonus[referrer] += referrerAmount; referredRewards[msg.sender] += userBonusAmount; userTotalBonus[msg.sender] += userBonusAmount; totalUnclaimedReferralRewards += referrerAmount + userBonusAmount; userTotalMintedNoBonus[msg.sender] += amountReceived; totalDXNDepositedLMP += _amount; _transferFromAndStake(_amount); nxd.mint(msg.sender, amountReceived); collectFees(); stakeOurDXN(); emit Deposit(msg.sender, _amount, amountReceived, _referralCode); } /** * @dev Allows users to deposit DXN and stakes it in the DBXen contract. Does not mint NXD. Does not care if CSP has ended. * @param _amount The amount of DXN to deposit. */ function depositNoMint(uint256 _amount) external { _transferFromAndStake(_amount); emit Deposit(msg.sender, _amount, 0, 0); collectFees(); stakeOurDXN(); } /** * @notice Internal function that transfers DXN from the sender to this contract and stakes it in the DBXen contract. Used in `deposit` and `depositNoMint` functions. * @param _amount The amount of DXN to transfer and stake. */ function _transferFromAndStake(uint256 _amount) internal { dxn.transferFrom(msg.sender, address(this), _amount); dxn.approve(address(dbxen), _amount); dbxen.stake(_amount); } /** * @dev Sets the referral code for the sender. * @param _referralCode The referral code to set. Must be unique. */ function setReferralCode(uint256 _referralCode) external { if (_referralCode == 0) { revert InvalidReferralCode(); } if (referralCodes[_referralCode] != address(0x0)) { revert ReferralCodeAlreadySet(); } referralCodes[_referralCode] = msg.sender; userToReferralCode[msg.sender] = _referralCode; emit ReferralCodeSet(_referralCode, msg.sender); } /** * @dev Collects fees from the DBXen contract. * Can be called by anyone. */ function collectFees() public { if (ourClaimableFees() > 0) { // Need to check because claimFees() will revert if there are no fees to claim dbxen.claimFees(); } } /** * @dev Withdraws referral rewards for the sender. Reverts if there are no rewards to withdraw or if the fundraiser is ongoing. Rewards are minted as NXD. */ function withdrawReferralRewards() external { if (block.timestamp < endTime) { revert CSPOngoing(); } uint256 amount = referredRewards[msg.sender] + referrerRewards[msg.sender]; if (amount == 0) { revert NoRewards(); } totalUnclaimedReferralRewards -= amount; referrerRewards[msg.sender] = 0; referredRewards[msg.sender] = 0; nxd.mint(msg.sender, amount); emit ReferralRewardsWithdrawn(msg.sender, amount); } /** * @dev Stakes our DXN in the DBXen contract. Can be called by anyone. Having this in the receive() function will cause a ReentrancyGuardReentrantCall error. */ function stakeOurDXN() public { uint256 amount = pendingDXNToStake; if (amount > 0) { pendingDXNToStake = 0; dxn.approve(address(dbxen), amount); dbxen.stake(amount); totalDXNStaked += amount; } } function setDevAllocMinter(address newDevAllowMinter) external { if (msg.sender != devAllocMinter) revert NotAuthorized(); devAllocMinter = newDevAllowMinter; } /** * @dev Mints NXD for the dev allocation and distributes it to the recipients. Can only be called by the devAllocMinter. */ function mintDevAlloc(address[] memory recipients) public { if (msg.sender != devAllocMinter) revert NotAuthorized(); if (block.timestamp < endTime) { revert CSPOngoing(); } uint256 totalNXDMinted = nxd.totalSupply() + totalUnclaimedReferralRewards; // dev alloc is 2% of total minted uint256 devAlloc = ((totalNXDMinted * 10000) / 9800) - totalNXDMinted; if (devAlloc > 0) { if (devAlloc + totalNXDMinted > nxd.maxSupply()) { devAlloc = nxd.maxSupply() - totalNXDMinted; } nxd.mintDevAlloc(address(vesting), devAlloc); uint256 devAllocPerRecipient = devAlloc / recipients.length; for (uint256 i = 0; i < recipients.length; i++) { vesting.setVesting(recipients[i], devAllocPerRecipient); } } } /** * @dev Receives ETH from DBXen after calling `collectFees` and uses it to buy DXN, stake half of it, and burn the other half. * This is needed to receive ETH from DBXen.claimFees() * ETH rewards earned through the DXN Staking Vault are distributed as followed: * • 50% Buy & Burn NXD * • 30% Buy & Stake DXN * • 15% NXD Staking Vault * • 5% Buy & Burn DXN * */ receive() external payable { // DXN Staking Vault // • 50% Buy & Burn NXD // • 30% Buy & Stake DXN // • 15% NXD Staking Vault // • 5% Buy & Burn DXN // Buy DXN & NXD with 85%. 30% to Buy & Stake DXN + 50% to Buy & Burn NXD + 5% to Buy & Burn DXN uint256 ethToSwapForDXN = (address(this).balance * 8500) / 10000; uint256 quote = v3Oracle.getHumanQuote(DXN_WETH_POOL, 5 minutes, 1 ether, WETH9, address(dxn)); uint256 minOut = (ethToSwapForDXN * quote) / 1e18; // - 3% minOut = (minOut * 9700) / 10000; uint256 dxnAmountReceived = UNISWAP_V3_ROUTER.exactInputSingle{value: ethToSwapForDXN}( ISwapRouter.ExactInputSingleParams( WETH9, address(dxn), 10000, address(this), block.timestamp, ethToSwapForDXN, minOut, 0 ) ); // Burn 5/85 of DXN received (= 5% of ETH received) uint256 dxnToBurn = (dxnAmountReceived * 11111111) / 100000000; dxn.transfer(DEADBEEF, dxnToBurn); totalDXNBurned += dxnToBurn; // Sell DXN for NXD. Sell (50/85) % of DXN received. (50% of total ETH received) uint256 dxnToSwapForNXD = (dxnAmountReceived * 58823529) / 100000000; if (v2Oracle.canUpdate()) { v2Oracle.update(); } // Buy NXD with remaining DXN uint256 amountOutMin = v2Oracle.consult(address(dxn), dxnToSwapForNXD); // - 3% amountOutMin = (amountOutMin * 9700) / 10000; address[] memory path = new address[](2); path[0] = address(dxn); path[1] = address(nxd); dxn.approve(address(UNISWAP_V2_ROUTER), dxnToSwapForNXD); uint256[] memory amounts = UNISWAP_V2_ROUTER.swapExactTokensForTokens( dxnToSwapForNXD, amountOutMin, path, address(this), block.timestamp ); if (amounts[0] == 0) { revert GotNothing(); } pendingDXNToStake += dxn.balanceOf(address(this)); // Burn our NXD uint256 nxdToBurn = nxd.balanceOf(address(this)); nxd.transfer(DEADBEEF, nxdToBurn); totalNXDBurned += nxdToBurn; uint256 ethToStakingVault = address(this).balance; totalETHToStakingVault += ethToStakingVault; // Send remaining ETH to the NXD Staking Vault (bool sent,) = address(nxdStakingVault).call{value: address(this).balance}(""); if (!sent) { revert SendETHFail(); } emit HandleRewards(msg.value, dxnAmountReceived, dxnToBurn, pendingDXNToStake, nxdToBurn, ethToStakingVault); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
pragma solidity ^0.8.13; interface IDBXen { function mint(address to, uint256 amount) external; function burn(address from, uint256 amount) external; function balanceOf(address account) external view returns (uint256); function totalSupply() external view returns (uint256); function withdraw(uint256 amount) external; function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function claimFees() external; function claimRewards() external; function stake(uint256 amount) external; function accAccruedFees(address account) external view returns (uint256); function accRewards(address account) external view returns (uint256); function accWithdrawableStake( address account ) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol'; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
pragma solidity ^0.8.13; interface IV3Oracle { function getHumanQuote( address uniswapV3Pool, uint32 secondsAgo, uint128 baseAmount, address baseToken, address quoteToken ) external view returns (uint256 quoteAmount); }
pragma solidity ^0.8.13; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface INXDStakingVault { function deposit(uint256 _pid, uint256 _amount) external; function add(uint256 _allocPoint, IERC20 _token, bool _withUpdate, bool _withdrawable) external; }
pragma solidity >=0.6.6; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; // import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "./uniswapv2/libraries/FixedPoint.sol"; // import "./uniswapv2/libraries/UniswapV2OracleLibrary.sol"; // import "./uniswapv2/libraries/UniswapV2Library.sol"; import "./uniswapv2/libraries/SafeMath.sol"; // import "@uniswap/v2-core/contracts/libraries/SafeMath.sol"; // import "@uniswap/lib/contracts/libraries/FixedPoint.sol"; interface IUniswapV2PairLocal { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } library UniswapV2OracleLibrary { using FixedPoint for *; // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1] function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2 ** 32); } // produces the cumulative price using counterfactuals to save gas and avoid a call to sync. function currentCumulativePrices(address pair) internal view returns (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) { blockTimestamp = currentBlockTimestamp(); price0Cumulative = IUniswapV2PairLocal(pair).price0CumulativeLast(); price1Cumulative = IUniswapV2PairLocal(pair).price1CumulativeLast(); // if time has elapsed since the last update on the pair, mock the accumulated price values (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2PairLocal(pair).getReserves(); if (blockTimestampLast != blockTimestamp) { // subtraction overflow is desired uint32 timeElapsed = blockTimestamp - blockTimestampLast; // addition overflow is desired // counterfactual price0Cumulative += uint256(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed; // counterfactual price1Cumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed; } } } library UniswapV2Library { using SafeMathUniswap for uint256; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, "UniswapV2Library: IDENTICAL_ADDRESSES"); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), "UniswapV2Library: ZERO_ADDRESS"); } // calculates the CREATE2 address for a pair without making any external calls function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address( uint160( uint256( keccak256( abi.encodePacked( hex"ff", factory, keccak256(abi.encodePacked(token0, token1)), hex"96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" // init code hash ) ) ) ) ); } // fetches and sorts the reserves for a pair function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint256 reserveA, uint256 reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint256 reserve0, uint256 reserve1,) = IUniswapV2PairLocal(IUniswapV2Factory(factory).getPair(tokenA, tokenB)).getReserves(); (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0); } // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) internal pure returns (uint256 amountB) { require(amountA > 0, "UniswapV2Library: INSUFFICIENT_AMOUNT"); require(reserveA > 0 && reserveB > 0, "UniswapV2Library: INSUFFICIENT_LIQUIDITY"); amountB = amountA.mul(reserveB) / reserveA; } // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) internal pure returns (uint256 amountOut) { require(amountIn > 0, "UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT"); require(reserveIn > 0 && reserveOut > 0, "UniswapV2Library: INSUFFICIENT_LIQUIDITY"); uint256 amountInWithFee = amountIn.mul(997); uint256 numerator = amountInWithFee.mul(reserveOut); uint256 denominator = reserveIn.mul(1000).add(amountInWithFee); amountOut = numerator / denominator; } // given an output amount of an asset and pair reserves, returns a required input amount of the other asset function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) internal pure returns (uint256 amountIn) { require(amountOut > 0, "UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT"); require(reserveIn > 0 && reserveOut > 0, "UniswapV2Library: INSUFFICIENT_LIQUIDITY"); uint256 numerator = reserveIn.mul(amountOut).mul(1000); uint256 denominator = reserveOut.sub(amountOut).mul(997); amountIn = (numerator / denominator).add(1); } // performs chained getAmountOut calculations on any number of pairs function getAmountsOut(address factory, uint256 amountIn, address[] memory path) internal view returns (uint256[] memory amounts) { require(path.length >= 2, "UniswapV2Library: INVALID_PATH"); amounts = new uint256[](path.length); amounts[0] = amountIn; for (uint256 i; i < path.length - 1; i++) { (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i], path[i + 1]); amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut); } } // performs chained getAmountIn calculations on any number of pairs function getAmountsIn(address factory, uint256 amountOut, address[] memory path) internal view returns (uint256[] memory amounts) { require(path.length >= 2, "UniswapV2Library: INVALID_PATH"); amounts = new uint256[](path.length); amounts[amounts.length - 1] = amountOut; for (uint256 i = path.length - 1; i > 0; i--) { (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i - 1], path[i]); amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut); } } } // fixed window oracle that recomputes the average price for the entire period once every period // note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period contract V2Oracle { using FixedPoint for *; uint256 public constant PERIOD = 5 minutes; IUniswapV2PairLocal public immutable pair; address public immutable token0; address public immutable token1; uint256 public price0CumulativeLast; uint256 public price1CumulativeLast; uint32 public blockTimestampLast; FixedPoint.uq112x112 public price0Average; FixedPoint.uq112x112 public price1Average; constructor(address factory, address tokenA, address tokenB) { IUniswapV2PairLocal _pair = IUniswapV2PairLocal(IUniswapV2Factory(factory).getPair(address(tokenA), address(tokenB))); pair = _pair; token0 = _pair.token0(); token1 = _pair.token1(); price0CumulativeLast = _pair.price0CumulativeLast(); // fetch the current accumulated price value (1 / 0) price1CumulativeLast = _pair.price1CumulativeLast(); // fetch the current accumulated price value (0 / 1) uint112 reserve0; uint112 reserve1; (reserve0, reserve1, blockTimestampLast) = _pair.getReserves(); require(reserve0 != 0 && reserve1 != 0, "ExampleOracleSimple: NO_RESERVES"); // ensure that there's liquidity in the pair } function canUpdate() external view returns (bool) { uint32 blockTimestamp = UniswapV2OracleLibrary.currentBlockTimestamp(); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired return timeElapsed >= PERIOD; } function update() external { (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(address(pair)); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired // ensure that at least one full period has passed since the last update require(timeElapsed >= PERIOD, "ExampleOracleSimple: PERIOD_NOT_ELAPSED"); // overflow is desired, casting never truncates // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed)); price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed)); price0CumulativeLast = price0Cumulative; price1CumulativeLast = price1Cumulative; blockTimestampLast = blockTimestamp; } // note this will always return 0 before update has been called successfully for the first time. function consult(address token, uint256 amountIn) external view returns (uint256 amountOut) { if (token == token0) { amountOut = price0Average.mul(amountIn).decode144(); } else { require(token == token1, "ExampleOracleSimple: INVALID_TOKEN"); amountOut = price1Average.mul(amountIn).decode144(); } } }
pragma solidity ^0.8.13; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import "./interfaces/IUniswapV2Router02.sol"; import "./interfaces/IUniswapV2Pair.sol"; import "./interfaces/IV2Oracle.sol"; import "./interfaces/INXDProtocol.sol"; import "./TaxRecipient.sol"; interface IUniV2Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); } /** * @dev NXD Token contract that implements the ERC20 standard. It also includes: * - A tax mechanism for selling NXD tokens. * - A mechanism to remove NXD tokens from unauthorized LPs. Only called by the governance * - A mechanism to mint NXD tokens Only by the protocol contract. * - A mechanism to set the Uniswap V2 pair address and the V2 Oracle address. Only by the protocol contract. * - A mechanism to remove NXD tokens from unauthorized LPs. Only by the governance. */ contract NXDERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { error Unauthorized(); error NoRemovalZeroAddress(); error NoLPWithdraw(); error MaxSupply(); error NoRemovalMainLP(); mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; address public constant DEADBEEF = 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF; uint256 private _totalSupply; string private _name; string private _symbol; /** * The address of the NXDProtocol.sol contract instance. */ address public immutable protocol; uint256 public constant SELL_TAX_X100 = 500; // 5% struct TaxWhitelist { bool isExcludedWhenSender; bool isExcludedWhenRecipient; } // Whitelist for tax exclusion. address => (isExcludedWhenSender, isExcludedWhenRecipient) mapping(address => TaxWhitelist) public isExcludedFromTax; mapping(address => uint256) public lpSupplyOfPair; IUniV2Factory public UNISWAP_V2_FACTORY = block.chainid == 11155111 ? IUniV2Factory(0xdAF1b15AC3CA069Bf811553170Bad5b23342A4D6) : IUniV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); IUniswapV2Router02 public UNISWAP_V2_ROUTER = block.chainid == 11155111 ? IUniswapV2Router02(0x42f6460304545B48E788F6e8478Fbf5E7dd7CDe0) : IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); IUniswapV2Pair public uniswapV2Pair; IV2Oracle public v2Oracle; IERC20 public dxn; // Max to be minted as rewards for staking DXN uint256 public constant MAX_REWARDS_SUPPLY = 730_000 ether; // 730k NXD // Max to be minted for dev alloc (2% of total supply) uint256 public constant MAX_DEV_ALLOC = 15_000 ether; // 15k NXD // Max rewards supply + initial supply for liquidity uint256 public immutable maxSupply; TaxRecipient public immutable taxRecipient; uint256 public lastSupplyOfNXDInPair; uint256 public lastSupplyOfDXNInPair; address public governance; address public devFeeTo; uint256 public totalNXDBurned; // variables used to calculate rewards apy uint256 public contractStartBlock; uint256 public epochCalculationStartBlock; uint256 public epoch; // Returns burns since start of this contract function averageBurnedPerBlockSinceStart() external view returns (uint256 averagePerBlock) { uint256 burnedInThisEpoch = _balances[0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF] - totalBurnAddressBalUpToLastEpoch; averagePerBlock = (totalBurnAddressBalUpToLastEpoch + burnedInThisEpoch) / (block.number - (contractStartBlock)); } // Returns averge burned in this epoch function averageBurnedPerBlockEpoch() external view returns (uint256 averagePerBlock) { uint256 burnedInThisEpoch = _balances[0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF] - totalBurnAddressBalUpToLastEpoch; averagePerBlock = burnedInThisEpoch / (block.number - epochCalculationStartBlock); } struct EpochBurn { uint256 burned; uint256 totalSupply; } // For easy graphing historical epoch burns mapping(uint256 => EpochBurn) public epochBurns; uint256 public totalBurnAddressBalUpToLastEpoch; //Starts a new calculation epoch // Because averge since start will not be accurate function startNewEpochIfReady() public { if (epochCalculationStartBlock + 50000 < block.number) { uint256 burnedInThisEpoch = _balances[0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF] - totalBurnAddressBalUpToLastEpoch; totalBurnAddressBalUpToLastEpoch = _balances[0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF]; epochBurns[epoch] = EpochBurn(burnedInThisEpoch, _totalSupply); epochCalculationStartBlock = block.number; ++epoch; } } modifier onlyGovernance() { if (msg.sender != governance) { revert Unauthorized(); } _; } /** * Called from within the NXDProtocol.sol constructor. */ constructor( uint256 _initialSupply, address _initialSupplyTo, IERC20 _dxn, address _governance, address _vesting, address _devFeeTo ) { _name = block.chainid == 1 ? "NXD Token" : ""; _symbol = block.chainid == 1 ? "NXD" : ""; protocol = msg.sender; devFeeTo = _devFeeTo; _mint(_initialSupplyTo, _initialSupply); dxn = _dxn; maxSupply = _initialSupply + MAX_REWARDS_SUPPLY + MAX_DEV_ALLOC; taxRecipient = new TaxRecipient(msg.sender); governance = _governance; _updateTaxWhitelist(address(this), true, false); _updateTaxWhitelist(address(taxRecipient), true, false); _updateTaxWhitelist(protocol, true, true); _updateTaxWhitelist(_vesting, true, true); contractStartBlock = block.number; startNewEpochIfReady(); } function setUniswapV2Pair(address _uniswapV2Pair) external { if (msg.sender != protocol) { revert Unauthorized(); } uniswapV2Pair = IUniswapV2Pair(_uniswapV2Pair); _updateTaxWhitelist(_uniswapV2Pair, true, false); } function setV2Oracle(address _v2Oracle) external { if (msg.sender != protocol) { revert Unauthorized(); } v2Oracle = IV2Oracle(_v2Oracle); } function updateTaxWhitelist(address account, bool whenSender, bool whenRecipient) external { // Only governance or protocol can update tax whitelist if (msg.sender != governance && msg.sender != protocol) { revert Unauthorized(); } _updateTaxWhitelist(account, whenSender, whenRecipient); } /** * @dev Sets the governance address. Only callable by the current governance. Can be set to the zero address. * @param _governance The address of the new governance. */ function setGovernance(address _governance) external onlyGovernance { governance = _governance; } function _updateTaxWhitelist(address account, bool whenSender, bool whenRecipient) internal { isExcludedFromTax[account] = TaxWhitelist(whenSender, whenRecipient); } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } function mint(address account, uint256 amount) external { if (msg.sender != protocol) { revert Unauthorized(); } if (totalSupply() + amount > maxSupply - MAX_DEV_ALLOC) { revert MaxSupply(); } _mint(account, amount); } function mintDevAlloc(address account, uint256 amount) external { if (msg.sender != protocol) { revert Unauthorized(); } if (totalSupply() + amount > maxSupply) { revert MaxSupply(); } _mint(account, amount); } /** * @dev Returns the amount after tax and the tax amount. Whitelist is: * - When sender is this contract: To be able to swap NXD to DXN in `_transfer_ function. * - When sender is the `protocol` contract: To be able to burn NXD. * - When recipient is the `protocol` contract: To be able to create initial liquidity. * - When sender is the `taxRecipient` contract: To be able to handle tax: adding liquidity to NXD/DXN. * - When sender is the `uniswapV2Pair` contract: No tax on buys. * @param from The address of the sender. * @param to The address of the recipient. * @param amount The amount to calculate the tax for. * @return uint256 The amount after tax. * @return uint256 The tax amount. */ function getAmountsAfterTax(address from, address to, uint256 amount) public view returns (uint256, uint256) { if (isExcludedFromTax[from].isExcludedWhenSender || isExcludedFromTax[to].isExcludedWhenRecipient) { return (amount, 0); } // Apply tax uint256 taxAmount = (amount * SELL_TAX_X100) / 10000; uint256 amountAfterTax = amount - taxAmount; return (amountAfterTax, taxAmount); } function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } if (value > _balances[from]) { revert ERC20InsufficientBalance(from, _balances[from], value); } _balances[from] -= value; (uint256 amountAfterTax, uint256 taxAmount) = getAmountsAfterTax(from, to, value); if (taxAmount > 0) { // NXD burn - 2.0% // DXN buy and stake - 1.5% // LP add - 1% // Dev Fee - 0.5% _balances[address(this)] += taxAmount; emit Transfer(from, address(this), taxAmount); address[] memory nxdDXNPath = new address[](2); nxdDXNPath[0] = address(this); nxdDXNPath[1] = address(dxn); // Sell NXD, buy DXN and stake uint256 sellNXDAmount = (taxAmount * 4000) / 10000; // 40% (2/5) of total tax amount, which is 1.5% buy and stake DXN + 0.5% buy DXN to add liquidity _approve(address(this), address(UNISWAP_V2_ROUTER), sellNXDAmount); if (v2Oracle.canUpdate()) { v2Oracle.update(); } uint256 amountOutMin = v2Oracle.consult(address(this), sellNXDAmount); // - 3% amountOutMin = (amountOutMin * 9700) / 10000; // Send to taxRecipient to add LP UNISWAP_V2_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens( sellNXDAmount, amountOutMin, nxdDXNPath, address(taxRecipient), block.timestamp ); // We now have DXN uint256 remainingTax = taxAmount - sellNXDAmount; // 60% uint256 burnAmount = (taxAmount * 4000) / 10000; // 2% of all tax. 2/5% of tax amount uint256 devFeeAmount = (taxAmount * 1000) / 10000; // 10% of all tax. 0.5/5% of tax amount _balances[address(this)] -= remainingTax; startNewEpochIfReady(); // Burn 10% from tax amount _balances[0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF] += burnAmount; totalNXDBurned += burnAmount; emit Transfer(address(this), 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF, burnAmount); _balances[devFeeTo] += devFeeAmount; emit Transfer(address(this), devFeeTo, devFeeAmount); uint256 amountToTaxHandler = remainingTax - burnAmount - devFeeAmount; // Send NXD to Tax recipient to add liquidity _balances[address(taxRecipient)] += amountToTaxHandler; emit Transfer(address(this), address(taxRecipient), amountToTaxHandler); taxRecipient.handleTax(); } _balances[to] += amountAfterTax; emit Transfer(from, to, amountAfterTax); } function setDevFeeTo(address _devFeeTo) external { if (msg.sender != devFeeTo) { revert Unauthorized(); } devFeeTo = _devFeeTo; } function transfer(address to, uint256 value) public virtual override returns (bool) { _transfer(_msgSender(), to, value); return true; } function transferFrom(address from, address to, uint256 value) public virtual override returns (bool) { _spendAllowance(from, _msgSender(), value); _transfer(from, to, value); return true; } }
pragma solidity >=0.8.0; import "./interfaces/INXDProtocol.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract NXDStakingVault { using SafeERC20 for IERC20; error PoolAlreadyAdded(); error InvalidAmount(); error SendETHFail(); error NoRequest(); error Cooldown(); error Underflow(); error Locked(); error WithdrawDisabled(); event Add(address indexed token, uint256 indexed pid, uint256 allocPoint, bool withdrawable); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value); event WithdrawRequested(address indexed user, uint256 amount, uint256 canWithdrawAfterTimestamp); // Info of each user. struct UserInfo { uint256 amount; // How many tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of ETHs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accEthPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws tokens to a pool. Here's what happens: // 1. The pool's `accEthPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { IERC20 token; // Address of token contract. uint256 allocPoint; // How many allocation points assigned to this pool. ETHs to distribute per block. uint256 accEthPerShare; // Accumulated ETHs per share, times 1e12. See below. bool withdrawable; // Is this pool withdrawable? } // Info of each pool. uint256 public numPools; mapping(uint256 => PoolInfo) public poolInfo; mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint; // pid => owner => timestamp // mapping(uint256 => mapping(address => uint256)) public canWithdrawAfter; struct WithdrawalRequest { uint256 amount; uint256 canWithdrawAfterTimestamp; } // pid => owner => WithdrawalRequest mapping(uint256 => mapping(address => WithdrawalRequest)) public withdrawalRequests; uint256 public constant WITHDRAWAL_COOLDOWN = 1 days; //// pending rewards awaiting anyone to massUpdate uint256 public pendingRewards; // The NXD TOKEN! IERC20 public immutable nxd; INXDProtocol public immutable nxdProtocol; // keep track of latest known eth balance. used to determine new rewards uint256 public ourETHBalance; bool public locked; uint256 public nxdPenaltyBurned; uint256 public totalStaked; // variables used to calculate rewards apy uint256 public contractStartBlock; uint256 public epochCalculationStartBlock; uint256 public cumulativeRewardsSinceStart; uint256 public rewardsInThisEpoch; uint256 public epoch; // Returns fees generated since start of this contract function averageFeesPerBlockSinceStart() external view returns (uint256 averagePerBlock) { averagePerBlock = (cumulativeRewardsSinceStart + rewardsInThisEpoch) / (block.number - (contractStartBlock)); } // Returns averge fees in this epoch function averageFeesPerBlockEpoch() external view returns (uint256 averagePerBlock) { averagePerBlock = rewardsInThisEpoch / (block.number - epochCalculationStartBlock); } // For easy graphing historical epoch rewards mapping(uint256 => uint256) public epochRewards; //Starts a new calculation epoch // Because averge since start will not be accurate function startNewEpochIfReady() public { if (epochCalculationStartBlock + 50000 < block.number) { epochRewards[epoch] = rewardsInThisEpoch; cumulativeRewardsSinceStart += rewardsInThisEpoch; rewardsInThisEpoch = 0; epochCalculationStartBlock = block.number; ++epoch; } } // Reentrancy lock modifier lock() { if (locked) { revert Locked(); } locked = true; _; locked = false; } constructor(IERC20 _nxd) { nxd = _nxd; nxdProtocol = INXDProtocol(msg.sender); _add(100, _nxd, false, true); contractStartBlock = block.number; startNewEpochIfReady(); } // Add a new token pool. Can only be when contract is deployed. function _add(uint256 _allocPoint, IERC20 _token, bool _withUpdate, bool _withdrawable) internal { if (_withUpdate) { massUpdatePools(); } uint256 length = numPools; for (uint256 pid = 0; pid < length; ++pid) { if (poolInfo[pid].token == _token) { revert PoolAlreadyAdded(); } } totalAllocPoint = totalAllocPoint + _allocPoint; PoolInfo storage _poolInfo = poolInfo[length]; _poolInfo.token = _token; _poolInfo.allocPoint = _allocPoint; _poolInfo.accEthPerShare = 0; _poolInfo.withdrawable = _withdrawable; numPools += 1; emit Add(address(_token), length, _allocPoint, _withdrawable); } // View function to see pending ETHs on frontend. function pendingETH(uint256 _pid, address _user) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accEthPerShare = pool.accEthPerShare; return ((user.amount * accEthPerShare) / 1e12) - user.rewardDebt; } // Update reward vairables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = numPools; uint256 allRewards; for (uint256 pid = 0; pid < length; ++pid) { allRewards = allRewards + updatePool(pid); } pendingRewards = pendingRewards - allRewards; } function addPendingRewards() public { startNewEpochIfReady(); uint256 newRewards = address(this).balance - ourETHBalance; if (newRewards > 0) { ourETHBalance = address(this).balance; // If there is no change the balance didn't change pendingRewards = pendingRewards + newRewards; rewardsInThisEpoch += newRewards; } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) internal returns (uint256 ethReward) { PoolInfo storage pool = poolInfo[_pid]; if (totalStaked == 0) { // avoids division by 0 errors return 0; } ethReward = (pendingRewards * pool.allocPoint) // Multiplies pending rewards by allocation point of this pool and then total allocation // getting the percent of total pending rewards this pool should get / totalAllocPoint; // we can do this because pools are only mass updated pool.accEthPerShare += ((ethReward * 1e12) / totalStaked); } // Deposit NXD tokens to NXDStakingVault for ETH allocation. function deposit(uint256 _pid, uint256 _amount) public lock { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; massUpdatePools(); // Transfer pending tokens // to user updateAndPayOutPending(_pid, msg.sender); //Transfer in the amounts from user // save gas if (_amount > 0) { pool.token.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount += _amount; totalStaked += _amount; } user.rewardDebt = (user.amount * pool.accEthPerShare) / 1e12; emit Deposit(msg.sender, _pid, _amount); } // Test coverage // [x] Does user get the deposited amounts? // [x] Does user that its deposited for update correcty? // [x] Does the depositor get their tokens decreased function depositFor(address _depositFor, uint256 _pid, uint256 _amount) public lock { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_depositFor]; massUpdatePools(); // Transfer pending tokens // to user updateAndPayOutPending(_pid, _depositFor); // Update the balances of person that amount is being deposited for if (_amount > 0) { pool.token.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount += _amount; // This is depositedFor address totalStaked += _amount; } user.rewardDebt = (user.amount * pool.accEthPerShare) / 1e12; /// This is deposited for address emit Deposit(_depositFor, _pid, _amount); } // Withdraw tokens from NXDStakingVault. function withdraw(uint256 _pid, uint256 _amount, bool acceptsPenalty) public lock { _withdraw(_pid, _amount, msg.sender, msg.sender, acceptsPenalty); } // Low level withdraw function function _withdraw(uint256 _pid, uint256 _amount, address from, address to, bool acceptsPenalty) internal { PoolInfo storage pool = poolInfo[_pid]; if (!pool.withdrawable) { revert WithdrawDisabled(); } UserInfo storage user = userInfo[_pid][from]; if (user.amount < _amount) { revert Underflow(); } uint256 userGetsAfterPenalty = _amount; massUpdatePools(); updateAndPayOutPending(_pid, from); // Update balances of from. This is not withdrawal but claiming ETH farmed WithdrawalRequest storage request = withdrawalRequests[_pid][msg.sender]; if (_amount > 0) { if (block.timestamp >= request.canWithdrawAfterTimestamp && request.canWithdrawAfterTimestamp != 0) { withdrawCooldown(_pid); } // Stop receiving rewards for this amount NOW user.amount = user.amount - _amount; totalStaked -= _amount; if (acceptsPenalty) { userGetsAfterPenalty = (_amount * 7500) / 10000; } else { // 0 means Needs to wait 24 hours if (request.canWithdrawAfterTimestamp == 0) { uint256 timestamp = block.timestamp + WITHDRAWAL_COOLDOWN; withdrawalRequests[_pid][msg.sender] = WithdrawalRequest(_amount, timestamp); user.rewardDebt = (user.amount * pool.accEthPerShare) / 1e12; emit WithdrawRequested(from, _amount, timestamp); return; } else { revert Cooldown(); } } // If we are here we can withdraw pool.token.safeTransfer(address(to), userGetsAfterPenalty); // Burn penalty amount if (userGetsAfterPenalty < _amount) { uint256 amountToBurn = _amount - userGetsAfterPenalty; nxd.transfer(0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF, amountToBurn); nxdPenaltyBurned += amountToBurn; } } user.rewardDebt = (user.amount * pool.accEthPerShare) / 1e12; emit Withdraw(to, _pid, _amount); } /** * @notice Withdraws the amount requested if the cooldown period has passed. If the user has not requested a withdrawal or the cooldown period has not passed, the function reverts. * @param _pid The pool id. */ function withdrawCooldown(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; WithdrawalRequest storage request = withdrawalRequests[_pid][msg.sender]; if (request.canWithdrawAfterTimestamp == 0 || request.amount == 0) { revert NoRequest(); } if (block.timestamp < request.canWithdrawAfterTimestamp) { revert Cooldown(); } uint256 amount = request.amount; request.canWithdrawAfterTimestamp = 0; request.amount = 0; pool.token.safeTransfer(msg.sender, amount); emit Withdraw(msg.sender, _pid, request.amount); } function updateAndPayOutPending(uint256 _pid, address from) internal { uint256 pending = pendingETH(_pid, from); if (pending > 0) { safeETHTransfer(from, pending); } nxdProtocol.collectFees(); nxdProtocol.stakeOurDXN(); } // Withdraw without caring about rewards. EMERGENCY ONLY. // !Caution this will remove all your pending rewards! function emergencyWithdraw(uint256 _pid) public lock { PoolInfo storage pool = poolInfo[_pid]; if (!pool.withdrawable) { revert WithdrawDisabled(); } UserInfo storage user = userInfo[_pid][msg.sender]; pool.token.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; // No mass update dont update pending rewards } // Safe eth transfer function function safeETHTransfer(address _to, uint256 _amount) internal { (bool sent,) = _to.call{value: _amount}(""); if (!sent) { revert SendETHFail(); } ourETHBalance = address(this).balance; //Avoids possible recursion loop // proxy? } /** * @dev Receives ETH from NXDProtocol and updates pending rewards. */ receive() external payable { addPendingRewards(); } }
pragma solidity ^0.8.13; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "forge-std/console.sol"; contract Vesting { error NotValidToken(); error AlreadySet(); error Owner(); event VestingSet(address indexed user, uint256 amount); uint256 public constant VESTING_DURATION_SECS = 90 days; struct VestingSchedule { uint256 amount; uint256 startTimestamp; } mapping(address => VestingSchedule) public tokenAmountToVest; mapping(address => uint256) public claimed; IERC20 public token; address immutable owner; constructor() { owner = msg.sender; } /** * @dev Set the token to be vested. * @param tokenAddress The address of the token to be vested. */ function setToken(address tokenAddress) public { if (msg.sender != owner) { revert Owner(); } if (address(tokenAddress) == address(0)) { revert NotValidToken(); } if (address(token) != address(0)) { revert AlreadySet(); } token = IERC20(tokenAddress); } function setVesting(address user, uint256 amount) public { if (msg.sender != owner) { revert Owner(); } uint256 claimedAmt = claimed[user]; VestingSchedule storage vestingSchedule = tokenAmountToVest[user]; vestingSchedule.amount = vestingSchedule.amount + amount - claimedAmt; vestingSchedule.startTimestamp = block.timestamp; emit VestingSet(user, amount); } function claimable(address user) public view returns (uint256) { VestingSchedule memory vestingSchedule = tokenAmountToVest[user]; if (vestingSchedule.amount == 0) { return 0; } uint256 elapsed = block.timestamp - vestingSchedule.startTimestamp; if (elapsed == 0) { return 0; } if (elapsed >= VESTING_DURATION_SECS) { return vestingSchedule.amount - claimed[user]; } return (vestingSchedule.amount * elapsed) / VESTING_DURATION_SECS - claimed[user]; } function claim() public { uint256 claimableAmount = claimable(msg.sender); if (claimableAmount > 0) { claimed[msg.sender] += claimableAmount; // transfer to msg.sender token.transfer(msg.sender, claimableAmount); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IDBXenViews { /** * @dev Unclaimed fees represent the native coin amount that has been allocated * to a given account but was not claimed yet. * * @param account the address to query the unclaimed fees for * @return the amount in wei */ function getUnclaimedFees(address account) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; }
pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.4.0; import "./FullMathV2.sol"; import "./Babylonian.sol"; import "./BitMath.sol"; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) library FixedPoint { // range: [0, 2**112 - 1] // resolution: 1 / 2**112 struct uq112x112 { uint224 _x; } // range: [0, 2**144 - 1] // resolution: 1 / 2**112 struct uq144x112 { uint256 _x; } uint8 public constant RESOLUTION = 112; uint256 public constant Q112 = 0x10000000000000000000000000000; // 2**112 uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000; // 2**224 uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits) // encode a uint112 as a UQ112x112 function encode(uint112 x) internal pure returns (uq112x112 memory) { return uq112x112(uint224(x) << RESOLUTION); } // encodes a uint144 as a UQ144x112 function encode144(uint144 x) internal pure returns (uq144x112 memory) { return uq144x112(uint256(x) << RESOLUTION); } // decode a UQ112x112 into a uint112 by truncating after the radix point function decode(uq112x112 memory self) internal pure returns (uint112) { return uint112(self._x >> RESOLUTION); } // decode a UQ144x112 into a uint144 by truncating after the radix point function decode144(uq144x112 memory self) internal pure returns (uint144) { return uint144(self._x >> RESOLUTION); } // multiply a UQ112x112 by a uint, returning a UQ144x112 // reverts on overflow function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) { uint256 z = 0; require(y == 0 || (z = self._x * y) / y == self._x, "FixedPoint::mul: overflow"); return uq144x112(z); } // multiply a UQ112x112 by an int and decode, returning an int // reverts on overflow function muli(uq112x112 memory self, int256 y) internal pure returns (int256) { uint256 z = FullMathV2.mulDiv(self._x, uint256(y < 0 ? -y : y), Q112); require(z < 2 ** 255, "FixedPoint::muli: overflow"); return y < 0 ? -int256(z) : int256(z); } // multiply a UQ112x112 by a UQ112x112, returning a UQ112x112 // lossy function muluq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) { if (self._x == 0 || other._x == 0) { return uq112x112(0); } uint112 upper_self = uint112(self._x >> RESOLUTION); // * 2^0 uint112 lower_self = uint112(self._x & LOWER_MASK); // * 2^-112 uint112 upper_other = uint112(other._x >> RESOLUTION); // * 2^0 uint112 lower_other = uint112(other._x & LOWER_MASK); // * 2^-112 // partial products uint224 upper = uint224(upper_self) * upper_other; // * 2^0 uint224 lower = uint224(lower_self) * lower_other; // * 2^-224 uint224 uppers_lowero = uint224(upper_self) * lower_other; // * 2^-112 uint224 uppero_lowers = uint224(upper_other) * lower_self; // * 2^-112 // so the bit shift does not overflow require(upper <= uint112(5192296858534827628530496329220095), "FixedPoint::muluq: upper overflow"); // this cannot exceed 256 bits, all values are 224 bits uint256 sum = uint256(upper << RESOLUTION) + uppers_lowero + uppero_lowers + (lower >> RESOLUTION); // so the cast does not overflow require( sum <= uint224(26959946667150639794667015087019630673637144422540572481103610249215), "FixedPoint::muluq: sum overflow" ); return uq112x112(uint224(sum)); } // divide a UQ112x112 by a UQ112x112, returning a UQ112x112 function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) { require(other._x > 0, "FixedPoint::divuq: division by zero"); if (self._x == other._x) { return uq112x112(uint224(Q112)); } if (self._x <= uint144(22300745198530623141535718272648361505980415)) { uint256 value = (uint256(self._x) << RESOLUTION) / other._x; require( value <= uint224(26959946667150639794667015087019630673637144422540572481103610249215), "FixedPoint::divuq: overflow" ); return uq112x112(uint224(value)); } uint256 result = FullMathV2.mulDiv(Q112, self._x, other._x); require( result <= uint224(26959946667150639794667015087019630673637144422540572481103610249215), "FixedPoint::divuq: overflow" ); return uq112x112(uint224(result)); } // returns a UQ112x112 which represents the ratio of the numerator to the denominator // can be lossy function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) { require(denominator > 0, "FixedPoint::fraction: division by zero"); if (numerator == 0) return FixedPoint.uq112x112(0); if (numerator <= uint144(22300745198530623141535718272648361505980415)) { uint256 result = (numerator << RESOLUTION) / denominator; require( result <= uint224(26959946667150639794667015087019630673637144422540572481103610249215), "FixedPoint::fraction: overflow" ); return uq112x112(uint224(result)); } else { uint256 result = FullMathV2.mulDiv(numerator, Q112, denominator); require( result <= uint224(26959946667150639794667015087019630673637144422540572481103610249215), "FixedPoint::fraction: overflow" ); return uq112x112(uint224(result)); } } // take the reciprocal of a UQ112x112 // reverts on overflow // lossy function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) { require(self._x != 0, "FixedPoint::reciprocal: reciprocal of zero"); require(self._x != 1, "FixedPoint::reciprocal: overflow"); return uq112x112(uint224(Q224 / self._x)); } // square root of a UQ112x112 // lossy between 0/1 and 40 bits function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) { if (self._x <= uint144(22300745198530623141535718272648361505980415)) { return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112))); } uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x); safeShiftBits -= safeShiftBits % 2; return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2))); } }
pragma solidity >=0.6.12; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMathUniswap { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC-20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the ERC may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the ERC. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC-20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC-20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC-721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC-1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
pragma solidity >=0.6.2; import "./IUniswapV2Router01.sol"; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance( address owner, address spender ) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom( address from, address to, uint value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit( address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn( address indexed sender, uint amount0, uint amount1, address indexed to ); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap( uint amount0Out, uint amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
pragma solidity ^0.8.13; interface IV2Oracle { function update() external; // note this will always return 0 before update has been called successfully for the first time. function consult(address token, uint256 amountIn) external view returns (uint256 amountOut); function canUpdate() external view returns (bool); }
pragma solidity ^0.8.13; interface INXDProtocol { function depositNoMint(uint256 _amount) external; function collectFees() external; function stakeOurDXN() external; }
pragma solidity >=0.8.0; import "./interfaces/INXDProtocol.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "forge-std/console.sol"; import "./interfaces/IUniswapV2Router02.sol"; contract TaxRecipient { error OnlyNXD(); IERC20 public immutable nxd; address public immutable protocol; IERC20 public dxn = block.chainid == 11155111 ? IERC20(0x24AEdC58Ec49861EC31dd01BE1b9E176ce2529e6) // DXN token : IERC20(0x80f0C1c49891dcFDD40b6e0F960F84E6042bcB6F); IUniswapV2Router02 public UNISWAP_V2_ROUTER = block.chainid == 11155111 ? IUniswapV2Router02(0x42f6460304545B48E788F6e8478Fbf5E7dd7CDe0) : IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uint256 public nxdAddedToLp; uint256 public dxnAddedToLp; uint256 public dxnStaked; constructor(address _protocol) { nxd = IERC20(msg.sender); protocol = _protocol; } /** * @dev Handle tax from NXD protocol. Stakes 80% of received DXN and adds liquidity with the rest. */ function handleTax() external { if (msg.sender != address(nxd)) { revert OnlyNXD(); } uint256 ourDXNBalance = dxn.balanceOf(address(this)); uint256 ratio = 750000000000000000; // Stake 1.5% of all our DXN balance (1.5*1e18 /2) uint256 dxnToStake = (ourDXNBalance * ratio) / 1e18; // Stake 8% of total tax after swap to DXN dxn.approve(protocol, dxnToStake); INXDProtocol(protocol).depositNoMint(dxnToStake); dxnStaked += dxnToStake; // Add liquidity with remaining NXD and DXN ourDXNBalance = dxn.balanceOf(address(this)); uint256 ourNXDBalance = nxd.balanceOf(address(this)); // Approve tokens dxn.approve(address(UNISWAP_V2_ROUTER), ourDXNBalance); nxd.approve(address(UNISWAP_V2_ROUTER), ourNXDBalance); // Add liquidity (uint256 amountA, uint256 amountB,) = UNISWAP_V2_ROUTER.addLiquidity( address(nxd), address(dxn), ourNXDBalance, ourDXNBalance, 0, 0, address(this), block.timestamp ); nxdAddedToLp += amountA; dxnAddedToLp += amountB; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; library console { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function _sendLogPayload(bytes memory payload) private view { uint256 payloadLength = payload.length; address consoleAddress = CONSOLE_ADDRESS; /// @solidity memory-safe-assembly assembly { let payloadStart := add(payload, 32) let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) } } function log() internal view { _sendLogPayload(abi.encodeWithSignature("log()")); } function logInt(int p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); } function logUint(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function logString(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function logBool(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function logAddress(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function logBytes(bytes memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); } function logBytes1(bytes1 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); } function logBytes2(bytes2 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); } function logBytes3(bytes3 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); } function logBytes4(bytes4 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); } function logBytes5(bytes5 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); } function logBytes6(bytes6 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); } function logBytes7(bytes7 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); } function logBytes8(bytes8 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); } function logBytes9(bytes9 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); } function logBytes10(bytes10 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); } function logBytes11(bytes11 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); } function logBytes12(bytes12 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); } function logBytes13(bytes13 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); } function logBytes14(bytes14 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); } function logBytes15(bytes15 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); } function logBytes16(bytes16 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); } function logBytes17(bytes17 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); } function logBytes18(bytes18 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); } function logBytes19(bytes19 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); } function logBytes20(bytes20 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); } function logBytes21(bytes21 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); } function logBytes22(bytes22 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); } function logBytes23(bytes23 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); } function logBytes24(bytes24 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); } function logBytes25(bytes25 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); } function logBytes26(bytes26 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); } function logBytes27(bytes27 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); } function logBytes28(bytes28 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); } function logBytes29(bytes29 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); } function logBytes30(bytes30 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); } function logBytes31(bytes31 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); } function logBytes32(bytes32 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); } function log(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function log(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function log(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function log(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function log(uint p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); } function log(uint p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); } function log(uint p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); } function log(uint p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); } function log(string memory p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); } function log(string memory p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); } function log(string memory p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); } function log(string memory p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); } function log(bool p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); } function log(bool p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); } function log(bool p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); } function log(bool p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); } function log(address p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); } function log(address p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); } function log(address p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); } function log(address p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); } function log(uint p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); } function log(uint p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); } function log(uint p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); } function log(uint p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); } function log(uint p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); } function log(uint p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); } function log(uint p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); } function log(uint p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); } function log(uint p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); } function log(uint p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); } function log(uint p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); } function log(uint p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); } function log(uint p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); } function log(uint p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); } function log(uint p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); } function log(uint p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); } function log(string memory p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); } function log(string memory p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); } function log(string memory p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); } function log(string memory p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); } function log(string memory p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); } function log(string memory p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); } function log(string memory p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); } function log(string memory p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); } function log(string memory p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); } function log(string memory p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); } function log(string memory p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); } function log(string memory p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); } function log(string memory p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); } function log(string memory p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); } function log(string memory p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); } function log(string memory p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); } function log(bool p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); } function log(bool p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); } function log(bool p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); } function log(bool p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); } function log(bool p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); } function log(bool p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); } function log(bool p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); } function log(bool p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); } function log(bool p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); } function log(bool p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); } function log(bool p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); } function log(bool p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); } function log(bool p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); } function log(bool p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); } function log(bool p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); } function log(bool p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); } function log(address p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); } function log(address p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); } function log(address p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); } function log(address p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); } function log(address p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); } function log(address p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); } function log(address p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); } function log(address p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); } function log(address p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); } function log(address p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); } function log(address p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); } function log(address p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); } function log(address p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); } function log(address p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); } function log(address p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); } function log(address p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); } function log(uint p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); } }
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.0; // taken from https://medium.com/coinmonks/math-in-solidity-part-3-percents-and-proportions-4db014e080b1 // license is CC-BY-4.0 library FullMathV2 { function fullMul(uint256 x, uint256 y) internal pure returns (uint256 l, uint256 h) { uint256 mm = mulmod(x, y, type(uint256).max); l = x * y; h = mm - l; if (mm < l) h -= 1; } function fullDiv(uint256 l, uint256 h, uint256 d) private pure returns (uint256) { uint256 pow2 = d & type(uint256).max - d + 1; d /= pow2; l /= pow2; l += h * ((type(uint256).max - pow2 + 1) / pow2 + 1); uint256 r = 1; r *= 2 - d * r; r *= 2 - d * r; r *= 2 - d * r; r *= 2 - d * r; r *= 2 - d * r; r *= 2 - d * r; r *= 2 - d * r; r *= 2 - d * r; return l * r; } function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256) { (uint256 l, uint256 h) = fullMul(x, y); uint256 mm = mulmod(x, y, d); if (mm > l) h -= 1; l -= mm; if (h == 0) return l / d; require(h < d, "FullMath: FULLDIV_OVERFLOW"); return fullDiv(l, h, d); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.4.0; // computes square roots using the babylonian method // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method library Babylonian { // credit for this implementation goes to // https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687 function sqrt(uint256 x) internal pure returns (uint256) { if (x == 0) return 0; // this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2); // however that code costs significantly more gas uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return (r < r1 ? r : r1); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.5.0; library BitMath { // returns the 0 indexed position of the most significant bit of the input x // s.t. x >= 2**msb and x < 2**(msb+1) function mostSignificantBit(uint256 x) internal pure returns (uint8 r) { require(x > 0, "BitMath::mostSignificantBit: zero"); if (x >= 0x100000000000000000000000000000000) { x >>= 128; r += 128; } if (x >= 0x10000000000000000) { x >>= 64; r += 64; } if (x >= 0x100000000) { x >>= 32; r += 32; } if (x >= 0x10000) { x >>= 16; r += 16; } if (x >= 0x100) { x >>= 8; r += 8; } if (x >= 0x10) { x >>= 4; r += 4; } if (x >= 0x4) { x >>= 2; r += 2; } if (x >= 0x2) r += 1; } // returns the 0 indexed position of the least significant bit of the input x // s.t. (x & 2**lsb) != 0 and (x & (2**(lsb) - 1)) == 0) // i.e. the bit at the index is set and the mask of all lower bits is 0 function leastSignificantBit(uint256 x) internal pure returns (uint8 r) { require(x > 0, "BitMath::leastSignificantBit: zero"); r = 255; if (x & uint128(340282366920938463463374607431768211455) > 0) { r -= 128; } else { x >>= 128; } if (x & uint64(18446744073709551615) > 0) { r -= 64; } else { x >>= 64; } if (x & uint32(4294967295) > 0) { r -= 32; } else { x >>= 32; } if (x & uint16(32767) > 0) { r -= 16; } else { x >>= 16; } if (x & uint8(255) > 0) { r -= 8; } else { x >>= 8; } if (x & 0xf > 0) { r -= 4; } else { x >>= 4; } if (x & 0x3 > 0) { r -= 2; } else { x >>= 2; } if (x & 0x1 > 0) r -= 1; } }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external returns (address); function WETH() external returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens(uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens(uint256 amountOut, address[] calldata path, address to, uint256 deadline) external payable returns (uint256[] memory amounts); function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external pure returns (uint256 amountB); function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) external pure returns (uint256 amountOut); function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "@uniswap/lib/=lib/solidity-lib/", "@uniswap/v2-core/=lib/v2-core/", "abdk-libraries-solidity/=lib/abdk-libraries-solidity/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "base64-sol/=lib/base64/", "base64/=lib/base64/", "solidity-lib/=lib/solidity-lib/contracts/", "v2-core/=lib/v2-core/contracts/", "v3-core/=lib/v3-core/contracts/", "v3-periphery/=lib/v3-periphery/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"address","name":"_dbxen","type":"address"},{"internalType":"address","name":"_dbxenViews","type":"address"},{"internalType":"address","name":"_v3Oracle","type":"address"},{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address","name":"_devFeeTo","type":"address"},{"internalType":"address","name":"_devAllocMinter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CSPHasEnded","type":"error"},{"inputs":[],"name":"CSPOngoing","type":"error"},{"inputs":[],"name":"GotNothing","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidReferralCode","type":"error"},{"inputs":[],"name":"NXDMaxSupplyMinted","type":"error"},{"inputs":[],"name":"NoAutoReferral","type":"error"},{"inputs":[],"name":"NoRewards","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotInitialized","type":"error"},{"inputs":[],"name":"PoolAlreadyCreated","type":"error"},{"inputs":[],"name":"ReferralCodeAlreadySet","type":"error"},{"inputs":[],"name":"SendETHFail","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"referralCode","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dxnAmountReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dxnBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dxnToStake","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nxdBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethToStakingVault","type":"uint256"}],"name":"HandleRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"uniswapV2Pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"nxdDesired","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dxnDesired","type":"uint256"}],"name":"PoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"referralCode","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"ReferralCodeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReferralRewardsWithdrawn","type":"event"},{"inputs":[],"name":"DEADBEEF","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DXN_WETH_POOL","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNISWAP_V2_FACTORY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNISWAP_V2_ROUTER","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNISWAP_V3_ROUTER","outputs":[{"internalType":"contract ISwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nxdDesired","type":"uint256"},{"internalType":"uint256","name":"dxnDesired","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"createPool","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dbxen","outputs":[{"internalType":"contract IDBXen","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dbxenViews","outputs":[{"internalType":"contract IDBXenViews","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decreasePerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_referralCode","type":"uint256"},{"internalType":"bool","name":"_allowDynamicAmount","type":"bool"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositNoMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAllocMinter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dxn","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getReferralBonuses","outputs":[{"internalType":"uint256","name":"referrerAmount","type":"uint256"},{"internalType":"uint256","name":"userAmount","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"mintDevAlloc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nxd","outputs":[{"internalType":"contract NXDERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nxdStakingVault","outputs":[{"internalType":"contract NXDStakingVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ourClaimableFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDXNToStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"referralCodes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referredRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referrerRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newDevAllowMinter","type":"address"}],"name":"setDevAllocMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_referralCode","type":"uint256"}],"name":"setReferralCode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeOurDXN","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDXNBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDXNDepositedLMP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDXNStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalETHToStakingVault","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalNXDBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnclaimedReferralRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userToReferralCode","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userTotalBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userTotalMintedNoBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2Oracle","outputs":[{"internalType":"contract V2Oracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v3Oracle","outputs":[{"internalType":"contract IV3Oracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vesting","outputs":[{"internalType":"contract Vesting","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawReferralRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101406040524662aa36a7146200002b577380f0c1c49891dcfdd40b6e0f960f84e6042bcb6f62000041565b7324aedc58ec49861ec31dd01be1b9e176ce2529e65b600080546001600160a01b0319166001600160a01b03929092169190911790554662aa36a714620000875773e592427a0aece92de3edee1f18e0157c058615646200009d565b733a71158eb1f7ec993510d4628402062cd919b6655b600180546001600160a01b0319166001600160a01b03929092169190911790554662aa36a714620000e357737a250d5630b4cf539739df2c5dacb4c659f2488d620000f9565b7342f6460304545b48e788f6e8478fbf5e7dd7cde05b600280546001600160a01b0319166001600160a01b03929092169190911790554662aa36a7146200013f57735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f62000155565b73daf1b15ac3ca069bf811553170bad5b23342a4d65b600380546001600160a01b0319166001600160a01b0392909216919091179055670de0b6b3a76400006004556706f05b59d3b20000600555426006819055620001a290621275006200040a565b600755348015620001b257600080fd5b50604051620093d8380380620093d8833981016040819052620001d5916200044f565b6001600160a01b038616608052604051620001f090620003e0565b604051809103906000f0801580156200020d573d6000803e3d6000fd5b506001600160a01b039081166101208190526000546040518a933393921691879187906200023b90620003ee565b9586526001600160a01b03948516602087015292841660408601529083166060850152821660808401521660a082015260c001604051809103906000f0801580156200028b573d6000803e3d6000fd5b506001600160a01b0390811660a08190526101205160405163144fa6d760e01b815260048101929092529091169063144fa6d790602401600060405180830381600087803b158015620002dd57600080fd5b505af1158015620002f2573d6000803e3d6000fd5b5050505060a0516040516200030790620003fc565b6001600160a01b039091168152602001604051809103906000f08015801562000334573d6000803e3d6000fd5b506001600160a01b0390811660c081905260a051604051622bea0f60e41b815260048101929092526001602483018190526044830152909116906302bea0f090606401600060405180830381600087803b1580156200039257600080fd5b505af1158015620003a7573d6000803e3d6000fd5b505050506001600160a01b0394851660e052928416610100525050601080546001600160a01b0319169190921617905550620004db9050565b610603806200482183390190565b612be28062004e2483390190565b6119d28062007a0683390190565b808201808211156200042c57634e487b7160e01b600052601160045260246000fd5b92915050565b80516001600160a01b03811681146200044a57600080fd5b919050565b600080600080600080600060e0888a0312156200046b57600080fd5b875196506200047d6020890162000432565b95506200048d6040890162000432565b94506200049d6060890162000432565b9350620004ad6080890162000432565b9250620004bd60a0890162000432565b9150620004cd60c0890162000432565b905092959891949750929550565b60805160a05160c05160e05161010051610120516142166200060b60003960008181610ea7015281816116af01526117300152600081816103290152611063015260008181610f4e0152612804015260008181610b620152610f840152600081816107d0015281816109f801528181610a8801528181610d4a01528181611373015281816114770152818161153f015281816115d801528181611681015281816119f201528181611a7701528181611b1701528181611bcc01528181611c5101528181611cd601528181611fa001528181612136015281816122480152818161236801528181612431015281816124cf0152818161257301526125f3015260008181611099015281816126e1015281816127690152818161289401528181612a6c0152612af401526142166000f3fe608060405260043610620002925760003560e01c8063742508e2116200015f578063afbcb26911620000c5578063cdadfbf21162000084578063cdadfbf214620011e1578063d11115281462001206578063d7ac9b101462001228578063ebb2cc4c146200124a578063f697c7a61462001274578063f9f8bdb714620012a557600080fd5b8063afbcb2691462001147578063b2f293251462001181578063b88074f51462001199578063c60b547314620011b1578063c879657214620011c957600080fd5b8063916d8c82116200011e578063916d8c821462001085578063930ffbe314620010bb57806396e0a13914620010d357806399d8fae314620010eb578063a82ed9ec146200110d578063ac4a4500146200112f57600080fd5b8063742508e21462000fc957806378e979251462000fe1578063793352901462000ff957806384e311a4146200101e57806386bc7560146200104f57600080fd5b80633804046811620002055780634aa4a4fc11620001c45780634aa4a4fc1462000ec95780634aec8f181462000ef35780635afe54d21462000f185780635c99a0a41462000f3a5780635f8dccec1462000f705780637073c6f61462000fa657600080fd5b8063380404681462000de057806341c64a2f1462000e1b5780634267a2731462000e3d57806343a0d0661462000e6e57806344c63eec1462000e9357600080fd5b806330e6c144116200025257806330e6c1441462000d065780633197cbb61462000d1e57806331b703db1462000d36578063330a58001462000d855780633438c40c1462000daf57600080fd5b8062b501961462000c4657806309253f751462000c715780631fb9f6fa1462000ca2578063227ad71d1462000cbc578063286440611462000ce157600080fd5b3662000c41576000612710620002ab4761213462002b7a565b620002b7919062002b9a565b6000805460405163d465fe0b60e01b8152737f808fd904ffa3eb6a6f259e6965fb1466a05372600482015261012c6024820152670de0b6b3a7640000604482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260648201526001600160a01b03918216608482015292935090917f00000000000000000000000000000000000000000000000000000000000000009091169063d465fe0b9060a401602060405180830381865afa15801562000373573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000399919062002bbd565b90506000670de0b6b3a7640000620003b2838562002b7a565b620003be919062002b9a565b9050612710620003d1826125e462002b7a565b620003dd919062002b9a565b600154604080516101008101825273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28152600080546001600160a01b03908116602084019081526127108486019081523060608601908152426080870190815260a087018d815260c088018b815260e08901888152995163414bf38960e01b81529851871660048a0152945186166024890152925162ffffff1660448801529051841660648701525160848601525160a48501525160c48401529251831660e483015293945091169063414bf3899086906101040160206040518083038185885af1158015620004c5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190620004ec919062002bbd565b905060006305f5e100620005048362a98ac762002b7a565b62000510919062002b9a565b60005460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb90620005599073deadbeefdeadbeefdeadbeefdeadbeefdeadbeef90859060040162002bd7565b6020604051808303816000875af115801562000579573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200059f919062002bff565b508060156000828254620005b4919062002c26565b90915550600090506305f5e100620005d184630381936962002b7a565b620005dd919062002b9a565b9050600e60009054906101000a90046001600160a01b03166001600160a01b031663a17a26856040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000633573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000659919062002bff565b15620006ca57600e60009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620006b057600080fd5b505af1158015620006c5573d6000803e3d6000fd5b505050505b600e5460008054604051633ddac95360e01b815291926001600160a01b0390811692633ddac9539262000704921690869060040162002bd7565b602060405180830381865afa15801562000722573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000748919062002bbd565b90506127106200075b826125e462002b7a565b62000767919062002b9a565b604080516002808252606082018352929350600092909160208301908036833750506000805483519394506001600160a01b031692849250620007ae57620007ae62002c52565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008160018151811062000805576200080562002c52565b6001600160a01b03928316602091820292909201015260005460025460405163095ea7b360e01b81529183169263095ea7b3926200084c9290911690879060040162002bd7565b6020604051808303816000875af11580156200086c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000892919062002bff565b506002546040516338ed173960e01b81526000916001600160a01b0316906338ed173990620008ce908790879087903090429060040162002c68565b6000604051808303816000875af1158015620008ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000918919081019062002d36565b90508060008151811062000930576200093062002c52565b60200260200101516000036200095957604051635070cdd160e01b815260040160405180910390fd5b6000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015620009a2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009c8919062002bbd565b600f6000828254620009db919062002c26565b90915550506040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801562000a48573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a6e919062002bbd565b60405163a9059cbb60e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb9062000ad59073deadbeefdeadbeefdeadbeefdeadbeefdeadbeef90859060040162002bd7565b6020604051808303816000875af115801562000af5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b1b919062002bff565b50806013600082825462000b30919062002c26565b9091555050601680544791829160009062000b4d90849062002c26565b90915550506040516000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169047908381818185875af1925050503d806000811462000bbf576040519150601f19603f3d011682016040523d82523d6000602084013e62000bc4565b606091505b505090508062000be7576040516350490ba960e01b815260040160405180910390fd5b600f5460408051348152602081018c90528082018b905260608101929092526080820185905260a08201849052517f67b5a7be490d8676b76828347317a6b1a6b54b5c882c5829af39b5a2281eaa299181900360c00190a1005b600080fd5b34801562000c5357600080fd5b5062000c5e60125481565b6040519081526020015b60405180910390f35b34801562000c7e57600080fd5b5062000c5e62000c9036600462002dec565b600a6020526000908152604090205481565b34801562000caf57600080fd5b5062000cba620012bd565b005b34801562000cc957600080fd5b5062000cba62000cdb36600462002e0c565b62001420565b34801562000cee57600080fd5b5062000cba62000d0036600462002ea6565b620017ec565b34801562000d1357600080fd5b5062000c5e60135481565b34801562000d2b57600080fd5b5062000c5e60075481565b34801562000d4357600080fd5b5062000d6c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200162000c68565b34801562000d9257600080fd5b5062000d6c73deadbeefdeadbeefdeadbeefdeadbeefdeadbeef81565b34801562000dbc57600080fd5b5062000c5e62000dce36600462002dec565b600c6020526000908152604090205481565b34801562000ded57600080fd5b5062000e0562000dff36600462002ea6565b620018a4565b6040805192835260208301919091520162000c68565b34801562000e2857600080fd5b5060015462000d6c906001600160a01b031681565b34801562000e4a57600080fd5b5062000c5e62000e5c36600462002dec565b600d6020526000908152604090205481565b34801562000e7b57600080fd5b5062000cba62000e8d36600462002ec0565b620018ec565b34801562000ea057600080fd5b5062000d6c7f000000000000000000000000000000000000000000000000000000000000000081565b34801562000ed657600080fd5b5062000d6c73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801562000f0057600080fd5b5062000cba62000f1236600462002dec565b6200206e565b34801562000f2557600080fd5b5060005462000d6c906001600160a01b031681565b34801562000f4757600080fd5b5062000d6c7f000000000000000000000000000000000000000000000000000000000000000081565b34801562000f7d57600080fd5b5062000d6c7f000000000000000000000000000000000000000000000000000000000000000081565b34801562000fb357600080fd5b5062000c5e6c0537a333f3e43c2f8d051f274881565b34801562000fd657600080fd5b5062000c5e600f5481565b34801562000fee57600080fd5b5062000c5e60065481565b3480156200100657600080fd5b5062000c5e6200101836600462002efc565b620020bc565b3480156200102b57600080fd5b5062000c5e6200103d36600462002dec565b600b6020526000908152604090205481565b3480156200105c57600080fd5b5062000d6c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156200109257600080fd5b5062000d6c7f000000000000000000000000000000000000000000000000000000000000000081565b348015620010c857600080fd5b5062000cba620026a9565b348015620010e057600080fd5b5062000c5e60165481565b348015620010f857600080fd5b5060035462000d6c906001600160a01b031681565b3480156200111a57600080fd5b5060025462000d6c906001600160a01b031681565b3480156200113c57600080fd5b5062000c5e60145481565b3480156200115457600080fd5b5062000d6c6200116636600462002ea6565b6008602052600090815260409020546001600160a01b031681565b3480156200118e57600080fd5b5062000c5e60155481565b348015620011a657600080fd5b5062000c5e60115481565b348015620011be57600080fd5b5062000c5e620027ec565b348015620011d657600080fd5b5062000cba6200287f565b348015620011ee57600080fd5b5062000cba6200120036600462002ea6565b6200290a565b3480156200121357600080fd5b5060105462000d6c906001600160a01b031681565b3480156200123557600080fd5b50600e5462000d6c906001600160a01b031681565b3480156200125757600080fd5b5062000d6c737f808fd904ffa3eb6a6f259e6965fb1466a0537281565b3480156200128157600080fd5b5062000c5e6200129336600462002dec565b60096020526000908152604090205481565b348015620012b257600080fd5b5062000c5e6200296c565b600754421015620012e15760405163c264ab4d60e01b815260040160405180910390fd5b336000908152600b6020908152604080832054600a90925282205462001308919062002c26565b9050806000036200132c57604051630fec21fd60e21b815260040160405180910390fd5b806011600082825462001340919062002f3e565b9091555050336000818152600b60209081526040808320839055600a90915280822091909155516340c10f1960e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916340c10f1991620013b39190859060040162002bd7565b600060405180830381600087803b158015620013ce57600080fd5b505af1158015620013e3573d6000803e3d6000fd5b50506040518381523392507f996ae228123457779bb0d7cd6daa18e54006fe2f6dc172f12197d826b08dabcd91506020015b60405180910390a250565b6010546001600160a01b031633146200144c5760405163ea8e4eb560e01b815260040160405180910390fd5b600754421015620014705760405163c264ab4d60e01b815260040160405180910390fd5b60006011547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620014d4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014fa919062002bbd565b62001506919062002c26565b90506000816126486200151c8261271062002b7a565b62001528919062002b9a565b62001534919062002f3e565b90508015620017e7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200159c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620015c2919062002bbd565b620015ce838362002c26565b11156200166a57817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001635573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200165b919062002bbd565b62001667919062002f3e565b90505b604051633aaeacfd60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063755d59fa90620016da907f000000000000000000000000000000000000000000000000000000000000000090859060040162002bd7565b600060405180830381600087803b158015620016f557600080fd5b505af11580156200170a573d6000803e3d6000fd5b5050505060008351826200171f919062002b9a565b905060005b8451811015620017e4577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166396c9ee6286838151811062001772576200177262002c52565b6020026020010151846040518363ffffffff1660e01b81526004016200179a92919062002bd7565b600060405180830381600087803b158015620017b557600080fd5b505af1158015620017ca573d6000803e3d6000fd5b505050508080620017db9062002f54565b91505062001724565b50505b505050565b806000036200180e5760405163e55b462960e01b815260040160405180910390fd5b6000818152600860205260409020546001600160a01b031615620018455760405163091da0bf60e21b815260040160405180910390fd5b600081815260086020908152604080832080546001600160a01b031916339081179091558084526009835292819020849055518381527fc872d799ec127e1a42b35045564b2f8898fafa9fc580451f8e63bcd28c5c88d3910162001415565b600080620186a0620018b98461138862002b7a565b620018c5919062002b9a565b9150620186a0620018d98461271062002b7a565b620018e5919062002b9a565b9050915091565b600e546001600160a01b031662001916576040516321c4e35760e21b815260040160405180910390fd5b6007544211156200193a5760405163155f2c7b60e01b815260040160405180910390fd5b826000036200195c5760405163162908e360e11b815260040160405180910390fd5b6000620019686200296c565b90506000670de0b6b3a764000062001981838762002b7a565b6200198d919062002b9a565b6000858152600860205260408120549192509081906001600160a01b0316338103620019cc57604051631087758f60e01b815260040160405180910390fd5b6001600160a01b03811615620019ed57620019e784620018a4565b90935091505b6011547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639747498c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001a4f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a75919062002bbd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001ad4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001afa919062002bbd565b62001b06919062002f3e565b62001b12919062002f3e565b8284867f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001b74573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001b9a919062002bbd565b62001ba6919062002c26565b62001bb2919062002c26565b62001bbe919062002c26565b111562001e6d5760006011547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639747498c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001c29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001c4f919062002bbd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001cae573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001cd4919062002bbd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001d33573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001d59919062002bbd565b62001d65919062002f3e565b62001d71919062002f3e565b62001d7d919062002f3e565b905080158062001d8b575086155b1562001daa57604051636e7f5a3760e01b815260040160405180910390fd5b6001600160a01b03821662001dc0578062001e36565b670de0b6b3a7640000670ff59ee833b3000062001dde838362002b7a565b62001df284670ff59ee833b3000062002b7a565b62001dfe919062002f3e565b62001e1290670de0b6b3a764000062002b7a565b62001e1e919062002b9a565b62001e2a919062002b9a565b62001e36908262002f3e565b94508562001e4d86670de0b6b3a764000062002b7a565b62001e59919062002b9a565b985062001e6685620018a4565b9094509250505b6001600160a01b0381166000908152600b60205260408120805485929062001e9790849062002c26565b90915550506001600160a01b0381166000908152600d60205260408120805485929062001ec690849062002c26565b9091555050336000908152600a60205260408120805484929062001eec90849062002c26565b9091555050336000908152600d60205260408120805484929062001f1290849062002c26565b9091555062001f249050828462002c26565b6011600082825462001f37919062002c26565b9091555050336000908152600c60205260408120805486929062001f5d90849062002c26565b92505081905550876012600082825462001f78919062002c26565b9091555062001f89905088620029c4565b6040516340c10f1960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340c10f199062001fd9903390889060040162002bd7565b600060405180830381600087803b15801562001ff457600080fd5b505af115801562002009573d6000803e3d6000fd5b50505050620020176200287f565b62002021620026a9565b604080518981526020810186905290810188905233907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e9060600160405180910390a25050505050505050565b6010546001600160a01b031633146200209a5760405163ea8e4eb560e01b815260040160405180910390fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000841580620020ca575083155b15620020e95760405163162908e360e11b815260040160405180910390fd5b600e546001600160a01b0316156200211457604051630149ba8b60e11b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af115801562002188573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620021ae919062002bff565b506000546040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b03909116906323b872dd906064016020604051808303816000875af115801562002207573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200222d919062002bff565b5060025460405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169263095ea7b39262002285929190911690899060040162002bd7565b6020604051808303816000875af1158015620022a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620022cb919062002bff565b5060005460025460405163095ea7b360e01b81526001600160a01b039283169263095ea7b3926200230492911690889060040162002bd7565b6020604051808303816000875af115801562002324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200234a919062002bff565b506002546000805460405162e8e33760e81b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152918216602482015260448101899052606481018890526084810183905260a481019290925285811660c483015260e482018590529091169063e8e3370090610104016060604051808303816000875af1158015620023f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002416919062002f70565b6003546000546040519295506001600160a01b0391821694507f0000000000000000000000000000000000000000000000000000000000000000935016906200245f9062002b56565b6001600160a01b03938416815291831660208301529091166040820152606001604051809103906000f0801580156200249c573d6000803e3d6000fd5b50600e80546001600160a01b0319166001600160a01b039283161790556003546000805460405163e6a4390560e01b81527f00000000000000000000000000000000000000000000000000000000000000008516600482015290841660248201529092919091169063e6a4390590604401602060405180830381865afa1580156200252b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002551919062002f9f565b60405163a29a608960e01b81526001600160a01b0380831660048301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063a29a608990602401600060405180830381600087803b158015620025ba57600080fd5b505af1158015620025cf573d6000803e3d6000fd5b5050600e5460405163332c412d60e01b81526001600160a01b0391821660048201527f0000000000000000000000000000000000000000000000000000000000000000909116925063332c412d9150602401600060405180830381600087803b1580156200263c57600080fd5b505af115801562002651573d6000803e3d6000fd5b5050604080516001600160a01b0385168152602081018a90529081018890527f620f7d92e94f37e846b7a037fa45c886f3ab726b58c6531813825a47ad4eec509250606001905060405180910390a150949350505050565b600f548015620027e9576000600f8190555460405163095ea7b360e01b81526001600160a01b039091169063095ea7b3906200270c907f000000000000000000000000000000000000000000000000000000000000000090859060040162002bd7565b6020604051808303816000875af11580156200272c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002752919062002bff565b5060405163534a7e1d60e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a694fc3a90602401600060405180830381600087803b158015620027b657600080fd5b505af1158015620027cb573d6000803e3d6000fd5b505050508060146000828254620027e3919062002c26565b90915550505b50565b604051635fcc96f560e11b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bf992dea90602401602060405180830381865afa15801562002854573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200287a919062002bbd565b905090565b60006200288b620027ec565b111562002908577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d294f0936040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620028ee57600080fd5b505af115801562002903573d6000803e3d6000fd5b505050505b565b6200291581620029c4565b6040805182815260006020820181905281830152905133917f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e919081900360600190a2620029626200287f565b620027e9620026a9565b600080600654426200297f919062002f3e565b9050670de0b6b3a7640000620029a36c0537a333f3e43c2f8d051f27488362002b7a565b620029af919062002b9a565b600454620029be919062002f3e565b91505090565b6000546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af115801562002a1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002a42919062002bff565b5060005460405163095ea7b360e01b81526001600160a01b039091169063095ea7b39062002a97907f000000000000000000000000000000000000000000000000000000000000000090859060040162002bd7565b6020604051808303816000875af115801562002ab7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002add919062002bff565b5060405163534a7e1d60e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a694fc3a90602401600060405180830381600087803b15801562002b4157600080fd5b505af1158015620017e4573d6000803e3d6000fd5b6112218062002fc083390190565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141762002b945762002b9462002b64565b92915050565b60008262002bb857634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121562002bd057600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b8015158114620027e957600080fd5b60006020828403121562002c1257600080fd5b815162002c1f8162002bf0565b9392505050565b8082018082111562002b945762002b9462002b64565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101562002cba5784516001600160a01b03168352938301939183019160010162002c93565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171562002d075762002d0762002c3c565b604052919050565b600067ffffffffffffffff82111562002d2c5762002d2c62002c3c565b5060051b60200190565b6000602080838503121562002d4a57600080fd5b825167ffffffffffffffff81111562002d6257600080fd5b8301601f8101851362002d7457600080fd5b805162002d8b62002d858262002d0f565b62002cdb565b81815260059190911b8201830190838101908783111562002dab57600080fd5b928401925b8284101562002dcb5783518252928401929084019062002db0565b979650505050505050565b6001600160a01b0381168114620027e957600080fd5b60006020828403121562002dff57600080fd5b813562002c1f8162002dd6565b6000602080838503121562002e2057600080fd5b823567ffffffffffffffff81111562002e3857600080fd5b8301601f8101851362002e4a57600080fd5b803562002e5b62002d858262002d0f565b81815260059190911b8201830190838101908783111562002e7b57600080fd5b928401925b8284101562002dcb57833562002e968162002dd6565b8252928401929084019062002e80565b60006020828403121562002eb957600080fd5b5035919050565b60008060006060848603121562002ed657600080fd5b8335925060208401359150604084013562002ef18162002bf0565b809150509250925092565b6000806000806080858703121562002f1357600080fd5b8435935060208501359250604085013562002f2e8162002dd6565b9396929550929360600135925050565b8181038181111562002b945762002b9462002b64565b60006001820162002f695762002f6962002b64565b5060010190565b60008060006060848603121562002f8657600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121562002fb257600080fd5b815162002c1f8162002dd656fe60e06040523480156200001157600080fd5b5060405162001221380380620012218339810160408190526200003491620003bd565b60405163e6a4390560e01b81526001600160a01b03838116600483015282811660248301526000919085169063e6a4390590604401602060405180830381865afa15801562000087573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ad919062000407565b9050806001600160a01b03166080816001600160a01b031681525050806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000108573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012e919062000407565b6001600160a01b031660a0816001600160a01b031681525050806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000186573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ac919062000407565b6001600160a01b031660c0816001600160a01b031681525050806001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200022a91906200042c565b600081905550806001600160a01b0316635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200026f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029591906200042c565b600181905550600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015620002dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200030391906200045e565b6002805463ffffffff191663ffffffff9290921691909117905590925090506001600160701b038216158015906200034357506001600160701b03811615155b620003945760405162461bcd60e51b815260206004820181905260248201527f4578616d706c654f7261636c6553696d706c653a204e4f5f5245534552564553604482015260640160405180910390fd5b505050505050620004b4565b80516001600160a01b0381168114620003b857600080fd5b919050565b600080600060608486031215620003d357600080fd5b620003de84620003a0565b9250620003ee60208501620003a0565b9150620003fe60408501620003a0565b90509250925092565b6000602082840312156200041a57600080fd5b6200042582620003a0565b9392505050565b6000602082840312156200043f57600080fd5b5051919050565b80516001600160701b0381168114620003b857600080fd5b6000806000606084860312156200047457600080fd5b6200047f8462000446565b92506200048f6020850162000446565b9150604084015163ffffffff81168114620004a957600080fd5b809150509250925092565b60805160a05160c051610d29620004f8600039600081816101ea015261028701526000818160be015261021001526000818161019501526103910152610d296000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a2e6204511610071578063a2e6204514610173578063a6bb45391461017d578063a8aa1b3114610190578063b4d1d795146101b7578063c5700a02146101c0578063d21220a7146101e557600080fd5b80630dfe1681146100b95780633ddac953146100fd5780635909c0d51461011e5780635a3d5493146101275780635e6aaf2c14610130578063a17a26851461015b575b600080fd5b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61011061010b366004610b81565b61020c565b6040519081526020016100f4565b61011060005481565b61011060015481565b600454610143906001600160e01b031681565b6040516001600160e01b0390911681526020016100f4565b61016361034f565b60405190151581526020016100f4565b61017b610387565b005b600354610143906001600160e01b031681565b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b61011061012c81565b6002546101d09063ffffffff1681565b60405163ffffffff90911681526020016100f4565b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036102855760408051602081019091526003546001600160e01b031681526102759061026e9084610502565b5160701c90565b6001600160901b03169050610349565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146103165760405162461bcd60e51b815260206004820152602260248201527f4578616d706c654f7261636c6553696d706c653a20494e56414c49445f544f4b60448201526122a760f11b60648201526084015b60405180910390fd5b60408051602081019091526004546001600160e01b0316815261033d9061026e9084610502565b6001600160901b031690505b92915050565b60008061035a6105a0565b6002549091506000906103739063ffffffff1683610bcf565b61012c63ffffffff90911610159392505050565b60008060006103b57f00000000000000000000000000000000000000000000000000000000000000006105b6565b60025492955090935091506000906103d39063ffffffff1683610bcf565b905061012c8163ffffffff16101561043d5760405162461bcd60e51b815260206004820152602760248201527f4578616d706c654f7261636c6553696d706c653a20504552494f445f4e4f545f6044820152661153105414d15160ca1b606482015260840161030d565b60405180602001604052808263ffffffff166000548761045d9190610bf3565b6104679190610c1c565b6001600160e01b039081169091529051600380546001600160e01b031916919092161790556040805160208101909152600154819063ffffffff8416906104ae9087610bf3565b6104b89190610c1c565b6001600160e01b039081169091529051600480546001600160e01b03191691909216179055506000929092556001556002805463ffffffff191663ffffffff909216919091179055565b604080516020810190915260008152600082158061053f575083516001600160e01b0316836105318183610c30565b925061053d9083610c1c565b145b61058b5760405162461bcd60e51b815260206004820152601960248201527f4669786564506f696e743a3a6d756c3a206f766572666c6f7700000000000000604482015260640161030d565b60408051602081019091529081529392505050565b60006105b164010000000042610c47565b905090565b60008060006105c36105a0565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190610c5b565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa158015610667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068b9190610c5b565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156106d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f49190610c90565b9250925092508363ffffffff168163ffffffff16146107a35760006107198286610bcf565b90508063ffffffff1661073e846001600160701b0316866001600160701b03166107ad565b5161075291906001600160e01b0316610c30565b61075c9088610ce0565b96508063ffffffff16610781856001600160701b0316856001600160701b03166107ad565b5161079591906001600160e01b0316610c30565b61079f9087610ce0565b9550505b5050509193909250565b6040805160208101909152600081526000821161081b5760405162461bcd60e51b815260206004820152602660248201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260448201526579207a65726f60d01b606482015260840161030d565b826000036108385750604080516020810190915260008152610349565b6001600160901b0383116108cf57600061085683607086901b610c1c565b90506001600160e01b038111156108af5760405162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015260640161030d565b6040518060200160405280826001600160e01b0316815250915050610349565b600061085684600160701b8560008060006108ea86866109a8565b91509150600084806108fe576108fe610c06565b86880990508281111561091957610916600183610bf3565b91505b6109238184610bf3565b925081600003610941576109378584610c1c565b93505050506109a1565b8482106109905760405162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015260640161030d565b61099b8383876109ea565b93505050505b9392505050565b6000808060001984860990506109be8486610c30565b92506109ca8382610bf3565b9150828110156109e2576109df600183610bf3565b91505b509250929050565b6000806109f983600019610bf3565b610a04906001610ce0565b83169050610a128184610c1c565b9250610a1e8186610c1c565b945080610a2d81600019610bf3565b610a38906001610ce0565b610a429190610c1c565b610a4d906001610ce0565b610a579085610c30565b610a619086610ce0565b94506001610a6f8185610c30565b610a7a906002610bf3565b610a849082610c30565b9050610a908185610c30565b610a9b906002610bf3565b610aa59082610c30565b9050610ab18185610c30565b610abc906002610bf3565b610ac69082610c30565b9050610ad28185610c30565b610add906002610bf3565b610ae79082610c30565b9050610af38185610c30565b610afe906002610bf3565b610b089082610c30565b9050610b148185610c30565b610b1f906002610bf3565b610b299082610c30565b9050610b358185610c30565b610b40906002610bf3565b610b4a9082610c30565b9050610b568185610c30565b610b61906002610bf3565b610b6b9082610c30565b9050610b778187610c30565b9695505050505050565b60008060408385031215610b9457600080fd5b82356001600160a01b0381168114610bab57600080fd5b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b63ffffffff828116828216039080821115610bec57610bec610bb9565b5092915050565b8181038181111561034957610349610bb9565b634e487b7160e01b600052601260045260246000fd5b600082610c2b57610c2b610c06565b500490565b808202811582820484141761034957610349610bb9565b600082610c5657610c56610c06565b500690565b600060208284031215610c6d57600080fd5b5051919050565b80516001600160701b0381168114610c8b57600080fd5b919050565b600080600060608486031215610ca557600080fd5b610cae84610c74565b9250610cbc60208501610c74565b9150604084015163ffffffff81168114610cd557600080fd5b809150509250925092565b8082018082111561034957610349610bb956fea26469706673582212204cdec9e6b036d1675bcafb1e72f0b333239efccb9789d99497916e6d757d94d864736f6c63430008140033a26469706673582212201d02ed010a17874e8f86c29f5c02bc5a5b8786c771ec5113630319bbeeba55a564736f6c6343000814003360a060405234801561001057600080fd5b50336080526080516105cc6100376000396000818161017f01526103cb01526105cc6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806396c9ee621161005b57806396c9ee621461010c5780639d70898c1461011f578063c884ef8314610129578063fc0c546a1461014957600080fd5b8063144fa6d71461008d578063402914f5146100a25780634e71d92d146100c85780635527a04a146100d0575b600080fd5b6100a061009b3660046104ad565b610174565b005b6100b56100b03660046104ad565b610230565b6040519081526020015b60405180910390f35b6100a061030f565b6100f76100de3660046104ad565b6000602081905290815260409020805460019091015482565b604080519283526020830191909152016100bf565b6100a061011a3660046104cf565b6103c0565b6100b56276a70081565b6100b56101373660046104ad565b60016020526000908152604090205481565b60025461015c906001600160a01b031681565b6040516001600160a01b0390911681526020016100bf565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101bd57604051635a54cd2760e11b815260040160405180910390fd5b6001600160a01b0381166101e45760405163ee17566b60e01b815260040160405180910390fd5b6002546001600160a01b03161561020e5760405163a741a04560e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03811660009081526020818152604080832081518083019092528054808352600190910154928201929092529082036102735750600092915050565b6000816020015142610285919061050f565b905080600003610299575060009392505050565b6276a70081106102d0576001600160a01b03841660009081526001602052604090205482516102c8919061050f565b949350505050565b6001600160a01b03841660009081526001602052604090205482516276a700906102fb908490610528565b610305919061053f565b6102c8919061050f565b600061031a33610230565b905080156103bd573360009081526001602052604081208054839290610341908490610561565b909155505060025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bb9190610574565b505b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461040957604051635a54cd2760e11b815260040160405180910390fd5b6001600160a01b038216600090815260016020908152604080832054918390529091208054829061043b908590610561565b610445919061050f565b81554260018201556040518381526001600160a01b038516907f90782417eb6da69d0b671119cc8e9c2063c7b0987ef1378141a54770a8c91fb39060200160405180910390a250505050565b80356001600160a01b03811681146104a857600080fd5b919050565b6000602082840312156104bf57600080fd5b6104c882610491565b9392505050565b600080604083850312156104e257600080fd5b6104eb83610491565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610522576105226104f9565b92915050565b8082028115828204841417610522576105226104f9565b60008261055c57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610522576105226104f9565b60006020828403121561058657600080fd5b815180151581146104c857600080fdfea26469706673582212204081ea42f5db524384ab9a0002c170a22e9c4525b9b899709300a92adb0ea6a764736f6c6343000814003360e06040524662aa36a7146200002a57735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f62000040565b73daf1b15ac3ca069bf811553170bad5b23342a4d65b600780546001600160a01b0319166001600160a01b03929092169190911790554662aa36a7146200008657737a250d5630b4cf539739df2c5dacb4c659f2488d6200009c565b7342f6460304545b48e788f6e8478fbf5e7dd7cde05b600880546001600160a01b0319166001600160a01b0392909216919091179055348015620000c957600080fd5b5060405162002be238038062002be2833981016040819052620000ec91620005ca565b466001146200010b57604051806020016040528060008152506200012e565b60405180604001604052806009815260200168272c22102a37b5b2b760b91b8152505b6003906200013d9082620006f7565b50466001146200015d57604051806020016040528060008152506200017a565b6040518060400160405280600381526020016213961160ea1b8152505b600490620001899082620006f7565b5033608052600f80546001600160a01b0319166001600160a01b038316179055620001b585876200036b565b600b80546001600160a01b0319166001600160a01b03861617905569032d26d12e980b600000620001f1699a956119863cd440000088620007d9565b620001fd9190620007d9565b60a05260405133906200021090620005a3565b6001600160a01b039091168152602001604051809103906000f0801580156200023d573d6000803e3d6000fd5b506001600160a01b0390811660c0908152600e80546001600160a01b031916868416179055604080518082018252600180825260006020808401828152308352600580835286842095518654925161ffff1993841691151561ff001990811692909217610100911515820217909755975187518089018952868152808501868152918b1686528285528886209051815492519285169015158b1617911515880291909117905560805187518089018952868152808501878152918b1686528285528886209051815492519285169015158b1617911515880291909117905586518088018852858152808401958652988b168452909152939020945185549151919093169215159093169190911791151502179055436011556200035f620003ad565b50505050505062000827565b6001600160a01b0382166200039b5760405163ec442f0560e01b8152600060048201526024015b60405180910390fd5b620003a96000838362000470565b5050565b4360125461c350620003c09190620007d9565b10156200046e5760155473deadbeefdeadbeefdeadbeefdeadbeefdeadbeef6000908152602081905260008051602062002bc28339815191525490916200040791620007f5565b60008051602062002bc28339815191525460155560408051808201825282815260025460208281019182526013805460009081526014909252938120925183559051600190920191909155436012558154929350909162000468906200080b565b90915550505b565b6001600160a01b0383166200049f578060026000828254620004939190620007d9565b90915550620005139050565b6001600160a01b03831660009081526020819052604090205481811015620004f45760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640162000392565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620005315760028054829003905562000550565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200059691815260200190565b60405180910390a3505050565b6108f380620022cf83390190565b6001600160a01b0381168114620005c757600080fd5b50565b60008060008060008060c08789031215620005e457600080fd5b865195506020870151620005f881620005b1565b60408801519095506200060b81620005b1565b60608801519094506200061e81620005b1565b60808801519093506200063181620005b1565b60a08801519092506200064481620005b1565b809150509295509295509295565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200067d57607f821691505b6020821081036200069e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620006f257600081815260208120601f850160051c81016020861015620006cd5750805b601f850160051c820191505b81811015620006ee57828155600101620006d9565b5050505b505050565b81516001600160401b0381111562000713576200071362000652565b6200072b8162000724845462000668565b84620006a4565b602080601f8311600181146200076357600084156200074a5750858301515b600019600386901b1c1916600185901b178555620006ee565b600085815260208120601f198616915b82811015620007945788860151825594840194600190910190840162000773565b5085821015620007b35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b80820180821115620007ef57620007ef620007c3565b92915050565b81810381811115620007ef57620007ef620007c3565b600060018201620008205762000820620007c3565b5060010190565b60805160a05160c051611a2b620008a46000396000818161046d01528181611100015281816112eb01528181611346015261138e0152600081816105d90152818161093201526109e10152600081816104b8015281816106780152818161087b015281816108e5015281816109a20152610a240152611a2b6000f3fe608060405234801561001057600080fd5b50600436106102745760003560e01c8063755d59fa11610151578063a9059cbb116100c3578063cb4ca63111610087578063cb4ca63114610591578063d5abeb01146105d4578063d7ac9b10146105fb578063dd62ed3e1461060e578063ef3b9dd114610647578063f38221a41461064f57600080fd5b8063a9059cbb14610551578063ab033ea914610564578063b33f417614610577578063bba8623014610580578063be5340901461058957600080fd5b806395d89b411161011557806395d89b41146104f65780639747498c146104fe57806399d8fae31461050f5780639d6eb2cb14610522578063a29a60891461052b578063a82ed9ec1461053e57600080fd5b8063755d59fa1461048f578063872e225a146104a25780638ce74426146104b35780638db07c4d146104da578063900cf0cf146104ed57600080fd5b8063330a5800116101ea57806349c5468d116101ae57806349c5468d146104075780635aa6e675146104105780635afe54d2146104235780635d577c181461043657806370a082311461043f578063737ea06e1461046857600080fd5b8063330a580014610392578063332c412d146103c5578063383da5fa146103d857806340c10f19146103e157806349bd5a5e146103f457600080fd5b806318160ddd1161023c57806318160ddd1461032557806321a454421461032d57806323b872dd1461034057806325d158cf1461035357806330e6c1441461037a578063313ce5671461038357600080fd5b806302bea0f01461027957806306fdde031461028e578063095ea7b3146102ac5780630f56107e146102cf5780631202fcc7146102fd575b600080fd5b61028c6102873660046116c5565b610657565b005b6102966106c8565b6040516102a3919061170e565b60405180910390f35b6102bf6102ba36600461175c565b61075a565b60405190151581526020016102a3565b6102ef6102dd366004611786565b60066020526000908152604090205481565b6040519081526020016102a3565b61031061030b3660046117a8565b610774565b604080519283526020830191909152016102a3565b6002546102ef565b61028c61033b366004611786565b610802565b6102bf61034e3660046117a8565b61084e565b6103106103613660046117e4565b6014602052600090815260409020805460019091015482565b6102ef60105481565b604051601281526020016102a3565b6103ad73deadbeefdeadbeefdeadbeefdeadbeefdeadbeef81565b6040516001600160a01b0390911681526020016102a3565b61028c6103d3366004611786565b610870565b6102ef600c5481565b61028c6103ef36600461175c565b6108da565b6009546103ad906001600160a01b031681565b6102ef60115481565b600e546103ad906001600160a01b031681565b600b546103ad906001600160a01b031681565b6102ef60125481565b6102ef61044d366004611786565b6001600160a01b031660009081526020819052604090205490565b6103ad7f000000000000000000000000000000000000000000000000000000000000000081565b61028c61049d36600461175c565b610997565b6102ef699a956119863cd440000081565b6103ad7f000000000000000000000000000000000000000000000000000000000000000081565b600f546103ad906001600160a01b031681565b6102ef60135481565b610296610a0a565b6102ef69032d26d12e980b60000081565b6007546103ad906001600160a01b031681565b6102ef6101f481565b61028c610539366004611786565b610a19565b6008546103ad906001600160a01b031681565b6102bf61055f36600461175c565b610a8c565b61028c610572366004611786565b610aa2565b6102ef60155481565b6102ef600d5481565b6102ef610aee565b6105bd61059f366004611786565b60056020526000908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152016102a3565b6102ef7f000000000000000000000000000000000000000000000000000000000000000081565b600a546103ad906001600160a01b031681565b6102ef61061c3660046117fd565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61028c610b5c565b6102ef610c16565b600e546001600160a01b0316331480159061069b5750336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614155b156106b8576040516282b42960e81b815260040160405180910390fd5b6106c3838383610c70565b505050565b6060600380546106d790611830565b80601f016020809104026020016040519081016040528092919081815260200182805461070390611830565b80156107505780601f1061072557610100808354040283529160200191610750565b820191906000526020600020905b81548152906001019060200180831161073357829003601f168201915b5050505050905090565b600033610768818585610cc9565b60019150505b92915050565b6001600160a01b038316600090815260056020526040812054819060ff16806107ba57506001600160a01b038416600090815260056020526040902054610100900460ff165b156107ca575081905060006107fa565b60006127106107db6101f486611880565b6107e59190611897565b905060006107f382866118b9565b9350909150505b935093915050565b600f546001600160a01b0316331461082c576040516282b42960e81b815260040160405180910390fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b600061085b843384610cd6565b610866848484610d59565b5060019392505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108b8576040516282b42960e81b815260040160405180910390fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610922576040516282b42960e81b815260040160405180910390fd5b61095669032d26d12e980b6000007f00000000000000000000000000000000000000000000000000000000000000006118b9565b8161096060025490565b61096a91906118cc565b111561098957604051632cdb04a160e21b815260040160405180910390fd5b6109938282611478565b5050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109df576040516282b42960e81b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000008161096060025490565b6060600480546106d790611830565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a61576040516282b42960e81b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b038316179055610a898160016000610c70565b50565b6000610a99338484610d59565b50600192915050565b600e546001600160a01b03163314610acc576040516282b42960e81b815260040160405180910390fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b60155473deadbeefdeadbeefdeadbeefdeadbeefdeadbeef600090815260208190526000805160206119b68339815191525490918291610b2e91906118b9565b905060115443610b3e91906118b9565b81601554610b4c91906118cc565b610b569190611897565b91505090565b4360125461c350610b6d91906118cc565b1015610c145760155473deadbeefdeadbeefdeadbeefdeadbeefdeadbeef600090815260208190526000805160206119b6833981519152549091610bb0916118b9565b6000805160206119b683398151915254601555604080518082018252828152600254602082810191825260138054600090815260149092529381209251835590516001909201919091554360125581549293509091610c0e906118df565b90915550505b565b60155473deadbeefdeadbeefdeadbeefdeadbeefdeadbeef600090815260208190526000805160206119b68339815191525490918291610c5691906118b9565b905060125443610c6691906118b9565b610b569082611897565b604080518082018252921515835290151560208084019182526001600160a01b039490941660009081526005909452922090518154925161ffff1990931690151561ff0019161761010092151592909202919091179055565b6106c383838360016114ae565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610d535781811015610d4457604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b610d53848484840360006114ae565b50505050565b6001600160a01b038316610d8357604051634b637e8f60e11b815260006004820152602401610d3b565b6001600160a01b038216610dad5760405163ec442f0560e01b815260006004820152602401610d3b565b6001600160a01b038316600090815260208190526040902054811115610e10576001600160a01b0383166000818152602081905260409081902054905163391434e360e21b81526004810192909252602482015260448101829052606401610d3b565b6001600160a01b03831660009081526020819052604081208054839290610e389084906118b9565b909155506000905080610e4c858585610774565b90925090508015611407573060009081526020819052604081208054839290610e769084906118cc565b909155505060405181815230906001600160a01b038716906000805160206119d68339815191529060200160405180910390a36040805160028082526060820183526000926020830190803683370190505090503081600081518110610ede57610ede6118f8565b6001600160a01b039283166020918202929092010152600b54825191169082906001908110610f0f57610f0f6118f8565b6001600160a01b03909216602092830291909101909101526000612710610f3884610fa0611880565b610f429190611897565b600854909150610f5d9030906001600160a01b031683610cc9565b600a60009054906101000a90046001600160a01b03166001600160a01b031663a17a26856040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd4919061190e565b1561104257600a60009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b505050505b600a54604051633ddac95360e01b8152306004820152602481018390526000916001600160a01b031690633ddac95390604401602060405180830381865afa158015611092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b6919061192b565b90506127106110c7826125e4611880565b6110d19190611897565b600854604051635c11d79560e01b81529192506001600160a01b031690635c11d7959061112a908590859088907f0000000000000000000000000000000000000000000000000000000000000000904290600401611944565b600060405180830381600087803b15801561114457600080fd5b505af1158015611158573d6000803e3d6000fd5b505050506000828561116a91906118b9565b9050600061271061117d87610fa0611880565b6111879190611897565b9050600061271061119a886103e8611880565b6111a49190611897565b306000908152602081905260408120805492935085929091906111c89084906118b9565b909155506111d69050610b5c565b73deadbeefdeadbeefdeadbeefdeadbeefdeadbeef600090815260208190526000805160206119b683398151915280548492906112149084906118cc565b92505081905550816010600082825461122d91906118cc565b909155505060405182815273deadbeefdeadbeefdeadbeefdeadbeefdeadbeef9030906000805160206119d68339815191529060200160405180910390a3600f546001600160a01b0316600090815260208190526040812080548392906112959084906118cc565b9091555050600f546040518281526001600160a01b039091169030906000805160206119d68339815191529060200160405180910390a36000816112d984866118b9565b6112e391906118b9565b9050806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166001600160a01b03168152602001908152602001600020600082825461133991906118cc565b90915550506040518181527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169030906000805160206119d68339815191529060200160405180910390a37f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f514d4c66040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156113e757600080fd5b505af11580156113fb573d6000803e3d6000fd5b50505050505050505050505b6001600160a01b0384166000908152602081905260408120805484929061142f9084906118cc565b92505081905550836001600160a01b0316856001600160a01b03166000805160206119d68339815191528460405161146991815260200190565b60405180910390a35050505050565b6001600160a01b0382166114a25760405163ec442f0560e01b815260006004820152602401610d3b565b61099360008383611583565b6001600160a01b0384166114d85760405163e602df0560e01b815260006004820152602401610d3b565b6001600160a01b03831661150257604051634a1406b160e11b815260006004820152602401610d3b565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610d5357826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161157591815260200190565b60405180910390a350505050565b6001600160a01b0383166115ae5780600260008282546115a391906118cc565b909155506116209050565b6001600160a01b038316600090815260208190526040902054818110156116015760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610d3b565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661163c5760028054829003905561165b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03166000805160206119d68339815191528360405161168e91815260200190565b60405180910390a3505050565b80356001600160a01b03811681146116b257600080fd5b919050565b8015158114610a8957600080fd5b6000806000606084860312156116da57600080fd5b6116e38461169b565b925060208401356116f3816116b7565b91506040840135611703816116b7565b809150509250925092565b600060208083528351808285015260005b8181101561173b5785810183015185820160400152820161171f565b506000604082860101526040601f19601f8301168501019250505092915050565b6000806040838503121561176f57600080fd5b6117788361169b565b946020939093013593505050565b60006020828403121561179857600080fd5b6117a18261169b565b9392505050565b6000806000606084860312156117bd57600080fd5b6117c68461169b565b92506117d46020850161169b565b9150604084013590509250925092565b6000602082840312156117f657600080fd5b5035919050565b6000806040838503121561181057600080fd5b6118198361169b565b91506118276020840161169b565b90509250929050565b600181811c9082168061184457607f821691505b60208210810361186457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761076e5761076e61186a565b6000826118b457634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561076e5761076e61186a565b8082018082111561076e5761076e61186a565b6000600182016118f1576118f161186a565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561192057600080fd5b81516117a1816116b7565b60006020828403121561193d57600080fd5b5051919050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119945784516001600160a01b03168352938301939183019160010161196f565b50506001600160a01b0396909616606085015250505060800152939250505056feab5df040718b8f3693f97387eae2b30dba7f3bb953d1029260a38be856fa3d0eddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220b59944c3a6b594bf3459f01c451eab9c3323a7f8dbdf9d10fa796f7f71f7791264736f6c6343000814003360c06040524662aa36a714610028577380f0c1c49891dcfdd40b6e0f960f84e6042bcb6f61003e565b7324aedc58ec49861ec31dd01be1b9e176ce2529e65b600080546001600160a01b0319166001600160a01b03929092169190911790554662aa36a71461008257737a250d5630b4cf539739df2c5dacb4c659f2488d610098565b7342f6460304545b48e788f6e8478fbf5e7dd7cde05b600180546001600160a01b0319166001600160a01b03929092169190911790553480156100c457600080fd5b506040516108f33803806108f38339810160408190526100e3916100f8565b336080526001600160a01b031660a052610128565b60006020828403121561010a57600080fd5b81516001600160a01b038116811461012157600080fd5b9392505050565b60805160a05161077d610176600039600081816101090152818161024b01526102e101526000818160ae0152818161015c015281816103eb015281816104fb0152610588015261077d6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638ce744261161005b5780638ce7442614610104578063a82ed9ec1461012b578063b9de186a1461013e578063f514d4c61461014757600080fd5b80632d9c7f071461008d57806331b703db146100a957806346db5a3b146100e85780635afe54d2146100f1575b600080fd5b61009660035481565b6040519081526020015b60405180910390f35b6100d07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a0565b61009660025481565b6000546100d0906001600160a01b031681565b6100d07f000000000000000000000000000000000000000000000000000000000000000081565b6001546100d0906001600160a01b031681565b61009660045481565b61014f610151565b005b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461019a57604051633f33d0c960e01b815260040160405180910390fd5b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156101e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610207919061066f565b9050670a688906bd8b00006000670de0b6b3a7640000610227838561069e565b61023191906106bb565b60005460405163095ea7b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820184905292935091169063095ea7b3906044016020604051808303816000875af11580156102a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ca91906106dd565b506040516366d6fdf960e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdadfbf290602401600060405180830381600087803b15801561032d57600080fd5b505af1158015610341573d6000803e3d6000fd5b5050505080600460008282546103579190610706565b90915550506000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156103a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c8919061066f565b6040516370a0823160e01b81523060048201529093506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610432573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610456919061066f565b60005460015460405163095ea7b360e01b81526001600160a01b03918216600482015260248101889052929350169063095ea7b3906044016020604051808303816000875af11580156104ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d191906106dd565b5060015460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303816000875af1158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a91906106dd565b506001546000805460405162e8e33760e81b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152918216602482015260448101859052606481018890526084810183905260a481018390523060c48201524260e48201529192839291169063e8e3370090610104016060604051808303816000875af115801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190610719565b509150915081600260008282546106499190610706565b9250508190555080600360008282546106629190610706565b9091555050505050505050565b60006020828403121561068157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106b5576106b5610688565b92915050565b6000826106d857634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156106ef57600080fd5b815180151581146106ff57600080fd5b9392505050565b808201808211156106b5576106b5610688565b60008060006060848603121561072e57600080fd5b835192506020840151915060408401519050925092509256fea26469706673582212203bbfc2847a32bae249d69ad8d37b53c95968d7cfa2daf468b3c74a14ded1d83e64736f6c63430008140033ab5df040718b8f3693f97387eae2b30dba7f3bb953d1029260a38be856fa3d0e60c06040523480156200001157600080fd5b50604051620019d2380380620019d28339810160408190526200003491620002e6565b6001600160a01b0381166080523360a05262000056606482600060016200006b565b43600a55620000646200019c565b50620003b9565b81156200007c576200007c6200020a565b60008054905b81811015620000d9576000818152600160205260409020546001600160a01b03808716911603620000c657604051633caf458560e01b815260040160405180910390fd5b620000d1816200032e565b905062000082565b5084600354620000ea91906200034a565b60039081556000828152600160208190526040822080546001600160a01b0319166001600160a01b03891617815580820189905560028101839055928301805460ff191686151517905581549091908190620001489084906200034a565b909155505060408051878152841515602082015283916001600160a01b038816917ffb49f04496a66162267fb2119fa017c4d20ff5129a4bb8bc17ceac786a5d5d5b910160405180910390a3505050505050565b43600b5461c350620001af91906200034a565b10156200020857600d54600e546000908152600f60205260408120829055600c8054909190620001e19084906200034a565b90915550506000600d81905543600b55600e805490919062000203906200032e565b909155505b565b6000805490805b82811015620002465762000225816200025e565b6200023190836200034a565b91506200023e816200032e565b905062000211565b508060055462000257919062000366565b6005555050565b600081815260016020526040812060095482036200027f5750600092915050565b60035481600101546005546200029691906200037c565b620002a2919062000396565b600954909250620002b98364e8d4a510006200037c565b620002c5919062000396565b816002016000828254620002da91906200034a565b90915550919392505050565b600060208284031215620002f957600080fd5b81516001600160a01b03811681146200031157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60006001820162000343576200034362000318565b5060010190565b8082018082111562000360576200036062000318565b92915050565b8181038181111562000360576200036062000318565b808202811582820484141762000360576200036062000318565b600082620003b457634e487b7160e01b600052601260045260246000fd5b500490565b60805160a0516115de620003f46000396000818161054301528181610fac015261101f0152600081816102c90152610e8b01526115de6000f3fe6080604052600436106101d15760003560e01c8063817b1cd2116100f7578063d2a5276b11610095578063e6f0d1e911610064578063e6f0d1e9146105ba578063eded3fda146105d0578063ef3b9dd1146105e6578063feedab00146105fb57600080fd5b8063d2a5276b14610531578063e07335aa14610565578063e0b006951461057a578063e2bbb1581461059a57600080fd5b806393f1a40b116100d157806393f1a40b1461049d5780639dbc2d90146104dc578063c8ffb873146104f1578063cf3090121461050757600080fd5b8063817b1cd214610451578063841d9ac214610467578063900cf0cf1461048757600080fd5b80633f791deb1161016f5780635312ea8e1161013e5780635312ea8e146103f05780635d577c1814610410578063608c8d3a14610426578063630b5ba11461043c57600080fd5b80633f791deb1461033957806349c5468d1461038d5780634cf5fbf5146103a35780634dc47d34146103c357600080fd5b806317caf6f1116101ab57806317caf6f1146102a157806331b703db146102b757806333cfcd3b1461030357806335c62bc21461032357600080fd5b806303dec009146101e55780630ff350851461020d5780631526fe271461022357600080fd5b366101e0576101de610612565b005b600080fd5b3480156101f157600080fd5b506101fa610665565b6040519081526020015b60405180910390f35b34801561021957600080fd5b506101fa60085481565b34801561022f57600080fd5b5061027561023e3660046113d1565b600160208190526000918252604090912080549181015460028201546003909201546001600160a01b039093169290919060ff1684565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610204565b3480156102ad57600080fd5b506101fa60035481565b3480156102c357600080fd5b506102eb7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610204565b34801561030f57600080fd5b506101de61031e3660046113f8565b610687565b34801561032f57600080fd5b506101fa60005481565b34801561034557600080fd5b5061037861035436600461144d565b60046020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610204565b34801561039957600080fd5b506101fa600a5481565b3480156103af57600080fd5b506101de6103be366004611479565b6106d4565b3480156103cf57600080fd5b506101fa6103de3660046113d1565b600f6020526000908152604090205481565b3480156103fc57600080fd5b506101de61040b3660046113d1565b610808565b34801561041c57600080fd5b506101fa600b5481565b34801561043257600080fd5b506101fa600d5481565b34801561044857600080fd5b506101de6108f5565b34801561045d57600080fd5b506101fa60095481565b34801561047357600080fd5b506101de6104823660046113d1565b61093f565b34801561049357600080fd5b506101fa600e5481565b3480156104a957600080fd5b506103786104b836600461144d565b60026020908152600092835260408084209091529082529020805460019091015482565b3480156104e857600080fd5b506101fa610a14565b3480156104fd57600080fd5b506101fa600c5481565b34801561051357600080fd5b506007546105219060ff1681565b6040519015158152602001610204565b34801561053d57600080fd5b506102eb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561057157600080fd5b506101de610612565b34801561058657600080fd5b506101fa61059536600461144d565b610a3e565b3480156105a657600080fd5b506101de6105b53660046114ac565b610aa8565b3480156105c657600080fd5b506101fa60065481565b3480156105dc57600080fd5b506101fa60055481565b3480156105f257600080fd5b506101de610bc9565b34801561060757600080fd5b506101fa6201518081565b61061a610bc9565b60006006544761062a91906114e4565b9050801561066257476006556005546106449082906114f7565b60058190555080600d600082825461065c91906114f7565b90915550505b50565b6000600b544361067591906114e4565b600d54610682919061150a565b905090565b60075460ff16156106ab576040516303cb96db60e21b815260040160405180910390fd5b6007805460ff191660011790556106c58383338085610c30565b50506007805460ff1916905550565b60075460ff16156106f8576040516303cb96db60e21b815260040160405180910390fd5b6007805460ff19166001908117909155600083815260209182526040808220600284528183206001600160a01b038816845290935290206107376108f5565b6107418486610f8c565b821561079157815461075e906001600160a01b0316333086611095565b8281600001600082825461077291906114f7565b92505081905550826009600082825461078b91906114f7565b90915550505b6002820154815464e8d4a51000916107a89161152c565b6107b2919061150a565b600182015560405183815284906001600160a01b038716907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a350506007805460ff19169055505050565b60075460ff161561082c576040516303cb96db60e21b815260040160405180910390fd5b6007805460ff19166001908117909155600082815260209190915260409020600381015460ff16610870576040516337ae717b60e01b815260040160405180910390fd5b60008281526002602090815260408083203380855292529091208054835491926108a3926001600160a01b031691611102565b8054604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a3600080825560019091015550506007805460ff19169055565b6000805490805b828110156109295761090d81611138565b61091790836114f7565b915061092281611543565b90506108fc565b508060055461093891906114e4565b6005555050565b60008181526001602081815260408084206004835281852033865290925290922090810154158061096f57508054155b1561098d576040516333ff64eb60e21b815260040160405180910390fd5b80600101544210156109b25760405163b0782df760e01b815260040160405180910390fd5b8054600060018301819055825582546109d5906001600160a01b03163383611102565b8154604051908152849033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a350505050565b6000600a5443610a2491906114e4565b600d54600c54610a3491906114f7565b610682919061150a565b600082815260016020818152604080842060028084528286206001600160a01b03881687529093529084209181015492820154825491939164e8d4a5100090610a8890849061152c565b610a92919061150a565b610a9c91906114e4565b93505050505b92915050565b60075460ff1615610acc576040516303cb96db60e21b815260040160405180910390fd5b6007805460ff19166001908117909155600083815260209182526040808220600284528183203384529093529020610b026108f5565b610b0c8433610f8c565b8215610b5c578154610b29906001600160a01b0316333086611095565b82816000016000828254610b3d91906114f7565b925050819055508260096000828254610b5691906114f7565b90915550505b6002820154815464e8d4a5100091610b739161152c565b610b7d919061150a565b6001820155604051838152849033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a350506007805460ff191690555050565b43600b5461c350610bda91906114f7565b1015610c2e57600d54600e546000908152600f60205260408120829055600c8054909190610c099084906114f7565b90915550506000600d81905543600b55600e8054909190610c2990611543565b909155505b565b6000858152600160205260409020600381015460ff16610c63576040516337ae717b60e01b815260040160405180910390fd5b60008681526002602090815260408083206001600160a01b038816845290915290208054861115610ca75760405163caccb6d960e01b815260040160405180910390fd5b85610cb06108f5565b610cba8887610f8c565b600088815260046020908152604080832033845290915290208715610f1a5780600101544210158015610cf05750600181015415155b15610cfe57610cfe8961093f565b8254610d0b9089906114e4565b835560098054899190600090610d229084906114e4565b90915550508415610d4d57612710610d3c89611d4c61152c565b610d46919061150a565b9150610e2e565b8060010154600003610e15576000610d6862015180426114f7565b6040805180820182528b8152602080820184815260008f8152600483528481203382529092529290209051815590516001909101556002860154855491925064e8d4a5100091610db8919061152c565b610dc2919061150a565b6001850155604080518a8152602081018390526001600160a01b038a16917fd72eb5d043f24a0168ae744d5c44f9596fd673a26bf74d9646bff4b844882d14910160405180910390a25050505050610f85565b60405163b0782df760e01b815260040160405180910390fd5b8354610e44906001600160a01b03168784611102565b87821015610f1a576000610e58838a6114e4565b60405163a9059cbb60e01b815273deadbeefdeadbeefdeadbeefdeadbeefdeadbeef6004820152602481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f00919061155c565b508060086000828254610f1391906114f7565b9091555050505b6002840154835464e8d4a5100091610f319161152c565b610f3b919061150a565b600184015560405188815289906001600160a01b038816907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a3505050505b5050505050565b6000610f988383610a3e565b90508015610faa57610faa82826111b5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c87965726040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561100557600080fd5b505af1158015611019573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663930ffbe36040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b50505050505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526110fc9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611232565b50505050565b6040516001600160a01b0383811660248301526044820183905261113391859182169063a9059cbb906064016110ca565b505050565b600081815260016020526040812060095482036111585750600092915050565b600354816001015460055461116d919061152c565b611177919061150a565b60095490925061118c8364e8d4a5100061152c565b611196919061150a565b8160020160008282546111a991906114f7565b90915550919392505050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611202576040519150601f19603f3d011682016040523d82523d6000602084013e611207565b606091505b5050905080611229576040516350490ba960e01b815260040160405180910390fd5b50504760065550565b60006112476001600160a01b0384168361129a565b9050805160001415801561126c57508080602001905181019061126a919061155c565b155b1561113357604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b60606112a8838360006112af565b9392505050565b6060814710156112d45760405163cd78605960e01b8152306004820152602401611291565b600080856001600160a01b031684866040516112f09190611579565b60006040518083038185875af1925050503d806000811461132d576040519150601f19603f3d011682016040523d82523d6000602084013e611332565b606091505b509150915061134286838361134c565b9695505050505050565b6060826113615761135c826113a8565b6112a8565b815115801561137857506001600160a01b0384163b155b156113a157604051639996b31560e01b81526001600160a01b0385166004820152602401611291565b50806112a8565b8051156113b85780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6000602082840312156113e357600080fd5b5035919050565b801515811461066257600080fd5b60008060006060848603121561140d57600080fd5b83359250602084013591506040840135611426816113ea565b809150509250925092565b80356001600160a01b038116811461144857600080fd5b919050565b6000806040838503121561146057600080fd5b8235915061147060208401611431565b90509250929050565b60008060006060848603121561148e57600080fd5b61149784611431565b95602085013595506040909401359392505050565b600080604083850312156114bf57600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b81810381811115610aa257610aa26114ce565b80820180821115610aa257610aa26114ce565b60008261152757634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610aa257610aa26114ce565b600060018201611555576115556114ce565b5060010190565b60006020828403121561156e57600080fd5b81516112a8816113ea565b6000825160005b8181101561159a5760208186018101518583015201611580565b50600092019182525091905056fea2646970667358221220f135a5b16279139ce9c2124f2e1290083f264d8df3c60a063f7f32b1d25d71d464736f6c6343000814003300000000000000000000000000000000000000000000010f0cf064dd59200000000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd00000000000000000000000096b07b04b1ee09a7b6271e591f79206c54ec6d0600000000000000000000000021c6e0427fb2ba0e827253f48241aabdd8051eaa000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54
Deployed Bytecode
0x608060405260043610620002925760003560e01c8063742508e2116200015f578063afbcb26911620000c5578063cdadfbf21162000084578063cdadfbf214620011e1578063d11115281462001206578063d7ac9b101462001228578063ebb2cc4c146200124a578063f697c7a61462001274578063f9f8bdb714620012a557600080fd5b8063afbcb2691462001147578063b2f293251462001181578063b88074f51462001199578063c60b547314620011b1578063c879657214620011c957600080fd5b8063916d8c82116200011e578063916d8c821462001085578063930ffbe314620010bb57806396e0a13914620010d357806399d8fae314620010eb578063a82ed9ec146200110d578063ac4a4500146200112f57600080fd5b8063742508e21462000fc957806378e979251462000fe1578063793352901462000ff957806384e311a4146200101e57806386bc7560146200104f57600080fd5b80633804046811620002055780634aa4a4fc11620001c45780634aa4a4fc1462000ec95780634aec8f181462000ef35780635afe54d21462000f185780635c99a0a41462000f3a5780635f8dccec1462000f705780637073c6f61462000fa657600080fd5b8063380404681462000de057806341c64a2f1462000e1b5780634267a2731462000e3d57806343a0d0661462000e6e57806344c63eec1462000e9357600080fd5b806330e6c144116200025257806330e6c1441462000d065780633197cbb61462000d1e57806331b703db1462000d36578063330a58001462000d855780633438c40c1462000daf57600080fd5b8062b501961462000c4657806309253f751462000c715780631fb9f6fa1462000ca2578063227ad71d1462000cbc578063286440611462000ce157600080fd5b3662000c41576000612710620002ab4761213462002b7a565b620002b7919062002b9a565b6000805460405163d465fe0b60e01b8152737f808fd904ffa3eb6a6f259e6965fb1466a05372600482015261012c6024820152670de0b6b3a7640000604482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260648201526001600160a01b03918216608482015292935090917f00000000000000000000000021c6e0427fb2ba0e827253f48241aabdd8051eaa9091169063d465fe0b9060a401602060405180830381865afa15801562000373573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000399919062002bbd565b90506000670de0b6b3a7640000620003b2838562002b7a565b620003be919062002b9a565b9050612710620003d1826125e462002b7a565b620003dd919062002b9a565b600154604080516101008101825273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28152600080546001600160a01b03908116602084019081526127108486019081523060608601908152426080870190815260a087018d815260c088018b815260e08901888152995163414bf38960e01b81529851871660048a0152945186166024890152925162ffffff1660448801529051841660648701525160848601525160a48501525160c48401529251831660e483015293945091169063414bf3899086906101040160206040518083038185885af1158015620004c5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190620004ec919062002bbd565b905060006305f5e100620005048362a98ac762002b7a565b62000510919062002b9a565b60005460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb90620005599073deadbeefdeadbeefdeadbeefdeadbeefdeadbeef90859060040162002bd7565b6020604051808303816000875af115801562000579573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200059f919062002bff565b508060156000828254620005b4919062002c26565b90915550600090506305f5e100620005d184630381936962002b7a565b620005dd919062002b9a565b9050600e60009054906101000a90046001600160a01b03166001600160a01b031663a17a26856040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000633573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000659919062002bff565b15620006ca57600e60009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620006b057600080fd5b505af1158015620006c5573d6000803e3d6000fd5b505050505b600e5460008054604051633ddac95360e01b815291926001600160a01b0390811692633ddac9539262000704921690869060040162002bd7565b602060405180830381865afa15801562000722573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000748919062002bbd565b90506127106200075b826125e462002b7a565b62000767919062002b9a565b604080516002808252606082018352929350600092909160208301908036833750506000805483519394506001600160a01b031692849250620007ae57620007ae62002c52565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c78160018151811062000805576200080562002c52565b6001600160a01b03928316602091820292909201015260005460025460405163095ea7b360e01b81529183169263095ea7b3926200084c9290911690879060040162002bd7565b6020604051808303816000875af11580156200086c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000892919062002bff565b506002546040516338ed173960e01b81526000916001600160a01b0316906338ed173990620008ce908790879087903090429060040162002c68565b6000604051808303816000875af1158015620008ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000918919081019062002d36565b90508060008151811062000930576200093062002c52565b60200260200101516000036200095957604051635070cdd160e01b815260040160405180910390fd5b6000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015620009a2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009c8919062002bbd565b600f6000828254620009db919062002c26565b90915550506040516370a0823160e01b81523060048201526000907f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b0316906370a0823190602401602060405180830381865afa15801562000a48573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a6e919062002bbd565b60405163a9059cbb60e01b81529091506001600160a01b037f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c7169063a9059cbb9062000ad59073deadbeefdeadbeefdeadbeefdeadbeefdeadbeef90859060040162002bd7565b6020604051808303816000875af115801562000af5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b1b919062002bff565b50806013600082825462000b30919062002c26565b9091555050601680544791829160009062000b4d90849062002c26565b90915550506040516000906001600160a01b037f000000000000000000000000a1b56e42137d06280e34b3e1352d80ac3becaf79169047908381818185875af1925050503d806000811462000bbf576040519150601f19603f3d011682016040523d82523d6000602084013e62000bc4565b606091505b505090508062000be7576040516350490ba960e01b815260040160405180910390fd5b600f5460408051348152602081018c90528082018b905260608101929092526080820185905260a08201849052517f67b5a7be490d8676b76828347317a6b1a6b54b5c882c5829af39b5a2281eaa299181900360c00190a1005b600080fd5b34801562000c5357600080fd5b5062000c5e60125481565b6040519081526020015b60405180910390f35b34801562000c7e57600080fd5b5062000c5e62000c9036600462002dec565b600a6020526000908152604090205481565b34801562000caf57600080fd5b5062000cba620012bd565b005b34801562000cc957600080fd5b5062000cba62000cdb36600462002e0c565b62001420565b34801562000cee57600080fd5b5062000cba62000d0036600462002ea6565b620017ec565b34801562000d1357600080fd5b5062000c5e60135481565b34801562000d2b57600080fd5b5062000c5e60075481565b34801562000d4357600080fd5b5062000d6c7f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c781565b6040516001600160a01b03909116815260200162000c68565b34801562000d9257600080fd5b5062000d6c73deadbeefdeadbeefdeadbeefdeadbeefdeadbeef81565b34801562000dbc57600080fd5b5062000c5e62000dce36600462002dec565b600c6020526000908152604090205481565b34801562000ded57600080fd5b5062000e0562000dff36600462002ea6565b620018a4565b6040805192835260208301919091520162000c68565b34801562000e2857600080fd5b5060015462000d6c906001600160a01b031681565b34801562000e4a57600080fd5b5062000c5e62000e5c36600462002dec565b600d6020526000908152604090205481565b34801562000e7b57600080fd5b5062000cba62000e8d36600462002ec0565b620018ec565b34801562000ea057600080fd5b5062000d6c7f0000000000000000000000000d3f85c6175ce44f22e6cb54dc2bf25ab2a9dabc81565b34801562000ed657600080fd5b5062000d6c73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801562000f0057600080fd5b5062000cba62000f1236600462002dec565b6200206e565b34801562000f2557600080fd5b5060005462000d6c906001600160a01b031681565b34801562000f4757600080fd5b5062000d6c7f00000000000000000000000096b07b04b1ee09a7b6271e591f79206c54ec6d0681565b34801562000f7d57600080fd5b5062000d6c7f000000000000000000000000a1b56e42137d06280e34b3e1352d80ac3becaf7981565b34801562000fb357600080fd5b5062000c5e6c0537a333f3e43c2f8d051f274881565b34801562000fd657600080fd5b5062000c5e600f5481565b34801562000fee57600080fd5b5062000c5e60065481565b3480156200100657600080fd5b5062000c5e6200101836600462002efc565b620020bc565b3480156200102b57600080fd5b5062000c5e6200103d36600462002dec565b600b6020526000908152604090205481565b3480156200105c57600080fd5b5062000d6c7f00000000000000000000000021c6e0427fb2ba0e827253f48241aabdd8051eaa81565b3480156200109257600080fd5b5062000d6c7f000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd81565b348015620010c857600080fd5b5062000cba620026a9565b348015620010e057600080fd5b5062000c5e60165481565b348015620010f857600080fd5b5060035462000d6c906001600160a01b031681565b3480156200111a57600080fd5b5060025462000d6c906001600160a01b031681565b3480156200113c57600080fd5b5062000c5e60145481565b3480156200115457600080fd5b5062000d6c6200116636600462002ea6565b6008602052600090815260409020546001600160a01b031681565b3480156200118e57600080fd5b5062000c5e60155481565b348015620011a657600080fd5b5062000c5e60115481565b348015620011be57600080fd5b5062000c5e620027ec565b348015620011d657600080fd5b5062000cba6200287f565b348015620011ee57600080fd5b5062000cba6200120036600462002ea6565b6200290a565b3480156200121357600080fd5b5060105462000d6c906001600160a01b031681565b3480156200123557600080fd5b50600e5462000d6c906001600160a01b031681565b3480156200125757600080fd5b5062000d6c737f808fd904ffa3eb6a6f259e6965fb1466a0537281565b3480156200128157600080fd5b5062000c5e6200129336600462002dec565b60096020526000908152604090205481565b348015620012b257600080fd5b5062000c5e6200296c565b600754421015620012e15760405163c264ab4d60e01b815260040160405180910390fd5b336000908152600b6020908152604080832054600a90925282205462001308919062002c26565b9050806000036200132c57604051630fec21fd60e21b815260040160405180910390fd5b806011600082825462001340919062002f3e565b9091555050336000818152600b60209081526040808320839055600a90915280822091909155516340c10f1960e01b81527f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b0316916340c10f1991620013b39190859060040162002bd7565b600060405180830381600087803b158015620013ce57600080fd5b505af1158015620013e3573d6000803e3d6000fd5b50506040518381523392507f996ae228123457779bb0d7cd6daa18e54006fe2f6dc172f12197d826b08dabcd91506020015b60405180910390a250565b6010546001600160a01b031633146200144c5760405163ea8e4eb560e01b815260040160405180910390fd5b600754421015620014705760405163c264ab4d60e01b815260040160405180910390fd5b60006011547f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620014d4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014fa919062002bbd565b62001506919062002c26565b90506000816126486200151c8261271062002b7a565b62001528919062002b9a565b62001534919062002f3e565b90508015620017e7577f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200159c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620015c2919062002bbd565b620015ce838362002c26565b11156200166a57817f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001635573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200165b919062002bbd565b62001667919062002f3e565b90505b604051633aaeacfd60e11b81526001600160a01b037f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c7169063755d59fa90620016da907f0000000000000000000000000d3f85c6175ce44f22e6cb54dc2bf25ab2a9dabc90859060040162002bd7565b600060405180830381600087803b158015620016f557600080fd5b505af11580156200170a573d6000803e3d6000fd5b5050505060008351826200171f919062002b9a565b905060005b8451811015620017e4577f0000000000000000000000000d3f85c6175ce44f22e6cb54dc2bf25ab2a9dabc6001600160a01b03166396c9ee6286838151811062001772576200177262002c52565b6020026020010151846040518363ffffffff1660e01b81526004016200179a92919062002bd7565b600060405180830381600087803b158015620017b557600080fd5b505af1158015620017ca573d6000803e3d6000fd5b505050508080620017db9062002f54565b91505062001724565b50505b505050565b806000036200180e5760405163e55b462960e01b815260040160405180910390fd5b6000818152600860205260409020546001600160a01b031615620018455760405163091da0bf60e21b815260040160405180910390fd5b600081815260086020908152604080832080546001600160a01b031916339081179091558084526009835292819020849055518381527fc872d799ec127e1a42b35045564b2f8898fafa9fc580451f8e63bcd28c5c88d3910162001415565b600080620186a0620018b98461138862002b7a565b620018c5919062002b9a565b9150620186a0620018d98461271062002b7a565b620018e5919062002b9a565b9050915091565b600e546001600160a01b031662001916576040516321c4e35760e21b815260040160405180910390fd5b6007544211156200193a5760405163155f2c7b60e01b815260040160405180910390fd5b826000036200195c5760405163162908e360e11b815260040160405180910390fd5b6000620019686200296c565b90506000670de0b6b3a764000062001981838762002b7a565b6200198d919062002b9a565b6000858152600860205260408120549192509081906001600160a01b0316338103620019cc57604051631087758f60e01b815260040160405180910390fd5b6001600160a01b03811615620019ed57620019e784620018a4565b90935091505b6011547f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b0316639747498c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001a4f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a75919062002bbd565b7f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001ad4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001afa919062002bbd565b62001b06919062002f3e565b62001b12919062002f3e565b8284867f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001b74573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001b9a919062002bbd565b62001ba6919062002c26565b62001bb2919062002c26565b62001bbe919062002c26565b111562001e6d5760006011547f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b0316639747498c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001c29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001c4f919062002bbd565b7f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001cae573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001cd4919062002bbd565b7f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001d33573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001d59919062002bbd565b62001d65919062002f3e565b62001d71919062002f3e565b62001d7d919062002f3e565b905080158062001d8b575086155b1562001daa57604051636e7f5a3760e01b815260040160405180910390fd5b6001600160a01b03821662001dc0578062001e36565b670de0b6b3a7640000670ff59ee833b3000062001dde838362002b7a565b62001df284670ff59ee833b3000062002b7a565b62001dfe919062002f3e565b62001e1290670de0b6b3a764000062002b7a565b62001e1e919062002b9a565b62001e2a919062002b9a565b62001e36908262002f3e565b94508562001e4d86670de0b6b3a764000062002b7a565b62001e59919062002b9a565b985062001e6685620018a4565b9094509250505b6001600160a01b0381166000908152600b60205260408120805485929062001e9790849062002c26565b90915550506001600160a01b0381166000908152600d60205260408120805485929062001ec690849062002c26565b9091555050336000908152600a60205260408120805484929062001eec90849062002c26565b9091555050336000908152600d60205260408120805484929062001f1290849062002c26565b9091555062001f249050828462002c26565b6011600082825462001f37919062002c26565b9091555050336000908152600c60205260408120805486929062001f5d90849062002c26565b92505081905550876012600082825462001f78919062002c26565b9091555062001f89905088620029c4565b6040516340c10f1960e01b81526001600160a01b037f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c716906340c10f199062001fd9903390889060040162002bd7565b600060405180830381600087803b15801562001ff457600080fd5b505af115801562002009573d6000803e3d6000fd5b50505050620020176200287f565b62002021620026a9565b604080518981526020810186905290810188905233907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e9060600160405180910390a25050505050505050565b6010546001600160a01b031633146200209a5760405163ea8e4eb560e01b815260040160405180910390fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000841580620020ca575083155b15620020e95760405163162908e360e11b815260040160405180910390fd5b600e546001600160a01b0316156200211457604051630149ba8b60e11b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018690527f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c76001600160a01b0316906323b872dd906064016020604051808303816000875af115801562002188573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620021ae919062002bff565b506000546040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b03909116906323b872dd906064016020604051808303816000875af115801562002207573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200222d919062002bff565b5060025460405163095ea7b360e01b81526001600160a01b037f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c781169263095ea7b39262002285929190911690899060040162002bd7565b6020604051808303816000875af1158015620022a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620022cb919062002bff565b5060005460025460405163095ea7b360e01b81526001600160a01b039283169263095ea7b3926200230492911690889060040162002bd7565b6020604051808303816000875af115801562002324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200234a919062002bff565b506002546000805460405162e8e33760e81b81526001600160a01b037f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c781166004830152918216602482015260448101899052606481018890526084810183905260a481019290925285811660c483015260e482018590529091169063e8e3370090610104016060604051808303816000875af1158015620023f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002416919062002f70565b6003546000546040519295506001600160a01b0391821694507f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c7935016906200245f9062002b56565b6001600160a01b03938416815291831660208301529091166040820152606001604051809103906000f0801580156200249c573d6000803e3d6000fd5b50600e80546001600160a01b0319166001600160a01b039283161790556003546000805460405163e6a4390560e01b81527f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c78516600482015290841660248201529092919091169063e6a4390590604401602060405180830381865afa1580156200252b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002551919062002f9f565b60405163a29a608960e01b81526001600160a01b0380831660048301529192507f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c79091169063a29a608990602401600060405180830381600087803b158015620025ba57600080fd5b505af1158015620025cf573d6000803e3d6000fd5b5050600e5460405163332c412d60e01b81526001600160a01b0391821660048201527f00000000000000000000000070536d44820fe3ddd4a2e3eedbc937b8b9d566c7909116925063332c412d9150602401600060405180830381600087803b1580156200263c57600080fd5b505af115801562002651573d6000803e3d6000fd5b5050604080516001600160a01b0385168152602081018a90529081018890527f620f7d92e94f37e846b7a037fa45c886f3ab726b58c6531813825a47ad4eec509250606001905060405180910390a150949350505050565b600f548015620027e9576000600f8190555460405163095ea7b360e01b81526001600160a01b039091169063095ea7b3906200270c907f000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd90859060040162002bd7565b6020604051808303816000875af11580156200272c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002752919062002bff565b5060405163534a7e1d60e11b8152600481018290527f000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd6001600160a01b03169063a694fc3a90602401600060405180830381600087803b158015620027b657600080fd5b505af1158015620027cb573d6000803e3d6000fd5b505050508060146000828254620027e3919062002c26565b90915550505b50565b604051635fcc96f560e11b81523060048201526000907f00000000000000000000000096b07b04b1ee09a7b6271e591f79206c54ec6d066001600160a01b03169063bf992dea90602401602060405180830381865afa15801562002854573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200287a919062002bbd565b905090565b60006200288b620027ec565b111562002908577f000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd6001600160a01b031663d294f0936040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620028ee57600080fd5b505af115801562002903573d6000803e3d6000fd5b505050505b565b6200291581620029c4565b6040805182815260006020820181905281830152905133917f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e919081900360600190a2620029626200287f565b620027e9620026a9565b600080600654426200297f919062002f3e565b9050670de0b6b3a7640000620029a36c0537a333f3e43c2f8d051f27488362002b7a565b620029af919062002b9a565b600454620029be919062002f3e565b91505090565b6000546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af115801562002a1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002a42919062002bff565b5060005460405163095ea7b360e01b81526001600160a01b039091169063095ea7b39062002a97907f000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd90859060040162002bd7565b6020604051808303816000875af115801562002ab7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002add919062002bff565b5060405163534a7e1d60e11b8152600481018290527f000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd6001600160a01b03169063a694fc3a90602401600060405180830381600087803b15801562002b4157600080fd5b505af1158015620017e4573d6000803e3d6000fd5b6112218062002fc083390190565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141762002b945762002b9462002b64565b92915050565b60008262002bb857634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121562002bd057600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b8015158114620027e957600080fd5b60006020828403121562002c1257600080fd5b815162002c1f8162002bf0565b9392505050565b8082018082111562002b945762002b9462002b64565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101562002cba5784516001600160a01b03168352938301939183019160010162002c93565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171562002d075762002d0762002c3c565b604052919050565b600067ffffffffffffffff82111562002d2c5762002d2c62002c3c565b5060051b60200190565b6000602080838503121562002d4a57600080fd5b825167ffffffffffffffff81111562002d6257600080fd5b8301601f8101851362002d7457600080fd5b805162002d8b62002d858262002d0f565b62002cdb565b81815260059190911b8201830190838101908783111562002dab57600080fd5b928401925b8284101562002dcb5783518252928401929084019062002db0565b979650505050505050565b6001600160a01b0381168114620027e957600080fd5b60006020828403121562002dff57600080fd5b813562002c1f8162002dd6565b6000602080838503121562002e2057600080fd5b823567ffffffffffffffff81111562002e3857600080fd5b8301601f8101851362002e4a57600080fd5b803562002e5b62002d858262002d0f565b81815260059190911b8201830190838101908783111562002e7b57600080fd5b928401925b8284101562002dcb57833562002e968162002dd6565b8252928401929084019062002e80565b60006020828403121562002eb957600080fd5b5035919050565b60008060006060848603121562002ed657600080fd5b8335925060208401359150604084013562002ef18162002bf0565b809150509250925092565b6000806000806080858703121562002f1357600080fd5b8435935060208501359250604085013562002f2e8162002dd6565b9396929550929360600135925050565b8181038181111562002b945762002b9462002b64565b60006001820162002f695762002f6962002b64565b5060010190565b60008060006060848603121562002f8657600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121562002fb257600080fd5b815162002c1f8162002dd656fe60e06040523480156200001157600080fd5b5060405162001221380380620012218339810160408190526200003491620003bd565b60405163e6a4390560e01b81526001600160a01b03838116600483015282811660248301526000919085169063e6a4390590604401602060405180830381865afa15801562000087573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ad919062000407565b9050806001600160a01b03166080816001600160a01b031681525050806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000108573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012e919062000407565b6001600160a01b031660a0816001600160a01b031681525050806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000186573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ac919062000407565b6001600160a01b031660c0816001600160a01b031681525050806001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200022a91906200042c565b600081905550806001600160a01b0316635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200026f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029591906200042c565b600181905550600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015620002dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200030391906200045e565b6002805463ffffffff191663ffffffff9290921691909117905590925090506001600160701b038216158015906200034357506001600160701b03811615155b620003945760405162461bcd60e51b815260206004820181905260248201527f4578616d706c654f7261636c6553696d706c653a204e4f5f5245534552564553604482015260640160405180910390fd5b505050505050620004b4565b80516001600160a01b0381168114620003b857600080fd5b919050565b600080600060608486031215620003d357600080fd5b620003de84620003a0565b9250620003ee60208501620003a0565b9150620003fe60408501620003a0565b90509250925092565b6000602082840312156200041a57600080fd5b6200042582620003a0565b9392505050565b6000602082840312156200043f57600080fd5b5051919050565b80516001600160701b0381168114620003b857600080fd5b6000806000606084860312156200047457600080fd5b6200047f8462000446565b92506200048f6020850162000446565b9150604084015163ffffffff81168114620004a957600080fd5b809150509250925092565b60805160a05160c051610d29620004f8600039600081816101ea015261028701526000818160be015261021001526000818161019501526103910152610d296000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a2e6204511610071578063a2e6204514610173578063a6bb45391461017d578063a8aa1b3114610190578063b4d1d795146101b7578063c5700a02146101c0578063d21220a7146101e557600080fd5b80630dfe1681146100b95780633ddac953146100fd5780635909c0d51461011e5780635a3d5493146101275780635e6aaf2c14610130578063a17a26851461015b575b600080fd5b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61011061010b366004610b81565b61020c565b6040519081526020016100f4565b61011060005481565b61011060015481565b600454610143906001600160e01b031681565b6040516001600160e01b0390911681526020016100f4565b61016361034f565b60405190151581526020016100f4565b61017b610387565b005b600354610143906001600160e01b031681565b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b61011061012c81565b6002546101d09063ffffffff1681565b60405163ffffffff90911681526020016100f4565b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036102855760408051602081019091526003546001600160e01b031681526102759061026e9084610502565b5160701c90565b6001600160901b03169050610349565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146103165760405162461bcd60e51b815260206004820152602260248201527f4578616d706c654f7261636c6553696d706c653a20494e56414c49445f544f4b60448201526122a760f11b60648201526084015b60405180910390fd5b60408051602081019091526004546001600160e01b0316815261033d9061026e9084610502565b6001600160901b031690505b92915050565b60008061035a6105a0565b6002549091506000906103739063ffffffff1683610bcf565b61012c63ffffffff90911610159392505050565b60008060006103b57f00000000000000000000000000000000000000000000000000000000000000006105b6565b60025492955090935091506000906103d39063ffffffff1683610bcf565b905061012c8163ffffffff16101561043d5760405162461bcd60e51b815260206004820152602760248201527f4578616d706c654f7261636c6553696d706c653a20504552494f445f4e4f545f6044820152661153105414d15160ca1b606482015260840161030d565b60405180602001604052808263ffffffff166000548761045d9190610bf3565b6104679190610c1c565b6001600160e01b039081169091529051600380546001600160e01b031916919092161790556040805160208101909152600154819063ffffffff8416906104ae9087610bf3565b6104b89190610c1c565b6001600160e01b039081169091529051600480546001600160e01b03191691909216179055506000929092556001556002805463ffffffff191663ffffffff909216919091179055565b604080516020810190915260008152600082158061053f575083516001600160e01b0316836105318183610c30565b925061053d9083610c1c565b145b61058b5760405162461bcd60e51b815260206004820152601960248201527f4669786564506f696e743a3a6d756c3a206f766572666c6f7700000000000000604482015260640161030d565b60408051602081019091529081529392505050565b60006105b164010000000042610c47565b905090565b60008060006105c36105a0565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190610c5b565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa158015610667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068b9190610c5b565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156106d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f49190610c90565b9250925092508363ffffffff168163ffffffff16146107a35760006107198286610bcf565b90508063ffffffff1661073e846001600160701b0316866001600160701b03166107ad565b5161075291906001600160e01b0316610c30565b61075c9088610ce0565b96508063ffffffff16610781856001600160701b0316856001600160701b03166107ad565b5161079591906001600160e01b0316610c30565b61079f9087610ce0565b9550505b5050509193909250565b6040805160208101909152600081526000821161081b5760405162461bcd60e51b815260206004820152602660248201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260448201526579207a65726f60d01b606482015260840161030d565b826000036108385750604080516020810190915260008152610349565b6001600160901b0383116108cf57600061085683607086901b610c1c565b90506001600160e01b038111156108af5760405162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015260640161030d565b6040518060200160405280826001600160e01b0316815250915050610349565b600061085684600160701b8560008060006108ea86866109a8565b91509150600084806108fe576108fe610c06565b86880990508281111561091957610916600183610bf3565b91505b6109238184610bf3565b925081600003610941576109378584610c1c565b93505050506109a1565b8482106109905760405162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015260640161030d565b61099b8383876109ea565b93505050505b9392505050565b6000808060001984860990506109be8486610c30565b92506109ca8382610bf3565b9150828110156109e2576109df600183610bf3565b91505b509250929050565b6000806109f983600019610bf3565b610a04906001610ce0565b83169050610a128184610c1c565b9250610a1e8186610c1c565b945080610a2d81600019610bf3565b610a38906001610ce0565b610a429190610c1c565b610a4d906001610ce0565b610a579085610c30565b610a619086610ce0565b94506001610a6f8185610c30565b610a7a906002610bf3565b610a849082610c30565b9050610a908185610c30565b610a9b906002610bf3565b610aa59082610c30565b9050610ab18185610c30565b610abc906002610bf3565b610ac69082610c30565b9050610ad28185610c30565b610add906002610bf3565b610ae79082610c30565b9050610af38185610c30565b610afe906002610bf3565b610b089082610c30565b9050610b148185610c30565b610b1f906002610bf3565b610b299082610c30565b9050610b358185610c30565b610b40906002610bf3565b610b4a9082610c30565b9050610b568185610c30565b610b61906002610bf3565b610b6b9082610c30565b9050610b778187610c30565b9695505050505050565b60008060408385031215610b9457600080fd5b82356001600160a01b0381168114610bab57600080fd5b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b63ffffffff828116828216039080821115610bec57610bec610bb9565b5092915050565b8181038181111561034957610349610bb9565b634e487b7160e01b600052601260045260246000fd5b600082610c2b57610c2b610c06565b500490565b808202811582820484141761034957610349610bb9565b600082610c5657610c56610c06565b500690565b600060208284031215610c6d57600080fd5b5051919050565b80516001600160701b0381168114610c8b57600080fd5b919050565b600080600060608486031215610ca557600080fd5b610cae84610c74565b9250610cbc60208501610c74565b9150604084015163ffffffff81168114610cd557600080fd5b809150509250925092565b8082018082111561034957610349610bb956fea26469706673582212204cdec9e6b036d1675bcafb1e72f0b333239efccb9789d99497916e6d757d94d864736f6c63430008140033a26469706673582212201d02ed010a17874e8f86c29f5c02bc5a5b8786c771ec5113630319bbeeba55a564736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000010f0cf064dd59200000000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd00000000000000000000000096b07b04b1ee09a7b6271e591f79206c54ec6d0600000000000000000000000021c6e0427fb2ba0e827253f48241aabdd8051eaa000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54
-----Decoded View---------------
Arg [0] : initialSupply (uint256): 5000000000000000000000
Arg [1] : _dbxen (address): 0xF5c80c305803280B587F8cabBcCdC4d9BF522AbD
Arg [2] : _dbxenViews (address): 0x96b07b04b1ee09A7b6271e591F79206C54Ec6d06
Arg [3] : _v3Oracle (address): 0x21c6e0427fb2bA0E827253f48241aAbDd8051eAa
Arg [4] : _governance (address): 0x254f637Af8D6276f5FfE4072279CB60A8E013e54
Arg [5] : _devFeeTo (address): 0x254f637Af8D6276f5FfE4072279CB60A8E013e54
Arg [6] : _devAllocMinter (address): 0x254f637Af8D6276f5FfE4072279CB60A8E013e54
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000010f0cf064dd59200000
Arg [1] : 000000000000000000000000f5c80c305803280b587f8cabbccdc4d9bf522abd
Arg [2] : 00000000000000000000000096b07b04b1ee09a7b6271e591f79206c54ec6d06
Arg [3] : 00000000000000000000000021c6e0427fb2ba0e827253f48241aabdd8051eaa
Arg [4] : 000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54
Arg [5] : 000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54
Arg [6] : 000000000000000000000000254f637af8d6276f5ffe4072279cb60a8e013e54
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.