ETH Price: $3,789.24 (+6.63%)

Contract

0x24eA9c1cfD77A8DB3fB707F967309cF013CC1078
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

TokenTracker

CAVO (CAVO) (@$10.8446)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve210839692024-10-31 6:57:4734 days ago1730357867IN
Excavo Finance: CAVO Token
0 ETH0.000418049.02424874
Approve202312702024-07-04 6:10:35153 days ago1720073435IN
Excavo Finance: CAVO Token
0 ETH0.000113922.47526975
Approve200888872024-06-14 8:35:47173 days ago1718354147IN
Excavo Finance: CAVO Token
0 ETH0.00044079.50102719
Approve200749032024-06-12 9:38:35175 days ago1718185115IN
Excavo Finance: CAVO Token
0 ETH0.001520833
VIEW ADVANCED FILTER

Latest 3 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
114582382020-12-15 14:39:251450 days ago1608043165
Excavo Finance: CAVO Token
0.01 ETH
114267242020-12-10 18:10:271454 days ago1607623827
Excavo Finance: CAVO Token
 Contract Creation0 ETH
114267242020-12-10 18:10:271454 days ago1607623827
Excavo Finance: CAVO Token
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CAVO

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 51 : CAVO.sol
pragma solidity >=0.6.6;

import './PublicPresale.sol';
import './xCAVO.sol';
import './EXCV.sol';
import './TeamDistribution.sol';
import './PrivatePresale.sol';

contract CAVO is PublicPresale, PrivatePresale, TeamDistribution {
    
    uint private constant PUBLIC_PRESALE_DURATION_IN_BLOCKS = 7 * 6500;
    uint32 private constant PRESALE_VESTING_PERIOD_IN_BLOCKS = 7 * 6500;
    
    uint private constant PRIVATE_PRESALE_DISTRIBUTED_CAVO_IN_WEI = 1460.769 ether;
    
    address private constant PUBLIC_PRESALE_OWNER = 0xAb96C12881A2E9Ffa6706Ae68bCFA4EcD1A8bf21;

    address[] private teamAddresses = [
        0x381657fdE9bfE7558837757aC54249Ef748CACB7, // A.M.
        0x564569020c298D2487445CCa5C5ef3eD8cd408A3, // Y.O.
        0xDfe2abc3d395a87a1476f5B707E77f5F23B1d88b, // A.
        0x8CF3329E378c6196F35f5cB7eea5040873f8AC8C, // D.B.
        0x8B9a2b2d9a41909D613C81F2f344E364cD62b63C, // Z.
        0x57B93A6b8954938DE455BE95c9AA7843b99D7DEa, // V.
        0xf0393FB1e988317ca6E3fb986874D019dE712c7d, // M.
        0x698f4a1f42c3601579A3E40a9e4D90C2032C443a  // X.
    ];

    uint[] private teamAmounts = [
        40000 ether, // A.M.
        40000 ether, // Y.O.
        15000 ether, // A.
        10000 ether, // D.B.
        50000 ether, // Z.
        30000 ether, // V.
        10000 ether, // M.
        5000  ether  // X.
    ];
    
    constructor() 
        public 
        PublicPresale(PUBLIC_PRESALE_OWNER, PRESALE_VESTING_PERIOD_IN_BLOCKS, PUBLIC_PRESALE_DURATION_IN_BLOCKS) 
        PrivatePresale(PRESALE_VESTING_PERIOD_IN_BLOCKS, PRIVATE_PRESALE_DISTRIBUTED_CAVO_IN_WEI) 
        TeamDistribution(PRESALE_VESTING_PERIOD_IN_BLOCKS, teamAddresses, teamAmounts) 
    {
        address _xCAVO;
        address _EXCV;
        bytes memory xCAVOBytecode = type(xCAVO).creationCode;
        bytes memory EXCVBytecode = type(EXCV).creationCode;
        bytes32 xCAVOSalt = keccak256(abi.encodePacked("xCAVO"));
        bytes32 EXCVSalt = keccak256(abi.encodePacked("EXCV"));
        assembly {
            _xCAVO := create2(0, add(xCAVOBytecode, 32), mload(xCAVOBytecode), xCAVOSalt)
            _EXCV := create2(0, add(EXCVBytecode, 32), mload(EXCVBytecode), EXCVSalt)
        }
        xCAVOToken = _xCAVO;
        EXCVToken = _EXCV;

        _mint(address(this), totalTeamDistribution.add(totalPrivatePresaleDistribution));
    }
}

File 2 of 51 : BaseCAVO.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './libraries/SafeMath.sol';
import './libraries/Math.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IEXCV.sol';
import './interfaces/IExcavoFactory.sol';

contract BaseCAVO is ICAVO, IExcavoERC20, ReentrancyGuard {
    using SafeMath for uint;

    string public constant override name = 'CAVO';
    string public constant override symbol = 'CAVO';
    uint8 public constant override decimals = 18;
    
    uint public constant override MAX_SUPPLY = 10**6 * 10**18;
    uint public constant override CREATOR_SUPPLY = 200 ether + 120 ether;

    address public override xCAVOToken;
    address public immutable override creator;
    address public override EXCVToken;

    uint public override totalSupply;
    mapping(address => uint) public override balanceOf;
    mapping(address => mapping(address => uint)) public override allowance;
    mapping(address => uint) private lastBalanceOf;
    mapping(address => uint) private lastBalanceBlockOf;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {
        creator = msg.sender;
        _mint(msg.sender, CREATOR_SUPPLY);
    }

    function initialize(address _factory) external override nonReentrant {
        require(msg.sender == creator && IEXCV(EXCVToken).factory() == address(0), 'EXCV: FORBIDDEN');
        IEXCV(EXCVToken).initialize(_factory);
        IxCAVO(xCAVOToken).initialize(_factory, EXCVToken);
    }

    function virtualBalanceOf(address account) external view override returns (uint) {
        uint balance = balanceOf[account];
        if (block.number - lastBalanceBlockOf[account] > 0) {
            return balance;
        }
        uint lastBalance = lastBalanceOf[account];
        return balance < lastBalance ? balance : lastBalance;
    }

    function mint(address account, uint256 amount) external override nonReentrant {
        require(msg.sender == xCAVOToken, 'Excavo: FORBIDDEN');
        _mint(account, amount);
    }

    function _mint(address to, uint value) internal {
        _saveLastBalance(to);
        uint _value = Math.min(value, MAX_SUPPLY.sub(totalSupply));
        totalSupply = totalSupply.add(_value);
        balanceOf[to] = balanceOf[to].add(_value);
        emit Transfer(address(0), to, _value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) internal {
        _saveLastBalance(from);
        _saveLastBalance(to);
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint value) external virtual override returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external virtual override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external virtual override returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }

    function _saveLastBalance(address account) private {
        if (block.number - lastBalanceBlockOf[account] > 0) {
            lastBalanceOf[account] = balanceOf[account];
            lastBalanceBlockOf[account] = block.number;
        } 
    }
}

File 3 of 51 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 4 of 51 : SafeMath.sol
pragma solidity >=0.6.6;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }

    function div(uint x, uint y) internal pure returns (uint z) {
        require(y > 0, "SafeMath: division by zero");
        z = x / y;
    }
}

File 5 of 51 : Math.sol
pragma solidity >=0.6.6;

// a library for performing various math operations

library Math {
    function min(uint x, uint y) internal pure returns (uint z) {
        z = x < y ? x : y;
    }

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}

File 6 of 51 : ICAVO.sol
pragma solidity >=0.6.6;

interface ICAVO {
    function MAX_SUPPLY() external pure returns(uint);
    function CREATOR_SUPPLY() external pure returns(uint);
    function creator() external returns (address);
    function xCAVOToken() external view returns (address);
    function EXCVToken() external view returns (address);
    function mint(address to, uint value) external;
    function initialize(address _factory) external;
    function virtualBalanceOf(address account) external view returns (uint);
}

File 7 of 51 : IExcavoERC20.sol
pragma solidity >=0.6.6;

interface IExcavoERC20 {
    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);
}

File 8 of 51 : IxCAVO.sol
pragma solidity >=0.6.6;

interface IxCAVO {
    function excvEthPair() external view returns (address);
    function cavoEthPair() external view returns (address);
    function getEXCV() external view returns (address);
    function getCAVO() external view returns (address);
    
    function redeem(address recipient) external;
    function initialize(address _factory, address _EXCV) external;
    function registerPairCreation() external;
    function mint(uint price) external;
    function accumulatedMintableCAVOAmount() external view returns (uint);
}

File 9 of 51 : IEXCV.sol
pragma solidity >=0.6.6;

interface IEXCV {
    function MAX_SUPPLY() external pure returns(uint);
    function CREATOR_SUPPLY() external pure returns(uint);
    function xEXCVToken() external view returns (address);
    function factory() external view returns (address);

    function mint(address to, uint value) external;
    function initialize(address _factory) external;
}

File 10 of 51 : IExcavoFactory.sol
pragma solidity >=0.6.6;

interface IExcavoFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);
    
    function EXCVToken() external view returns (address);
    function CAVOToken() external view returns (address);
    function WETHToken() external view returns (address);

    function feeToSetter() external view returns (address);
    function router() 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 initialize(address) external;
}

File 11 of 51 : PublicPresale.sol
pragma solidity >=0.6.6;

import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './libraries/TransferHelper.sol';
import './libraries/Math.sol';
import './libraries/SafeMath.sol';
import './libraries/DistributionLibrary.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IPublicPresale.sol';
import './BaseCAVO.sol';

contract PublicPresale is BaseCAVO, IPublicPresale {
    
    using SafeMath for uint;
    using DistributionLibrary for DistributionLibrary.Data;

    event PublicPresalePurchase(address indexed recipient, uint amount);
    event PublicDistributed(address indexed recipient, uint amount);

    address public immutable override presaleOwner;
    uint private presaleDurationInBlocks;
    uint private presaleStartBlock;
    
    DistributionLibrary.Data private distribution;

    constructor(address _presaleOwner, uint32 _vestingBlocksInPeriod, uint _presaleDurationInBlocks) public {
        presaleOwner = _presaleOwner;
        distribution.blocksInPeriod = _vestingBlocksInPeriod;
        presaleDurationInBlocks = _presaleDurationInBlocks;
    }

    function availablePublicPresaleAmountOf(address account) external view override returns (uint) {
        return distribution.availableAmountOf(account);
    }

    function publicPresaleClaim(uint amount) external override nonReentrant {
        distribution.claim(amount);
        emit PublicDistributed(msg.sender, amount);
    }

    function startPublicPresaleDistribution() external override nonReentrant {
        require(presaleStartBlock != 0 && block.number >= presaleStartBlock.add(presaleDurationInBlocks), 'PublicPresale: INVALID_PARAMS');
        distribution.start();
    }

    function startPublicPresale() external override nonReentrant {
        require(presaleStartBlock == 0 && msg.sender == creator, 'PublicPresale: FORBIDDEN');
        presaleStartBlock = block.number;
    }

    receive() external payable nonReentrant {
        require(block.number >= presaleStartBlock && block.number < presaleStartBlock.add(presaleDurationInBlocks), 'PublicPresale: INACTIVE');
        // P = 0.5 ETH/CAVO
        uint mintedCAVO = msg.value.mul(100).div(50);
        payable(presaleOwner).transfer(msg.value);
        _mint(address(this), mintedCAVO);
        distribution.maxAmountOf[msg.sender] = distribution.maxAmountOf[msg.sender].add(mintedCAVO);
        emit PublicPresalePurchase(msg.sender, mintedCAVO);
    }
}

File 12 of 51 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

File 13 of 51 : DistributionLibrary.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './TransferHelper.sol';
import './Math.sol';
import './SafeMath.sol';
import '../interfaces/ICAVO.sol';

library DistributionLibrary {
    using SafeMath for uint;

    struct Data {
        mapping(address => uint) claimedAmountOf;
        mapping(address => uint) maxAmountOf;
        uint unlockBlock;
        uint32 blocksInPeriod;
    }

    function availableAmountOf(Data storage self, address account) internal view returns (uint) {
        if (self.unlockBlock == 0 || block.number <= self.unlockBlock || self.maxAmountOf[account] == 0) {
            return 0;
        }
        uint unlockedAmountPerPeriod = self.maxAmountOf[account].mul(10).div(100);
        uint unlockPeriodInBlocks = self.maxAmountOf[account].div(unlockedAmountPerPeriod).mul(self.blocksInPeriod);
        return Math.min(self.unlockBlock.add(unlockPeriodInBlocks), block.number)
            .sub(self.unlockBlock)
            .div(self.blocksInPeriod)
            .mul(unlockedAmountPerPeriod)
            .sub(self.claimedAmountOf[account]);
    }

    function start(Data storage self) internal {
        require(self.unlockBlock == 0 && msg.sender == ICAVO(address(this)).creator(), 'DistributionLibrary: FORBIDDEN');
        self.unlockBlock = block.number;
    }

    function claim(Data storage self, uint amount) internal {
        require(amount <= availableAmountOf(self, msg.sender), 'DistributionLibrary: OVERDRAFT');
        self.claimedAmountOf[msg.sender] = self.claimedAmountOf[msg.sender].add(amount);
        TransferHelper.safeTransfer(address(this), msg.sender, amount);
    }
}

File 14 of 51 : IPublicPresale.sol
pragma solidity >=0.6.6;

interface IPublicPresale {
    function presaleOwner() external view returns (address);
    function availablePublicPresaleAmountOf(address account) external view returns (uint);

    function publicPresaleClaim(uint amount) external;
    function startPublicPresaleDistribution() external;
    function startPublicPresale() external;
}

File 15 of 51 : TestCAVO.sol
pragma solidity >=0.6.6;

import '../PublicPresale.sol';
import '../TeamDistribution.sol';
import '../PrivatePresale.sol';
import './TestxCAVO.sol';
import './TestEXCV.sol';

contract TestCAVO is PublicPresale, PrivatePresale, TeamDistribution {

    uint public constant PUBLIC_PRESALE_DURATION_IN_BLOCKS = 10;
    uint32 public constant PRESALE_VESTING_PERIOD_IN_BLOCKS = 10;
    uint public constant PRIVATE_PRESALE_DISTRIBUTED_CAVO_IN_WEI = 10000;
    address private constant PUBLIC_PRESALE_OWNER = 0xeAD9C93b79Ae7C1591b1FB5323BD777E86e150d4;
    address[] private _teamAddresses = [
        0xeAD9C93b79Ae7C1591b1FB5323BD777E86e150d4, 
        0xE5904695748fe4A84b40b3fc79De2277660BD1D3, 
        0x92561F28Ec438Ee9831D00D1D59fbDC981b762b2
    ];
    uint[] private _teamAmounts = [
        1000000,
        1500000,
        2000000
    ];

    constructor() 
        public 
        PublicPresale(PUBLIC_PRESALE_OWNER, PRESALE_VESTING_PERIOD_IN_BLOCKS, PUBLIC_PRESALE_DURATION_IN_BLOCKS) 
        PrivatePresale(PRESALE_VESTING_PERIOD_IN_BLOCKS, PRIVATE_PRESALE_DISTRIBUTED_CAVO_IN_WEI) 
        TeamDistribution(PRESALE_VESTING_PERIOD_IN_BLOCKS, _teamAddresses, _teamAmounts) 
    {
        address _xCAVO;
        address _EXCV;
        bytes memory xCAVOBytecode = type(TestxCAVO).creationCode;
        bytes memory EXCVBytecode = type(TestEXCV).creationCode;
        bytes32 xCAVOSalt = keccak256(abi.encodePacked("xCAVO"));
        bytes32 EXCVSalt = keccak256(abi.encodePacked("EXCV"));
        assembly {
            _xCAVO := create2(0, add(xCAVOBytecode, 32), mload(xCAVOBytecode), xCAVOSalt)
            _EXCV := create2(0, add(EXCVBytecode, 32), mload(EXCVBytecode), EXCVSalt)
        }
        xCAVOToken = _xCAVO;
        EXCVToken = _EXCV;

        _mint(address(this), totalTeamDistribution.add(totalPrivatePresaleDistribution));
    }

    function teamAddresses() external view returns (address[] memory) {
        return _teamAddresses;
    }

    function teamAmounts() external view returns (uint[] memory) {
        return _teamAmounts;
    }

    function testMint(address account, uint256 amount) external {
        _mint(account, amount);
    }
}

