Contract 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x085c21c4c362ba4e04a175662690eaeaa9bee742c198901164e85dcca4ace3f9Set Trader Refer...271071192022-09-28 3:12:4126 mins ago0x367ba3e55c6e1ea380a386190ae96d412a74eaec IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00001943
0x255a1d5fa7fb6cc9dfd89fa1a0c9900b298320c86b7a8199a6ab548e0ccdbd6aRegister Code271019752022-09-28 2:44:4054 mins ago0xf16632127cc6242581d5d9ca77f970f5fa371ade IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00001549
0x0c018c38f0c2b6686d67030e1f90789c7440bd1e89eab449a2090bd2d3e12b19Set Trader Refer...270728422022-09-27 23:22:214 hrs 17 mins ago0x787bf189c6d9005a8e44dd29563fb6ea2dc33326 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00001896
0x52c2889a18504fcb855996ec2c0c7c01ac5cfe831e9e65b1a1043ce5be76f2e5Register Code270726712022-09-27 23:20:314 hrs 18 mins ago0xec501b18fddd1e6478221eaa8b1a38f7aa087c82 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00001895
0xd000697a97a8a889881ecdee0d3f9aa0a0daa033317d19cc14fa63d7cac0338cRegister Code270647272022-09-27 21:48:315 hrs 50 mins ago0x7749c684bf538503f36c157458cd348dd59c602f IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00002381
0x36cb71888578112d5f6d52365e342cf4848a99d89d2247041edac7d16e9f4753Set Trader Refer...270631782022-09-27 21:29:286 hrs 9 mins ago0x0ea37b047b4d2f37cef7be3e6671bf9cb85e2e5b IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00002486
0x1909e992354cebad3881eb6deaf6186218ac971770c66d46b02c3a21efa46618Register Code270599232022-09-27 20:54:376 hrs 44 mins ago0x1dd19cfc54ee4d330060e2c7e8418c7c1b834e84 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.0000269
0xdd68252b7327de7a59c754b76973656c6218cdd8525f05159f546d3ec60e84deRegister Code270385862022-09-27 17:39:439 hrs 59 mins ago0xbdc70cb1ef1e879405fcd42e39a79080a6ffd91d IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00005636
0x77879d674d99453f3cbe9194857a241cb4ad553067289e6ef14e36c2126d018cRegister Code270359562022-09-27 17:15:3810 hrs 23 mins ago0x8c6800b8159601419118b4995ae0111bf5b7db57 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00005784
0x4e103cb67534ba8831c3abb5d92afdfaa2d32538239431fc0a67c511210319b1Register Code270359222022-09-27 17:15:2810 hrs 23 mins ago0x4f5a399e294474eeb06a24ab436c8cfe3cd4e127 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00005784
0x340f98a52fc5d26ad485558be1072131b090ebcfe583ba82284b6fe9b5c37f59Set Trader Refer...270357072022-09-27 17:13:5310 hrs 25 mins ago0xf16632127cc6242581d5d9ca77f970f5fa371ade IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00005615
0x8ef619574d7c29925bedbe00921a6f13dd7364cd76c42d56e4fd8ff289214925Set Trader Refer...270311632022-09-27 16:46:5010 hrs 52 mins ago0x7b4a0ac7741c7e6cfc8b96d4760e219dbf13da82 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00005253
0xc1550b948c24cd844efdbd7e31d1ae2515ca17fc09792184b71cc9bee561b1a8Register Code270298102022-09-27 16:39:2211 hrs ago0x7b4a0ac7741c7e6cfc8b96d4760e219dbf13da82 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00004956
0xe20b83ca6fa39d5e1411fa6fd354eb92e0361077cd8288ddaf2de26471e0cb34Set Trader Refer...270246752022-09-27 16:14:1511 hrs 25 mins ago0x74775da414349c9a0fd6ee635ac95a2e6cc8e2d0 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003283
0x1ccbd6cad49ee07afdd7178a1ccb7bf1e583ae74d135dbbbb3d028d3247e6398Register Code270242212022-09-27 16:12:3711 hrs 26 mins ago0x52df51654cb2db79f4e7f3acafc00e402e04a048 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003283
0xbe2f41fc17bc6c1f6eec5418b87a1fed3437f791c3e1a362d5a1ca44412a642aSet Trader Refer...270183532022-09-27 15:39:1212 hrs ago0xc0b7b4f02c2b90fc47f6642de8b10d00605f881a IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003305
0x5c0f406a86ea84e47c0e6765b5b0770662d558706b14850d7b5a4207ab6b6565Register Code270181812022-09-27 15:38:0312 hrs 1 min ago0xc1178d5bada448126a5054eaf4e7c2f3fca5e974 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003099
0xabcc8f68e9a025be2fb43ea8c671b889fc0d86c0df595b27fa63a759b015f729Register Code270075132022-09-27 14:31:4813 hrs 7 mins ago0x873500f402a062e8d0688cb779b6e0440873eafb IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003063
0xbf52ee3a45cb0faf8670e62eca5a1486282291afdb6ae93f926af0c07850b81aRegister Code270050112022-09-27 14:16:4313 hrs 22 mins ago0x0396e7a8c8765c72cd98274e133169d180cd7324 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003044
0x54e4ebe1478a72d05f7f64502b400df2fdae39b7ee00f7787983c086aedca597Set Trader Refer...269923232022-09-27 13:03:2114 hrs 36 mins ago0xce5036110fd665fde011b3db3a6d567d48c90ab7 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00001947
0x4e0ff785b091d8478c8a72976297ab6ff80b96ed913078731b9064fba43399a8Register Code269913392022-09-27 12:56:4014 hrs 42 mins ago0x859481ee6854f4078dd19d50dcf10919dfae6786 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00002015
0x5709a7900fd2f798b960657368c9879ab800ddcc0f26193917ba97f9312510d6Register Code269705632022-09-27 10:54:3916 hrs 44 mins ago0xe7ce1c48c62412115f212de69860b063765de10a IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00001593
0x7f43431e3576bda07c85d0eb05b616b776b699ca441cd38f2e1c5fac6e26fde8Register Code269628252022-09-27 9:52:4817 hrs 46 mins ago0x3d5cb0be1a23cf23242ebed8c61544c319b69bec IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00002117
0xb4236ca7f00c867c49daf44daa6642d7a9ee4073161d893f9ca9d1350aeb1389Register Code269524742022-09-27 8:28:3619 hrs 10 mins ago0x6e6cea0e277d9cfcef9094c5c8713bb52ed600e0 IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.00003562
0x204f73e0a1b991c47d3379849a5a06ee0f9b4f338604ad57df049390f6ae180bSet Trader Refer...269385062022-09-27 6:44:3420 hrs 54 mins ago0x0aa0c3ac0151c42537fdb3cb6a2f37b9251a6c6c IN  0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH0.0000122
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x904624bf817a9824ebb7558511a0b06b2d18be612b959f2c6f3ceb0d36e70d62271116102022-09-28 3:38:111 min ago 0x87a4088bd721f83b6c2e5102e2fa47022cb1c831 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x017689843fe4f3b4fd38bc27bdc5610721af295da9235b390ac3a698eb0bdee6271116092022-09-28 3:38:111 min ago 0x87a4088bd721f83b6c2e5102e2fa47022cb1c831 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xca9f8f645d90378785167c6c2c3331f6b4aade15b39b1a23f32a45272b49a071271114612022-09-28 3:37:232 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xf602067bcca8798a74e43c39c894252e472a6e82e2509601ba5a8a1305931fb3271114342022-09-28 3:37:132 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x593c46c93f7c77d7d3564a9e57aef8797c8463b3e5993d904684b5a385291286271113552022-09-28 3:36:452 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x4f40e383cd59e197cde62cb95cb23d7dadf63111a266279d2526f224df06237b271113092022-09-28 3:36:292 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x3026d662da6635a855b9d67e1d50fb53aef615d00ea1fa4b32e22195d331be22271112502022-09-28 3:36:053 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x8c3c4256adc5f4c350b42329b9e920d57f3ea785e8b68aa26367cb9e23476748271112232022-09-28 3:35:573 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x5c36263c70554f738dc6d123f50698158e221258fb3815d489ebca32e0d75c47271112212022-09-28 3:35:563 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x03aa54773a20f075d171532194c6b1ef6d913a70e8976d012c6443e470da0ee3271111992022-09-28 3:35:483 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x845246875d1dc679b187a9683922d5dd4cbf2a9398828e4d3c9e233ee18b8259271111922022-09-28 3:35:463 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x6b4484225b27515db1c9c7bf164ab7a676c4562b8a52ed02dd6b25ce8952ae93271111542022-09-28 3:35:293 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xfe823eb181806412492b83863edb4c1628857761dfde150491e6a3616a9fb0b7271109242022-09-28 3:34:205 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x08eaf3e29bbbf73c0a344e972e8445079a9fa17dd01d861344486f6926307525271109072022-09-28 3:34:145 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xbd79f86bbf49b7d03aa04953be354a40253aea107e70ef3ad751d79988a94834271108362022-09-28 3:33:545 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x5f3596f55aaa894cf1f2f3a0cdd94a038da8d617319980f6651e8ac367f73b62271108102022-09-28 3:33:465 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x3d86ce08df5d086584dbf3053a2f5b9068c9a89a45c3041a2563b866927aa9e9271106472022-09-28 3:32:506 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xd02f2faff0ac3de38ed9e1fe37d811e64ae8a1b32e60d9482f2d8ed42aad25ca271105852022-09-28 3:32:296 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x81a8ca6d64099f039020f6f7246b58165c67abfe4c0dc920c0c1df68d489baa4271105002022-09-28 3:32:027 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x7e980c54f5b3a1c7e56887e2afd798e659fc05857fe8123ef58a227cd8c7bc87271104612022-09-28 3:31:497 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x07c0b29fb4c1b036bf99b226e6e78af9ccdccafbbb4ed716d655fa332facb888271104232022-09-28 3:31:387 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xc658156743cc2bacbb00746e78e394b66461973b70f4489f39d4594f8f89020e271104072022-09-28 3:31:337 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x5a10dc3b7bb7d1d71bbd942aa3677196289ed978e9e07ea52fa4352fe4ec671b271103802022-09-28 3:31:218 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0x1e71e1e6f14b022173d37929c3fc31b04fecd259af6fbcd127b3b00d869ec85f271103252022-09-28 3:31:098 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
0xd1b360c2e704490ef419e68acf9ea05194c5e739652bcf334317dfa93ba361f9271103192022-09-28 3:31:068 mins ago 0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba 0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ReferralStorage

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 5 : ReferralStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../libraries/math/SafeMath.sol";

