Contract 0x9887c3c65a411ea465a7318cfc38f108de7a13fd

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x00a155680133b5ba8b16ac10ae05532c923dac2ad02e7406ce5cc337b191f4190x6a7d12c2115017822021-08-15 12:56:2539 days 10 hrs ago0x69a9632201acf699212b3155e3e0cde6c8479d61 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00036786
0x665e8a80a5685c8308712169f80c407b7d95fec0424abdd7e1c981b00937d0fe0x6a7d12c2102981982021-07-04 11:26:3981 days 12 hrs ago0x42b84c053b1d68737b9cd910e15dbccd360f0488 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00674024
0x1b7cf13c653608f286d707353f3d19af26e9966c77a0a94d1acf23832043b66cDistribute BNB102954092021-07-04 9:07:1281 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00077509
0x89ef2f2568ee906b155519ac0d405f33d43a883e120bb24b6eceacfe5e310f78Claim Tokens102954072021-07-04 9:07:0681 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.0007083
0x4a229feb450e3c89c9d81497ce075253c6947acba4b3c9c463a950d5a1f14d18Add Liquidity102954022021-07-04 9:06:5181 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.02249828
0x7ec5d96d49774ddc33c5b92b46c749000be94fd73bf8550cf75e89403d18a73dTransfer Tokens ...102953972021-07-04 9:06:3681 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.0129556
0x723e983e2276181f00165ed1f3c3937f7cca90fd0501c68eb6b2cd62b36bde0fContribute102953852021-07-04 9:06:0081 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0.05 BNB0.00121217
0xe3ef2a7db7628cee9431aa8165dd559d6157418ca7fd6daebe22e8ee1d8edcddTransfer Tokens102952682021-07-04 9:00:0981 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00065424
0x1e9f43f94913d6371c5861b6551de507301b6a09889a84619d868fae9f83f02f0x6a7d12c2102952512021-07-04 8:59:1881 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00552686
0xa752b2d9584c61ea744fcb8e3afbca60dd0ca9c56931ee8e8beb5b7708973fe10x6a7d12c2102951792021-07-04 8:55:4281 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00552734
0xe1aa8ae1b2c8d7b442321e7675e8604c94349a8b9236249eb343cf984aab6107Transfer Tokens102950522021-07-04 8:49:2181 days 14 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00040276
0x90d8934f37712615bd147cea8d30de1b3493e0e25d5d4df6e2ad9f00bd1bb0c50x6a7d12c2102950242021-07-04 8:47:5781 days 15 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00611159
0xb10b4c6fed93e4d2a4495e02659a53eae49944fdfa5667c08ef3e27caecd595eTransfer Tokens102946242021-07-04 8:27:5781 days 15 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00040276
0xdcb047f38e2d4d8870ce14fae17c62f94cb877245adc727b755334444af586c40x6a7d12c2102945722021-07-04 8:25:2181 days 15 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00693475
0xd697f85f294e1377b0d0707f2d0d1c901d9a2462c251a6d330d4ed5eaa2479f70x6a7d12c2102941552021-07-04 8:04:3081 days 15 hrs ago0x525211a84b118d2265ebf9209e87dc589afb694c IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00693451
0xfe8254e2865514b0ad5ccb49c941bca535db7281bfd284067dd768dd64f157b5Transfer Tokens ...99262622021-06-21 11:48:4694 days 11 hrs ago0x8280a8c87e8811278505d42bdbb4438929fc41dd IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.01296443
0xba15605b952e43848b7c36f32d92e88f6d4b70b06a89426fc089353dd258dbc4Contribute99221012021-06-21 8:20:4394 days 15 hrs ago0x8280a8c87e8811278505d42bdbb4438929fc41dd IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd1 BNB0.00121217
0x383cedac9e61f654594f1f332a7e9f58120bc8b2a8f9fd988253b6988c0b478eTransfer Tokens99218432021-06-21 8:07:4994 days 15 hrs ago0x8280a8c87e8811278505d42bdbb4438929fc41dd IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00065423
0x36c53e1c18cfca7def39d486cf479d3e634a4f267cec25178ae8376de6323b920x6a7d12c299217902021-06-21 8:05:1094 days 15 hrs ago0x8280a8c87e8811278505d42bdbb4438929fc41dd IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00694231
0x08071a5e8e57b5f816851e8f38cebfb860af898f5b74ff9be96c3e640f095a04Contribute97605062021-06-15 17:40:44100 days 6 hrs ago0x7482b336283041386942fc106fd47f99976d1a06 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd2 BNB0.00121217
0x333cb55f904b6df1b2155c3d333642fa7128a02f10161957dd6601701ce09ecaTransfer Tokens97604982021-06-15 17:40:20100 days 6 hrs ago0x7482b336283041386942fc106fd47f99976d1a06 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00065423
0xf5939af21622ebc4ed1c558c8f2f5bb10286fbd44777687aed575fb8675b86d2Transfer Tokens97604252021-06-15 17:36:41100 days 6 hrs ago0x7482b336283041386942fc106fd47f99976d1a06 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00065423
0xb7355b98e74cf53fd3a7b9f0b908e5db4f7fe9179560df6378f18ae4d59c1328Transfer Tokens97603502021-06-15 17:32:56100 days 6 hrs ago0x7482b336283041386942fc106fd47f99976d1a06 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00035278
0x1eb3bd1f8956fd93705154d425411ef3376bb545516bacc6c18809d20d6e2d82Transfer Tokens97603482021-06-15 17:32:50100 days 6 hrs ago0x7482b336283041386942fc106fd47f99976d1a06 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00035278
0xeb1262eb2d782ab4f97571eb0d8d8c6259660e1c8bd8e74aaa47e557fd7b3aa00x6a7d12c297600682021-06-15 17:18:50100 days 6 hrs ago0x7482b336283041386942fc106fd47f99976d1a06 IN  0x9887c3c65a411ea465a7318cfc38f108de7a13fd0 BNB0.00635698
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x665e8a80a5685c8308712169f80c407b7d95fec0424abdd7e1c981b00937d0fe102981982021-07-04 11:26:3981 days 12 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x6725f303b657a9451d8ba641348b6761a6cc7a170 BNB
0x665e8a80a5685c8308712169f80c407b7d95fec0424abdd7e1c981b00937d0fe102981982021-07-04 11:26:3981 days 12 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd99d1c33f9fc3444f8101754abc46c52416550d10 BNB
0x1b7cf13c653608f286d707353f3d19af26e9966c77a0a94d1acf23832043b66c102954092021-07-04 9:07:1281 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd0x525211a84b118d2265ebf9209e87dc589afb694c0.047025 BNB
0x1b7cf13c653608f286d707353f3d19af26e9966c77a0a94d1acf23832043b66c102954092021-07-04 9:07:1281 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd0xcbb6c761f43ed0d72ba5420b37a822f646cba1f40.00125 BNB
0x1b7cf13c653608f286d707353f3d19af26e9966c77a0a94d1acf23832043b66c102954092021-07-04 9:07:1281 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd0xcbb6c761f43ed0d72ba5420b37a822f646cba1f40.00125 BNB
0x89ef2f2568ee906b155519ac0d405f33d43a883e120bb24b6eceacfe5e310f78102954072021-07-04 9:07:0681 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd10439534c9f2457aac5c274531e1c95e66208950 BNB
0x4a229feb450e3c89c9d81497ce075253c6947acba4b3c9c463a950d5a1f14d18102954022021-07-04 9:06:5181 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd99d1c33f9fc3444f8101754abc46c52416550d10.000475 BNB
0x4a229feb450e3c89c9d81497ce075253c6947acba4b3c9c463a950d5a1f14d18102954022021-07-04 9:06:5181 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd10439534c9f2457aac5c274531e1c95e66208950 BNB
0x7ec5d96d49774ddc33c5b92b46c749000be94fd73bf8550cf75e89403d18a73d102953972021-07-04 9:06:3681 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x5e5aa6dd85149ac9ef7a4fd57717d73a694919a50 BNB
0x7ec5d96d49774ddc33c5b92b46c749000be94fd73bf8550cf75e89403d18a73d102953972021-07-04 9:06:3681 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd10439534c9f2457aac5c274531e1c95e66208950 BNB
0x7ec5d96d49774ddc33c5b92b46c749000be94fd73bf8550cf75e89403d18a73d102953972021-07-04 9:06:3681 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x2a0167b5605f92aeacfc3f4c3aea79a7608a04a60 BNB
0xe3ef2a7db7628cee9431aa8165dd559d6157418ca7fd6daebe22e8ee1d8edcdd102952682021-07-04 9:00:0981 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd10439534c9f2457aac5c274531e1c95e66208950 BNB
0xe3ef2a7db7628cee9431aa8165dd559d6157418ca7fd6daebe22e8ee1d8edcdd102952682021-07-04 9:00:0981 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd10439534c9f2457aac5c274531e1c95e66208950 BNB
0x1e9f43f94913d6371c5861b6551de507301b6a09889a84619d868fae9f83f02f102952512021-07-04 8:59:1881 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x6725f303b657a9451d8ba641348b6761a6cc7a170 BNB
0x1e9f43f94913d6371c5861b6551de507301b6a09889a84619d868fae9f83f02f102952512021-07-04 8:59:1881 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd99d1c33f9fc3444f8101754abc46c52416550d10 BNB
0xa752b2d9584c61ea744fcb8e3afbca60dd0ca9c56931ee8e8beb5b7708973fe1102951792021-07-04 8:55:4281 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x6725f303b657a9451d8ba641348b6761a6cc7a170 BNB
0xa752b2d9584c61ea744fcb8e3afbca60dd0ca9c56931ee8e8beb5b7708973fe1102951792021-07-04 8:55:4281 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd99d1c33f9fc3444f8101754abc46c52416550d10 BNB
0xe1aa8ae1b2c8d7b442321e7675e8604c94349a8b9236249eb343cf984aab6107102950522021-07-04 8:49:2181 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x2c3592abfc79f29f662d37c0aa29d002ee4908ad0 BNB
0xe1aa8ae1b2c8d7b442321e7675e8604c94349a8b9236249eb343cf984aab6107102950522021-07-04 8:49:2181 days 14 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x2c3592abfc79f29f662d37c0aa29d002ee4908ad0 BNB
0x90d8934f37712615bd147cea8d30de1b3493e0e25d5d4df6e2ad9f00bd1bb0c5102950242021-07-04 8:47:5781 days 15 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x6725f303b657a9451d8ba641348b6761a6cc7a170 BNB
0x90d8934f37712615bd147cea8d30de1b3493e0e25d5d4df6e2ad9f00bd1bb0c5102950242021-07-04 8:47:5781 days 15 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd99d1c33f9fc3444f8101754abc46c52416550d10 BNB
0xb10b4c6fed93e4d2a4495e02659a53eae49944fdfa5667c08ef3e27caecd595e102946242021-07-04 8:27:5781 days 15 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xf0b2de1e07bbc21c219c3868b4dad7e630ff7a780 BNB
0xb10b4c6fed93e4d2a4495e02659a53eae49944fdfa5667c08ef3e27caecd595e102946242021-07-04 8:27:5781 days 15 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xf0b2de1e07bbc21c219c3868b4dad7e630ff7a780 BNB
0xdcb047f38e2d4d8870ce14fae17c62f94cb877245adc727b755334444af586c4102945722021-07-04 8:25:2181 days 15 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0x6725f303b657a9451d8ba641348b6761a6cc7a170 BNB
0xdcb047f38e2d4d8870ce14fae17c62f94cb877245adc727b755334444af586c4102945722021-07-04 8:25:2181 days 15 hrs ago 0x9887c3c65a411ea465a7318cfc38f108de7a13fd 0xd99d1c33f9fc3444f8101754abc46c52416550d10 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
YsecPresale

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : IBEP20Timelock.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