File 16 of 51 : TeamDistribution.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './libraries/TransferHelper.sol';
import './libraries/Math.sol';
import './libraries/SafeMath.sol';
import './libraries/DistributionLibrary.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/ITeamDistribution.sol';

abstract contract TeamDistribution is ITeamDistribution, ICAVO, IExcavoERC20, ReentrancyGuard {
    using SafeMath for uint;
    using DistributionLibrary for DistributionLibrary.Data;

    event TeamDistributed(address indexed recipient, uint amount);

    uint public override totalTeamDistribution;
    DistributionLibrary.Data private distribution;

    constructor(uint32 _blocksInPeriod, address[] memory _team, uint[] memory _amounts) public {
        require(_team.length == _amounts.length, 'TeamDistribution: INVALID_PARAMS');
        uint total;
        for (uint i = 0; i < _team.length; ++i) {
            distribution.maxAmountOf[_team[i]] = _amounts[i];
            total = total.add(_amounts[i]);
        }
        totalTeamDistribution = total;
        distribution.blocksInPeriod = _blocksInPeriod;
    }

    function availableTeamMemberAmountOf(address account) external view override returns (uint) {
        return distribution.availableAmountOf(account);
    }

    function teamMemberClaim(uint amount) external override nonReentrant {
        distribution.claim(amount);
        emit TeamDistributed(msg.sender, amount);
    }

    function startTeamDistribution() external override nonReentrant {
        distribution.start();
    }
}

File 17 of 51 : PrivatePresale.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './libraries/TransferHelper.sol';
import './libraries/SafeMath.sol';
import './libraries/DistributionLibrary.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IPrivatePresale.sol';

abstract contract PrivatePresale is IPrivatePresale, ICAVO, IExcavoERC20, ReentrancyGuard {
    using SafeMath for uint;
    using DistributionLibrary for DistributionLibrary.Data;

    event PrivateDistributionInitialized(address indexed recipient, uint amount);
    event PrivateDistributed(address indexed recipient, uint amount);

    DistributionLibrary.Data private distribution;
    uint public override totalPrivatePresaleDistribution;
    uint public override privatePresaleDistributed;

    constructor(uint32 _blocksInPeriod, uint _totalPrivatePresaleDistribution) public {
        distribution.blocksInPeriod = _blocksInPeriod;
        totalPrivatePresaleDistribution = _totalPrivatePresaleDistribution;
    }

    function distribute(address[] calldata _accounts, uint[] calldata _amounts) external override nonReentrant {
        require(msg.sender == ICAVO(address(this)).creator(), 'PrivatePresale: FORBIDDEN');
        require(_accounts.length == _amounts.length, 'PrivatePresale: INVALID_LENGTH');
        uint _distributed = privatePresaleDistributed;
        for (uint i = 0; i < _accounts.length; ++i) {
            uint max = distribution.maxAmountOf[_accounts[i]].add(_amounts[i]);
            distribution.maxAmountOf[_accounts[i]] = max;
            _distributed = _distributed.add(_amounts[i]);
            emit PrivateDistributionInitialized(_accounts[i], max);
        }
        require(_distributed <= totalPrivatePresaleDistribution, 'PrivatePresale: LIMIT_EXCEEDED');
        privatePresaleDistributed = _distributed;
    }

    function editDistributed(address _account, uint _amount) external override nonReentrant {
        // disabled if admin has started the private presale distribution
        require(distribution.unlockBlock == 0 && msg.sender == ICAVO(address(this)).creator(), 'PrivatePresale: FORBIDDEN');
        uint _distributed = privatePresaleDistributed.sub(distribution.maxAmountOf[_account]).add(_amount);
        distribution.maxAmountOf[_account] = _amount;
        require(_distributed <= totalPrivatePresaleDistribution, 'PrivatePresale: LIMIT_EXCEEDED');
        privatePresaleDistributed = _distributed;
        emit PrivateDistributionInitialized(_account, _amount);
    }

    function availablePrivatePresaleAmountOf(address account) external view override returns (uint) {
        return distribution.availableAmountOf(account);
    }

    function privatePresaleClaim(uint amount) external override nonReentrant {
        distribution.claim(amount);
        emit PrivateDistributed(msg.sender, amount);
    }

    function startPrivatePresaleDistribution() external override nonReentrant {
        // called, once admin has distributed all of the presale tokens
        require(privatePresaleDistributed == totalPrivatePresaleDistribution, 'PrivatePresale: DISTRIBUTION_UNFINISHED');
        distribution.start();
    }
}

File 18 of 51 : TestxCAVO.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

import '../xCAVO.sol';

contract TestxCAVO is xCAVO {
    function testSetExpectedPrice(uint price) external {
        expectedPriceInUQ = price;
    }
}

File 19 of 51 : TestEXCV.sol
pragma solidity >=0.6.6;

import "../EXCV.sol";

contract TestEXCV is EXCV {
    function testMint(address account, uint256 amount) external {
        _mint(account, amount);
    }
}

File 20 of 51 : ITeamDistribution.sol
pragma solidity >=0.6.6;

interface ITeamDistribution {
    function totalTeamDistribution() external view returns (uint);
    function availableTeamMemberAmountOf(address account) external view returns (uint);

    function teamMemberClaim(uint amount) external;
    function startTeamDistribution() external;
}

File 21 of 51 : IPrivatePresale.sol
pragma solidity >=0.6.6;

interface IPrivatePresale {
    function totalPrivatePresaleDistribution() external view returns (uint);
    function privatePresaleDistributed() external view returns (uint);
    function availablePrivatePresaleAmountOf(address account) external view returns (uint);

    function distribute(address[] calldata _accounts, uint[] calldata _amounts) external;
    function editDistributed(address _account, uint _amount) external;
    function privatePresaleClaim(uint amount) external;
    function startPrivatePresaleDistribution() external;
}

File 22 of 51 : xCAVO.sol
pragma solidity >=0.6.6;

import './interfaces/IxCAVO.sol';
import './interfaces/ICAVO.sol';
import "./interfaces/IERC20.sol";
import "./interfaces/IEXCV.sol";
import "./interfaces/IExcavoPair.sol";
import "./interfaces/IExcavoFactory.sol";
import './libraries/SafeMath.sol';
import "./libraries/ExcavoLibrary.sol";
import './libraries/UQ112x112.sol';
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract xCAVO is IxCAVO, IERC20, ReentrancyGuard {
    using SafeMath for uint;
    
    event Redeem(address indexed sender, address indexed recipient, uint amount);

    string public constant override name = 'xCAVO';
    string public constant override symbol = 'xCAVO';
    uint8 public constant override decimals = 18;
    uint private constant Q112 = 2**112;
    uint private constant WEI_IN_CAVO = 10**18;
    uint private constant VESTING_PERIOD = 7020000; // 36 * 30 * 6500 = 7020000 = 36 months in blocks
    
    address public immutable override getCAVO;
    address public override excvEthPair;
    address public override cavoEthPair;
    address public override getEXCV;

    mapping(address => uint) private lastAccumulatedMintableCAVOAmount;
    mapping(address => uint) private lastAccumulatedUnclaimedLiquidity;

    uint public override accumulatedMintableCAVOAmount;
    uint private firstBlockNumber;
    uint private lastBlockNumber;
    uint internal expectedPriceInUQ;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {
        getCAVO = msg.sender;
    }

    function initialize(address _factory, address _EXCV) external override nonReentrant  {
        require(getEXCV == address(0) && excvEthPair == address(0) && cavoEthPair == address(0) && msg.sender == getCAVO, "xCAVO: FORBIDDEN"); 
        getEXCV = _EXCV;
        address WETH = IExcavoFactory(_factory).WETHToken();
        excvEthPair = ExcavoLibrary.pairFor(_factory, getEXCV, WETH);
        cavoEthPair = ExcavoLibrary.pairFor(_factory, getCAVO, WETH);
    }

    function registerPairCreation() external override nonReentrant {
        require(firstBlockNumber == 0 && msg.sender == cavoEthPair, "xCAVO: FORBIDDEN");
        firstBlockNumber = block.number;
        lastBlockNumber = block.number;
    }

    function totalSupply() external view override returns (uint) {
        return IERC20(getCAVO).totalSupply();
    }

    function balanceOf(address owner) external view override returns (uint) {
        uint totalUnclaimedLiquidity = IExcavoPair(excvEthPair).accumulatedLiquidityGrowth() - lastAccumulatedUnclaimedLiquidity[owner];
        if (totalUnclaimedLiquidity == 0) {
            return 0;
        }
        uint totalMintableCAVO = accumulatedMintableCAVOAmount - lastAccumulatedMintableCAVOAmount[owner];
        uint liquidity = IExcavoPair(excvEthPair).unclaimedLiquidityOf(owner);
        return liquidity.mul(totalMintableCAVO) / totalUnclaimedLiquidity;
    }

    function redeem(address recipient) external override nonReentrant {
        uint liquidity = IExcavoPair(excvEthPair).claimAllLiquidity(msg.sender);
        uint accumulatedUnclaimedLiquidity = IExcavoPair(excvEthPair).accumulatedUnclaimedLiquidity();
        uint totalUnclaimedLiquidity = accumulatedUnclaimedLiquidity - lastAccumulatedUnclaimedLiquidity[msg.sender]; // overflow desired
        if (totalUnclaimedLiquidity == 0) {
            revert('xCAVO: INSUFFICIENT_MINTED_AMOUNT');
        }
        uint totalMintableCAVO = accumulatedMintableCAVOAmount - lastAccumulatedMintableCAVOAmount[msg.sender]; // overflow desired
        uint mintedAmount = liquidity.mul(totalMintableCAVO) / totalUnclaimedLiquidity;
        require(mintedAmount > 0, 'xCAVO: INSUFFICIENT_MINTED_AMOUNT');
        lastAccumulatedUnclaimedLiquidity[msg.sender] = accumulatedUnclaimedLiquidity;
        lastAccumulatedMintableCAVOAmount[msg.sender] = accumulatedMintableCAVOAmount;
        ICAVO(getCAVO).mint(recipient, mintedAmount);
        emit Redeem(msg.sender, recipient, mintedAmount);
    }

    function mint(uint priceInUQ) external override nonReentrant {
        require(msg.sender == cavoEthPair, "xCAVO: FORBIDDEN");

        if (block.number - firstBlockNumber >= VESTING_PERIOD || block.number == lastBlockNumber) {
            return;
        }
        uint priceChangeInUQ = Q112.mul(block.number.sub(lastBlockNumber)).mul(3).div(6500000);
        if (expectedPriceInUQ + priceChangeInUQ < expectedPriceInUQ) {
            return; // overflow: stop minting
        }
        expectedPriceInUQ += priceChangeInUQ; // cannot overflow
        if (priceInUQ >= expectedPriceInUQ) {
            // mintedAmount = 10^6 * (N - Nprev) * (N + Nprev - 2 * N0) / ((36 * 30 * 6500)^2)
            // ((36 * 30 * 6500)**2) = 49280400000000
            // 10**6 = 1000000
            uint mintedAmount = block.number.sub(lastBlockNumber).mul(1000000)
                .mul(block.number.add(lastBlockNumber).sub(firstBlockNumber.mul(2)))
                .mul(WEI_IN_CAVO)
                .div(49280400000000);
            if (mintedAmount > 0) {
                accumulatedMintableCAVOAmount = accumulatedMintableCAVOAmount + mintedAmount; // overflow desired
            }
        }
        lastBlockNumber = block.number;
    }

    function allowance(address /*owner*/, address /*spender*/) external view override returns (uint) {
        revert("xCAVO: FORBIDDEN");
    }

    function approve(address /*spender*/, uint /*value*/) external override returns (bool) {
        revert("xCAVO: FORBIDDEN");
    }

    function transfer(address /*to*/, uint /*value*/) external override returns (bool) {
        revert("xCAVO: FORBIDDEN");
    }

    function transferFrom(address /*from*/, address /*to*/, uint /*value*/) external override returns (bool) {
        revert("xCAVO: FORBIDDEN");
    }
}

File 23 of 51 : IERC20.sol
pragma solidity >=0.6.6;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view 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);
}

File 24 of 51 : IExcavoPair.sol
pragma solidity >=0.6.6;

import './IExcavoERC20.sol';

interface IExcavoPair is IExcavoERC20 {
    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 router() external view returns (address);
    function accumulatedLiquidityGrowth() external view returns (uint);
    function accumulatedUnclaimedLiquidity() external view returns (uint);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() 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, uint discount) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address, address) external;
    function setxEXCV(address) external;

    function unclaimedLiquidityOf(address) external view returns (uint);
    function claimLiquidity(address account, uint256 amount) external returns (uint claimAmount);
    function claimAllLiquidity(address account) external returns (uint claimAmount);

    function compoundLiquidity() external;
    function setCAVO(address _CAVO, address _xCAVO) external;   
}

File 25 of 51 : ExcavoLibrary.sol
pragma solidity >=0.6.6;

import '../interfaces/IExcavoPair.sol';
import "./SafeMath.sol";
import './Math.sol';

library ExcavoLibrary {
    using SafeMath for uint;

    // 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, 'ExcavoLibrary: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'ExcavoLibrary: 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(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'3b4596e5d4f0ba0faf3c029e2a152a4931e4da86804417810c5960569e839f1e' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IExcavoPair(pairFor(factory, 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(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'ExcavoLibrary: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'ExcavoLibrary: 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(uint amountIn, uint reserveIn, uint reserveOut, uint discount) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'ExcavoLibrary: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'ExcavoLibrary: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(10000 - 4 * discount);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(10000).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(uint amountOut, uint reserveIn, uint reserveOut, uint discount) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'ExcavoLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'ExcavoLibrary: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(10000);
        uint denominator = reserveOut.sub(amountOut).mul(10000 - 4 * discount);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path, uint discount) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'ExcavoLibrary: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut, discount);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path, uint discount) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'ExcavoLibrary: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut, discount);
        }
    }
}

File 26 of 51 : UQ112x112.sol
pragma solidity >=0.6.6;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))

// range: [0, 2**112 - 1]
// resolution: 1 / 2**112

library UQ112x112 {
    uint224 constant Q112 = 2**112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112; // never overflows
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}

File 27 of 51 : EXCV.sol
pragma solidity >=0.6.6;

import './interfaces/IExcavoERC20.sol';
import './interfaces/ICAVO.sol';
import './libraries/Math.sol';
import "./xEXCV.sol";