import "../access/Governable.sol";
import "../peripherals/interfaces/ITimelock.sol";

import "./interfaces/IReferralStorage.sol";

contract ReferralStorage is Governable, IReferralStorage {
    using SafeMath for uint256;

    struct Tier {
        uint256 totalRebate; // e.g. 2400 for 24%
        uint256 discountShare; // 5000 for 50%/50%, 7000 for 30% rebates/70% discount
    }

    uint256 public constant BASIS_POINTS = 10000;

    mapping (address => uint256) public referrerDiscountShares; // to override default value in tier
    mapping (address => uint256) public referrerTiers; // link between user <> tier
    mapping (uint256 => Tier) public tiers;

    mapping (address => bool) public isHandler;

    mapping (bytes32 => address) public codeOwners;
    mapping (address => bytes32) public traderReferralCodes;

    event SetHandler(address handler, bool isActive);
    event SetTraderReferralCode(address account, bytes32 code);
    event SetTier(uint256 tierId, uint256 totalRebate, uint256 discountShare);
    event SetReferrerTier(address referrer, uint256 tierId);
    event SetReferrerDiscountShare(address referrer, uint256 discountShare);
    event RegisterCode(address account, bytes32 code);
    event SetCodeOwner(address account, address newAccount, bytes32 code);
    event GovSetCodeOwner(bytes32 code, address newAccount);

    modifier onlyHandler() {
        require(isHandler[msg.sender], "ReferralStorage: forbidden");
        _;
    }

    function setHandler(address _handler, bool _isActive) external onlyGov {
        isHandler[_handler] = _isActive;
        emit SetHandler(_handler, _isActive);
    }

    function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external onlyGov {
        require(_totalRebate <= BASIS_POINTS, "ReferralStorage: invalid totalRebate");
        require(_discountShare <= BASIS_POINTS, "ReferralStorage: invalid discountShare");

        Tier memory tier = tiers[_tierId];
        tier.totalRebate = _totalRebate;
        tier.discountShare = _discountShare;
        tiers[_tierId] = tier;
        emit SetTier(_tierId, _totalRebate, _discountShare);
    }

    function setReferrerTier(address _referrer, uint256 _tierId) external onlyGov {
        referrerTiers[_referrer] = _tierId;
        emit SetReferrerTier(_referrer, _tierId);
    }

    function setReferrerDiscountShare(uint256 _discountShare) external {
        require(_discountShare <= BASIS_POINTS, "ReferralStorage: invalid discountShare");

        referrerDiscountShares[msg.sender] = _discountShare;
        emit SetReferrerDiscountShare(msg.sender, _discountShare);
    }

    function setTraderReferralCode(address _account, bytes32 _code) external override onlyHandler {
        _setTraderReferralCode(_account, _code);
    }

    function setTraderReferralCodeByUser(bytes32 _code) external {
        _setTraderReferralCode(msg.sender, _code);
    }

    function registerCode(bytes32 _code) external {
        require(_code != bytes32(0), "ReferralStorage: invalid _code");
        require(codeOwners[_code] == address(0), "ReferralStorage: code already exists");

        codeOwners[_code] = msg.sender;
        emit RegisterCode(msg.sender, _code);
    }

    function setCodeOwner(bytes32 _code, address _newAccount) external {
        require(_code != bytes32(0), "ReferralStorage: invalid _code");

        address account = codeOwners[_code];
        require(msg.sender == account, "ReferralStorage: forbidden");

        codeOwners[_code] = _newAccount;
        emit SetCodeOwner(msg.sender, _newAccount, _code);
    }

    function govSetCodeOwner(bytes32 _code, address _newAccount) external onlyGov {
        require(_code != bytes32(0), "ReferralStorage: invalid _code");

        codeOwners[_code] = _newAccount;
        emit GovSetCodeOwner(_code, _newAccount);
    }

    function getTraderReferralInfo(address _account) external override view returns (bytes32, address) {
        bytes32 code = traderReferralCodes[_account];
        address referrer;
        if (code != bytes32(0)) {
            referrer = codeOwners[code];
        }
        return (code, referrer);
    }

    function _setTraderReferralCode(address _account, bytes32 _code) private {
        traderReferralCodes[_account] = _code;
        emit SetTraderReferralCode(_account, _code);
    }
}