interface IBEP20Timelock{
    function AllocationLength() external view returns (uint256);
    function AddAllocation(string memory name, uint256 amount, uint256 releaseDate, bool isInterval, uint256 percentageOfRelease, uint256 intervalOfRelease, address token) external;
    function WithdrawFromAllocation(string memory name) external;
}

File 2 of 16 : IBEP20TimelockFactory.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

interface IBEP20TimelockFactory
{
    function CreateTimelock(address owner, address tokenOwner) external returns(address);
}

File 3 of 16 : PresaleData.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "./TokenAllocation.sol";
import "./PresaleDataAddresses.sol";
import "./PresaleDataState.sol";
import "./PresaleInfo.sol";

struct PresaleData{
    PresaleInfo Info;
    uint256 StartDate;
    uint256 EndDate;
    uint256 Softcap;
    uint256 Hardcap;
    uint256 TokenLiqAmount;
    uint256 LiqPercentage;
    uint256 TokenPresaleAllocation;
    bool PermalockLiq;
    TokenAllocation[] TokenAllocations;// will not be returned in view of PresaleData
    TokenAllocation LiquidityTokenAllocation;
    PresaleDataAddresses Addresses;
    PresaleDataState State;
    mapping(address => uint256) BNBContributedPerAddress;// will not be returned in view of PresaleData
    mapping(address => bool) ClaimedAddress;// will not be returned in view of PresaleData
}

File 4 of 16 : PresaleDataAddresses.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

struct PresaleDataAddresses
{
    address TokenOwnerAddress;
    address TokenAddress;
    address TokenTimeLock;
    address UnsoldTransferAddress;
}

File 5 of 16 : PresaleDataState.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

struct PresaleDataState{
    uint256 TotalTokenAmount;
    uint256 Step;
    uint256 ContributedBNB;
    uint256 RaisedFeeBNB;
    bool Exists;
    uint256 RetrievedTokenAmount;
    uint256 RetrievedBNBAmount;
    uint256 NumberOfContributors;
    uint256 PresaleTokenPrice;
    uint256 ListingTokenPrice;
    bool IsBurnUnsold;
    uint256 TransferedBurnUnsold;
}

File 6 of 16 : PresaleInfo.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

struct PresaleInfo{
    string Name;
    string Website;
    string Telegram;
    string Twitter;
    string Github;
    string Medium;
}

File 7 of 16 : PresaleSettings.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "./TokenAllocation.sol";

struct PresaleSettings{
    string Name;
    uint256 StartDate;
    uint256 EndDate;
    uint256 Softcap;
    uint256 Hardcap;
    uint256 TokenLiqAmount;
    uint256 LiqPercentage;
    uint256 TokenPresaleAllocation;
    bool PermalockLiq;
    TokenAllocation[] TokenAllocations;
    TokenAllocation LiquidityTokenAllocation;
    address Token;
    string Website;
    string Telegram;
    string Twitter;
    string Github;
    string Medium;
    uint256 PresaleTokenPrice;
    uint256 ListingTokenPrice;
    bool IsBurnUnsold;
    address UnsoldTransferAddress;
}

File 8 of 16 : TokenAllocation.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

struct TokenAllocation
{
    string Name;
    uint256 Amount;
    uint256 RemainingAmount;
    uint256 ReleaseDate;
    bool IsInterval;
    uint256 PercentageOfRelease;
    uint256 IntervalOfRelease;
    bool Exists;
    address Token;
}