contract EXCV is IEXCV, IExcavoERC20, ReentrancyGuard {
    using SafeMath for uint;

    string public constant override name = 'EXCV';
    string public constant override symbol = 'EXCV';
    uint8 public constant override decimals = 18;

    uint public constant override MAX_SUPPLY = 10**9 * 10**18;
    // TODO: make sure, it's OK
    uint public constant override CREATOR_SUPPLY = 600 * 5 * 10**18;

    address public override immutable xEXCVToken;
    address public override factory;

    uint public override totalSupply;
    mapping(address => uint) public override balanceOf;
    mapping(address => mapping(address => uint)) public override allowance;
    address private immutable creator;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {
        creator = msg.sender;
        address _xEXCV;
        bytes memory bytecode = type(xEXCV).creationCode;
        bytes32 salt = keccak256(abi.encodePacked("xEXCV"));
        assembly {
            _xEXCV := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        xEXCVToken = _xEXCV;
    }

    function initialize(address _factory) external override nonReentrant {
        require(factory == address(0) && msg.sender == creator, "EXCV: FORBIDDEN");
        factory = _factory;
        IxEXCV(xEXCVToken).initialize(_factory);
        _mint(ICAVO(creator).creator(), CREATOR_SUPPLY);
    }

    function _mint(address to, uint value) internal {
        uint _value = Math.min(value, MAX_SUPPLY.sub(totalSupply));
        totalSupply = totalSupply.add(_value);
        balanceOf[to] = balanceOf[to].add(_value);
        emit Transfer(address(0), to, _value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) private {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function mint(address to, uint value) external override nonReentrant {
        require(msg.sender == xEXCVToken, "EXCV: FORBIDDEN");
        _mint(to, value);
    }

    function approve(address spender, uint value) external virtual override nonReentrant returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external virtual override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external virtual override nonReentrant returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }
}

File 28 of 51 : xEXCV.sol
pragma solidity >=0.6.6;

import "./interfaces/IxEXCV.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IEXCV.sol";
import "./interfaces/IExcavoFactory.sol";
import "./interfaces/IExcavoPair.sol";
import "./libraries/ExcavoLibrary.sol";
import './libraries/Math.sol';
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract xEXCV is IxEXCV, IERC20, ReentrancyGuard {
    // each time user adds liquidity to EXCV generating pairs, add active pair address
    // each time user removes liquidity to EXCV generating pairs, remove active pair address
    using SafeMath for uint;

    event Redeem(address indexed sender, address indexed recipient, uint amount);

    uint constant MIN_LIQUIDITY_PAIR_COUNT = 3;
    
    address public immutable override getEXCV;
    address public override factory;
    address public override excvEthPair;
    address[] private _liquidityPairs;

    string public constant override symbol = "xEXCV";
    string public constant override name = "xEXCV";
    uint8 public constant override decimals = 18; 

    constructor() public {
        getEXCV = msg.sender;
    }

    function initialize(address _factory) external override nonReentrant {
        require(msg.sender == getEXCV && factory == address(0) && excvEthPair == address(0), "xEXCV: FORBIDDEN");
        factory = _factory;
        address WETH = IExcavoFactory(_factory).WETHToken();
        excvEthPair = ExcavoLibrary.pairFor(_factory, getEXCV, WETH);
    }

    function addPair(address tokenA, address tokenB) external override nonReentrant {
        require(ExcavoLibrary.pairFor(factory, tokenA, tokenB) == msg.sender, "xEXCV: FORBIDDEN");
        if (!_pairExists(msg.sender)) {
            _liquidityPairs.push(msg.sender);
        }
    }

    function redeem(address recipient) external override nonReentrant {
        address[] memory pairs = _liquidityPairs;
        uint _circulatingSupply = circulatingSupply();
        uint excvQuantity;
        for (uint i = 0; i < pairs.length; i++) {
            uint lastK = IExcavoPair(pairs[i]).totalSupply();
            uint claimedLiquidity = IExcavoPair(pairs[i]).claimAllLiquidity(msg.sender);
            excvQuantity = excvQuantity.add(claimedLiquidity.mul(_circulatingSupply).div(lastK));
        }
        IEXCV(getEXCV).mint(recipient, excvQuantity);
        emit Redeem(msg.sender, recipient, excvQuantity);
    }

    function redeemPair(address recipient, address pair, uint claimedLiquidityAmount) external override nonReentrant {
        require(_pairExists(pair), "xEXCV: unknown pair");

        uint _circulatingSupply = circulatingSupply();
        uint lastK = IExcavoPair(pair).totalSupply();
        IExcavoPair(pair).claimLiquidity(msg.sender, claimedLiquidityAmount);
        uint excvQuantity = claimedLiquidityAmount.mul(_circulatingSupply).div(lastK);

        IEXCV(getEXCV).mint(recipient, excvQuantity);
        emit Redeem(msg.sender, recipient, excvQuantity);
    }

    function totalSupply() external view override returns (uint) {
        return IERC20(getEXCV).totalSupply();
    }

    function balanceOf(address owner) external view override returns (uint) {
        address[] memory pairs = _liquidityPairs;
        uint _circulatingSupply = circulatingSupply();
        uint excvQuantity;
        for (uint i = 0; i < pairs.length; i++) {
            uint accumulatedLiquidity = IExcavoPair(pairs[i]).unclaimedLiquidityOf(owner);
            uint lastK = IExcavoPair(pairs[i]).totalSupply();
            excvQuantity = excvQuantity.add(accumulatedLiquidity.mul(_circulatingSupply).div(lastK));
        }
        return excvQuantity;
    }

    function liquidityPairs() external view override returns (address[] memory) {
        return _liquidityPairs;
    }

    function pairBalanceOf(address owner, address pair) external view override returns (uint) {
        if (!_pairExists(pair)) {
            return 0;
        }
        uint lastK = IExcavoPair(pair).totalSupply();
        if (lastK == 0) {
            return 0;
        }
        uint _circulatingSupply = circulatingSupply();
        uint accumulatedLiquidity = IExcavoPair(pair).unclaimedLiquidityOf(owner);
        return accumulatedLiquidity.mul(_circulatingSupply) / lastK;
    }

    function circulatingSupply() private view returns (uint) {
        (uint reserve0, uint reserve1, ) = IExcavoPair(excvEthPair).getReserves();
        return IExcavoPair(excvEthPair).token0() == getEXCV ? reserve0 : reserve1;
    }

    function _pairExists(address pair) private view returns (bool) {
        address[] memory pairs = _liquidityPairs;
        for (uint i = 0; i < pairs.length; ++i) {
            if (pairs[i] == pair) {
                return true;
            }
        }
        return false;
    }

    function allowance(address /*owner*/, address /*spender*/) external view override returns (uint) {
        revert("xEXCV: FORBIDDEN");
    }

    function approve(address /*spender*/, uint /*value*/) external override returns (bool) {
        revert("xEXCV: FORBIDDEN");
    }

    function transfer(address /*to*/, uint /*value*/) external override returns (bool) {
        revert("xEXCV: FORBIDDEN");
    }

    function transferFrom(address /*from*/, address /*to*/, uint /*value*/) external override returns (bool) {
        revert("xEXCV: FORBIDDEN");
    }
}

File 29 of 51 : IxEXCV.sol
pragma solidity >=0.6.6;

interface IxEXCV {
    function liquidityPairs() external view returns (address[] memory);
    function factory() external view returns (address);
    function excvEthPair() external view returns (address);
    function getEXCV() external view returns (address);

    function initialize(address _factory) external;
    function redeem(address recipient) external;
    function redeemPair(address recipient, address pair, uint claimedLiquidityAmount) external;
    function addPair(address tokenA, address tokenB) external;
    function pairBalanceOf(address owner, address pair) external view returns (uint);
}

File 30 of 51 : DistributionTest.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import '../libraries/TransferHelper.sol';
import '../libraries/Math.sol';
import '../libraries/SafeMath.sol';
import '../libraries/DistributionLibrary.sol';
import '../interfaces/ICAVO.sol';
import '../interfaces/IExcavoERC20.sol';
import '../interfaces/IxCAVO.sol';
import './TestCAVO.sol';

contract DistributionTest is TestCAVO {
    using SafeMath for uint;
    using DistributionLibrary for DistributionLibrary.Data;

    event Distributed(address indexed recipient, uint amount);
    event DistributionStarted(address indexed sender, uint blockNumber);

    DistributionLibrary.Data private testDistribution;
    uint private totalDistribution;

    constructor(uint32 _blocksInPeriod, address[] memory _team, uint[] memory _amounts) public {
        require(_team.length == _amounts.length, 'DistributionTest: INVALID_PARAMS');
        uint total;
        for (uint i = 0; i < _team.length; ++i) {
            testDistribution.maxAmountOf[_team[i]] = _amounts[i];
            total = total.add(_amounts[i]);
        }
        totalDistribution = total;
        testDistribution.blocksInPeriod = _blocksInPeriod;

        _mint(address(this), totalDistribution);
    }

    function testAvailableAmountOf(address account) external view returns (uint) {
        return testDistribution.availableAmountOf(account);
    }

    function testClaim(uint amount) external {
        testDistribution.claim(amount);
        emit Distributed(msg.sender, amount);
    }

    function testStartDistribution() external nonReentrant {
        testDistribution.start();
        emit DistributionStarted(msg.sender, block.number);
    }
}

File 31 of 51 : ExcavoPair.sol
pragma solidity >=0.6.6;

import './interfaces/IERC20.sol';
import './interfaces/IxEXCV.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IExcavoFactory.sol';
import './interfaces/IExcavoCallee.sol';
import './interfaces/IExcavoPair.sol';
import './libraries/Math.sol';
import './libraries/UQ112x112.sol';
import './libraries/PairLibrary.sol';
import './BaseExcavoPair.sol';

contract ExcavoPair is IExcavoPair, BaseExcavoPair {
    using SafeMath  for uint;
    using UQ112x112 for uint224;

    event Compound(address indexed owner, uint liquidityGrowth);

    struct SwapDetails {
        uint balance0;
        uint balance1;
        address _token0;
        address _token1;
        uint balance0Adjusted;
        uint balance1Adjusted;
    }

    uint public constant override MINIMUM_LIQUIDITY = 10**3;
    bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));

    uint private unlocked = 1;
    modifier lock() {
        require(unlocked == 1, 'Excavo: LOCKED');
        unlocked = 0;
        _;
        unlocked = 1;
    }

    function getReserves() public view override returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
        _reserve0 = data.reserve0;
        _reserve1 = data.reserve1;
        _blockTimestampLast = data.blockTimestampLast;
    }

    function _safeTransfer(address token, address to, uint value) private {
        (bool success, bytes memory _data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
        require(success && (_data.length == 0 || abi.decode(_data, (bool))), 'Excavo: TRANSFER_FAILED');
    }

    constructor() public {
        data.factory = msg.sender;
    }

    // called once by the factory at time of deployment
    function initialize(address _token0, address _token1, address _router) external override lock {
        data.initialize(_token0, _token1, _router);
    }       

    function setCAVO(address _CAVO, address _xCAVO) external override lock {
        data.setCAVO(_CAVO, _xCAVO);
    }

    function setxEXCV(address _xEXCV) external override lock {
        data.setxEXCV(_xEXCV);
    }

    // update reserves and, on the first call per block, price accumulators
    function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
        require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Excavo: OVERFLOW');
        uint32 blockTimestamp = uint32(block.timestamp % 2**32);
        uint32 timeElapsed = blockTimestamp - data.blockTimestampLast; // overflow is desired
        if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
            // * never overflows, and + overflow is desired
            data.price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
            data.price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
        }
        data.reserve0 = uint112(balance0);
        data.reserve1 = uint112(balance1);
        data.blockTimestampLast = blockTimestamp;
        emit Sync(data.reserve0, data.reserve1);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function mint(address to) external lock override returns (uint liquidity) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        uint balance0 = IERC20(data.token0).balanceOf(address(this));
        uint balance1 = IERC20(data.token1).balanceOf(address(this));
        uint amount0 = balance0.sub(_reserve0);
        uint amount1 = balance1.sub(_reserve1);
        uint _totalSupply = data.totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        uint _liquidity = Math.sqrt(amount0.mul(amount1));
        if (_totalSupply == 0) {
            liquidity = _liquidity.sub(MINIMUM_LIQUIDITY);
            _mint(address(0), MINIMUM_LIQUIDITY, MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
            require(liquidity > 0, 'Excavo: INSUFFICIENT_LIQUIDITY_MINTED');
            _mint(to, liquidity, liquidity);
        } else {
            liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
            require(liquidity > 0, 'Excavo: INSUFFICIENT_LIQUIDITY_MINTED');
            _mint(to, liquidity, _liquidity);
        }
        _update(balance0, balance1, _reserve0, _reserve1);
        emit Mint(msg.sender, amount0, amount1);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function burn(address to) public override lock returns (uint amount0, uint amount1) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        address _token0 = data.token0;                                // gas savings
        address _token1 = data.token1;                                // gas savings
        uint balance0 = IERC20(_token0).balanceOf(address(this));
        uint balance1 = IERC20(_token1).balanceOf(address(this));
        uint liquidity = data.balanceOf[address(this)];
        uint _totalSupply = data.totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
        amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
        require(amount0 > 0 && amount1 > 0, 'Excavo: INSUFFICIENT_LIQUIDITY_BURNED');

        _burn(address(this), liquidity);
        _safeTransfer(_token0, to, amount0);
        _safeTransfer(_token1, to, amount1);
        balance0 = IERC20(_token0).balanceOf(address(this));
        balance1 = IERC20(_token1).balanceOf(address(this));
        _update(balance0, balance1, _reserve0, _reserve1);
        emit Burn(msg.sender, amount0, amount1, to);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata _data, uint discount) external override lock {
        require(msg.sender == data.router, "Excavo: FORBIDDEN");
        SwapDetails memory details;
        require(amount0Out > 0 || amount1Out > 0, 'Excavo: INSUFFICIENT_OUTPUT_AMOUNT');
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        require(amount0Out < _reserve0 && amount1Out < _reserve1, 'Excavo: INSUFFICIENT_LIQUIDITY');

        { // scope for _token{0,1}, avoids stack too deep errors
        details._token0 = data.token0;
        details._token1 = data.token1;
        require(to != details._token0 && to != details._token1, 'Excavo: INVALID_TO');
        if (amount0Out > 0) _safeTransfer(details._token0, to, amount0Out); // optimistically transfer tokens
        if (amount1Out > 0) _safeTransfer(details._token1, to, amount1Out); // optimistically transfer tokens
        if (_data.length > 0) IExcavoCallee(to).ExcavoCall(msg.sender, amount0Out, amount1Out, _data);
        details.balance0 = IERC20(details._token0).balanceOf(address(this));
        details.balance1 = IERC20(details._token1).balanceOf(address(this));
        }
        uint amount0In = details.balance0 > _reserve0 - amount0Out ? details.balance0 - (_reserve0 - amount0Out) : 0;
        uint amount1In = details.balance1 > _reserve1 - amount1Out ? details.balance1 - (_reserve1 - amount1Out) : 0;
        require(amount0In > 0 || amount1In > 0, 'Excavo: INSUFFICIENT_INPUT_AMOUNT');
        { // scope for reserve{0,1}Adjusted, avoids stack too deep errors
        details.balance0Adjusted = details.balance0.mul(10000).sub(amount0In.mul(4 * discount));
        details.balance1Adjusted = details.balance1.mul(10000).sub(amount1In.mul(4 * discount));
        require(details.balance0Adjusted.mul(details.balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(10000**2), 'Excavo: K');
        }
        
        if (data.CAVO != address(0)) {
            uint prevPriceCumulativeLast = data.token0 == data.CAVO ? data.price0CumulativeLast : data.price1CumulativeLast;
            uint prevBlockTimestampLast = data.blockTimestampLast;
            _update(details.balance0, details.balance1, _reserve0, _reserve1);
            // call mint first call per block 
            if (data.blockTimestampLast != prevBlockTimestampLast) {
                uint priceCumulativeLast = data.token0 == data.CAVO ? data.price0CumulativeLast : data.price1CumulativeLast;
                IxCAVO(data.xCAVO).mint((priceCumulativeLast - prevPriceCumulativeLast) / (data.blockTimestampLast - prevBlockTimestampLast));
            }
        } else {
            _update(details.balance0, details.balance1, _reserve0, _reserve1);
        }
        emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
    }

    // force balances to match reserves
    function skim(address to) external override lock {
        address _token0 = data.token0; // gas savings
        address _token1 = data.token1; // gas savings
        _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(data.reserve0));
        _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(data.reserve1));
    }

    // force reserves to match balances
    function sync() external override lock {
        _update(IERC20(data.token0).balanceOf(address(this)), IERC20(data.token1).balanceOf(address(this)), data.reserve0, data.reserve1);
    }

    function factory() external view override returns (address) {
        return data.factory;
    }

    function token0() external view override returns (address) {
        return data.token0;
    }

    function token1() external view override returns (address) {
        return data.token1;
    }

    function router() external view override returns (address) {
        return data.router;
    }

    function accumulatedUnclaimedLiquidity() external view override returns (uint) {
        return data.accumulatedUnclaimedLiquidity;
    }

    function price0CumulativeLast() external view override returns (uint) {
        return data.price0CumulativeLast;
    }

    function price1CumulativeLast() external view override returns (uint) {
        return data.price1CumulativeLast;
    }

    function claimLiquidity(address account, uint256 amount) external override lock returns (uint) {
        return data.claimLiquidity(account, amount);
    }

    function claimAllLiquidity(address account) external override lock returns (uint) {
        return data.claimAllLiquidity(account);
    }

    function accumulatedLiquidityGrowth() external view override returns (uint) {
        return data.accumulatedLiquidityGrowth();
    }

    function unclaimedLiquidityOf(address account) external view override returns (uint) {
        return data.unclaimedLiquidityOf(account);
    }

    function compoundLiquidity() external override lock {
        emit Compound(msg.sender, data.compoundLiquidity());
    }

    function _mint(address to, uint value, uint k) private {
        data.mint(to, value, k);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) private {
        data.burn(from, value);
        emit Transfer(from, address(0), value);
    }

    function _transfer(address from, address to, uint value) internal virtual override {
        data.transfer(from, to, value);
        emit Transfer(from, to, value);
    }
}

File 32 of 51 : IExcavoCallee.sol
pragma solidity >=0.6.6;

interface IExcavoCallee {
    function ExcavoCall(address sender, uint amount0, uint amount1, bytes calldata data) external;
}