File 2 of 5 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @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 3 of 5 : Governable.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

contract Governable {
    address public gov;

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

    modifier onlyGov() {
        require(msg.sender == gov, "Governable: forbidden");
        _;
    }

    function setGov(address _gov) external onlyGov {
        gov = _gov;
    }
}

File 4 of 5 : ITimelock.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface ITimelock {
    function setAdmin(address _admin) external;
    function enableLeverage(address _vault) external;
    function disableLeverage(address _vault) external;
    function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external;
    function signalSetGov(address _target, address _gov) external;
    function managedSetHandler(address _target, address _handler, bool _isActive) external;
    function managedSetMinter(address _target, address _minter, bool _isActive) external;
}

File 5 of 5 : IReferralStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IReferralStorage {
    function setTraderReferralCode(address _account, bytes32 _code) external;
    function getTraderReferralInfo(address _account) external view returns (bytes32, address);
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"code","type":"bytes32"},{"indexed":false,"internalType":"address","name":"newAccount","type":"address"}],"name":"GovSetCodeOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"code","type":"bytes32"}],"name":"RegisterCode","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"newAccount","type":"address"},{"indexed":false,"internalType":"bytes32","name":"code","type":"bytes32"}],"name":"SetCodeOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"handler","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"SetHandler","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"uint256","name":"discountShare","type":"uint256"}],"name":"SetReferrerDiscountShare","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"uint256","name":"tierId","type":"uint256"}],"name":"SetReferrerTier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tierId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalRebate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"discountShare","type":"uint256"}],"name":"SetTier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"code","type":"bytes32"}],"name":"SetTraderReferralCode","type":"event"},{"inputs":[],"name":"BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"codeOwners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getTraderReferralInfo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_code","type":"bytes32"},{"internalType":"address","name":"_newAccount","type":"address"}],"name":"govSetCodeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isHandler","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referrerDiscountShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referrerTiers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_code","type":"bytes32"}],"name":"registerCode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_code","type":"bytes32"},{"internalType":"address","name":"_newAccount","type":"address"}],"name":"setCodeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discountShare","type":"uint256"}],"name":"setReferrerDiscountShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"uint256","name":"_tierId","type":"uint256"}],"name":"setReferrerTier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tierId","type":"uint256"},{"internalType":"uint256","name":"_totalRebate","type":"uint256"},{"internalType":"uint256","name":"_discountShare","type":"uint256"}],"name":"setTier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bytes32","name":"_code","type":"bytes32"}],"name":"setTraderReferralCode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_code","type":"bytes32"}],"name":"setTraderReferralCodeByUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tiers","outputs":[{"internalType":"uint256","name":"totalRebate","type":"uint256"},{"internalType":"uint256","name":"discountShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"traderReferralCodes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610d59806100326000396000f3fe608060405234801561001057600080fd5b50600436106100f15760003560e01c8063039af9eb146100f657806312d43a511461012c5780631582a0181461015057806336def2c8146101885780633fb8b323146101a757806346ea87af146101d3578063534ef8831461020d57806356b4b2ad1461025457806371a6a79014610280578063836a0187146102a657806385725b58146102cf5780639c8e2de9146102f55780639cb7de4b14610312578063c8b3c46014610340578063cfad57a21461035d578063dfcfa25014610383578063e1e01bf3146103af578063e1f1c4a7146103cc578063ed843134146103d4575b600080fd5b6101136004803603602081101561010c57600080fd5b5035610400565b6040805192835260208301919091528051918290030190f35b610134610419565b604080516001600160a01b039092168252519081900360200190f35b6101766004803603602081101561016657600080fd5b50356001600160a01b0316610428565b60408051918252519081900360200190f35b6101a56004803603602081101561019e57600080fd5b503561043a565b005b6101a5600480360360408110156101bd57600080fd5b506001600160a01b03813516906020013561052e565b6101f9600480360360208110156101e957600080fd5b50356001600160a01b03166105d4565b604080519115158252519081900360200190f35b6102336004803603602081101561022357600080fd5b50356001600160a01b03166105e9565b604080519283526001600160a01b0390911660208301528051918290030190f35b6101a56004803603604081101561026a57600080fd5b506001600160a01b03813516906020013561062f565b6101766004803603602081101561029657600080fd5b50356001600160a01b031661069e565b6101a5600480360360608110156102bc57600080fd5b50803590602081013590604001356106b0565b610176600480360360208110156102e557600080fd5b50356001600160a01b0316610805565b6101a56004803603602081101561030b57600080fd5b5035610817565b6101a56004803603604081101561032857600080fd5b506001600160a01b03813516906020013515156108a7565b6101346004803603602081101561035657600080fd5b5035610958565b6101a56004803603602081101561037357600080fd5b50356001600160a01b0316610973565b6101a56004803603604081101561039957600080fd5b50803590602001356001600160a01b03166109e2565b6101a5600480360360208110156103c557600080fd5b5035610ad7565b610176610ae4565b6101a5600480360360408110156103ea57600080fd5b50803590602001356001600160a01b0316610aea565b6003602052600090815260409020805460019091015482565b6000546001600160a01b031681565b60026020526000908152604090205481565b8061047a576040805162461bcd60e51b815260206004820152601e6024820152600080516020610cba833981519152604482015290519081900360640190fd5b6000818152600560205260409020546001600160a01b0316156104ce5760405162461bcd60e51b8152600401808060200182810382526024815260200180610cda6024913960400191505060405180910390fd5b60008181526005602090815260409182902080546001600160a01b03191633908117909155825190815290810183905281517f04f82286a2a3b2ee5c8555de8304dfe2ea70991613213184b73a9e408d2d8029929181900390910190a150565b6000546001600160a01b0316331461057b576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b6001600160a01b0382166000818152600260209081526040918290208490558151928352820183905280517f7696855cdbb94bb5a44cb0a95caff6f29173aa1cbfba193834b12b90827ce2bc9281900390910190a15050565b60046020526000908152604090205460ff1681565b6001600160a01b038116600090815260066020526040812054819081811561062557506000818152600560205260409020546001600160a01b03165b9092509050915091565b3360009081526004602052604090205460ff16610690576040805162461bcd60e51b815260206004820152601a6024820152792932b332b93930b629ba37b930b3b29d103337b93134b23232b760311b604482015290519081900360640190fd5b61069a8282610c02565b5050565b60016020526000908152604090205481565b6000546001600160a01b031633146106fd576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b61271082111561073e5760405162461bcd60e51b8152600401808060200182810382526024815260200180610c966024913960400191505060405180910390fd5b61271081111561077f5760405162461bcd60e51b8152600401808060200182810382526026815260200180610cfe6026913960400191505060405180910390fd5b610787610c5b565b50600083815260036020818152604080842081518083018352878152808401878152958990529383528351815593516001909401939093558251868152908101859052808301849052915190917f4ebd23a492b2bd79586cb57cae40d7793408265f20320f68b478b971e696f4c7919081900360600190a150505050565b60066020526000908152604090205481565b6127108111156108585760405162461bcd60e51b8152600401808060200182810382526026815260200180610cfe6026913960400191505060405180910390fd5b336000818152600160209081526040918290208490558151928352820183905280517fbd224f3917462b0fa80805fe3ec29be3a37f664955aad6224e5ece036224c4299281900390910190a150565b6000546001600160a01b031633146108f4576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915582519384529083015280517fd373464a39404e5f98fdb4b152b8ba9a094561e97e5c4b4ea11eb18cd9e6695e9281900390910190a15050565b6005602052600090815260409020546001600160a01b031681565b6000546001600160a01b031633146109c0576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a2f576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b81610a6f576040805162461bcd60e51b815260206004820152601e6024820152600080516020610cba833981519152604482015290519081900360640190fd5b60008281526005602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518581529182015281517f6431f88c655dd0e2b8d09b6405c007c515c66d67f2998e69c902873a8c8f3e97929181900390910190a15050565b610ae13382610c02565b50565b61271081565b81610b2a576040805162461bcd60e51b815260206004820152601e6024820152600080516020610cba833981519152604482015290519081900360640190fd5b6000828152600560205260409020546001600160a01b0316338114610b93576040805162461bcd60e51b815260206004820152601a6024820152792932b332b93930b629ba37b930b3b29d103337b93134b23232b760311b604482015290519081900360640190fd5b60008381526005602090815260409182902080546001600160a01b0386166001600160a01b0319909116811790915582513381529182015280820185905290517f5640856798d41ce9ca0a109b54c20a06eb99ba9c36ab4547115dafb8473cf3979181900360600190a1505050565b6001600160a01b0382166000818152600660209081526040918290208490558151928352820183905280517f43825f14567dda057e821be2e51a5aa79aa51f3907a647e3ed2bd486a01050f19281900390910190a15050565b60405180604001604052806000815260200160008152509056fe476f7665726e61626c653a20666f7262696464656e0000000000000000000000526566657272616c53746f726167653a20696e76616c696420746f74616c526562617465526566657272616c53746f726167653a20696e76616c6964205f636f64650000526566657272616c53746f726167653a20636f646520616c726561647920657869737473526566657272616c53746f726167653a20696e76616c696420646973636f756e745368617265a26469706673582212206ea8c744fe30fea0df029a8f83305f2ccab1a943ff0dd3a5582d975a4f726a4364736f6c634300060c0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.