File 9 of 16 : YsecPresale.sol
/*
__/\\\________/\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\\\________/\\\\\\\\\_        
 _\///\\\____/\\\/____/\\\/////////\\\_\/\\\///////////______/\\\////////__       
  ___\///\\\/\\\/_____\//\\\______\///__\/\\\_______________/\\\/___________      
   _____\///\\\/________\////\\\_________\/\\\\\\\\\\\______/\\\_____________     
    _______\/\\\____________\////\\\______\/\\\///////______\/\\\_____________    
     _______\/\\\_______________\////\\\___\/\\\_____________\//\\\____________   
      _______\/\\\________/\\\______\//\\\__\/\\\______________\///\\\__________  
       _______\/\\\_______\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\____\////\\\\\\\\\_ 
        _______\///__________\///////////_____\///////////////________\/////////__

Visit and follow!

* Website:  https://www.ysec.finance
* Twitter:  https://twitter.com/YearnSecure
* Telegram: https://t.me/YearnSecure
* Medium:   https://yearnsecure.medium.com/

*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;

import "./Models/PresaleData.sol";
import "./Models/PresaleSettings.sol";
import "./Interfaces/IBEP20Timelock.sol";
import "./Interfaces/IBEP20TimelockFactory.sol";
import "./interfaces/IBEP20.sol";
import "./interfaces/IPancakeFactory.sol";
import "./interfaces/IPancakeRouter02.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract YsecPresale is Ownable, ReentrancyGuard{
    using SafeMath for uint;

    //steps
    //0:initialized
    //1:Tokens transfered and ready for contributions
    //>1 presale finished
    //2:Tokens transfered to locks
    //3:Liquidity Added on pancake and ready for withdrawal
    //>3 tokens claimable and BNB distributable

    address public PancakeswapRouterAddress;
    address public PancakeswapFactoryAddress;
    
    address public TimelockFactoryAddress;
    address public YieldFeeAddress;
    address public FeeAddress;

    mapping(uint256 => PresaleData) public Presales;
    uint256[] public PresaleIndexer;

    event TokensTransfered(uint256 presaleId, uint256 amount);
    event Contributed(uint256 presaleId, address contributor, uint256 amount);
    event RetrievedBNB(uint256 presaleId, address contributor, uint256 amount);
    event RetrievedTokens(uint256 presaleId, uint256 amount);
    event TokensTransferedToLocks(uint256 presaleId, uint256 amount);
    event NoTokensTransferedToLocks(uint256 presaleId);
    event PancakeswapLiquidityAdded(uint256 presaleId, bool permaLockedLiq, uint256 amountOfBNB, uint256 amountOfTokens);
    event ClaimedTokens(uint256 presaleId, address claimer, uint256 amount);
    event BNBYieldFeeDistributed(uint256 presaleId, address reciever, uint256 amount);
    event BNBFeeDistributed(uint256 presaleId, address reciever, uint256 amount);
    event BNBDistributed(uint256 presaleId, address reciever, uint256 amount);
    event UnsoldTokensTransfered(uint256 presaleId, address reciever, uint256 amount);
    event UnliqedTokensTransfered(uint256 presaleId, address reciever, uint256 amount);

    constructor(address timelockFactoryAddress, address yieldFeeAddress, address feeAddress) public{
        PancakeswapRouterAddress = 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F;
        PancakeswapFactoryAddress = 0xBCfCcbde45cE874adCB698cC183deBcF17952812;
        TimelockFactoryAddress = timelockFactoryAddress;
        YieldFeeAddress = yieldFeeAddress;
        FeeAddress = feeAddress;
    }

    function SetTimelockFactory(address timelockFactoryAddress) onlyOwner() external{
        TimelockFactoryAddress = timelockFactoryAddress;
    }

    function SetYieldFeeAddress(address yieldFeeAddress) onlyOwner() external{
        YieldFeeAddress = yieldFeeAddress;
    }

    function SetFeeAddress(address feeAddress) onlyOwner() external{
        FeeAddress = feeAddress;
    }

    function SetPancakeswapRouterAddress(address router) onlyOwner() external{
        PancakeswapRouterAddress = router;
    }

    function SetPancakeswapFactoryAddress(address router) onlyOwner() external{
        PancakeswapFactoryAddress = router;
    }

    function CreatePresale(PresaleSettings memory settings) external returns(uint256 presaleId){
        require(settings.EndDate > settings.StartDate, "Do not start before end");
        require(settings.StartDate > block.timestamp, "Start in future");
        require(settings.Hardcap >= settings.Softcap, "Hardcap has to equal or exceed softcap");

        address pairAddress = IPancakeFactory(PancakeswapFactoryAddress).getPair(IPancakeRouter02(PancakeswapRouterAddress).WETH(), settings.Token);
        require(pairAddress == address(0), "Token/BNB pair should not exist");

        presaleId = PresaleIndexer.length.add(1);
        Presales[presaleId].State.IsBurnUnsold = settings.IsBurnUnsold;
        
        Presales[presaleId].StartDate = settings.StartDate;
        Presales[presaleId].EndDate = settings.EndDate;
        Presales[presaleId].Softcap = settings.Softcap;
        Presales[presaleId].Hardcap = settings.Hardcap;

        Presales[presaleId].LiqPercentage = settings.LiqPercentage;
        Presales[presaleId].PermalockLiq = settings.PermalockLiq;
        if(!settings.PermalockLiq) require(settings.LiquidityTokenAllocation.ReleaseDate > block.timestamp, "Liquidity allocation not set in future");
        Presales[presaleId].LiquidityTokenAllocation = settings.LiquidityTokenAllocation;

        Presales[presaleId].Addresses.TokenOwnerAddress = _msgSender();
        Presales[presaleId].Addresses.TokenAddress = settings.Token;
        Presales[presaleId].Addresses.TokenTimeLock = address(0x0);

        Presales[presaleId].State.TotalTokenAmount = 0;
        Presales[presaleId].State.Step = 0;
        Presales[presaleId].State.ContributedBNB = 0;
        Presales[presaleId].State.RaisedFeeBNB = 0;
        Presales[presaleId].State.Exists = true;
        Presales[presaleId].State.RetrievedTokenAmount = 0;
        Presales[presaleId].State.RetrievedBNBAmount = 0;
        Presales[presaleId].State.NumberOfContributors = 0;

        Presales[presaleId].Info.Name = settings.Name;
        Presales[presaleId].Info.Website = settings.Website;
        Presales[presaleId].Info.Telegram = settings.Telegram;
        Presales[presaleId].Info.Twitter = settings.Twitter;
        Presales[presaleId].Info.Github = settings.Github;
        Presales[presaleId].Info.Medium = settings.Medium;

        for(uint i=0; i<settings.TokenAllocations.length; i++)
        {
            require(settings.TokenAllocations[i].ReleaseDate > block.timestamp, "Allocation not set in future");
            TokenAllocation memory allocation = settings.TokenAllocations[i];
            if(allocation.Token == Presales[presaleId].Addresses.TokenAddress) Presales[presaleId].State.TotalTokenAmount = Presales[presaleId].State.TotalTokenAmount.add(allocation.Amount);
            Presales[presaleId].TokenAllocations.push(allocation);
        }

        if(!settings.IsBurnUnsold)//default type -> divide unsold tokens
        {
            Presales[presaleId].TokenLiqAmount = settings.TokenLiqAmount;
            Presales[presaleId].TokenPresaleAllocation = settings.TokenPresaleAllocation;
            Presales[presaleId].State.TotalTokenAmount = Presales[presaleId].State.TotalTokenAmount.add(settings.TokenLiqAmount);
            Presales[presaleId].State.TotalTokenAmount = Presales[presaleId].State.TotalTokenAmount.add(settings.TokenPresaleAllocation);
        }else{//new type determine pricing and burn/transfer unsold/unlisted tokens
            Presales[presaleId].State.PresaleTokenPrice = settings.PresaleTokenPrice;
            Presales[presaleId].State.ListingTokenPrice = settings.ListingTokenPrice;
            Presales[presaleId].Addresses.UnsoldTransferAddress = settings.UnsoldTransferAddress;

            uint256 maxPresaleTokenAmount = settings.Hardcap.mul(1e18).div(settings.PresaleTokenPrice);
            Presales[presaleId].State.TotalTokenAmount = Presales[presaleId].State.TotalTokenAmount.add(maxPresaleTokenAmount);
            uint256 maxLiqBnbMinFees = settings.Hardcap.div(100).mul(95);
            uint256 maxLiqBnbAmount = maxLiqBnbMinFees.div(100).mul(settings.LiqPercentage);
            uint256 maxLiqTokenAmount = maxLiqBnbAmount.mul(1e18).div(settings.ListingTokenPrice);
            Presales[presaleId].State.TotalTokenAmount = Presales[presaleId].State.TotalTokenAmount.add(maxLiqTokenAmount);

            Presales[presaleId].TokenLiqAmount = maxLiqTokenAmount;
            Presales[presaleId].TokenPresaleAllocation = maxPresaleTokenAmount;
        }
        PresaleIndexer.push(presaleId);
    }

    //step 0 -> part of init
    function TransferTokens(uint256 presaleId) nonReentrant() RequireTokenOwner(presaleId) external{
        RequireStep(presaleId, 0);
        require(IBEP20(Presales[presaleId].Addresses.TokenAddress).allowance(_msgSender(), address(this)) >= Presales[presaleId].State.TotalTokenAmount , "Transfer of token has not been approved");
        IBEP20(Presales[presaleId].Addresses.TokenAddress).transferFrom(_msgSender(), address(this), Presales[presaleId].State.TotalTokenAmount);
        Presales[presaleId].State.Step = 1;
        emit TokensTransfered(presaleId, Presales[presaleId].State.TotalTokenAmount);
    }

    //step 1 -> contributions open
    function Contribute(uint256 presaleId) nonReentrant() public payable{
        RequireStep(presaleId, 1);
        require(msg.value > 0, "Cannot contribute 0");
        require(!PresaleFinished(presaleId), "Presale has already finished");
        require(PresaleStarted(presaleId), "Presale has not started yet!");

        uint256 amountRecieved = msg.value;
        require(Presales[presaleId].State.ContributedBNB + amountRecieved <= Presales[presaleId].Hardcap, "Incoming contribution exceeds hardcap");
        Presales[presaleId].State.ContributedBNB = Presales[presaleId].State.ContributedBNB.add(amountRecieved);
        Presales[presaleId].State.RaisedFeeBNB = Presales[presaleId].State.RaisedFeeBNB.add(amountRecieved.div(100).mul(5));//5% is fee
        if(Presales[presaleId].BNBContributedPerAddress[_msgSender()] == 0) Presales[presaleId].State.NumberOfContributors = Presales[presaleId].State.NumberOfContributors.add(1);
        Presales[presaleId].BNBContributedPerAddress[_msgSender()] = Presales[presaleId].BNBContributedPerAddress[_msgSender()].add(amountRecieved);
        emit Contributed(presaleId, _msgSender(), amountRecieved);
     }

    //step 1 -> in case of failed presale allow users to retrieve invested BNB
    //https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now
    function RetrieveBNB(uint256 presaleId, address contributor) nonReentrant() external{
        RequireStep(presaleId, 1);
        require(!SoftcapMet(presaleId), "Softcap has been met! you are not able to retrieve BNB");
        require(PresaleFinished(presaleId), "Presale has not finished! you are not able to retrieve BNB");

        uint256 BNBContributedForAddress = Presales[presaleId].BNBContributedPerAddress[contributor];
        require(BNBContributedForAddress > 0, "No BNB available for withdrawal");
        Presales[presaleId].BNBContributedPerAddress[contributor] = 0;
        (bool success, ) = contributor.call{value:BNBContributedForAddress}('');
        require(success, "Transfer failed.");
        emit RetrievedBNB(presaleId, contributor, BNBContributedForAddress);
    }

    //step 1 -> in case of failed presale allow tokenowner to retrieve tokens
    function RetrieveTokens(uint256 presaleId) RequireTokenOwner(presaleId) nonReentrant() external{
        RequireStep(presaleId, 1);
        require(!SoftcapMet(presaleId), "Softcap has been met! you are not able to retrieve BNB");
        require(PresaleFinished(presaleId), "Presale has not finished! you are not able to retrieve BNB");
        
        uint256 remainingAmount = Presales[presaleId].State.TotalTokenAmount.sub(Presales[presaleId].State.RetrievedTokenAmount);
        require(remainingAmount > 0, "No remaining tokens for retrieval");
        uint256 balance = IBEP20(Presales[presaleId].Addresses.TokenAddress).balanceOf(address(this));
        require(balance >= remainingAmount, "No tokens left!");

        Presales[presaleId].State.RetrievedTokenAmount = Presales[presaleId].State.RetrievedTokenAmount.add(remainingAmount);
        IBEP20(Presales[presaleId].Addresses.TokenAddress).transfer(_msgSender(), remainingAmount);
        emit RetrievedTokens(presaleId, remainingAmount);
    }

    //step 1 -> transfer tokens to allocated locks in preperation for step 2 
    function TransferTokensToLocks(uint256 presaleId) nonReentrant() external{
        RequireStep(presaleId, 1);
        require(SoftcapMet(presaleId), "Softcap has not been met!");
        require(PresaleFinished(presaleId), "Presale has not finished!");
        //create timelock
        Presales[presaleId].Addresses.TokenTimeLock = IBEP20TimelockFactory(TimelockFactoryAddress).CreateTimelock(address(this), Presales[presaleId].Addresses.TokenOwnerAddress);

        if(Presales[presaleId].State.TotalTokenAmount.sub(Presales[presaleId].TokenPresaleAllocation).sub(Presales[presaleId].TokenLiqAmount) == 0){
            Presales[presaleId].State.Step = 2;
            emit NoTokensTransferedToLocks(presaleId);
        }else{
            //approve all tokens except used for presale and liq
            IBEP20(Presales[presaleId].Addresses.TokenAddress).approve(Presales[presaleId].Addresses.TokenTimeLock, Presales[presaleId].State.TotalTokenAmount.sub(Presales[presaleId].TokenPresaleAllocation).sub(Presales[presaleId].TokenLiqAmount));
            //create and transfer allocations
            for(uint i=0; i<Presales[presaleId].TokenAllocations.length; i++)
            {
                IBEP20Timelock(Presales[presaleId].Addresses.TokenTimeLock).AddAllocation(Presales[presaleId].TokenAllocations[i].Name, Presales[presaleId].TokenAllocations[i].Amount, Presales[presaleId].TokenAllocations[i].ReleaseDate, Presales[presaleId].TokenAllocations[i].IsInterval, Presales[presaleId].TokenAllocations[i].PercentageOfRelease, Presales[presaleId].TokenAllocations[i].IntervalOfRelease, Presales[presaleId].Addresses.TokenAddress);
            }
            Presales[presaleId].State.Step = 2;
            emit TokensTransferedToLocks(presaleId, Presales[presaleId].State.TotalTokenAmount.sub(Presales[presaleId].TokenPresaleAllocation).sub(Presales[presaleId].TokenLiqAmount));
        }
    }

    //step 2 -> add liquidity to pancakeswap in preperation for step 3
    function AddLiquidity(uint256 presaleId) nonReentrant() external{
        RequireStep(presaleId, 2);
        uint256 liqTokenAmount;
        uint256 amountOfBNB = Presales[presaleId].State.ContributedBNB.sub(Presales[presaleId].State.RaisedFeeBNB).div(100).mul(Presales[presaleId].LiqPercentage);
        if(!Presales[presaleId].State.IsBurnUnsold){//default type -> divide unsold tokens
            liqTokenAmount = Presales[presaleId].TokenLiqAmount;
        }else{//new type determine pricing and burn/transfer unsold/unlisted tokens
            liqTokenAmount = amountOfBNB.mul(1e18).div(Presales[presaleId].State.ListingTokenPrice);
        }
        IBEP20(Presales[presaleId].Addresses.TokenAddress).approve(PancakeswapRouterAddress, liqTokenAmount);//approve pancakerouter
        
        if(Presales[presaleId].PermalockLiq)//permanently locked liq
        {
            IPancakeRouter02(PancakeswapRouterAddress).addLiquidityETH{value : amountOfBNB}(address(Presales[presaleId].Addresses.TokenAddress), liqTokenAmount, 0, 0, address(0x000000000000000000000000000000000000dEaD), block.timestamp.add(1 days));
        }
        else// use allocation for locking
        {
            IPancakeRouter02(PancakeswapRouterAddress).addLiquidityETH{value : amountOfBNB}(address(Presales[presaleId].Addresses.TokenAddress), liqTokenAmount, 0, 0, address(this), block.timestamp.add(1 days));
            address pairAddress = IPancakeFactory(PancakeswapFactoryAddress).getPair(IPancakeRouter02(PancakeswapRouterAddress).WETH(), Presales[presaleId].Addresses.TokenAddress);
            IBEP20(pairAddress).approve(Presales[presaleId].Addresses.TokenTimeLock, IBEP20(pairAddress).balanceOf(address(this)));
            IBEP20Timelock(Presales[presaleId].Addresses.TokenTimeLock).AddAllocation(Presales[presaleId].LiquidityTokenAllocation.Name, IBEP20(pairAddress).balanceOf(address(this)), Presales[presaleId].LiquidityTokenAllocation.ReleaseDate, Presales[presaleId].LiquidityTokenAllocation.IsInterval, Presales[presaleId].LiquidityTokenAllocation.PercentageOfRelease, Presales[presaleId].LiquidityTokenAllocation.IntervalOfRelease, pairAddress);
        }
        Presales[presaleId].State.RetrievedBNBAmount = Presales[presaleId].State.RetrievedBNBAmount.add(amountOfBNB);
        Presales[presaleId].State.Step = 3;
        emit PancakeswapLiquidityAdded(presaleId, Presales[presaleId].PermalockLiq, amountOfBNB, liqTokenAmount);
    }

    //step 3 -> claim tokens for presale contributors
    function ClaimTokens(uint256 presaleId) nonReentrant() external{
        RequireStep(presaleId, 3);
        require(Presales[presaleId].BNBContributedPerAddress[_msgSender()] > 0, "No contributions for address");
        require(Presales[presaleId].ClaimedAddress[_msgSender()] == false, "Already claimed for address");
        uint256 presaleTokenAmount;
        if(!Presales[presaleId].State.IsBurnUnsold){//default type -> divide unsold tokens
            presaleTokenAmount = Presales[presaleId].TokenPresaleAllocation;
        }else{//new type determine pricing and burn/transfer unsold/unlisted tokens
            presaleTokenAmount = Presales[presaleId].State.ContributedBNB.mul(1e18).div(Presales[presaleId].State.PresaleTokenPrice);
        }
        uint256 amountToSend = Presales[presaleId].BNBContributedPerAddress[_msgSender()].mul(presaleTokenAmount).div(Presales[presaleId].State.ContributedBNB);
        Presales[presaleId].ClaimedAddress[_msgSender()] = true;
        IBEP20(Presales[presaleId].Addresses.TokenAddress).transfer(_msgSender(), amountToSend);
        emit ClaimedTokens(presaleId, _msgSender(), amountToSend);
    }

    //step 3 -> distribute BNB to presale host and fees to ysec and unsold/unliq tokens to transferaddress
    function DistributeBNB(uint256 presaleId) nonReentrant() external{
        RequireStep(presaleId, 3);
        require(Presales[presaleId].State.ContributedBNB.sub(Presales[presaleId].State.RetrievedBNBAmount) > 0, "No BNB left to distribute");
        
        (bool successDiv, ) = YieldFeeAddress.call{value: Presales[presaleId].State.RaisedFeeBNB.div(2)}('');
        require(successDiv, "Transfer to yield fee address failed.");
        Presales[presaleId].State.RetrievedBNBAmount = Presales[presaleId].State.RetrievedBNBAmount.add(Presales[presaleId].State.RaisedFeeBNB.div(2));
        (bool successFee, ) = FeeAddress.call{value: Presales[presaleId].State.RaisedFeeBNB.div(2)}('');
        require(successFee, "Transfer to fee address failed.");
        Presales[presaleId].State.RetrievedBNBAmount = Presales[presaleId].State.RetrievedBNBAmount.add(Presales[presaleId].State.RaisedFeeBNB.div(2));
        uint256 amountSendToOwner = Presales[presaleId].State.ContributedBNB.sub(Presales[presaleId].State.RetrievedBNBAmount);
        (bool successOwner, ) = Presales[presaleId].Addresses.TokenOwnerAddress.call{value: amountSendToOwner}('');
        require(successOwner, "Transfer to owner failed.");
        Presales[presaleId].State.RetrievedBNBAmount = Presales[presaleId].State.RetrievedBNBAmount.add(amountSendToOwner);

        if(Presales[presaleId].State.IsBurnUnsold)//transfer unsold and unliq tokens
        {
            require(Presales[presaleId].State.TransferedBurnUnsold == 0, "No unsold/liq tokens left to transfer");
            uint256 soldTokens = Presales[presaleId].State.ContributedBNB.mul(1e18).div(Presales[presaleId].State.PresaleTokenPrice);
            uint256 unsoldTokens = Presales[presaleId].TokenPresaleAllocation.sub(soldTokens);

            uint256 BNBLiq = Presales[presaleId].State.ContributedBNB.sub(Presales[presaleId].State.RaisedFeeBNB).div(100).mul(Presales[presaleId].LiqPercentage);
            uint256 usedLiqTokens = BNBLiq.mul(1e18).div(Presales[presaleId].State.ListingTokenPrice);
            uint256 unusedLiqTokens = Presales[presaleId].TokenLiqAmount.sub(usedLiqTokens);

            Presales[presaleId].State.TransferedBurnUnsold = Presales[presaleId].State.TransferedBurnUnsold.add(unsoldTokens).add(unusedLiqTokens);
            IBEP20(Presales[presaleId].Addresses.TokenAddress).transfer(Presales[presaleId].Addresses.UnsoldTransferAddress, unsoldTokens);
            IBEP20(Presales[presaleId].Addresses.TokenAddress).transfer(Presales[presaleId].Addresses.UnsoldTransferAddress, unusedLiqTokens);
            emit UnsoldTokensTransfered(presaleId, Presales[presaleId].Addresses.UnsoldTransferAddress, unsoldTokens);
            emit UnliqedTokensTransfered(presaleId, Presales[presaleId].Addresses.UnsoldTransferAddress, unusedLiqTokens);
        }

        emit BNBYieldFeeDistributed(presaleId, YieldFeeAddress, Presales[presaleId].State.RaisedFeeBNB.div(2));
        emit BNBFeeDistributed(presaleId, FeeAddress, Presales[presaleId].State.RaisedFeeBNB.div(2));
        emit BNBDistributed(presaleId, Presales[presaleId].Addresses.TokenOwnerAddress, amountSendToOwner);
    }

    modifier RequireTokenOwner(uint256 presaleId){
        ValidPresale(presaleId);
        require(Presales[presaleId].Addresses.TokenOwnerAddress == _msgSender(), "Sender is not owner of tokens!");
        _;
    }

    function PresaleStarted(uint256 presaleId) public view returns(bool){
        return Presales[presaleId].State.Step > 0 && Presales[presaleId].StartDate <= block.timestamp && !PresaleFinished(presaleId);
    }

     function PresaleFinished(uint256 presaleId) public view returns(bool){
        return HardcapMet(presaleId) || Presales[presaleId].EndDate <= block.timestamp;
    }

    function SoftcapMet(uint256 presaleId) public view returns (bool){
        return Presales[presaleId].State.ContributedBNB >= Presales[presaleId].Softcap;
    }

    function HardcapMet(uint256 presaleId) public view returns (bool){
        return Presales[presaleId].State.ContributedBNB >= Presales[presaleId].Hardcap;
    }

    function RequireStep(uint256 presaleId, uint256 step) private{
        require(Presales[presaleId].State.Step == step, "Required step is not active!");
    }

    function ValidPresale(uint256 presaleId) private{
        require(Presales[presaleId].State.Exists, "Presale does not exist");
    }
    
    function PresaleIndexerLength() public view returns(uint256){
        return PresaleIndexer.length;
    }

    function GetTokenAllocations(uint256 presaleId) public view returns(TokenAllocation[] memory){
        TokenAllocation[] memory result = new TokenAllocation[](Presales[presaleId].TokenAllocations.length);
        for(uint i=0; i< Presales[presaleId].TokenAllocations.length; i++)
        {
            TokenAllocation storage allocation = Presales[presaleId].TokenAllocations[i];
            result[i] = allocation;
        }
        return result;
    }

    function GetBNBContributedForAddress(uint256 presaleId, address forAddress) public view returns(uint256){
        return Presales[presaleId].BNBContributedPerAddress[forAddress];
    }

    function GetAmountOfTokensForAddress(uint256 presaleId, address forAddress) public view returns(uint256){
        if(Presales[presaleId].BNBContributedPerAddress[forAddress] == 0 || Presales[presaleId].State.ContributedBNB == 0) return 0;
        uint256 presaleTokenAmount;
        if(!Presales[presaleId].State.IsBurnUnsold){//default type -> divide unsold tokens
            presaleTokenAmount = Presales[presaleId].TokenPresaleAllocation;
        }else{//new type determine pricing and burn/transfer unsold/unlisted tokens
            presaleTokenAmount = Presales[presaleId].State.ContributedBNB.mul(1e18).div(Presales[presaleId].State.PresaleTokenPrice);
        }
        return Presales[presaleId].BNBContributedPerAddress[forAddress].mul(presaleTokenAmount).div(Presales[presaleId].State.ContributedBNB);
    }

    function GetHardcapAmountOfTokensForAddress(uint256 presaleId, address forAddress) public view returns(uint256){
        return Presales[presaleId].BNBContributedPerAddress[forAddress].mul(Presales[presaleId].TokenPresaleAllocation).div(Presales[presaleId].Hardcap);
    }

    function GetRatio(uint256 presaleId) public view returns(uint256){
        uint256 oneBNB = 1000000000000000000;
        uint256 presaleTokenAmount;
        if(!Presales[presaleId].State.IsBurnUnsold){//default type -> divide unsold tokens
            presaleTokenAmount = Presales[presaleId].TokenPresaleAllocation;
        }else{//new type determine pricing and burn/transfer unsold/unlisted tokens
            presaleTokenAmount = Presales[presaleId].State.ContributedBNB.mul(1e18).div(Presales[presaleId].State.PresaleTokenPrice);
        }
        return oneBNB.mul(presaleTokenAmount).div(Presales[presaleId].State.ContributedBNB);
    }

    function GetNumberOfContributors(uint256 presaleId) public view returns(uint256){
        return Presales[presaleId].State.NumberOfContributors;
    }

    function ContributorHasClaimed(uint256 presaleId, address forAddress) public view returns(bool){
        return Presales[presaleId].ClaimedAddress[forAddress];
    }
}

File 10 of 16 : IBEP20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

interface IBEP20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the token decimals.
     */
    function decimals() external view returns (uint8);

    /**
     * @dev Returns the token symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the token name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the bep token owner.
     */
    function getOwner() external view returns (address);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address _owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 11 of 16 : IPancakeFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