File 33 of 51 : PairLibrary.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

import '../interfaces/IERC20.sol';
import '../interfaces/IxEXCV.sol';
import '../interfaces/IxCAVO.sol';
import '../interfaces/IExcavoFactory.sol';
import '../interfaces/IExcavoCallee.sol';
import '../interfaces/IERC20.sol';
import './SafeMath.sol';
import './Math.sol';

library PairLibrary {
    using SafeMath for uint;

    struct Data {
        address factory;
        address token0;
        address token1;
        address router;
        uint totalSupply;
        
        uint accumulatedUnclaimedLiquidity;
    
        uint112 reserve0;           // uses single storage slot, accessible via getReserves
        uint112 reserve1;           // uses single storage slot, accessible via getReserves
        uint32 blockTimestampLast;  // uses single storage slot, accessible via getReserves

        uint price0CumulativeLast;
        uint price1CumulativeLast;
    
        mapping(address => uint) kOf;
        mapping(address => uint) lastUnclaimedLiquidityOf;
        mapping(address => uint) virtualKOf;
        mapping(address => uint) balanceOf;

        uint totalK;
        address xEXCV;
        address xCAVO;
        address CAVO;
    }

    function initialize(Data storage self, address _token0, address _token1, address _router) external {
        require(msg.sender == self.factory, 'Excavo: FORBIDDEN'); // sufficient check
        self.token0 = _token0;
        self.token1 = _token1;
        self.router = _router;
    }       

    function setCAVO(Data storage self, address _CAVO, address _xCAVO) external {
        require(msg.sender == self.factory, 'Excavo: FORBIDDEN'); // sufficient check
        self.CAVO = _CAVO;
        self.xCAVO = _xCAVO;
        if (_CAVO != address(0)) {
            IxCAVO(_xCAVO).registerPairCreation();
        }
    }

    function setxEXCV(Data storage self, address _xEXCV) external {
        require(self.xEXCV == address(0) && msg.sender == IExcavoFactory(self.factory).feeToSetter(), "Excavo: FORBIDDEN"); 
        self.xEXCV = _xEXCV;
        IxEXCV(_xEXCV).addPair(self.token0, self.token1);
    }

    function claimLiquidity(Data storage self, address account, uint256 amount) external returns (uint claimAmount) {
        require(msg.sender == self.xEXCV || msg.sender == self.xCAVO, "Excavo: FORBIDDEN");
        _accumulateLiquidityGrowth(
            self,
            IERC20(self.token0).balanceOf(address(this)), 
            IERC20(self.token1).balanceOf(address(this)), 
            self.balanceOf[account], 
            self.totalSupply, 
            account
        );
        claimAmount = self.lastUnclaimedLiquidityOf[account].sub(amount); 
        self.lastUnclaimedLiquidityOf[account] = claimAmount;
    }

    function claimAllLiquidity(Data storage self, address account) public returns (uint claimAmount) {
        require(msg.sender == self.xEXCV || msg.sender == self.xCAVO, "Excavo: FORBIDDEN");
        self.virtualKOf[address(this)] = _accumulateTotalLiquidityGrowth(self);
        _accumulateLiquidityGrowth(
            self,
            IERC20(self.token0).balanceOf(address(this)), 
            IERC20(self.token1).balanceOf(address(this)), 
            self.balanceOf[account], 
            self.totalSupply, 
            account
        );
        claimAmount = self.lastUnclaimedLiquidityOf[account];
        self.lastUnclaimedLiquidityOf[account] = 0;
    }

    function accumulatedLiquidityGrowth(Data storage self) external view returns (uint) {
        uint lastTotalK = self.virtualKOf[address(this)].add(self.totalK);
        uint newTotalK = _calculateNewK(
            self.reserve0, 
            self.reserve1, 
            self.totalSupply,
            self.totalSupply,
            lastTotalK
        );
        if (newTotalK > lastTotalK) {
            return self.accumulatedUnclaimedLiquidity + (newTotalK - lastTotalK); // overflow desired
        }
        return self.accumulatedUnclaimedLiquidity;
    }

    function unclaimedLiquidityOf(Data storage self, address account) external view returns (uint) {
        uint newK = _calculateNewK(
            IERC20(self.token0).balanceOf(address(this)), 
            IERC20(self.token1).balanceOf(address(this)), 
            self.balanceOf[account],
            self.totalSupply,
            self.virtualKOf[account]
        );
        if (newK > self.virtualKOf[account]) {
            uint liquidityGrowth = newK - self.virtualKOf[account]; // cannot overflow
            return self.lastUnclaimedLiquidityOf[account].add(liquidityGrowth);
        }
        return self.lastUnclaimedLiquidityOf[account];
    }

    function compoundLiquidity(Data storage self) external returns (uint) {
        self.virtualKOf[address(this)] = _accumulateTotalLiquidityGrowth(self);
        return _accumulateLiquidityGrowth(
            self,
            IERC20(self.token0).balanceOf(address(this)), 
            IERC20(self.token1).balanceOf(address(this)), 
            self.balanceOf[msg.sender], 
            self.totalSupply, 
            msg.sender
        );
    }

    function mint(Data storage self, address to, uint value, uint k) external {
        _accumulateTotalLiquidityGrowth(self);
        _accumulateLiquidityGrowth(
            self,
            IERC20(self.token0).balanceOf(address(this)), 
            IERC20(self.token1).balanceOf(address(this)), 
            self.balanceOf[to], 
            self.totalSupply, 
            to
        );
        uint newKTo = self.kOf[to].add(k);
        _updateK(self, to, newKTo, newKTo);
        self.totalK = self.totalK.add(k);
        self.virtualKOf[address(this)] = 0;
       
        uint newBalance = self.balanceOf[to].add(value);
        self.totalSupply = self.totalSupply.add(value);
        self.balanceOf[to] = newBalance;
    }

    function burn(Data storage self, address from, uint value) external {
        uint newBalance = self.balanceOf[from].sub(value);
        _accumulateTotalLiquidityGrowth(self);
        _accumulateLiquidityGrowth(
            self,
            IERC20(self.token0).balanceOf(address(this)), 
            IERC20(self.token1).balanceOf(address(this)), 
            self.balanceOf[from], 
            self.totalSupply, 
            from
        );
        uint newK = self.kOf[from].mul(newBalance).div(self.balanceOf[from]);
        _updateK(self, from, newK, newK);
        
        self.totalK = self.totalK.sub(self.kOf[from].sub(newK));
        self.virtualKOf[address(this)] = 0;
        self.balanceOf[from] = newBalance;
        self.totalSupply = self.totalSupply.sub(value);
    }

    function transfer(Data storage self, address from, address to, uint value) external {
        uint newBalanceFrom = self.balanceOf[from].sub(value);
        uint newBalanceTo = self.balanceOf[to].add(value);

        uint balance0 = IERC20(self.token0).balanceOf(address(this));
        uint balance1 = IERC20(self.token1).balanceOf(address(this));
        uint _totalSupply = self.totalSupply;
        _accumulateLiquidityGrowth(
            self,
            balance0, 
            balance1, 
            self.balanceOf[from], 
            _totalSupply, 
            from
        );
        _accumulateLiquidityGrowth(
            self,
            balance0, 
            balance1, 
            self.balanceOf[to], 
            _totalSupply, 
            to
        );

        uint newKFrom = self.kOf[from].mul(newBalanceFrom).div(self.balanceOf[from]);
        uint newKTo = self.kOf[to].add(self.kOf[from].sub(newKFrom));
        uint virtualKTo = _calculateNewK(
            balance0, 
            balance1, 
            newBalanceTo,
            _totalSupply,
            newKTo
        );
        uint virtualKFrom = _calculateNewK(
            balance0, 
            balance1, 
            newBalanceFrom,
            _totalSupply,
            newKFrom
        );
        _updateK(self, to, newKTo, virtualKTo);
        _updateK(self, from, newKFrom, virtualKFrom);

        self.balanceOf[from] = newBalanceFrom;
        self.balanceOf[to] = newBalanceTo;
    }

    function _calculateNewK(
        uint balance0, 
        uint balance1,
        uint liquidity, 
        uint totalSupply,
        uint virtualK
    ) private pure returns (uint k) {
        if (totalSupply == 0) {
            return virtualK;
        } 
        uint amount0 = liquidity.mul(balance0) / totalSupply;
        uint amount1 = liquidity.mul(balance1) / totalSupply;
        if (amount0 == 0 || amount1 == 0) {
            return virtualK;
        }
        k = Math.sqrt(amount0.mul(amount1));
    }   

    function _accumulateTotalLiquidityGrowth(Data storage self) private returns (uint virtualTotalK) {
        virtualTotalK = self.virtualKOf[address(this)];
        uint lastTotalK = virtualTotalK.add(self.totalK);
        uint newTotalK = _calculateNewK(
            self.reserve0, 
            self.reserve1, 
            self.totalSupply,
            self.totalSupply,
            lastTotalK
        );
        if (newTotalK > lastTotalK) {
            virtualTotalK = newTotalK.sub(self.totalK);
            self.accumulatedUnclaimedLiquidity = self.accumulatedUnclaimedLiquidity + (newTotalK - lastTotalK); // overflow desired
        }
    }

    function _accumulateLiquidityGrowth(
        Data storage self, 
        uint balance0, 
        uint balance1,
        uint liquidity, 
        uint totalSupply,
        address account
    ) private returns (uint liquidityGrowth) {
        uint virtualK = self.virtualKOf[account];
        if (account == address(this)) {
            return virtualK;
        }
        uint newK = _calculateNewK(
            balance0, 
            balance1, 
            liquidity,
            totalSupply,
            virtualK
        );
        if (newK > virtualK) {
            liquidityGrowth = newK - virtualK; // cannot overflow
            self.virtualKOf[account] = newK;
            self.lastUnclaimedLiquidityOf[account] = self.lastUnclaimedLiquidityOf[account].add(liquidityGrowth);
        }
    }

    function _updateK(Data storage self, address account, uint k, uint virtualK) private {
        self.kOf[account] = k;
        self.virtualKOf[account] = virtualK;
    }
}

File 34 of 51 : BaseExcavoPair.sol
pragma solidity >=0.6.6;

import './interfaces/IExcavoERC20.sol';
import './libraries/SafeMath.sol';
import './libraries/PairLibrary.sol';

abstract contract BaseExcavoPair is IExcavoERC20 {
    using SafeMath for uint;
    using PairLibrary for PairLibrary.Data;

    string public constant override name = 'Excavo';
    string public constant override symbol = 'EXCAVO';
    uint8 public constant override decimals = 18;
    
    PairLibrary.Data internal data;
    mapping(address => mapping(address => uint)) public override allowance;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {}

    function totalSupply() external view override returns (uint) {
        return data.totalSupply;
    }

    function balanceOf(address account) external view override returns (uint) {
        return data.balanceOf[account];
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) internal virtual;

    function approve(address spender, uint value) external override returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external override returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }
}

File 35 of 51 : ExcavoERC20.sol
pragma solidity >=0.6.6;

import './interfaces/IExcavoERC20.sol';
import './libraries/SafeMath.sol';

contract ExcavoERC20 is IExcavoERC20 {
    using SafeMath for uint;

    string public constant override name = 'Excavo';
    string public constant override symbol = 'EXCAVO';
    uint8 public constant override decimals = 18;
    uint  public override totalSupply;
    mapping(address => uint) public override balanceOf;
    mapping(address => mapping(address => uint)) public override allowance;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {}

    function _mint(address to, uint value) internal virtual {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) internal virtual {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) internal virtual {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint value) external override returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external override returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }
}

File 36 of 51 : ERC20.sol
pragma solidity >=0.6.6;

import '../ExcavoERC20.sol';

contract ERC20 is ExcavoERC20 {
    constructor(uint _totalSupply) public {
        _mint(msg.sender, _totalSupply);
    }
}

File 37 of 51 : TestERC20.sol
pragma solidity >=0.6.6;

import '../libraries/SafeMath.sol';

contract TestERC20 {
    using SafeMath for uint;

    string public constant name = 'Test Token';
    string public constant symbol = 'TT';
    uint8 public constant decimals = 18;
    uint  public totalSupply;
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor(uint _totalSupply) public {
        _mint(msg.sender, _totalSupply);
    }

    function _mint(address to, uint value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) private {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }
}

File 38 of 51 : DeflatingERC20.sol
pragma solidity >=0.6.6;

import '../libraries/SafeMath.sol';

contract DeflatingERC20 {
    using SafeMath for uint;

    string public constant name = 'Deflating Test Token';
    string public constant symbol = 'DTT';
    uint8 public constant decimals = 18;
    uint  public totalSupply;
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor(uint _totalSupply) public {
        _mint(msg.sender, _totalSupply);
    }

    function _mint(address to, uint value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) private {
        uint burnAmount = value / 100;
        _burn(from, burnAmount);
        uint transferAmount = value.sub(burnAmount);
        balanceOf[from] = balanceOf[from].sub(transferAmount);
        balanceOf[to] = balanceOf[to].add(transferAmount);
        emit Transfer(from, to, transferAmount);
    }

    function approve(address spender, uint value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }
}

File 39 of 51 : ExcavoRouter.sol
pragma solidity >=0.6.6;

import './interfaces/IExcavoFactory.sol';
import './libraries/TransferHelper.sol';

import './interfaces/IExcavoRouter.sol';
import './libraries/ExcavoLibrary.sol';
import "./libraries/TraderDiscount.sol";
import './libraries/SafeMath.sol';
import './interfaces/IERC20.sol';
import './interfaces/IWETH.sol';
import './interfaces/ICAVO.sol';

contract ExcavoRouter is IExcavoRouter {
    using SafeMath for uint;

    address public immutable override factory;
    address public immutable override WETH;
    address public immutable override CAVO;

    modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'ExcavoRouter: EXPIRED');
        _;
    }

    constructor(address _factory, address _WETH, address _CAVO) public {
        factory = _factory;
        WETH = _WETH;
        CAVO = _CAVO;
    }

    receive() external payable {
        assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract
    }

    // **** ADD LIQUIDITY ****
    function _addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin
    ) internal virtual returns (uint amountA, uint amountB) {
        // create the pair if it doesn't exist yet
        if (IExcavoFactory(factory).getPair(tokenA, tokenB) == address(0)) {
            IExcavoFactory(factory).createPair(tokenA, tokenB);
        }

        (uint reserveA, uint reserveB) = ExcavoLibrary.getReserves(factory, tokenA, tokenB);

        if (reserveA == 0 && reserveB == 0) {
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint amountBOptimal = ExcavoLibrary.quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                require(amountBOptimal >= amountBMin, 'ExcavoRouter: INSUFFICIENT_B_AMOUNT');
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint amountAOptimal = ExcavoLibrary.quote(amountBDesired, reserveB, reserveA);
                assert(amountAOptimal <= amountADesired);
                require(amountAOptimal >= amountAMin, 'ExcavoRouter: INSUFFICIENT_A_AMOUNT');
                (amountA, amountB) = (amountAOptimal, amountBDesired);
            }
        }
    }

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
        (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);
        address pair = ExcavoLibrary.pairFor(factory, tokenA, tokenB);
        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
        liquidity = IExcavoPair(pair).mint(to);  
    }
    
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
        (amountToken, amountETH) = _addLiquidity(
            token,
            WETH,
            amountTokenDesired,
            msg.value,
            amountTokenMin,
            amountETHMin
        );
        address pair = ExcavoLibrary.pairFor(factory, token, WETH);
        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
        IWETH(WETH).deposit{value: amountETH}();
        assert(IWETH(WETH).transfer(pair, amountETH));
        liquidity = IExcavoPair(pair).mint(to);
        // refund dust eth, if any
        if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);
    }

    // **** REMOVE LIQUIDITY ****
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
        address pair = ExcavoLibrary.pairFor(factory, tokenA, tokenB);
        IExcavoPair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair
        (uint amount0, uint amount1) = IExcavoPair(pair).burn(to);
        (address token0,) = ExcavoLibrary.sortTokens(tokenA, tokenB);
        (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);
        require(amountA >= amountAMin, 'ExcavoRouter: INSUFFICIENT_A_AMOUNT');
        require(amountB >= amountBMin, 'ExcavoRouter: INSUFFICIENT_B_AMOUNT');
    }
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {
        (amountToken, amountETH) = removeLiquidity(
            token,
            WETH,
            liquidity,
            amountTokenMin,
            amountETHMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, amountToken);
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(to, amountETH);
    }

    // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountETH) {
        (, amountETH) = removeLiquidity(
            token,
            WETH,
            liquidity,
            amountTokenMin,
            amountETHMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, IERC20(token).balanceOf(address(this)));
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(to, amountETH);
    }
    // function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
    //     address token,
    //     uint liquidity,
    //     uint amountTokenMin,
    //     uint amountETHMin,
    //     address to,
    //     uint deadline,
    //     bool approveMax, uint8 v, bytes32 r, bytes32 s
    // ) external virtual override returns (uint amountETH) {
    //     // address pair = ExcavoLibrary.pairFor(factory, token, WETH);
    //     // uint value = approveMax ? uint(-1) : liquidity;
    //     // IExcavoPair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
    //     // amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(
    //     //     token, liquidity, amountTokenMin, amountETHMin, to, deadline
    //     // );
    // }

    // **** SWAP ****
    // requires the initial amount to have already been sent to the first pair
    function _swap(uint[] memory amounts, address[] memory path, address _to, uint discount) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0,) = ExcavoLibrary.sortTokens(input, output);
            uint amountOut = amounts[i + 1];
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
            address to = i < path.length - 2 ? ExcavoLibrary.pairFor(factory, output, path[i + 2]) : _to;
            
            IExcavoPair(ExcavoLibrary.pairFor(factory, input, output)).swap(
                amount0Out, amount1Out, to, new bytes(0), discount
            );
        }
    }
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        amounts = ExcavoLibrary.getAmountsOut(factory, amountIn, path, discount);
        require(amounts[amounts.length - 1] >= amountOutMin, 'ExcavoRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, ExcavoLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to, discount);
    }
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        amounts = ExcavoLibrary.getAmountsIn(factory, amountOut, path, discount);
        require(amounts[0] <= amountInMax, 'ExcavoRouter: EXCESSIVE_INPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, ExcavoLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to, discount);
    }
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        payable 
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[0] == WETH, 'ExcavoRouter: INVALID_PATH');
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        amounts = ExcavoLibrary.getAmountsOut(factory, msg.value, path, discount);
        require(amounts[amounts.length - 1] >= amountOutMin, 'ExcavoRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        IWETH(WETH).deposit{value: amounts[0]}();
        assert(IWETH(WETH).transfer(ExcavoLibrary.pairFor(factory, path[0], path[1]), amounts[0]));
        _swap(amounts, path, to, discount);
    }
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        virtual
        override 
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WETH, 'ExcavoRouter: INVALID_PATH');
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        amounts = ExcavoLibrary.getAmountsIn(factory, amountOut, path, discount);
        require(amounts[0] <= amountInMax, 'ExcavoRouter: EXCESSIVE_INPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, ExcavoLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this), discount);
        IWETH(WETH).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
    }
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override 
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WETH, 'ExcavoRouter: INVALID_PATH');
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        amounts = ExcavoLibrary.getAmountsOut(factory, amountIn, path, discount);
        require(amounts[amounts.length - 1] >= amountOutMin, 'ExcavoRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, ExcavoLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this), discount);
        IWETH(WETH).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
    }
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        payable 
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[0] == WETH, 'ExcavoRouter: INVALID_PATH');
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        amounts = ExcavoLibrary.getAmountsIn(factory, amountOut, path, discount);
        require(amounts[0] <= msg.value, 'ExcavoRouter: EXCESSIVE_INPUT_AMOUNT');
        IWETH(WETH).deposit{value: amounts[0]}();
        assert(IWETH(WETH).transfer(ExcavoLibrary.pairFor(factory, path[0], path[1]), amounts[0]));
        _swap(amounts, path, to, discount);
        // refund dust eth, if any
        if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);
    }

    // **** SWAP (supporting fee-on-transfer tokens) ****
    // requires the initial amount to have already been sent to the first pair
    function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to, uint k) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            {
            //(address input, address output) = (path[i], path[i + 1]);
            (address token0,) = ExcavoLibrary.sortTokens(path[i], path[i + 1]);
            IExcavoPair pair = IExcavoPair(ExcavoLibrary.pairFor(factory, path[i], path[i + 1]));
            uint amountInput;
            uint amountOutput;
            { // scope to avoid stack too deep errors
            (uint reserve0, uint reserve1,) = pair.getReserves();
            (uint reserveInput, uint reserveOutput) = path[i] == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
            amountInput = IERC20(path[i]).balanceOf(address(pair)).sub(reserveInput);
            amountOutput = ExcavoLibrary.getAmountOut(amountInput, reserveInput, reserveOutput, k);
            }

            {
            (uint amount0Out, uint amount1Out) = path[i] == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));
            address to = i < path.length - 2 ? ExcavoLibrary.pairFor(factory, path[i + 1], path[i + 2]) : _to;
            pair.swap(amount0Out, amount1Out, to, new bytes(0), k);
            }
            }
        }
    }

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) {
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, ExcavoLibrary.pairFor(factory, path[0], path[1]), amountIn
        );
        uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to);
        {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        _swapSupportingFeeOnTransferTokens(path, to, discount);
        }
        require(
            IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
            'ExcavoRouter: INSUFFICIENT_OUTPUT_AMOUNT'
        );
    }
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    )
        external
        virtual
        override
        payable 
        ensure(deadline)
    {
        require(path[0] == WETH, 'ExcavoRouter: INVALID_PATH');
        uint amountIn = msg.value;
        IWETH(WETH).deposit{value: amountIn}();
        assert(IWETH(WETH).transfer(ExcavoLibrary.pairFor(factory, path[0], path[1]), amountIn));
        uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to);
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        _swapSupportingFeeOnTransferTokens(path, to, discount);
        require(
            IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
            'ExcavoRouter: INSUFFICIENT_OUTPUT_AMOUNT'
        );
    }
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    )
        external
        virtual
        override 
        ensure(deadline)
    {
        require(path[path.length - 1] == WETH, 'ExcavoRouter: INVALID_PATH');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, ExcavoLibrary.pairFor(factory, path[0], path[1]), amountIn
        );
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        _swapSupportingFeeOnTransferTokens(path, address(this), discount);
        uint amountOut = IERC20(WETH).balanceOf(address(this));
        require(amountOut >= amountOutMin, 'ExcavoRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        IWETH(WETH).withdraw(amountOut);
        TransferHelper.safeTransferETH(to, amountOut);
    }

    // **** LIBRARY FUNCTIONS ****
    function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
        return ExcavoLibrary.quote(amountA, reserveA, reserveB);
    }

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        public
        view
        virtual
        override
        returns (uint amountOut)
    {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        return ExcavoLibrary.getAmountOut(amountIn, reserveIn, reserveOut, discount);
    }

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
        public
        view
        virtual
        override
        returns (uint amountIn)
    {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        return ExcavoLibrary.getAmountIn(amountOut, reserveIn, reserveOut, discount);
    }

    function getAmountsOut(uint amountIn, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        return ExcavoLibrary.getAmountsOut(factory, amountIn, path, discount);
    }

    function getAmountsIn(uint amountOut, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        uint discount = TraderDiscount.calculateDiscount(ICAVO(CAVO).virtualBalanceOf(msg.sender));
        
        return ExcavoLibrary.getAmountsIn(factory, amountOut, path, discount);
    }
}

File 40 of 51 : IExcavoRouter.sol
pragma solidity >=0.6.6;

interface IExcavoRouter {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);
    function CAVO() external view returns (address);
    
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    // function removeLiquidityWithPermit(
    //     address tokenA,
    //     address tokenB,
    //     uint liquidity,
    //     uint amountAMin,
    //     uint amountBMin,
    //     address to,
    //     uint deadline,
    //     bool approveMax, uint8 v, bytes32 r, bytes32 s
    // ) external returns (uint amountA, uint amountB);
    // function removeLiquidityETHWithPermit(
    //     address token,
    //     uint liquidity,
    //     uint amountTokenMin,
    //     uint amountETHMin,
    //     address to,
    //     uint deadline,
    //     bool approveMax, uint8 v, bytes32 r, bytes32 s
    // ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external view returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external view returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);

    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;
}

File 41 of 51 : TraderDiscount.sol
pragma solidity >=0.6.6;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

import '../interfaces/IERC20.sol';

library TraderDiscount {
    function calculateDiscount(uint tokenAmount) internal pure returns (uint k)  {
        k = 4;
        tokenAmount = tokenAmount / (10 ** 18);
        if (tokenAmount < 1 ) {
            k = 10;
        } else if (tokenAmount >= 1 && tokenAmount <= 5) {
            k = 9;
        } else if (tokenAmount > 5 && tokenAmount <= 10) {
            k = 8;
        } else if (tokenAmount > 10 && tokenAmount <= 20) {
            k = 7;
        } else if (tokenAmount > 20 && tokenAmount <= 50) {
            k = 6;
        } else if (tokenAmount > 50 && tokenAmount <= 100) {
            k = 5;
        }
    }
}

File 42 of 51 : IWETH.sol
pragma solidity >=0.6.6;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 43 of 51 : TestExcavoRouter02.sol
pragma solidity >=0.6.6;

import '../ExcavoRouter.sol';

contract TestExcavoRouter is ExcavoRouter {
    constructor(address _factory, address _WETH, address _xCAVO) public ExcavoRouter(_factory, _WETH, _xCAVO) {}

    function testSwap(address pair, uint amount0Out, uint amount1Out, address to, bytes calldata data, uint k) external {
        IExcavoPair(pair).swap(amount0Out, amount1Out, to, data, k);
    }
}

File 44 of 51 : ExcavoFactory.sol
pragma solidity >=0.6.6;

import './interfaces/IExcavoFactory.sol';
import './interfaces/IEXCV.sol';
import './interfaces/ICAVO.sol';
import './ExcavoPair.sol';

contract ExcavoFactory is IExcavoFactory {
    address public immutable override EXCVToken;
    address public immutable override CAVOToken;
    address public immutable override WETHToken;
    address public immutable override feeToSetter;

    address public override router;
    // TODO: Remove
    bytes32 public immutable getCreationCode;

    mapping(address => mapping(address => address)) public override getPair;
    address[] public override allPairs;

    constructor(address _CAVO, address _EXCV, address _WETH) public {
        feeToSetter = msg.sender;
        CAVOToken = _CAVO;
        EXCVToken = _EXCV;
        WETHToken = _WETH;
        getCreationCode = keccak256(type(ExcavoPair).creationCode);
    }

    function allPairsLength() external view override returns (uint) {
        return allPairs.length;
    }

    function createPair(address tokenA, address tokenB) external override returns (address pair) {
        require(tokenA != tokenB, 'Excavo: FORBIDDEN');
        require(router != address(0), 'Excavo: ROUTER_NOT_SET');
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'Excavo: ZERO_ADDRESS');
        require(getPair[token0][token1] == address(0), 'Excavo: PAIR_EXISTS'); // single check is sufficient
        bytes memory bytecode = type(ExcavoPair).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        assembly {
            pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }

        IExcavoPair(pair).initialize(token0, token1, router);
       
        if ((token0 == CAVOToken || token1 == CAVOToken) && (token0 == WETHToken || token1 == WETHToken)) {
            // enable CAVO farming for CAVO/ETH pair only
            IExcavoPair(pair).setCAVO(CAVOToken, ICAVO(CAVOToken).xCAVOToken());
        } else if ((token0 == EXCVToken || token1 == EXCVToken) && (token0 == WETHToken || token1 == WETHToken)) {
            // enable xCAVO contract permissions for EXCV/ETH pair only
            IExcavoPair(pair).setCAVO(address(0), ICAVO(CAVOToken).xCAVOToken());
        }
        
        getPair[token0][token1] = pair;
        getPair[token1][token0] = pair; // populate mapping in the reverse direction
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

    function initialize(address _router) external override {
        require(msg.sender == feeToSetter && router == address(0), 'Excavo: FORBIDDEN');
        router = _router;
    }
}

File 45 of 51 : ExcavoOracleLibrary.sol
pragma solidity >=0.6.6;

import '../interfaces/IExcavoPair.sol';
import './FixedPoint.sol';

// library with helper methods for oracles that are concerned with computing average prices
library ExcavoOracleLibrary {
    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 (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {
        blockTimestamp = currentBlockTimestamp();
        price0Cumulative = IExcavoPair(pair).price0CumulativeLast();
        price1Cumulative = IExcavoPair(pair).price1CumulativeLast();

        // if time has elapsed since the last update on the pair, mock the accumulated price values
        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IExcavoPair(pair).getReserves();
        if (blockTimestampLast != blockTimestamp) {
            // subtraction overflow is desired
            uint32 timeElapsed = blockTimestamp - blockTimestampLast;
            // addition overflow is desired
            // counterfactual
            price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
            // counterfactual
            price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
        }
    }
}

File 46 of 51 : FixedPoint.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

import './Babylonian.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 {
        uint _x;
    }

    uint8 private constant RESOLUTION = 112;
    uint private constant Q112 = uint(1) << RESOLUTION;
    uint private constant Q224 = Q112 << RESOLUTION;

    // 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);
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {
        require(x != 0, 'FixedPoint: DIV_BY_ZERO');
        return uq112x112(self._x / uint224(x));
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    // reverts on overflow
    function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) {
        uint z;
        require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW");
        return uq144x112(z);
    }

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // equivalent to encode(numerator).div(denominator)
    function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
        return uq112x112((uint224(numerator) << RESOLUTION) / denominator);
    }

    // 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);
    }

    // take the reciprocal of a UQ112x112
    function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        require(self._x != 0, 'FixedPoint: ZERO_RECIPROCAL');
        return uq112x112(uint224(Q224 / self._x));
    }

    // square root of a UQ112x112
    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
    }
}

File 47 of 51 : Babylonian.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
library Babylonian {
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
        // else z = 0
    }
}

File 48 of 51 : FixedPointTest.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;
pragma experimental ABIEncoderV2;

import "../libraries/FixedPoint.sol";

contract FixedPointTest {
    function encode(uint112 x) external pure returns (FixedPoint.uq112x112 memory) {
        return FixedPoint.encode(x);
    }

    function encode144(uint144 x) external pure returns (FixedPoint.uq144x112 memory) {
        return FixedPoint.encode144(x);
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function div(FixedPoint.uq112x112 calldata self, uint112 y) external pure returns (FixedPoint.uq112x112 memory) {
        return FixedPoint.div(self, y);
    }

    function fraction(uint112 numerator, uint112 denominator) external pure returns (FixedPoint.uq112x112 memory) {
        return FixedPoint.fraction(numerator, denominator);
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    function mul(FixedPoint.uq112x112 calldata self, uint y) external pure returns (FixedPoint.uq144x112 memory) {
        return FixedPoint.mul(self, y);
    }

    // decode a UQ112x112 in a uint container into a uint by truncating after the radix point
    function decode(FixedPoint.uq112x112 calldata self) external pure returns (uint112) {
        return FixedPoint.decode(self);
    }

    function decode144(FixedPoint.uq144x112 calldata self) external pure returns (uint144) {
        return FixedPoint.decode144(self);
    }

    function reciprocal(FixedPoint.uq112x112 calldata self) external pure returns (FixedPoint.uq112x112 memory) {
        return FixedPoint.reciprocal(self);
    }

    function sqrt(FixedPoint.uq112x112 calldata self) external pure returns (FixedPoint.uq112x112 memory) {
        return FixedPoint.sqrt(self);
    }
}

File 49 of 51 : BabylonianTest.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

import '../libraries/Babylonian.sol';

// used for testing the logic of token naming
contract BabylonianTest {
    function sqrt(uint num) public pure returns (uint)  {
        return Babylonian.sqrt(num);
    }
}

File 50 of 51 : TransferHelperTest.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.6;

import '../libraries/TransferHelper.sol';

// test helper for transfers
contract TransferHelperTest {
    function safeApprove(address token, address to, uint value) external {
        TransferHelper.safeApprove(token, to, value);
    }

    function safeTransfer(address token, address to, uint value) external {
        TransferHelper.safeTransfer(token, to, value);
    }

    function safeTransferFrom(address token, address from, address to, uint value) external {
        TransferHelper.safeTransferFrom(token, from, to, value);
    }

    function safeTransferETH(address to, uint value) external {
        TransferHelper.safeTransferETH(to, value);
    }
}

// can revert on failure and returns true if successful
contract TransferHelperTestFakeERC20Compliant {
    bool public success;
    bool public shouldRevert;

    function setup(bool success_, bool shouldRevert_) public {
        success = success_;
        shouldRevert = shouldRevert_;
    }

    function transfer(address, uint256) public view returns (bool) {
        require(!shouldRevert, 'REVERT');
        return success;
    }

    function transferFrom(address, address, uint256) public view returns (bool) {
        require(!shouldRevert, 'REVERT');
        return success;
    }

    function approve(address, uint256) public view returns (bool) {
        require(!shouldRevert, 'REVERT');
        return success;
    }
}

// only reverts on failure, no return value
contract TransferHelperTestFakeERC20Noncompliant {
    bool public shouldRevert;

    function setup(bool shouldRevert_) public {
        shouldRevert = shouldRevert_;
    }

    function transfer(address, uint256) view public {
        require(!shouldRevert);
    }

    function transferFrom(address, address, uint256) view public {
        require(!shouldRevert);
    }

    function approve(address, uint256) view public {
        require(!shouldRevert);
    }
}

contract TransferHelperTestFakeFallback {
    bool public shouldRevert;

    function setup(bool shouldRevert_) public {
        shouldRevert = shouldRevert_;
    }

    receive() external payable {
        require(!shouldRevert);
    }
}

File 51 of 51 : RouterEventEmitter.sol
pragma solidity >=0.6.6;

import '../interfaces/IExcavoRouter.sol';

contract RouterEventEmitter {
    event Amounts(uint[] amounts);

    receive() external payable {}

    function swapExactTokensForTokens(
        address router,
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external {
        (bool success, bytes memory returnData) = router.delegatecall(abi.encodeWithSelector(
            IExcavoRouter(router).swapExactTokensForTokens.selector, amountIn, amountOutMin, path, to, deadline
        ));
        assert(success);
        emit Amounts(abi.decode(returnData, (uint[])));
    }

    function swapTokensForExactTokens(
        address router,
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external {
        (bool success, bytes memory returnData) = router.delegatecall(abi.encodeWithSelector(
            IExcavoRouter(router).swapTokensForExactTokens.selector, amountOut, amountInMax, path, to, deadline
        ));
        assert(success);
        emit Amounts(abi.decode(returnData, (uint[])));
    }

    function swapExactETHForTokens(
        address router,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable {
        (bool success, bytes memory returnData) = router.delegatecall(abi.encodeWithSelector(
            IExcavoRouter(router).swapExactETHForTokens.selector, amountOutMin, path, to, deadline
        ));
        assert(success);
        emit Amounts(abi.decode(returnData, (uint[])));
    }

    function swapTokensForExactETH(
        address router,
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external {
        (bool success, bytes memory returnData) = router.delegatecall(abi.encodeWithSelector(
            IExcavoRouter(router).swapTokensForExactETH.selector, amountOut, amountInMax, path, to, deadline
        ));
        assert(success);
        emit Amounts(abi.decode(returnData, (uint[])));
    }

    function swapExactTokensForETH(
        address router,
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external {
        (bool success, bytes memory returnData) = router.delegatecall(abi.encodeWithSelector(
            IExcavoRouter(router).swapExactTokensForETH.selector, amountIn, amountOutMin, path, to, deadline
        ));
        assert(success);
        emit Amounts(abi.decode(returnData, (uint[])));
    }

    function swapETHForExactTokens(
        address router,
        uint amountOut,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable {
        (bool success, bytes memory returnData) = router.delegatecall(abi.encodeWithSelector(
            IExcavoRouter(router).swapETHForExactTokens.selector, amountOut, path, to, deadline
        ));
        assert(success);
        emit Amounts(abi.decode(returnData, (uint[])));
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PrivateDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PrivateDistributionInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PublicDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PublicPresalePurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TeamDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"CREATOR_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXCVToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"availablePrivatePresaleAmountOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"availablePublicPresaleAmountOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"availableTeamMemberAmountOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"editDistributed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"privatePresaleClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"privatePresaleDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"publicPresaleClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPrivatePresaleDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPublicPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPublicPresaleDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTeamDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"teamMemberClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalPrivatePresaleDistribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTeamDistribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"virtualBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xCAVOToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101c060405273381657fde9bfe7558837757ac54249ef748cacb760c090815273564569020c298d2487445cca5c5ef3ed8cd408a360e05273dfe2abc3d395a87a1476f5b707e77f5f23b1d88b61010052738cf3329e378c6196f35f5cb7eea5040873f8ac8c61012052738b9a2b2d9a41909d613c81f2f344e364cd62b63c610140527357b93a6b8954938de455be95c9aa7843b99d7dea6101605273f0393fb1e988317ca6e3fb986874d019de712c7d6101805273698f4a1f42c3601579a3e40a9e4d90c2032c443a6101a052620000dd90601990600862000731565b506040805161010081018252690878678326eac9000000808252602082015269032d26d12e980b6000009181019190915269021e19e0c9bab240000060608201819052690a968163f0a57b400000608083015269065a4da25d3016c0000060a083015260c082015269010f0cf064dd5920000060e08201526200016590601a9060086200079b565b503480156200017357600080fd5b5061b1bc6019805480602002602001604051908101604052809291908181526020018280548015620001cf57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311620001b0575b5050505050601a8054806020026020016040519081016040528092919081815260200182805480156200022257602002820191906000526020600020905b8154815260200190600101908083116200020d575b5050600160005550505033606081901b60805261b1bc90684f303e02039e9680009073ab96c12881a2e9ffa6706ae68bcfa4ecd1a8bf2190839081906200027c90681158e460913d0000006001600160e01b036200050e16565b60609290921b6001600160601b03191660a052600d805463ffffffff1990811663ffffffff9384161790915560089290925560118054909216931692909217909155601255805182511462000318576040805162461bcd60e51b815260206004820181905260248201527f5465616d446973747269627574696f6e3a20494e56414c49445f504152414d53604482015290519081900360640190fd5b6000805b8351811015620003b4578281815181106200033357fe5b6020026020010151601560010160008684815181106200034f57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550620003a98382815181106200038c57fe5b6020026020010151836200060c60201b62000ac11790919060201c565b91506001016200031c565b5060145550506018805463ffffffff191663ffffffff929092169190911790556040516000908190606090620003ed60208201620007f2565b6020820181038252601f19601f820116604052509050606060405180602001620004179062000800565b601f1982820381018352601f90910116604081815264784341564f60d81b602083810191909152815180840360050181526025840183528051908201206322ac21ab60e11b604585015282516029818603018152604990940190925282519281019290922085519394509092909183919086016000f59550808351602085016000f5600180546001600160a01b03199081166001600160a01b038a8116919091179092556002805490911691831691909117905560125460145491965062000502913091620004f391906200060c602090811b62000ac117901c565b6001600160e01b036200050e16565b50505050505062000855565b62000522826001600160e01b036200066b16565b600062000560826200054f60035469d3c21bcecceda1000000620006be60201b620021461790919060201c565b6200071760201b620021b81760201c565b90506200057e816003546200060c60201b62000ac11790919060201c565b6003556001600160a01b038316600090815260046020908152604090912054620005b391839062000ac16200060c821b17901c565b6001600160a01b03841660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b8082018281101562000665576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b6001600160a01b038116600090815260076020526040902054430315620006bb576001600160a01b0381166000908152600460209081526040808320546006835281842055600790915290204390555b50565b8082038281111562000665576040805162461bcd60e51b815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b60008183106200072857816200072a565b825b9392505050565b82805482825590600052602060002090810192821562000789579160200282015b828111156200078957825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000752565b50620007979291506200080e565b5090565b828054828255906000526020600020908101928215620007e4579160200282015b82811115620007e457825182906001600160501b0316905591602001919060010190620007bc565b506200079792915062000838565b611653806200312883390190565b612ac0806200477b83390190565b6200083591905b80821115620007975780546001600160a01b031916815560010162000815565b90565b6200083591905b808211156200079757600081556001016200083f565b60805160601c60a05160601c61289a6200088e6000398061034f5280611af9525080610d2a5280611a595280611bb7525061289a6000f3fe6080604052600436106102025760003560e01c80635ceb139b1161011d5780639c89a10a116100b0578063cb7423581161007f578063dd62ed3e11610064578063dd62ed3e14610a24578063ea44539614610a6c578063f2ae927414610aac57610413565b8063cb742358146109cf578063d6a42d8514610a0f57610413565b80639c89a10a1461091f578063a9059cbb14610934578063c4d66de81461097a578063c836a489146109ba57610413565b806370a08231116100ec57806370a08231146108b5578063861a48dd146108f557806390996b2d1461090a57806395d89b411461049e57610413565b80635ceb139b146108375780636656d736146108615780636b2b3bf3146108765780636cb74849146108a057610413565b80632929abe61161019557806332cb6b0c1161016457806332cb6b0c14610772578063371139581461078757806340c10f19146107b15780635ca2a92d146107f757610413565b80632929abe61461064e5780632a455d791461071d5780632d13535714610732578063313ce5671461074757610413565b8063095ea7b3116101d1578063095ea7b31461054f57806318160ddd146105a957806319aef059146105be57806323b872dd146105fe57610413565b806302d05d3f14610418578063065e6eb71461045657806306fdde031461049e57806308ab59761461052857610413565b36610413576002600054141561027957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560095443108015906102a357506008546009546102a09163ffffffff610ac116565b43105b61030e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5075626c696350726573616c653a20494e414354495645000000000000000000604482015290519081900360640190fd5b6000610332603261032634606463ffffffff610b3916565b9063ffffffff610bbf16565b60405190915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016903480156108fc02916000818181858888f19350505050158015610397573d6000803e3d6000fd5b506103a23082610c40565b336000908152600b60205260409020546103c2908263ffffffff610ac116565b336000818152600b6020908152604091829020939093558051848152905191927fc397d7d9ef7c1875b142a11050c810d23e0965e3c5ea3bb28dc1c9d2032e146592918290030190a2506001600055005b600080fd5b34801561042457600080fd5b5061042d610d28565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561046257600080fd5b5061049c6004803603604081101561047957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610d4c565b005b3480156104aa57600080fd5b506104b3611007565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104ed5781810151838201526020016104d5565b50505050905090810190601f16801561051a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053457600080fd5b5061053d611040565b60408051918252519081900360200190f35b34801561055b57600080fd5b506105956004803603604081101561057257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611046565b604080519115158252519081900360200190f35b3480156105b557600080fd5b5061053d61105c565b3480156105ca57600080fd5b5061053d600480360360208110156105e157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611062565b34801561060a57600080fd5b506105956004803603606081101561062157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561107d565b34801561065a57600080fd5b5061049c6004803603604081101561067157600080fd5b81019060208101813564010000000081111561068c57600080fd5b82018360208201111561069e57600080fd5b803590602001918460208302840111640100000000831117156106c057600080fd5b9193909290916020810190356401000000008111156106de57600080fd5b8201836020820111156106f057600080fd5b8035906020019184602083028401116401000000008311171561071257600080fd5b50909250905061115c565b34801561072957600080fd5b5061053d61156e565b34801561073e57600080fd5b5061042d61157b565b34801561075357600080fd5b5061075c611597565b6040805160ff9092168252519081900360200190f35b34801561077e57600080fd5b5061053d61159c565b34801561079357600080fd5b5061049c600480360360208110156107aa57600080fd5b50356115aa565b3480156107bd57600080fd5b5061049c600480360360408110156107d457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611670565b34801561080357600080fd5b5061053d6004803603602081101561081a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611780565b34801561084357600080fd5b5061049c6004803603602081101561085a57600080fd5b5035611793565b34801561086d57600080fd5b5061053d611859565b34801561088257600080fd5b5061049c6004803603602081101561089957600080fd5b503561185f565b3480156108ac57600080fd5b5061049c611925565b3480156108c157600080fd5b5061053d600480360360208110156108d857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166119ad565b34801561090157600080fd5b5061049c6119bf565b34801561091657600080fd5b5061053d611af1565b34801561092b57600080fd5b5061042d611af7565b34801561094057600080fd5b506105956004803603604081101561095757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611b1b565b34801561098657600080fd5b5061049c6004803603602081101561099d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611b28565b3480156109c657600080fd5b5061042d611e24565b3480156109db57600080fd5b5061053d600480360360208110156109f257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611e40565b348015610a1b57600080fd5b5061049c611ebc565b348015610a3057600080fd5b5061053d60048036036040811015610a4757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611fcd565b348015610a7857600080fd5b5061053d60048036036020811015610a8f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611fea565b348015610ab857600080fd5b5061049c611ffd565b80820182811015610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b6000811580610b5457505080820282828281610b5157fe5b04145b610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b6000808211610c2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610c3857fe5b049392505050565b610c49826120da565b6000610c7382610c6e60035469d3c21bcecceda100000061214690919063ffffffff16565b6121b8565b600354909150610c89908263ffffffff610ac116565b60035573ffffffffffffffffffffffffffffffffffffffff8316600090815260046020526040902054610cc2908263ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff841660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60026000541415610dbe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055601054158015610e5b57503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e1657600080fd5b505af1158015610e2a573d6000803e3d6000fd5b505050506040513d6020811015610e4057600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b610ec657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072697661746550726573616c653a20464f5242494444454e00000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600f6020526040812054601354610f10918491610f049163ffffffff61214616565b9063ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600f60205260409020839055601254909150811115610fac57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a204c494d49545f45584345454445440000604482015290519081900360640190fd5b601381905560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fbe03476e65e5189c31bd84cd775900e0b2cd200157a96ac8dfbdef41ebde5111919081900360200190a25050600160005550565b6040518060400160405280600481526020017f4341564f0000000000000000000000000000000000000000000000000000000081525081565b60145481565b60006110533384846121d0565b50600192915050565b60035481565b6000611075600a8363ffffffff61223f16565b90505b919050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146111475773ffffffffffffffffffffffffffffffffffffffff84166000908152600560209081526040808320338452909152902054611115908363ffffffff61214616565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083203384529091529020555b6111528484846123a4565b5060019392505050565b600260005414156111ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000819055503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561121e57600080fd5b505af1158015611232573d6000803e3d6000fd5b505050506040513d602081101561124857600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633146112cd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072697661746550726573616c653a20464f5242494444454e00000000000000604482015290519081900360640190fd5b82811461133b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a20494e56414c49445f4c454e4754480000604482015290519081900360640190fd5b60135460005b848110156114ee5760006113da85858481811061135a57fe5b90506020020135600e60010160008a8a8781811061137457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ac190919063ffffffff16565b905080600f60008989868181106113ed57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061146d85858481811061145757fe5b9050602002013584610ac190919063ffffffff16565b925086868381811061147b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fbe03476e65e5189c31bd84cd775900e0b2cd200157a96ac8dfbdef41ebde5111826040518082815260200191505060405180910390a250600101611341565b5060125481111561156057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a204c494d49545f45584345454445440000604482015290519081900360640190fd5b601355505060016000555050565b681158e460913d00000081565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b601281565b69d3c21bcecceda100000081565b6002600054141561161c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055611632600e8263ffffffff61249716565b60408051828152905133917fb03c8c81bb6d72dee6ebce4af4bb86d2e26c4bca834f3336ad1ab65bcb106501919081900360200190a2506001600055565b600260005414156116e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560015473ffffffffffffffffffffffffffffffffffffffff16331461176d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f45786361766f3a20464f5242494444454e000000000000000000000000000000604482015290519081900360640190fd5b6117778282610c40565b50506001600055565b600061107560158363ffffffff61223f16565b6002600054141561180557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005561181b600a8263ffffffff61249716565b60408051828152905133917f1f003ee3725820392d2b4856070622ffd741edb3e27990d39f2a187f4dc0170b919081900360200190a2506001600055565b60135481565b600260005414156118d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556118e760158263ffffffff61249716565b60408051828152905133917fdb368e38c472e99d6c54fb15b254413b586036601f2031cf705d2b488a25f850919081900360200190a2506001600055565b6002600054141561199757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556119a66015612552565b6001600055565b60046020526000908152604090205481565b60026000541415611a3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055600954158015611a7b57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b611ae657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5075626c696350726573616c653a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b436009556001600055565b60125481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006110533384846123a4565b60026000541415611b9a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148015611c8e5750600254604080517fc45a0155000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163c45a0155916004808301926020929190829003018186803b158015611c4a57600080fd5b505afa158015611c5e573d6000803e3d6000fd5b505050506040513d6020811015611c7457600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16145b611cf957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f455843563a20464f5242494444454e0000000000000000000000000000000000604482015290519081900360640190fd5b600254604080517fc4d66de800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529151919092169163c4d66de891602480830192600092919082900301818387803b158015611d6d57600080fd5b505af1158015611d81573d6000803e3d6000fd5b5050600154600254604080517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301529283166024820152905191909216935063485cc9559250604480830192600092919082900301818387803b158015611e0457600080fd5b505af1158015611e18573d6000803e3d6000fd5b50506001600055505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460209081526040808320546007909252822054430315611e7f579050611078565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902054808210611eb25780611eb4565b815b949350505050565b60026000541415611f2e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560095415801590611f585750600854600954611f549163ffffffff610ac116565b4310155b611fc357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5075626c696350726573616c653a20494e56414c49445f504152414d53000000604482015290519081900360640190fd5b6119a6600a612552565b600560209081526000928352604080842090915290825290205481565b6000611075600e8363ffffffff61223f16565b6002600054141561206f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055601254601354146120d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061283e6027913960400191505060405180910390fd5b6119a6600e612552565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260409020544303156121435773ffffffffffffffffffffffffffffffffffffffff81166000908152600460209081526040808320546006835281842055600790915290204390555b50565b80820382811115610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b60008183106121c757816121c9565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000826002015460001480612258575082600201544311155b80612288575073ffffffffffffffffffffffffffffffffffffffff82166000908152600184016020526040902054155b1561229557506000610b33565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001840160205260408120546122d59060649061032690600a63ffffffff610b3916565b600385015473ffffffffffffffffffffffffffffffffffffffff851660009081526001870160205260408120549293509161232b9163ffffffff9081169161231f918690610bbf16565b9063ffffffff610b3916565b73ffffffffffffffffffffffffffffffffffffffff85166000908152602087905260409020546003870154600288015492935061239b9261238f91869161231f9163ffffffff908116916103269186906123899083908c90610ac116565b436121b8565b9063ffffffff61214616565b95945050505050565b6123ad836120da565b6123b6826120da565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600460205260409020546123ec908263ffffffff61214616565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260046020526040808220939093559084168152205461242e908263ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6124a1823361223f565b81111561250f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f446973747269627574696f6e4c6962726172793a204f56455244524146540000604482015290519081900360640190fd5b3360009081526020839052604090205461252f908263ffffffff610ac116565b3360008181526020859052604090209190915561254e90309083612660565b5050565b60028101541580156125ec57503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156125a757600080fd5b505af11580156125bb573d6000803e3d6000fd5b505050506040513d60208110156125d157600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b61265757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f446973747269627574696f6e4c6962726172793a20464f5242494444454e0000604482015290519081900360640190fd5b43600290910155565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061273657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126f9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612798576040519150601f19603f3d011682016040523d82523d6000602084013e61279d565b606091505b50915091508180156127cb5750805115806127cb57508080602001905160208110156127c857600080fd5b50515b61283657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b505050505056fe5072697661746550726573616c653a20444953545249425554494f4e5f554e46494e4953484544a2646970667358221220ba9fcfb51b0b0aed1f6f38b2dbddbb608fe5ecd1e385b1b61e5829dd8e57966664736f6c6343000606003360a060405234801561001057600080fd5b5060016000553360601b60805260805160601c61160561004e60003980610496528061062452806107d9528061086b5280610d3d52506116056000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c806370a08231116100b2578063a9059cbb11610081578063d293f98711610066578063d293f98714610389578063dd62ed3e14610391578063e0158f39146103cc57610136565b8063a9059cbb146101b8578063afff6a2c1461038157610136565b806370a08231146102fe57806395a2251f1461033157806395d89b411461013b578063a0712d681461036457610136565b806323b872dd11610109578063485cc955116100ee578063485cc955146102b15780635e6cd6bf146102ee5780636d02aba9146102f657610136565b806323b872dd14610250578063313ce5671461029357610136565b806306fdde031461013b578063095ea7b3146101b857806313d4fab61461020557806318160ddd14610236575b600080fd5b6101436103d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017d578181015183820152602001610165565b50505050905090810190601f1680156101aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f1600480360360408110156101ce57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561040d565b604080519115158252519081900360200190f35b61020d610476565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61023e610492565b60408051918252519081900360200190f35b6101f16004803603606081101561026657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561040d565b61029b61052b565b6040805160ff9092168252519081900360200190f35b6102ec600480360360408110156102c757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610530565b005b61020d61084d565b61020d610869565b61023e6004803603602081101561031457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661088d565b6102ec6004803603602081101561034757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610a24565b6102ec6004803603602081101561037a57600080fd5b5035610df3565b61023e611022565b6102ec611028565b61023e600480360360408110156103a757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661040d565b61020d611141565b6040518060400160405280600581526020017f784341564f00000000000000000000000000000000000000000000000000000081525081565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f784341564f3a20464f5242494444454e000000000000000000000000000000006044820152905160009181900360640190fd5b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fa57600080fd5b505afa15801561050e573d6000803e3d6000fd5b505050506040513d602081101561052457600080fd5b5051905090565b601281565b600260005414156105a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560035473ffffffffffffffffffffffffffffffffffffffff161580156105e3575060015473ffffffffffffffffffffffffffffffffffffffff16155b8015610605575060025473ffffffffffffffffffffffffffffffffffffffff16155b801561064657503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b6106b157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f784341564f3a20464f5242494444454e00000000000000000000000000000000604482015290519081900360640190fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008273ffffffffffffffffffffffffffffffffffffffff16634b2f336d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561073a57600080fd5b505afa15801561074e573d6000803e3d6000fd5b505050506040513d602081101561076457600080fd5b505160035490915061078e90849073ffffffffffffffffffffffffffffffffffffffff168361115d565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790556107fe837f00000000000000000000000000000000000000000000000000000000000000008361115d565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790555050600160005550565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff80821660009081526005602090815260408083205460015482517f8a0b8dd80000000000000000000000000000000000000000000000000000000081529251949586959294911692638a0b8dd89260048083019392829003018186803b15801561090b57600080fd5b505afa15801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b505103905080610949576000915050610a1f565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526004602081815260408084205460065460015483517fb4899fc700000000000000000000000000000000000000000000000000000000815295860197909752915191039593949093169263b4899fc7926024808201939291829003018186803b1580156109d257600080fd5b505afa1580156109e6573d6000803e3d6000fd5b505050506040513d60208110156109fc57600080fd5b5051905082610a11828463ffffffff61124816565b81610a1857fe5b0493505050505b919050565b60026000541415610a9657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155600154604080517fe85a8934000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff9092169163e85a89349160248082019260209290919082900301818787803b158015610b0f57600080fd5b505af1158015610b23573d6000803e3d6000fd5b505050506040513d6020811015610b3957600080fd5b5051600154604080517f5b383411000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff90921691635b38341191600480820192602092909190829003018186803b158015610bac57600080fd5b505afa158015610bc0573d6000803e3d6000fd5b505050506040513d6020811015610bd657600080fd5b505133600090815260056020526040902054909150810380610c43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806115af6021913960400191505060405180910390fd5b33600090815260046020526040812054600654039082610c69868463ffffffff61124816565b81610c7057fe5b04905060008111610ccc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806115af6021913960400191505060405180910390fd5b3360009081526005602090815260408083208790556006546004928390528184205580517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116938201939093526024810185905290517f0000000000000000000000000000000000000000000000000000000000000000909216926340c10f199260448084019382900301818387803b158015610d8157600080fd5b505af1158015610d95573d6000803e3d6000fd5b505060408051848152905173ffffffffffffffffffffffffffffffffffffffff8a1693503392507fd12200efa34901b99367694174c3b0d32c99585fdf37c7c26892136ddd0836d99181900360200190a35050600160005550505050565b60026000541415610e6557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260008190555473ffffffffffffffffffffffffffffffffffffffff163314610ef057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f784341564f3a20464f5242494444454e00000000000000000000000000000000604482015290519081900360640190fd5b626b1de06007544303101580610f07575060085443145b15610f115761101a565b6000610f6b62632ea0610f5f6003610f53610f37600854436112d490919063ffffffff16565b6e0100000000000000000000000000009063ffffffff61124816565b9063ffffffff61124816565b9063ffffffff61134616565b905060095481600954011015610f81575061101a565b600980548201908190558210611014576000611001652cd1fcbc8400610f5f670de0b6b3a7640000610f53610fe5610fc5600260075461124890919063ffffffff16565b600854610fd990439063ffffffff6113c716565b9063ffffffff6112d416565b610f53620f4240610f53600854436112d490919063ffffffff16565b905080156110125760068054820190555b505b50436008555b506001600055565b60065481565b6002600054141561109a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556007541580156110c6575060025473ffffffffffffffffffffffffffffffffffffffff1633145b61113157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f784341564f3a20464f5242494444454e00000000000000000000000000000000604482015290519081900360640190fd5b4360078190556008556001600055565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b600080600061116c8585611439565b604080517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527f3b4596e5d4f0ba0faf3c029e2a152a4931e4da86804417810c5960569e839f1e609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b60008115806112635750508082028282828161126057fe5b04145b6112ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b808203828111156112ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b60008082116113b657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816113bf57fe5b049392505050565b808201828110156112ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156114c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061158d6022913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16106114fb5782846114fe565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff821661158557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f45786361766f4c6962726172793a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b925092905056fe45786361766f4c6962726172793a204944454e544943414c5f414444524553534553784341564f3a20494e53554646494349454e545f4d494e5445445f414d4f554e54a264697066735822122012f592f23b227169c5dab001846fce154b132eac6200ee8034d12b4e31c1a94e64736f6c6343000606003360c060405234801561001057600080fd5b506001600090815533606090811b60a0526040516100306020820161009c565b6020820181038252601f19601f82011660405250905060006040516020018080643c22ac21ab60d91b8152506005019050604051602081830303815290604052805190602001209050808251602084016000f560601b6001600160601b031916608052506100a9915050565b611c1b80610ea583390190565b60805160601c60a05160601c610dc46100e160003980610831528061099b525080610469528061069d52806109345250610dc46000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806332cb6b0c11610097578063a9059cbb11610066578063a9059cbb146102ee578063c45a015514610327578063c4d66de81461032f578063dd62ed3e14610362576100f5565b806332cb6b0c1461027857806340c10f191461028057806370a08231146102bb57806395d89b41146100fa576100f5565b806318160ddd116100d357806318160ddd146101f557806323b872dd1461020f5780632a455d7914610252578063313ce5671461025a576100f5565b806306fdde03146100fa578063095ea7b3146101775780630bd8f619146101c4575b600080fd5b61010261039d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b06004803603604081101561018d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356103d6565b604080519115158252519081900360200190f35b6101cc610467565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101fd61048b565b60408051918252519081900360200190f35b6101b06004803603606081101561022557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610491565b6101fd6105ec565b6102626105f9565b6040805160ff9092168252519081900360200190f35b6101fd6105fe565b6102b96004803603604081101561029657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561060e565b005b6101fd600480360360208110156102d157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661073c565b6101b06004803603604081101561030457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561074e565b6101cc610765565b6102b96004803603602081101561034557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610781565b6101fd6004803603604081101561037857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610a44565b6040518060400160405280600481526020017f455843560000000000000000000000000000000000000000000000000000000081525081565b60006002600054141561044a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005561045a338484610a61565b5060018060005592915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60025481565b60006002600054141561050557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815573ffffffffffffffffffffffffffffffffffffffff851681526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146105d35773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020546105a1908363ffffffff610ad016565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083203384529091529020555b6105de848484610b42565b506001806000559392505050565b68a2a15d09519be0000081565b601281565b6b033b2e3c9fd0803ce800000081565b6002600054141561068057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461072957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f455843563a20464f5242494444454e0000000000000000000000000000000000604482015290519081900360640190fd5b6107338282610c23565b50506001600055565b60036020526000908152604090205481565b600061075b338484610b42565b5060015b92915050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600260005414156107f357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560015473ffffffffffffffffffffffffffffffffffffffff1615801561085357503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b6108be57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f455843563a20464f5242494444454e0000000000000000000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255604080517fc4d66de80000000000000000000000000000000000000000000000000000000081526004810192909252517f00000000000000000000000000000000000000000000000000000000000000009092169163c4d66de89160248082019260009290919082900301818387803b15801561097e57600080fd5b505af1158015610992573d6000803e3d6000fd5b50505050610a3c7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610a0157600080fd5b505af1158015610a15573d6000803e3d6000fd5b505050506040513d6020811015610a2b57600080fd5b505168a2a15d09519be00000610c23565b506001600055565b600460209081526000928352604080842090915290825290205481565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b8082038281111561075f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902054610b78908263ffffffff610ad016565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600360205260408082209390935590841681522054610bba908263ffffffff610d0416565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526003602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000610c4f82610c4a6002546b033b2e3c9fd0803ce8000000610ad090919063ffffffff16565b610d76565b600254909150610c65908263ffffffff610d0416565b60025573ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902054610c9e908263ffffffff610d0416565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b8082018281101561075f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b6000818310610d855781610d87565b825b939250505056fea2646970667358221220d3b889e646d1c9d3a05d77d725a4839f8b8aaa82a6f03f8dedbafcd4fa79a39064736f6c6343000606003360a060405234801561001057600080fd5b5060016000553360601b60805260805160601c611bc36100586000398061054e528061081a5280610f4b528061130a52806114a3528061151852806117175250611bc36000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c806395a2251f116100b2578063b6f3e08711610081578063c4d66de811610066578063c4d66de814610432578063dd62ed3e14610465578063e0158f39146104a057610136565b8063b6f3e087146103ef578063c45a01551461042a57610136565b806395a2251f1461036457806395d89b411461013b578063a9059cbb146101b8578063b07b4aea1461039757610136565b806323b872dd11610109578063313ce567116100ee578063313ce567146102e25780635e6cd6bf1461030057806370a082311461033157610136565b806323b872dd146102645780632817132c146102a757610136565b806306fdde031461013b578063095ea7b3146101b857806318160ddd14610205578063238242ab1461021f575b600080fd5b6101436104a8565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017d578181015183820152602001610165565b50505050905090810190601f1680156101aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f1600480360360408110156101ce57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356104e1565b604080519115158252519081900360200190f35b61020d61054a565b60408051918252519081900360200190f35b6102626004803603606081101561023557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356105e3565b005b6101f16004803603606081101561027a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104e1565b61020d600480360360408110156102bd57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610931565b6102ea610aab565b6040805160ff9092168252519081900360200190f35b610308610ab0565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61020d6004803603602081101561034757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610acc565b6102626004803603602081101561037a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdb565b61039f611060565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103db5781810151838201526020016103c3565b505050509050019250505060405180910390f35b6102626004803603604081101561040557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166110cf565b61030861125f565b6102626004803603602081101561044857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661127b565b61020d6004803603604081101561047b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166104e1565b610308611516565b6040518060400160405280600581526020017f784558435600000000000000000000000000000000000000000000000000000081525081565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f78455843563a20464f5242494444454e000000000000000000000000000000006044820152905160009181900360640190fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105b257600080fd5b505afa1580156105c6573d6000803e3d6000fd5b505050506040513d60208110156105dc57600080fd5b5051905090565b6002600054141561065557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556106638261153a565b6106ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f78455843563a20756e6b6e6f776e207061697200000000000000000000000000604482015290519081900360640190fd5b60006106d861161a565b905060008373ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561072257600080fd5b505afa158015610736573d6000803e3d6000fd5b505050506040513d602081101561074c57600080fd5b5051604080517f439de41900000000000000000000000000000000000000000000000000000000815233600482015260248101869052905191925073ffffffffffffffffffffffffffffffffffffffff86169163439de419916044808201926020929091908290030181600087803b1580156107c757600080fd5b505af11580156107db573d6000803e3d6000fd5b505050506040513d60208110156107f157600080fd5b50600090506108168261080a868663ffffffff6117b416565b9063ffffffff61183a16565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166340c10f1987836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156108bf57600080fd5b505af11580156108d3573d6000803e3d6000fd5b505060408051848152905173ffffffffffffffffffffffffffffffffffffffff8a1693503392507fd12200efa34901b99367694174c3b0d32c99585fdf37c7c26892136ddd0836d99181900360200190a35050600160005550505050565b600061093c8261153a565b61094857506000610aa5565b60008273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561099057600080fd5b505afa1580156109a4573d6000803e3d6000fd5b505050506040513d60208110156109ba57600080fd5b50519050806109cd576000915050610aa5565b60006109d761161a565b905060008473ffffffffffffffffffffffffffffffffffffffff1663b4899fc7876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a5857600080fd5b505afa158015610a6c573d6000803e3d6000fd5b505050506040513d6020811015610a8257600080fd5b5051905082610a97828463ffffffff6117b416565b81610a9e57fe5b0493505050505b92915050565b601281565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b600060606003805480602002602001604051908101604052809291908181526020018280548015610b3357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610b08575b505050505090506000610b4461161a565b90506000805b8351811015610cd0576000848281518110610b6157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1663b4899fc7886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610be557600080fd5b505afa158015610bf9573d6000803e3d6000fd5b505050506040513d6020811015610c0f57600080fd5b50518551909150600090869084908110610c2557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7257600080fd5b505afa158015610c86573d6000803e3d6000fd5b505050506040513d6020811015610c9c57600080fd5b50519050610cc4610cb78261080a858963ffffffff6117b416565b859063ffffffff6118bb16565b93505050600101610b4a565b50925050505b919050565b60026000541415610d4d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055600380546040805160208084028201810190925282815260609390929091830182828015610db657602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d8b575b505050505090506000610dc761161a565b90506000805b8351811015610f48576000848281518110610de457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e3157600080fd5b505afa158015610e45573d6000803e3d6000fd5b505050506040513d6020811015610e5b57600080fd5b50518551909150600090869084908110610e7157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1663e85a8934336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610ef757600080fd5b505af1158015610f0b573d6000803e3d6000fd5b505050506040513d6020811015610f2157600080fd5b50519050610f3c610cb78361080a848963ffffffff6117b416565b93505050600101610dcd565b507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166340c10f1985836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ff057600080fd5b505af1158015611004573d6000803e3d6000fd5b505060408051848152905173ffffffffffffffffffffffffffffffffffffffff881693503392507fd12200efa34901b99367694174c3b0d32c99585fdf37c7c26892136ddd0836d99181900360200190a3505060016000555050565b606060038054806020026020016040519081016040528092919081815260200182805480156110c557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161109a575b5050505050905090565b6002600054141561114157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055600154339061116c9073ffffffffffffffffffffffffffffffffffffffff16848461192d565b73ffffffffffffffffffffffffffffffffffffffff16146111ee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f78455843563a20464f5242494444454e00000000000000000000000000000000604482015290519081900360640190fd5b6111f73361153a565b61125657600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790555b50506001600055565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600260005414156112ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614801561134d575060015473ffffffffffffffffffffffffffffffffffffffff16155b801561136f575060025473ffffffffffffffffffffffffffffffffffffffff16155b6113da57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f78455843563a20464f5242494444454e00000000000000000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117909155604080517f4b2f336d000000000000000000000000000000000000000000000000000000008152905160009291634b2f336d916004808301926020929190829003018186803b15801561146f57600080fd5b505afa158015611483573d6000803e3d6000fd5b505050506040513d602081101561149957600080fd5b505190506114c8827f00000000000000000000000000000000000000000000000000000000000000008361192d565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550506001600055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000606060038054806020026020016040519081016040528092919081815260200182805480156115a157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611576575b50939450600093505050505b8151811015611610578373ffffffffffffffffffffffffffffffffffffffff168282815181106115d957fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141561160857600192505050610cd6565b6001016115ad565b5060009392505050565b6000806000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561168757600080fd5b505afa15801561169b573d6000803e3d6000fd5b505050506040513d60608110156116b157600080fd5b508051602091820151600254604080517f0dfe168100000000000000000000000000000000000000000000000000000000815290516dffffffffffffffffffffffffffff948516975093909216945073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811694911692630dfe1681926004808201939291829003018186803b15801561175e57600080fd5b505afa158015611772573d6000803e3d6000fd5b505050506040513d602081101561178857600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16146117ab57806117ad565b815b9250505090565b60008115806117cf575050808202828282816117cc57fe5b04145b610aa557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b60008082116118aa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816118b357fe5b049392505050565b80820182811015610aa557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b600080600061193c8585611a18565b604080517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527f3b4596e5d4f0ba0faf3c029e2a152a4931e4da86804417810c5960569e839f1e609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611aa0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b6c6022913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610611ada578284611add565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216611b6457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f45786361766f4c6962726172793a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b925092905056fe45786361766f4c6962726172793a204944454e544943414c5f414444524553534553a2646970667358221220806da739c6cf0bb8bae6e285d1b3bb9023447e0a7bb50867ed7278ea565ac08964736f6c63430006060033

Deployed Bytecode

0x6080604052600436106102025760003560e01c80635ceb139b1161011d5780639c89a10a116100b0578063cb7423581161007f578063dd62ed3e11610064578063dd62ed3e14610a24578063ea44539614610a6c578063f2ae927414610aac57610413565b8063cb742358146109cf578063d6a42d8514610a0f57610413565b80639c89a10a1461091f578063a9059cbb14610934578063c4d66de81461097a578063c836a489146109ba57610413565b806370a08231116100ec57806370a08231146108b5578063861a48dd146108f557806390996b2d1461090a57806395d89b411461049e57610413565b80635ceb139b146108375780636656d736146108615780636b2b3bf3146108765780636cb74849146108a057610413565b80632929abe61161019557806332cb6b0c1161016457806332cb6b0c14610772578063371139581461078757806340c10f19146107b15780635ca2a92d146107f757610413565b80632929abe61461064e5780632a455d791461071d5780632d13535714610732578063313ce5671461074757610413565b8063095ea7b3116101d1578063095ea7b31461054f57806318160ddd146105a957806319aef059146105be57806323b872dd146105fe57610413565b806302d05d3f14610418578063065e6eb71461045657806306fdde031461049e57806308ab59761461052857610413565b36610413576002600054141561027957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560095443108015906102a357506008546009546102a09163ffffffff610ac116565b43105b61030e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5075626c696350726573616c653a20494e414354495645000000000000000000604482015290519081900360640190fd5b6000610332603261032634606463ffffffff610b3916565b9063ffffffff610bbf16565b60405190915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ab96c12881a2e9ffa6706ae68bcfa4ecd1a8bf2116903480156108fc02916000818181858888f19350505050158015610397573d6000803e3d6000fd5b506103a23082610c40565b336000908152600b60205260409020546103c2908263ffffffff610ac116565b336000818152600b6020908152604091829020939093558051848152905191927fc397d7d9ef7c1875b142a11050c810d23e0965e3c5ea3bb28dc1c9d2032e146592918290030190a2506001600055005b600080fd5b34801561042457600080fd5b5061042d610d28565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561046257600080fd5b5061049c6004803603604081101561047957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610d4c565b005b3480156104aa57600080fd5b506104b3611007565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104ed5781810151838201526020016104d5565b50505050905090810190601f16801561051a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053457600080fd5b5061053d611040565b60408051918252519081900360200190f35b34801561055b57600080fd5b506105956004803603604081101561057257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611046565b604080519115158252519081900360200190f35b3480156105b557600080fd5b5061053d61105c565b3480156105ca57600080fd5b5061053d600480360360208110156105e157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611062565b34801561060a57600080fd5b506105956004803603606081101561062157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561107d565b34801561065a57600080fd5b5061049c6004803603604081101561067157600080fd5b81019060208101813564010000000081111561068c57600080fd5b82018360208201111561069e57600080fd5b803590602001918460208302840111640100000000831117156106c057600080fd5b9193909290916020810190356401000000008111156106de57600080fd5b8201836020820111156106f057600080fd5b8035906020019184602083028401116401000000008311171561071257600080fd5b50909250905061115c565b34801561072957600080fd5b5061053d61156e565b34801561073e57600080fd5b5061042d61157b565b34801561075357600080fd5b5061075c611597565b6040805160ff9092168252519081900360200190f35b34801561077e57600080fd5b5061053d61159c565b34801561079357600080fd5b5061049c600480360360208110156107aa57600080fd5b50356115aa565b3480156107bd57600080fd5b5061049c600480360360408110156107d457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611670565b34801561080357600080fd5b5061053d6004803603602081101561081a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611780565b34801561084357600080fd5b5061049c6004803603602081101561085a57600080fd5b5035611793565b34801561086d57600080fd5b5061053d611859565b34801561088257600080fd5b5061049c6004803603602081101561089957600080fd5b503561185f565b3480156108ac57600080fd5b5061049c611925565b3480156108c157600080fd5b5061053d600480360360208110156108d857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166119ad565b34801561090157600080fd5b5061049c6119bf565b34801561091657600080fd5b5061053d611af1565b34801561092b57600080fd5b5061042d611af7565b34801561094057600080fd5b506105956004803603604081101561095757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611b1b565b34801561098657600080fd5b5061049c6004803603602081101561099d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611b28565b3480156109c657600080fd5b5061042d611e24565b3480156109db57600080fd5b5061053d600480360360208110156109f257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611e40565b348015610a1b57600080fd5b5061049c611ebc565b348015610a3057600080fd5b5061053d60048036036040811015610a4757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611fcd565b348015610a7857600080fd5b5061053d60048036036020811015610a8f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611fea565b348015610ab857600080fd5b5061049c611ffd565b80820182811015610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b6000811580610b5457505080820282828281610b5157fe5b04145b610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b6000808211610c2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610c3857fe5b049392505050565b610c49826120da565b6000610c7382610c6e60035469d3c21bcecceda100000061214690919063ffffffff16565b6121b8565b600354909150610c89908263ffffffff610ac116565b60035573ffffffffffffffffffffffffffffffffffffffff8316600090815260046020526040902054610cc2908263ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff841660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b7f000000000000000000000000381657fde9bfe7558837757ac54249ef748cacb781565b60026000541415610dbe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055601054158015610e5b57503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e1657600080fd5b505af1158015610e2a573d6000803e3d6000fd5b505050506040513d6020811015610e4057600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b610ec657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072697661746550726573616c653a20464f5242494444454e00000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600f6020526040812054601354610f10918491610f049163ffffffff61214616565b9063ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600f60205260409020839055601254909150811115610fac57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a204c494d49545f45584345454445440000604482015290519081900360640190fd5b601381905560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fbe03476e65e5189c31bd84cd775900e0b2cd200157a96ac8dfbdef41ebde5111919081900360200190a25050600160005550565b6040518060400160405280600481526020017f4341564f0000000000000000000000000000000000000000000000000000000081525081565b60145481565b60006110533384846121d0565b50600192915050565b60035481565b6000611075600a8363ffffffff61223f16565b90505b919050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146111475773ffffffffffffffffffffffffffffffffffffffff84166000908152600560209081526040808320338452909152902054611115908363ffffffff61214616565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083203384529091529020555b6111528484846123a4565b5060019392505050565b600260005414156111ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000819055503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561121e57600080fd5b505af1158015611232573d6000803e3d6000fd5b505050506040513d602081101561124857600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633146112cd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072697661746550726573616c653a20464f5242494444454e00000000000000604482015290519081900360640190fd5b82811461133b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a20494e56414c49445f4c454e4754480000604482015290519081900360640190fd5b60135460005b848110156114ee5760006113da85858481811061135a57fe5b90506020020135600e60010160008a8a8781811061137457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ac190919063ffffffff16565b905080600f60008989868181106113ed57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061146d85858481811061145757fe5b9050602002013584610ac190919063ffffffff16565b925086868381811061147b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fbe03476e65e5189c31bd84cd775900e0b2cd200157a96ac8dfbdef41ebde5111826040518082815260200191505060405180910390a250600101611341565b5060125481111561156057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a204c494d49545f45584345454445440000604482015290519081900360640190fd5b601355505060016000555050565b681158e460913d00000081565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b601281565b69d3c21bcecceda100000081565b6002600054141561161c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055611632600e8263ffffffff61249716565b60408051828152905133917fb03c8c81bb6d72dee6ebce4af4bb86d2e26c4bca834f3336ad1ab65bcb106501919081900360200190a2506001600055565b600260005414156116e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560015473ffffffffffffffffffffffffffffffffffffffff16331461176d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f45786361766f3a20464f5242494444454e000000000000000000000000000000604482015290519081900360640190fd5b6117778282610c40565b50506001600055565b600061107560158363ffffffff61223f16565b6002600054141561180557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005561181b600a8263ffffffff61249716565b60408051828152905133917f1f003ee3725820392d2b4856070622ffd741edb3e27990d39f2a187f4dc0170b919081900360200190a2506001600055565b60135481565b600260005414156118d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556118e760158263ffffffff61249716565b60408051828152905133917fdb368e38c472e99d6c54fb15b254413b586036601f2031cf705d2b488a25f850919081900360200190a2506001600055565b6002600054141561199757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556119a66015612552565b6001600055565b60046020526000908152604090205481565b60026000541415611a3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055600954158015611a7b57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000381657fde9bfe7558837757ac54249ef748cacb716145b611ae657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5075626c696350726573616c653a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b436009556001600055565b60125481565b7f000000000000000000000000ab96c12881a2e9ffa6706ae68bcfa4ecd1a8bf2181565b60006110533384846123a4565b60026000541415611b9a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000381657fde9bfe7558837757ac54249ef748cacb716148015611c8e5750600254604080517fc45a0155000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163c45a0155916004808301926020929190829003018186803b158015611c4a57600080fd5b505afa158015611c5e573d6000803e3d6000fd5b505050506040513d6020811015611c7457600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16145b611cf957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f455843563a20464f5242494444454e0000000000000000000000000000000000604482015290519081900360640190fd5b600254604080517fc4d66de800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529151919092169163c4d66de891602480830192600092919082900301818387803b158015611d6d57600080fd5b505af1158015611d81573d6000803e3d6000fd5b5050600154600254604080517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301529283166024820152905191909216935063485cc9559250604480830192600092919082900301818387803b158015611e0457600080fd5b505af1158015611e18573d6000803e3d6000fd5b50506001600055505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460209081526040808320546007909252822054430315611e7f579050611078565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902054808210611eb25780611eb4565b815b949350505050565b60026000541415611f2e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560095415801590611f585750600854600954611f549163ffffffff610ac116565b4310155b611fc357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5075626c696350726573616c653a20494e56414c49445f504152414d53000000604482015290519081900360640190fd5b6119a6600a612552565b600560209081526000928352604080842090915290825290205481565b6000611075600e8363ffffffff61223f16565b6002600054141561206f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055601254601354146120d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061283e6027913960400191505060405180910390fd5b6119a6600e612552565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260409020544303156121435773ffffffffffffffffffffffffffffffffffffffff81166000908152600460209081526040808320546006835281842055600790915290204390555b50565b80820382811115610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b60008183106121c757816121c9565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000826002015460001480612258575082600201544311155b80612288575073ffffffffffffffffffffffffffffffffffffffff82166000908152600184016020526040902054155b1561229557506000610b33565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001840160205260408120546122d59060649061032690600a63ffffffff610b3916565b600385015473ffffffffffffffffffffffffffffffffffffffff851660009081526001870160205260408120549293509161232b9163ffffffff9081169161231f918690610bbf16565b9063ffffffff610b3916565b73ffffffffffffffffffffffffffffffffffffffff85166000908152602087905260409020546003870154600288015492935061239b9261238f91869161231f9163ffffffff908116916103269186906123899083908c90610ac116565b436121b8565b9063ffffffff61214616565b95945050505050565b6123ad836120da565b6123b6826120da565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600460205260409020546123ec908263ffffffff61214616565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260046020526040808220939093559084168152205461242e908263ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6124a1823361223f565b81111561250f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f446973747269627574696f6e4c6962726172793a204f56455244524146540000604482015290519081900360640190fd5b3360009081526020839052604090205461252f908263ffffffff610ac116565b3360008181526020859052604090209190915561254e90309083612660565b5050565b60028101541580156125ec57503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156125a757600080fd5b505af11580156125bb573d6000803e3d6000fd5b505050506040513d60208110156125d157600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b61265757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f446973747269627574696f6e4c6962726172793a20464f5242494444454e0000604482015290519081900360640190fd5b43600290910155565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061273657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126f9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612798576040519150601f19603f3d011682016040523d82523d6000602084013e61279d565b606091505b50915091508180156127cb5750805115806127cb57508080602001905160208110156127c857600080fd5b50515b61283657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b505050505056fe5072697661746550726573616c653a20444953545249425554494f4e5f554e46494e4953484544a2646970667358221220ba9fcfb51b0b0aed1f6f38b2dbddbb608fe5ecd1e385b1b61e5829dd8e57966664736f6c63430006060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

OVERVIEW

EXCAVO Finance platform is an Ethereum-based on-chain system of smart contracts. It was launched by Excavo.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.