interface IPancakeFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 12 of 16 : IPancakeRouter02.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

interface IPancakeRouter01 {
    function factory() external pure returns (address);
    function WETH() external pure 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 pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure 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);
}

interface IPancakeRouter02 is IPancakeRouter01 {
    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 13 of 16 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 14 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../GSN/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 15 of 16 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 16 of 16 : 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;
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"timelockFactoryAddress","type":"address"},{"internalType":"address","name":"yieldFeeAddress","type":"address"},{"internalType":"address","name":"feeAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"reciever","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BNBDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"reciever","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BNBFeeDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"reciever","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BNBYieldFeeDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Contributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"NoTokensTransferedToLocks","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"permaLockedLiq","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amountOfBNB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOfTokens","type":"uint256"}],"name":"PancakeswapLiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RetrievedBNB","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RetrievedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensTransferedToLocks","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"reciever","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnliqedTokensTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"presaleId","type":"uint256"},{"indexed":false,"internalType":"address","name":"reciever","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnsoldTokensTransfered","type":"event"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"AddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"ClaimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"Contribute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"},{"internalType":"address","name":"forAddress","type":"address"}],"name":"ContributorHasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"StartDate","type":"uint256"},{"internalType":"uint256","name":"EndDate","type":"uint256"},{"internalType":"uint256","name":"Softcap","type":"uint256"},{"internalType":"uint256","name":"Hardcap","type":"uint256"},{"internalType":"uint256","name":"TokenLiqAmount","type":"uint256"},{"internalType":"uint256","name":"LiqPercentage","type":"uint256"},{"internalType":"uint256","name":"TokenPresaleAllocation","type":"uint256"},{"internalType":"bool","name":"PermalockLiq","type":"bool"},{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"Amount","type":"uint256"},{"internalType":"uint256","name":"RemainingAmount","type":"uint256"},{"internalType":"uint256","name":"ReleaseDate","type":"uint256"},{"internalType":"bool","name":"IsInterval","type":"bool"},{"internalType":"uint256","name":"PercentageOfRelease","type":"uint256"},{"internalType":"uint256","name":"IntervalOfRelease","type":"uint256"},{"internalType":"bool","name":"Exists","type":"bool"},{"internalType":"address","name":"Token","type":"address"}],"internalType":"struct TokenAllocation[]","name":"TokenAllocations","type":"tuple[]"},{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"Amount","type":"uint256"},{"internalType":"uint256","name":"RemainingAmount","type":"uint256"},{"internalType":"uint256","name":"ReleaseDate","type":"uint256"},{"internalType":"bool","name":"IsInterval","type":"bool"},{"internalType":"uint256","name":"PercentageOfRelease","type":"uint256"},{"internalType":"uint256","name":"IntervalOfRelease","type":"uint256"},{"internalType":"bool","name":"Exists","type":"bool"},{"internalType":"address","name":"Token","type":"address"}],"internalType":"struct TokenAllocation","name":"LiquidityTokenAllocation","type":"tuple"},{"internalType":"address","name":"Token","type":"address"},{"internalType":"string","name":"Website","type":"string"},{"internalType":"string","name":"Telegram","type":"string"},{"internalType":"string","name":"Twitter","type":"string"},{"internalType":"string","name":"Github","type":"string"},{"internalType":"string","name":"Medium","type":"string"},{"internalType":"uint256","name":"PresaleTokenPrice","type":"uint256"},{"internalType":"uint256","name":"ListingTokenPrice","type":"uint256"},{"internalType":"bool","name":"IsBurnUnsold","type":"bool"},{"internalType":"address","name":"UnsoldTransferAddress","type":"address"}],"internalType":"struct PresaleSettings","name":"settings","type":"tuple"}],"name":"CreatePresale","outputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"DistributeBNB","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"FeeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"},{"internalType":"address","name":"forAddress","type":"address"}],"name":"GetAmountOfTokensForAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"},{"internalType":"address","name":"forAddress","type":"address"}],"name":"GetBNBContributedForAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"},{"internalType":"address","name":"forAddress","type":"address"}],"name":"GetHardcapAmountOfTokensForAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"GetNumberOfContributors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"GetRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"GetTokenAllocations","outputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"Amount","type":"uint256"},{"internalType":"uint256","name":"RemainingAmount","type":"uint256"},{"internalType":"uint256","name":"ReleaseDate","type":"uint256"},{"internalType":"bool","name":"IsInterval","type":"bool"},{"internalType":"uint256","name":"PercentageOfRelease","type":"uint256"},{"internalType":"uint256","name":"IntervalOfRelease","type":"uint256"},{"internalType":"bool","name":"Exists","type":"bool"},{"internalType":"address","name":"Token","type":"address"}],"internalType":"struct TokenAllocation[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"HardcapMet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PancakeswapFactoryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PancakeswapRouterAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"PresaleFinished","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"PresaleIndexer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PresaleIndexerLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"PresaleStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"Presales","outputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"string","name":"Website","type":"string"},{"internalType":"string","name":"Telegram","type":"string"},{"internalType":"string","name":"Twitter","type":"string"},{"internalType":"string","name":"Github","type":"string"},{"internalType":"string","name":"Medium","type":"string"}],"internalType":"struct PresaleInfo","name":"Info","type":"tuple"},{"internalType":"uint256","name":"StartDate","type":"uint256"},{"internalType":"uint256","name":"EndDate","type":"uint256"},{"internalType":"uint256","name":"Softcap","type":"uint256"},{"internalType":"uint256","name":"Hardcap","type":"uint256"},{"internalType":"uint256","name":"TokenLiqAmount","type":"uint256"},{"internalType":"uint256","name":"LiqPercentage","type":"uint256"},{"internalType":"uint256","name":"TokenPresaleAllocation","type":"uint256"},{"internalType":"bool","name":"PermalockLiq","type":"bool"},{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"Amount","type":"uint256"},{"internalType":"uint256","name":"RemainingAmount","type":"uint256"},{"internalType":"uint256","name":"ReleaseDate","type":"uint256"},{"internalType":"bool","name":"IsInterval","type":"bool"},{"internalType":"uint256","name":"PercentageOfRelease","type":"uint256"},{"internalType":"uint256","name":"IntervalOfRelease","type":"uint256"},{"internalType":"bool","name":"Exists","type":"bool"},{"internalType":"address","name":"Token","type":"address"}],"internalType":"struct TokenAllocation","name":"LiquidityTokenAllocation","type":"tuple"},{"components":[{"internalType":"address","name":"TokenOwnerAddress","type":"address"},{"internalType":"address","name":"TokenAddress","type":"address"},{"internalType":"address","name":"TokenTimeLock","type":"address"},{"internalType":"address","name":"UnsoldTransferAddress","type":"address"}],"internalType":"struct PresaleDataAddresses","name":"Addresses","type":"tuple"},{"components":[{"internalType":"uint256","name":"TotalTokenAmount","type":"uint256"},{"internalType":"uint256","name":"Step","type":"uint256"},{"internalType":"uint256","name":"ContributedBNB","type":"uint256"},{"internalType":"uint256","name":"RaisedFeeBNB","type":"uint256"},{"internalType":"bool","name":"Exists","type":"bool"},{"internalType":"uint256","name":"RetrievedTokenAmount","type":"uint256"},{"internalType":"uint256","name":"RetrievedBNBAmount","type":"uint256"},{"internalType":"uint256","name":"NumberOfContributors","type":"uint256"},{"internalType":"uint256","name":"PresaleTokenPrice","type":"uint256"},{"internalType":"uint256","name":"ListingTokenPrice","type":"uint256"},{"internalType":"bool","name":"IsBurnUnsold","type":"bool"},{"internalType":"uint256","name":"TransferedBurnUnsold","type":"uint256"}],"internalType":"struct PresaleDataState","name":"State","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"},{"internalType":"address","name":"contributor","type":"address"}],"name":"RetrieveBNB","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"RetrieveTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeAddress","type":"address"}],"name":"SetFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"SetPancakeswapFactoryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"SetPancakeswapRouterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"timelockFactoryAddress","type":"address"}],"name":"SetTimelockFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"yieldFeeAddress","type":"address"}],"name":"SetYieldFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"SoftcapMet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TimelockFactoryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"TransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"presaleId","type":"uint256"}],"name":"TransferTokensToLocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"YieldFeeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620051e9380380620051e9833981016040819052620000349162000112565b6000620000406200010e565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055600280546001600160a01b03199081167305ff2b0db69458a0750badebc4f9e13add608c7f1790915560038054821673bcfccbde45ce874adcb698cc183debcf17952812179055600480546001600160a01b039586169083161790556005805493851693821693909317909255600680549190931691161790556200017e565b3390565b60008060006060848603121562000127578283fd5b8351620001348162000165565b6020850151909350620001478162000165565b60408501519092506200015a8162000165565b809150509250925092565b6001600160a01b03811681146200017b57600080fd5b50565b61505b806200018e6000396000f3fe60806040526004361061020f5760003560e01c80638da5cb5b11610118578063da2315be116100a0578063f53d9d581161006f578063f53d9d58146105fc578063f547e3851461061c578063f571715a14610631578063fcb8a96314610646578063fd4e2e1e146106665761020f565b8063da2315be1461057c578063eb8897301461059c578063f2fde38b146105bc578063f35df123146105dc5761020f565b8063b5852c60116100e7578063b5852c60146104e7578063c06ed0c214610514578063cbf5fa7614610534578063d10e66fc14610549578063d45d548d1461055c5761020f565b80638da5cb5b146104725780639200aeef14610487578063970f9448146104a7578063a8de8ac6146104c75761020f565b80634705ae3b1161019b57806370c5bb111161016a57806370c5bb11146103e8578063715018a6146104085780637b7e8bac1461041d5780637ea316a91461043257806380ac087c146104525761020f565b80634705ae3b146103735780635fd136f214610388578063669c14b7146103a85780636a7d12c2146103c85761020f565b80632c70c16d116101e25780632c70c16d146102c45780633034064a146102f1578063307e14b3146103115780633502199114610331578063388c6dbd146103515761020f565b806308364261146102145780631c4d8074146102365780631d751c2c1461026c578063264ca834146102a4575b600080fd5b34801561022057600080fd5b5061023461022f36600461424f565b610686565b005b34801561024257600080fd5b5061025661025136600461427f565b610957565b6040516102639190614588565b60405180910390f35b34801561027857600080fd5b5061028c61028736600461424f565b610987565b6040516102639c9b9a99989796959493929190614e42565b3480156102b057600080fd5b506102566102bf36600461424f565b610f54565b3480156102d057600080fd5b506102e46102df36600461427f565b610f72565b6040516102639190614f7e565b3480156102fd57600080fd5b506102e461030c36600461424f565b610fc1565b34801561031d57600080fd5b506102e461032c36600461424f565b610fd6565b34801561033d57600080fd5b5061025661034c36600461424f565b610ff4565b34801561035d57600080fd5b5061036661103c565b6040516102639190614482565b34801561037f57600080fd5b506102e461104b565b34801561039457600080fd5b506102346103a336600461424f565b611051565b3480156103b457600080fd5b506102e46103c336600461424f565b61153b565b3480156103d457600080fd5b506102e46103e336600461402d565b6115d3565b3480156103f457600080fd5b5061023461040336600461424f565b611e13565b34801561041457600080fd5b5061023461205b565b34801561042957600080fd5b506103666120da565b34801561043e57600080fd5b5061025661044d36600461424f565b6120e9565b34801561045e57600080fd5b5061025661046d36600461424f565b612114565b34801561047e57600080fd5b50610366612132565b34801561049357600080fd5b506102346104a2366004613fd9565b612141565b3480156104b357600080fd5b506102e46104c236600461427f565b612198565b3480156104d357600080fd5b506102346104e2366004613fd9565b6121c4565b3480156104f357600080fd5b5061050761050236600461424f565b61221b565b6040516102639190614528565b34801561052057600080fd5b5061023461052f36600461424f565b6123fd565b34801561054057600080fd5b506103666126b2565b61023461055736600461424f565b6126c1565b34801561056857600080fd5b5061023461057736600461424f565b612917565b34801561058857600080fd5b5061023461059736600461427f565b613087565b3480156105a857600080fd5b506102346105b7366004613fd9565b613219565b3480156105c857600080fd5b506102346105d7366004613fd9565b613270565b3480156105e857600080fd5b506102346105f7366004613fd9565b613326565b34801561060857600080fd5b5061023461061736600461424f565b61337d565b34801561062857600080fd5b50610366613a2d565b34801561063d57600080fd5b50610366613a3c565b34801561065257600080fd5b50610234610661366004613fd9565b613a4b565b34801561067257600080fd5b506102e461068136600461427f565b613aa2565b8061069081613b91565b610698613bc5565b6000828152600760205260409020601701546001600160a01b039081169116146106dd5760405162461bcd60e51b81526004016106d490614973565b60405180910390fd5b600260015414156107005760405162461bcd60e51b81526004016106d490614d74565b6002600181905550610713826001613bc9565b61071c82612114565b156107395760405162461bcd60e51b81526004016106d490614c04565b610742826120e9565b61075e5760405162461bcd60e51b81526004016106d490614863565b6000828152600760209081526040822090810154601b9091015461078191613bfd565b9050600081116107a35760405162461bcd60e51b81526004016106d490614670565b6000838152600760205260408082206018015490516370a0823160e01b81526001600160a01b03909116906370a08231906107e2903090600401614482565b60206040518083038186803b1580156107fa57600080fd5b505afa15801561080e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108329190614267565b9050818110156108545760405162461bcd60e51b81526004016106d490614e19565b600084815260076020908152604090912001546108719083613c3f565b600085815260076020908152604090912090810191909155601801546001600160a01b031663a9059cbb6108a3613bc5565b846040518363ffffffff1660e01b81526004016108c19291906144d4565b602060405180830381600087803b1580156108db57600080fd5b505af11580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109139190614011565b507f5a0dbf8de996db69921aabab7729740e1f5c1f0b9d1d592ab56301af60b4e4388483604051610945929190614fc1565b60405180910390a15050600180555050565b60008281526007602090815260408083206001600160a01b038516845260280190915290205460ff165b92915050565b6007602090815260009182526040918290208251815460026001821615610100026000190190911604601f8101849004909302810160e090810190945260c08101838152919390928492849290918491840182828015610a285780601f106109fd57610100808354040283529160200191610a28565b820191906000526020600020905b815481529060010190602001808311610a0b57829003601f168201915b50505050508152602001600182018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aca5780601f10610a9f57610100808354040283529160200191610aca565b820191906000526020600020905b815481529060010190602001808311610aad57829003601f168201915b5050509183525050600282810180546040805160206001841615610100026000190190931694909404601f81018390048302850183019091528084529381019390830182828015610b5c5780601f10610b3157610100808354040283529160200191610b5c565b820191906000526020600020905b815481529060010190602001808311610b3f57829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152938201939291830182828015610bf05780601f10610bc557610100808354040283529160200191610bf0565b820191906000526020600020905b815481529060010190602001808311610bd357829003601f168201915b505050918352505060048201805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152938201939291830182828015610c845780601f10610c5957610100808354040283529160200191610c84565b820191906000526020600020905b815481529060010190602001808311610c6757829003601f168201915b505050918352505060058201805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152938201939291830182828015610d185780601f10610ced57610100808354040283529160200191610d18565b820191906000526020600020905b815481529060010190602001808311610cfb57829003601f168201915b505050919092525050506006820154600783015460088401546009850154600a860154600b870154600c880154600d89015460408051600f8c0180546101406020601f60026000196001861615610100020190941693909304928301819004028401810190945261012083018181529c9d9b9c9a9b999a989997989697959660ff909516959492939192849290918491840182828015610df95780601f10610dce57610100808354040283529160200191610df9565b820191906000526020600020905b815481529060010190602001808311610ddc57829003601f168201915b5050509183525050600182015460208083019190915260028301546040808401919091526003840154606080850191909152600485015460ff9081161515608080870191909152600587015460a080880191909152600688015460c080890191909152600790980154808416151560e0808a01919091526001600160a01b03610100928390048116998301999099528651808501885260178d01548a16815260188d01548a16818a015260198d01548a1681890152601a8d015490991689870152865161018081018852601b8d01548152601c8d0154818a0152601d8d015497810197909752601e8c015495870195909552601f8b0154841615159286019290925294890154948401949094526021880154958301959095526022870154908201526023860154918101919091526024850154610120820152602585015490921615156101408301526026909301546101608201529091908c565b60009081526007602052604090206009810154601d90910154101590565b60008281526007602090815260408083206009810154600c8201546001600160a01b0387168652602790920190935290832054610fba9291610fb49190613c64565b90613c9e565b9392505050565b60009081526007602052604090206022015490565b60088181548110610fe357fe5b600091825260209091200154905081565b6000818152600760205260408120601c01541580159061102557506000828152600760205260409020600601544210155b80156109815750611035826120e9565b1592915050565b6003546001600160a01b031681565b60085490565b600260015414156110745760405162461bcd60e51b81526004016106d490614d74565b6002600181905550611087816001613bc9565b61109081612114565b6110ac5760405162461bcd60e51b81526004016106d4906149aa565b6110b5816120e9565b6110d15760405162461bcd60e51b81526004016106d49061493c565b600480546000838152600760205260409081902060170154905163e9291a9560e01b81526001600160a01b039283169363e9291a959361111693309391169101614496565b602060405180830381600087803b15801561113057600080fd5b505af1158015611144573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111689190613ff5565b60008281526007602052604090206019810180546001600160a01b0319166001600160a01b039390931692909217909155600a810154600c820154601b909201546111bd926111b79190613bfd565b90613bfd565b61121457600081815260076020526040908190206002601c90910155517f2a2fd1e4b34979b7c990d21988c29d8a178749e09e7675df2384ddea33f2a0ae90611207908390614f7e565b60405180910390a1611534565b600081815260076020526040902060188101546019820154600a830154600c840154601b909401546001600160a01b039384169463095ea7b3949093169261126092916111b791613bfd565b6040518363ffffffff1660e01b815260040161127d9291906144d4565b602060405180830381600087803b15801561129757600080fd5b505af11580156112ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cf9190614011565b5060005b6000828152600760205260409020600e01548110156114c35760008281526007602052604090206019810154600e90910180546001600160a01b039092169163d261939891908490811061132357fe5b906000526020600020906008020160000160076000868152602001908152602001600020600e01848154811061135557fe5b90600052602060002090600802016001015460076000878152602001908152602001600020600e01858154811061138857fe5b90600052602060002090600802016003015460076000888152602001908152602001600020600e0186815481106113bb57fe5b906000526020600020906008020160040160009054906101000a900460ff1660076000898152602001908152602001600020600e0187815481106113fb57fe5b906000526020600020906008020160050154600760008a8152602001908152602001600020600e01888154811061142e57fe5b60009182526020808320600660089093020191909101548b835260079091526040918290206018015491516001600160e01b031960e08a901b1681526114859796959493926001600160a01b0316906004016145a6565b600060405180830381600087803b15801561149f57600080fd5b505af11580156114b3573d6000803e3d6000fd5b5050600190920191506112d39050565b5060008181526007602052604090206002601c820155600a810154600c820154601b909201547fefad5f1c3892d7db3c245a3af561f2df916fb961bebaaed2949b4ac8029835ed92849261151d9290916111b79190613bfd565b60405161152b929190614fc1565b60405180910390a15b5060018055565b600081815260076020526040812060250154670de0b6b3a764000090829060ff1661157857506000838152600760205260409020600c01546115ab565b60008481526007602052604090206023810154601d909101546115a89190610fb490670de0b6b3a7640000613c64565b90505b6000848152600760205260409020601d01546115cb90610fb48484613c64565b949350505050565b600081602001518260400151116115fc5760405162461bcd60e51b81526004016106d490614b51565b4282602001511161161f5760405162461bcd60e51b81526004016106d49061483a565b8160600151826080015110156116475760405162461bcd60e51b81526004016106d490614d2e565b600354600254604080516315ab88c960e31b815290516000936001600160a01b039081169363e6a439059391169163ad5c464891600480820192602092909190829003018186803b15801561169b57600080fd5b505afa1580156116af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d39190613ff5565b8561016001516040518363ffffffff1660e01b81526004016116f6929190614496565b60206040518083038186803b15801561170e57600080fd5b505afa158015611722573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117469190613ff5565b90506001600160a01b0381161561176f5760405162461bcd60e51b81526004016106d490614b88565b60085461177d906001613c3f565b61026084015160008281526007602081815260409283902060258101805495151560ff199687161790559088015160068201559187015190820155606086015160088201556080860151600982015560c0860151600b820155610100860151600d909101805482151593169290921790915590925061181e5742836101400151606001511161181e5760405162461bcd60e51b81526004016106d490614c5a565b610140830151600083815260076020908152604090912082518051600f9092019261184e92849290910190613d43565b50602082015160018201556040820151600282015560608201516003820155608082015160048201805491151560ff1992831617905560a0830151600583015560c0830151600683015560e083015160079092018054610100948501516001600160a01b0316909402610100600160a81b03199315159490921693909317919091161790556118db613bc5565b600083815260076020908152604082206017810180546001600160a01b03199081166001600160a01b039687161790915561016088015160188301805483169190961617909455601981018054909416909355601b8301829055601c8301829055601d8301829055601e8301829055601f8301805460ff191660011790558281018290556021830182905560228301919091558451805161198193929190910190613d43565b50610180830151600083815260076020908152604090912082516119ae9360019092019290910190613d43565b506101a0830151600083815260076020908152604090912082516119db9360029092019290910190613d43565b506101c083015160008381526007602090815260409091208251611a089360039092019290910190613d43565b506101e083015160008381526007602090815260409091208251611a359360049092019290910190613d43565b5061020083015160008381526007602090815260409091208251611a629360059092019290910190613d43565b5060005b83610120015151811015611c0d57428461012001518281518110611a8657fe5b60200260200101516060015111611aaf5760405162461bcd60e51b81526004016106d490614765565b611ab7613dc1565b8461012001518281518110611ac857fe5b602090810291909101810151600086815260079092526040909120601801546101008201519192506001600160a01b0391821691161415611b3857602080820151600086815260079092526040909120601b0154611b2591613c3f565b6000858152600760205260409020601b01555b60008481526007602090815260408220600e0180546001810182559083529181902083518051859460080290920192611b7692849290910190613d43565b5060208201516001828101919091556040830151600283015560608301516003830155608083015160048301805460ff1990811692151592909217905560a0840151600584015560c0840151600684015560e08401516007909301805461010095860151921693151593909317610100600160a81b0319166001600160a01b03909116909302929092179055919091019050611a66565b50826102600151611c895760a0830180516000848152600760205260409020600a81019190915560e0850151600c8201559051601b90910154611c4f91613c3f565b6000838152600760205260409020601b0181905560e0840151611c729190613c3f565b6000838152600760205260409020601b0155611dd8565b61022083018051600084815260076020526040812060238101929092556102408601516024830155610280860151601a90920180546001600160a01b0319166001600160a01b039093169290921790915590516080850151611cf89190610fb490670de0b6b3a7640000613c64565b6000848152600760205260409020601b0154909150611d179082613c3f565b6000848152600760205260408120601b01919091556080850151611d4990605f90611d43906064613c9e565b90613c64565b90506000611d698660c00151611d43606485613c9e90919063ffffffff16565b90506000611d91876102400151610fb4670de0b6b3a764000085613c6490919063ffffffff16565b6000878152600760205260409020601b0154909150611db09082613c3f565b6000878152600760205260409020601b810191909155600a810191909155600c019290925550505b50600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301819055919050565b60026001541415611e365760405162461bcd60e51b81526004016106d490614d74565b600260015580611e4581613b91565b611e4d613bc5565b6000828152600760205260409020601701546001600160a01b03908116911614611e895760405162461bcd60e51b81526004016106d490614973565b611e94826000613bc9565b6000828152600760205260409020601b8101546018909101546001600160a01b031663dd62ed3e611ec3613bc5565b306040518363ffffffff1660e01b8152600401611ee1929190614496565b60206040518083038186803b158015611ef957600080fd5b505afa158015611f0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f319190614267565b1015611f4f5760405162461bcd60e51b81526004016106d490614a8e565b6000828152600760205260409020601801546001600160a01b03166323b872dd611f77613bc5565b60008581526007602052604090819020601b015490516001600160e01b031960e085901b168152611fad929130916004016144b0565b602060405180830381600087803b158015611fc757600080fd5b505af1158015611fdb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fff9190614011565b50600082815260076020526040908190206001601c820155601b015490517f119519f464d8d89f3921b5e3e7945bc789a237451bd7e2e8ec187e2b823fc30f9161204b91859190614fc1565b60405180910390a1505060018055565b612063613bc5565b6000546001600160a01b039081169116146120905760405162461bcd60e51b81526004016106d490614a59565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6006546001600160a01b031681565b60006120f482610f54565b806109815750506000908152600760208190526040909120015442101590565b60009081526007602052604090206008810154601d90910154101590565b6000546001600160a01b031690565b612149613bc5565b6000546001600160a01b039081169116146121765760405162461bcd60e51b81526004016106d490614a59565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60008281526007602090815260408083206001600160a01b038516845260270190915290205492915050565b6121cc613bc5565b6000546001600160a01b039081169116146121f95760405162461bcd60e51b81526004016106d490614a59565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600760205260409020600e0154606090819067ffffffffffffffff8111801561224857600080fd5b5060405190808252806020026020018201604052801561228257816020015b61226f613dc1565b8152602001906001900390816122675790505b50905060005b6000848152600760205260409020600e01548110156123f6576000848152600760205260408120600e018054839081106122be57fe5b600091825260209182902060408051600893909302909101805460026001821615610100026000190190911604601f810185900490940283016101409081019092526101208301848152909450919284928492909184918401828280156123665780601f1061233b57610100808354040283529160200191612366565b820191906000526020600020905b81548152906001019060200180831161234957829003601f168201915b5050509183525050600182015460208201526002820154604082015260038201546060820152600482015460ff90811615156080830152600583015460a0830152600683015460c0830152600790920154918216151560e08201526001600160a01b03610100928390041691015283518490849081106123e257fe5b602090810291909101015250600101612288565b5092915050565b600260015414156124205760405162461bcd60e51b81526004016106d490614d74565b6002600155612430816003613bc9565b60008181526007602052604081206027018161244a613bc5565b6001600160a01b03166001600160a01b0316815260200190815260200160002054116124885760405162461bcd60e51b81526004016106d4906149e1565b6000818152600760205260408120602801906124a2613bc5565b6001600160a01b0316815260208101919091526040016000205460ff16156124dc5760405162461bcd60e51b81526004016106d490614ad5565b60008181526007602052604081206025015460ff1661250d57506000818152600760205260409020600c0154612540565b60008281526007602052604090206023810154601d9091015461253d9190610fb490670de0b6b3a7640000613c64565b90505b6000828152600760205260408120601d81015461258991610fb490859060270185612569613bc5565b6001600160a01b0316815260208101919091526040016000205490613c64565b6000848152600760205260408120919250600191602801906125a9613bc5565b6001600160a01b03908116825260208083019390935260409182016000908120805460ff1916951515959095179094558684526007909252909120601801541663a9059cbb6125f6613bc5565b836040518363ffffffff1660e01b81526004016126149291906144d4565b602060405180830381600087803b15801561262e57600080fd5b505af1158015612642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126669190614011565b507fd18cfec3e839055275aa213c7d374c6a38184928299599e43f6677df2f5dbf0483612691613bc5565b836040516126a193929190614f87565b60405180910390a150506001805550565b6004546001600160a01b031681565b600260015414156126e45760405162461bcd60e51b81526004016106d490614d74565b60026001819055506126f7816001613bc9565b600034116127175760405162461bcd60e51b81526004016106d490614d01565b612720816120e9565b1561273d5760405162461bcd60e51b81526004016106d49061479c565b61274681610ff4565b6127625760405162461bcd60e51b81526004016106d4906146f7565b60008181526007602052604090206009810154601d909101543491908201111561279e5760405162461bcd60e51b81526004016106d490614b0c565b6000828152600760205260409020601d01546127ba9082613c3f565b6000838152600760205260409020601d01556127f76127df6005611d43846064613c9e565b6000848152600760205260409020601e015490613c3f565b6000838152600760205260408120601e81019290925560279091019061281b613bc5565b6001600160a01b0316815260208101919091526040016000205461286957600082815260076020526040902060220154612856906001613c3f565b6000838152600760205260409020602201555b60008281526007602052604081206128a991839160270190612889613bc5565b6001600160a01b0316815260208101919091526040016000205490613c3f565b6000838152600760205260408120602701906128c3613bc5565b6001600160a01b031681526020810191909152604001600020557fb2ed2e021651f85a4754a44651fc09ac5141bc0329ce4dfe8dd712a5d04a8b3982612907613bc5565b8360405161204b93929190614f87565b6002600154141561293a5760405162461bcd60e51b81526004016106d490614d74565b600260015561294a816003613bc9565b60008181526007602052604081206021810154601d9091015461296c91613bfd565b116129895760405162461bcd60e51b81526004016106d490614ca0565b6005546000828152600760205260408120601e015490916001600160a01b0316906129b5906002613c9e565b6040516129c19061447f565b60006040518083038185875af1925050503d80600081146129fe576040519150601f19603f3d011682016040523d82523d6000602084013e612a03565b606091505b5050905080612a245760405162461bcd60e51b81526004016106d490614bbf565b6000828152600760205260409020601e0154612a5d90612a45906002613c9e565b60008481526007602052604090206021015490613c3f565b60008381526007602052604081206021810192909255600654601e9092015490916001600160a01b031690612a93906002613c9e565b604051612a9f9061447f565b60006040518083038185875af1925050503d8060008114612adc576040519150601f19603f3d011682016040523d82523d6000602084013e612ae1565b606091505b5050905080612b025760405162461bcd60e51b81526004016106d490614de2565b6000838152600760205260409020601e0154612b3b90612b23906002613c9e565b60008581526007602052604090206021015490613c3f565b600084815260076020526040812060218101839055601d01549091612b609190613bfd565b60008581526007602052604080822060170154905192935090916001600160a01b03909116908390612b919061447f565b60006040518083038185875af1925050503d8060008114612bce576040519150601f19603f3d011682016040523d82523d6000602084013e612bd3565b606091505b5050905080612bf45760405162461bcd60e51b81526004016106d49061472e565b600085815260076020526040902060210154612c109083613c3f565b600086815260076020526040902060218101919091556025015460ff1615612f575760008581526007602052604090206026015415612c615760405162461bcd60e51b81526004016106d4906148c0565b60008581526007602052604081206023810154601d90910154612c919190610fb490670de0b6b3a7640000613c64565b6000878152600760205260408120600c015491925090612cb19083613bfd565b6000888152600760205260408120600b810154601e820154601d909201549394509192612cea9291611d4391606491610fb49190613bfd565b60008981526007602052604081206024015491925090612d1690610fb484670de0b6b3a7640000613c64565b60008a8152600760205260408120600a015491925090612d369083613bfd565b60008b815260076020526040902060260154909150612d61908290612d5b9087613c3f565b90613c3f565b60008b8152600760205260409081902060268101929092556018820154601a90920154905163a9059cbb60e01b81526001600160a01b039283169263a9059cbb92612db39291169088906004016144d4565b602060405180830381600087803b158015612dcd57600080fd5b505af1158015612de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e059190614011565b5060008a815260076020526040908190206018810154601a90910154915163a9059cbb60e01b81526001600160a01b039182169263a9059cbb92612e509291169085906004016144d4565b602060405180830381600087803b158015612e6a57600080fd5b505af1158015612e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ea29190614011565b5060008a81526007602052604090819020601a015490517fb928864dacbff065ca6b004eb9a423c93563a3dc49b603884ddccbd902ad8dea91612ef2918d916001600160a01b0316908890614f87565b60405180910390a160008a81526007602052604090819020601a015490517fc7e6e76c2d01afc2fc532d354ab5efbffbb4dc53292e185bbc9c1d965b3a0a5d91612f49918d916001600160a01b0316908590614f87565b60405180910390a150505050505b6005546000868152600760205260409020601e01547f238f2a339e6c633647715499aac150bbfa0edb6168faab109fbbff72a07afaca9187916001600160a01b0390911690612fa7906002613c9e565b604051612fb693929190614f87565b60405180910390a16006546000868152600760205260409020601e01547f7da165cbc4c72c11699b445988adce6222db1d187b2a32c86ce1b2dcf2706ed69187916001600160a01b039091169061300e906002613c9e565b60405161301d93929190614f87565b60405180910390a1600085815260076020526040908190206017015490517f801e9c6e412d15c0708456fe7fb572db5447bfb9529977efa4bf621de1242bc2916130749188916001600160a01b0316908690614f87565b60405180910390a1505060018055505050565b600260015414156130aa5760405162461bcd60e51b81526004016106d490614d74565b60026001819055506130bd826001613bc9565b6130c682612114565b156130e35760405162461bcd60e51b81526004016106d490614c04565b6130ec826120e9565b6131085760405162461bcd60e51b81526004016106d490614863565b60008281526007602090815260408083206001600160a01b03851684526027019091529020548061314b5760405162461bcd60e51b81526004016106d490614dab565b60008381526007602090815260408083206001600160a01b03861680855260279091019092528083208390555183906131839061447f565b60006040518083038185875af1925050503d80600081146131c0576040519150601f19603f3d011682016040523d82523d6000602084013e6131c5565b606091505b50509050806131e65760405162461bcd60e51b81526004016106d490614cd7565b7f6bfbff6d652bc04f7069f4413ddf393c776dc0d9eb5a4f74c3f3283b0944798d84848460405161094593929190614f87565b613221613bc5565b6000546001600160a01b0390811691161461324e5760405162461bcd60e51b81526004016106d490614a59565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613278613bc5565b6000546001600160a01b039081169116146132a55760405162461bcd60e51b81526004016106d490614a59565b6001600160a01b0381166132cb5760405162461bcd60e51b81526004016106d4906146b1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61332e613bc5565b6000546001600160a01b0390811691161461335b5760405162461bcd60e51b81526004016106d490614a59565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600260015414156133a05760405162461bcd60e51b81526004016106d490614d74565b60026001819055506133b3816002613bc9565b6000818152600760205260408120600b810154601e820154601d9092015483926133e89291611d4391606491610fb491613bfd565b60008481526007602052604090206025015490915060ff1661341d576000838152600760205260409020600a01549150613448565b60008381526007602052604090206024015461344590610fb483670de0b6b3a7640000613c64565b91505b6000838152600760205260409081902060180154600254915163095ea7b360e01b81526001600160a01b039182169263095ea7b39261348e9291169086906004016144d4565b602060405180830381600087803b1580156134a857600080fd5b505af11580156134bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134e09190614011565b506000838152600760205260409020600d015460ff16156135b6576002546000848152600760205260408120601801546001600160a01b039283169263f305d7199285929091169086908061dead61353b4262015180613c3f565b6040518863ffffffff1660e01b815260040161355c969594939291906144ed565b6060604051808303818588803b15801561357557600080fd5b505af1158015613589573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906135ae91906142ae565b5050506139b5565b6002546000848152600760205260408120601801546001600160a01b039283169263f305d71992859290911690869080306135f44262015180613c3f565b6040518863ffffffff1660e01b8152600401613615969594939291906144ed565b6060604051808303818588803b15801561362e57600080fd5b505af1158015613642573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061366791906142ae565b5050600354600254604080516315ab88c960e31b81529051600094506001600160a01b039384169363e6a4390593169163ad5c4648916004808301926020929190829003018186803b1580156136bc57600080fd5b505afa1580156136d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136f49190613ff5565b600087815260076020526040908190206018015490516001600160e01b031960e085901b16815261373292916001600160a01b031690600401614496565b60206040518083038186803b15801561374a57600080fd5b505afa15801561375e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137829190613ff5565b600085815260076020526040908190206019015490516370a0823160e01b81529192506001600160a01b038084169263095ea7b3929091169083906370a08231906137d1903090600401614482565b60206040518083038186803b1580156137e957600080fd5b505afa1580156137fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138219190614267565b6040518363ffffffff1660e01b815260040161383e9291906144d4565b602060405180830381600087803b15801561385857600080fd5b505af115801561386c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138909190614011565b5060008481526007602052604090819020601981015491516370a0823160e01b81526001600160a01b039283169263d261939892600f0191908516906370a08231906138e0903090600401614482565b60206040518083038186803b1580156138f857600080fd5b505afa15801561390c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139309190614267565b6000888152600760205260409081902060128101546013820154601483015460159093015493516001600160e01b031960e089901b168152613981969594929360ff90921692908a906004016145a6565b600060405180830381600087803b15801561399b57600080fd5b505af11580156139af573d6000803e3d6000fd5b50505050505b6000838152600760205260409020602101546139d19082613c3f565b6000848152600760205260409081902060218101929092556003601c830155600d9091015490517f8fae4d005ad897cdbed47d2c321099666463097c92d471f2c46ee54b0b701eca916126a191869160ff169085908790614fa6565b6002546001600160a01b031681565b6005546001600160a01b031681565b613a53613bc5565b6000546001600160a01b03908116911614613a805760405162461bcd60e51b81526004016106d490614a59565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60008281526007602090815260408083206001600160a01b03851684526027019091528120541580613ae357506000838152600760205260409020601d0154155b15613af057506000610981565b60008381526007602052604081206025015460ff16613b2157506000838152600760205260409020600c0154613b54565b60008481526007602052604090206023810154601d90910154613b519190610fb490670de0b6b3a7640000613c64565b90505b6000848152600760209081526040808320601d8101546001600160a01b03881685526027909101909252909120546115cb9190610fb49084613c64565b6000818152600760205260409020601f015460ff16613bc25760405162461bcd60e51b81526004016106d49061480a565b50565b3390565b6000828152600760205260409020601c01548114613bf95760405162461bcd60e51b81526004016106d490614905565b5050565b6000610fba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613ce0565b600082820183811015610fba5760405162461bcd60e51b81526004016106d4906147d3565b600082613c7357506000610981565b82820282848281613c8057fe5b0414610fba5760405162461bcd60e51b81526004016106d490614a18565b6000610fba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613d0c565b60008184841115613d045760405162461bcd60e51b81526004016106d49190614593565b505050900390565b60008183613d2d5760405162461bcd60e51b81526004016106d49190614593565b506000838581613d3957fe5b0495945050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613d8457805160ff1916838001178555613db1565b82800160010185558215613db1579182015b82811115613db1578251825591602001919060010190613d96565b50613dbd929150613e1a565b5090565b60405180610120016040528060608152602001600081526020016000815260200160008152602001600015158152602001600081526020016000815260200160001515815260200160006001600160a01b031681525090565b5b80821115613dbd5760008155600101613e1b565b803561098181615002565b600082601f830112613e4a578081fd5b813567ffffffffffffffff811115613e60578182fd5b6020613e6f8182840201614fcf565b828152925080830184820160005b84811015613ea657613e94888584358a0101613f25565b83529183019190830190600101613e7d565b505050505092915050565b803561098181615017565b600082601f830112613ecc578081fd5b813567ffffffffffffffff811115613ee2578182fd5b613ef5601f8201601f1916602001614fcf565b9150808252836020828501011115613f0c57600080fd5b8060208401602084013760009082016020015292915050565b6000610120808385031215613f38578182fd5b613f4181614fcf565b915050813567ffffffffffffffff811115613f5b57600080fd5b613f6784828501613ebc565b825250602082013560208201526040820135604082015260608201356060820152613f958360808401613eb1565b608082015260a082013560a082015260c082013560c0820152613fbb8360e08401613eb1565b60e0820152610100613fcf84828501613e2f565b9082015292915050565b600060208284031215613fea578081fd5b8135610fba81615002565b600060208284031215614006578081fd5b8151610fba81615002565b600060208284031215614022578081fd5b8151610fba81615017565b60006020828403121561403e578081fd5b813567ffffffffffffffff80821115614055578283fd5b81840191506102a080838703121561406b578384fd5b61407481614fcf565b9050823582811115614084578485fd5b61409087828601613ebc565b8252506020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e08201526101006140e887828601613eb1565b9082015261012083810135838111156140ff578586fd5b61410b88828701613e3a565b8284015250506101408084013583811115614124578586fd5b61413088828701613f25565b82840152505061016061414587828601613e2f565b90820152610180838101358381111561415c578586fd5b61416888828701613ebc565b8284015250506101a08084013583811115614181578586fd5b61418d88828701613ebc565b8284015250506101c080840135838111156141a6578586fd5b6141b288828701613ebc565b8284015250506101e080840135838111156141cb578586fd5b6141d788828701613ebc565b82840152505061020080840135838111156141f0578586fd5b6141fc88828701613ebc565b918301919091525061022083810135908201526102408084013590820152610260915061422b86838501613eb1565b82820152610280915061424086838501613e2f565b91810191909152949350505050565b600060208284031215614260578081fd5b5035919050565b600060208284031215614278578081fd5b5051919050565b60008060408385031215614291578081fd5b8235915060208301356142a381615002565b809150509250929050565b6000806000606084860312156142c2578081fd5b8351925060208401519150604084015190509250925092565b6001600160a01b03169052565b15159052565b60008151808452815b81811015614313576020818501810151868301820152016142f7565b818111156143245782602083870101525b50601f01601f19169290920160200192915050565b80516001600160a01b03908116835260208083015182169084015260408083015182169084015260609182015116910152565b8051825260208101516020830152604081015160408301526060810151606083015260808101516143a060808401826142e8565b5060a081015160a083015260c081015160c083015260e081015160e0830152610100808201518184015250610120808201518184015250610140808201516143ea828501826142e8565b505061016090810151910152565b6000610120825181855261440e828601826142ee565b91505060208301516020850152604083015160408501526060830151606085015260808301511515608085015260a083015160a085015260c083015160c085015260e083015161446160e08601826142e8565b5061010080840151614475828701826142db565b5090949350505050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561457b57603f198886030184526145698583516143f8565b9450928501929085019060010161454d565b5092979650505050505050565b901515815260200190565b600060208252610fba60208301846142ee565b600060e0820160e08352818a5460018116600081146145cc57600181146145ed5761462b565b6145dc607f600284041685614f7e565b60ff1983168152602001925061462b565b600282046145fb8186614f7e565b6146048f614ff6565b875b8381101561462257815483820152600190910190602001614606565b91909101945050505b5050809250505087602083015286604083015261464b60608301876142e8565b8460808301528360a083015261466460c08301846142db565b98975050505050505050565b60208082526021908201527f4e6f2072656d61696e696e6720746f6b656e7320666f722072657472696576616040820152601b60fa1b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f50726573616c6520686173206e6f742073746172746564207965742100000000604082015260600190565b60208082526019908201527f5472616e7366657220746f206f776e6572206661696c65642e00000000000000604082015260600190565b6020808252601c908201527f416c6c6f636174696f6e206e6f742073657420696e2066757475726500000000604082015260600190565b6020808252601c908201527f50726573616c652068617320616c72656164792066696e697368656400000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b602080825260169082015275141c995cd85b1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b6020808252600f908201526e537461727420696e2066757475726560881b604082015260600190565b6020808252603a908201527f50726573616c6520686173206e6f742066696e69736865642120796f7520617260408201527f65206e6f742061626c6520746f20726574726965766520424e42000000000000606082015260800190565b60208082526025908201527f4e6f20756e736f6c642f6c697120746f6b656e73206c65667420746f207472616040820152643739b332b960d91b606082015260800190565b6020808252601c908201527f52657175697265642073746570206973206e6f74206163746976652100000000604082015260600190565b60208082526019908201527f50726573616c6520686173206e6f742066696e69736865642100000000000000604082015260600190565b6020808252601e908201527f53656e646572206973206e6f74206f776e6572206f6620746f6b656e73210000604082015260600190565b60208082526019908201527f536f667463617020686173206e6f74206265656e206d65742100000000000000604082015260600190565b6020808252601c908201527f4e6f20636f6e747269627574696f6e7320666f72206164647265737300000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526027908201527f5472616e73666572206f6620746f6b656e20686173206e6f74206265656e20616040820152661c1c1c9bdd995960ca1b606082015260800190565b6020808252601b908201527f416c726561647920636c61696d656420666f7220616464726573730000000000604082015260600190565b60208082526025908201527f496e636f6d696e6720636f6e747269627574696f6e2065786365656473206861604082015264072646361760dc1b606082015260800190565b60208082526017908201527f446f206e6f74207374617274206265666f726520656e64000000000000000000604082015260600190565b6020808252601f908201527f546f6b656e2f424e4220706169722073686f756c64206e6f7420657869737400604082015260600190565b60208082526025908201527f5472616e7366657220746f207969656c6420666565206164647265737320666160408201526434b632b21760d91b606082015260800190565b60208082526036908201527f536f667463617020686173206265656e206d65742120796f7520617265206e6f6040820152753a1030b13632903a37903932ba3934b2bb329021272160511b606082015260800190565b60208082526026908201527f4c697175696469747920616c6c6f636174696f6e206e6f742073657420696e2060408201526566757475726560d01b606082015260800190565b60208082526019908201527f4e6f20424e42206c65667420746f206469737472696275746500000000000000604082015260600190565b60208082526010908201526f2a3930b739b332b9103330b4b632b21760811b604082015260600190565b602080825260139082015272043616e6e6f7420636f6e74726962757465203606c1b604082015260600190565b60208082526026908201527f486172646361702068617320746f20657175616c206f7220657863656564207360408201526506f66746361760d41b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f4e6f20424e4220617661696c61626c6520666f72207769746864726177616c00604082015260600190565b6020808252601f908201527f5472616e7366657220746f206665652061646472657373206661696c65642e00604082015260600190565b6020808252600f908201526e4e6f20746f6b656e73206c6566742160881b604082015260600190565b600061034082528d5160c0610340840152614e616104008401826142ee565b905060208f015161033f1984830301610360850152614e8082826142ee565b91505060408f015161033f1984830301610380850152614ea082826142ee565b91505060608f015161033f19848303016103a0850152614ec082826142ee565b91505060808f015161033f19848303016103c0850152614ee082826142ee565b91505060a08f015161033f19848303016103e0850152614f0082826142ee565b9150508d60208401528c60408401528b60608401528a60808401528960a08401528860c08401528760e0840152614f3b6101008401886142e8565b828103610120840152614f4e81876143f8565b915050614f5f610140830185614339565b614f6d6101c083018461436c565b9d9c50505050505050505050505050565b90815260200190565b9283526001600160a01b03919091166020830152604082015260600190565b93845291151560208401526040830152606082015260800190565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715614fee57600080fd5b604052919050565b60009081526020902090565b6001600160a01b0381168114613bc257600080fd5b8015158114613bc257600080fdfea2646970667358221220f47f9f74aab400261c7eaf636c9ecc1da5cdddb7bfc87e139299b7d36d2e8cfa64736f6c634300060c00330000000000000000000000002a0167b5605f92aeacfc3f4c3aea79a7608a04a6000000000000000000000000cbb6c761f43ed0d72ba5420b37a822f646cba1f4000000000000000000000000cbb6c761f43ed0d72ba5420b37a822f646cba1f4

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000002a0167b5605f92aeacfc3f4c3aea79a7608a04a6000000000000000000000000cbb6c761f43ed0d72ba5420b37a822f646cba1f4000000000000000000000000cbb6c761f43ed0d72ba5420b37a822f646cba1f4
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000002a0167b5605f92aeacfc3f4c3aea79a7608a04a6
Arg [1] : 000000000000000000000000cbb6c761f43ed0d72ba5420b37a822f646cba1f4
Arg [2] : 000000000000000000000000cbb6c761f43ed0d72ba5420b37a822f646cba1f4


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading