Contract 0x3Cd316df040f8A76eb2b496B92b358d3b2EFB9F5

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xcc1053fb43247eb365859649194726fca7dbf84c970e160d37257fe3da29e388Set Trader Refer...742689982023-03-27 16:01:325 days 4 hrs ago0x13408dabfb1c10bfc5a59f60b2492a6e4cfe619f IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.000082580.1
0xd151eb6587741434a1159694a77690e64fc58cadb42c0941492587a20cf6c9f8Register Code735224182023-03-25 12:11:177 days 8 hrs ago0xffd3003a187d9951e49bda206f32a6e765360427 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003013 0.1
0x33f3ea7b8df92a742b5d41ae3edc41eddc453d336d987c415d272c084a207cbeSet Trader Refer...697833102023-03-14 15:27:4718 days 5 hrs ago0x4b87f1e5090c7b9e816cc26e35f605e1ef76d2e7 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00007734 0.1
0xf785e1f2a0365403ed87774b4e2602c3a2ec6e6ce99319b0edcc49b3ed5a7ef6Set Trader Refer...683912012023-03-10 2:22:1522 days 18 hrs ago0x3dfc8749cabb6fd294b70d9cc63fbc9702645ee0 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004365 0.1
0xe8208b20b87139b723299308992952fabda80e4f103cde2864916f6e91260ad1Set Trader Refer...683550952023-03-09 23:28:4722 days 20 hrs ago0xf1d4b2fc9562d64a7ade249d492996918cf65b42 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00006081 0.1
0x779067ff0b0d7b808f75b48803bd1bcb7480b4c13d1dc0670eb3be47a417e698Set Trader Refer...682603852023-03-09 16:15:1523 days 4 hrs ago0xe6b29a99cde6b8f94915b6fc216a00edce53fdd2 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.000047120.1
0x8330fe7722b8be36bae7a171b7f63d1353e42147d2ad1830695b531a643430f3Set Trader Refer...682603772023-03-09 16:15:1323 days 4 hrs ago0x58d722dd75a14224ae96bb0944aff50e4d28c69d IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004918 0.1
0x0ed577ad7a59567698292bfcb74d3c7aee0006188142eda2eba54902ad9a7579Set Trader Refer...667521982023-03-04 17:22:5528 days 3 hrs ago0xc34ae1a39662415a4720d4a3e7c2be0e202568c2 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004663 0.1
0xa973f3c214f8a732e44769663c9b95bf61d47989a51bc9e8533b820930e28fc4Register Code667518242023-03-04 17:21:0028 days 3 hrs ago0xc34ae1a39662415a4720d4a3e7c2be0e202568c2 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004662 0.1
0xd6071a92a33bf746867eed4c55ba651f668a25b2db9234aaba052cf3535f0bb4Set Trader Refer...659069672023-03-02 1:35:2630 days 18 hrs ago0x77921114ea208a76cc774abd41946ec5cd5ea764 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.000035460.1
0x5c80a70451db8800620dbd68c7bf15795d362f10ec7b006df4ad9b88f91f5929Set Trader Refer...655984862023-03-01 2:36:0531 days 17 hrs ago0xe74864c33be4d8da148e0e3a21d345cbe6ec9677 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003186 0.1
0xa3312adfd0ef33ad45e2c1076a40f602770a4ee0fc516a3deefb1b54a6e3626eRegister Code654816722023-02-28 17:23:2632 days 3 hrs ago0x772676f3164d6ef517cbdaaa69ebf514d5806ac9 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004942 0.1
0x7d258da19a31009393a6bf19745eb4a7ef9e42209abc6154498e0bab95eb7700Set Trader Refer...654100782023-02-28 12:17:5032 days 8 hrs ago0xa0c9f17689f1e96f711ec15a7c27550d0f7340d1 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.0000285 0.1
0x1c17b746c98acec2eab855e8172672930bfb6a0b2a0dc06ff95c3d8a806ec3adSet Trader Refer...651517052023-02-27 17:30:3433 days 2 hrs ago0xfd56cc4979e33c2ef97d97b63fb664250f33c946 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00005171 0.1
0xad8cc4442812c16e006479d5acdb6a840edb218cd0040563f11bff5a0bd7b813Set Trader Refer...649997072023-02-27 7:01:1133 days 13 hrs ago0x131ddfd1dc9133077c72800c60072374cf6c87fb IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00002875 0.1
0x7c72f497a5a48020030d9e802e7a428eb87811a636a7e4f2164cc4474d69d6bdRegister Code644418082023-02-25 12:58:5635 days 7 hrs ago0x4ea0c6de1b4504952f40ab6268dce5696d3c3652 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003295 0.1
0xed1d51b4fc45d14b1a0d5de944647a5c9dff8c91148ca436fa5e64297bd0aa5eSet Trader Refer...639552602023-02-24 1:46:2536 days 18 hrs ago0xa571b83275fc41b6287d33ab16a905a07232575a IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004521 0.1
0xf164def44a008c0c3ecb2d665c8d494a3825eb37254084c7f9d7ea702f3a0e37Register Code639551462023-02-24 1:45:5736 days 18 hrs ago0xa571b83275fc41b6287d33ab16a905a07232575a IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004731 0.1
0x1b0ae95deb72725b3ebfa4f5cfe5922d557ea0523dedca5cb4053782ff12046fSet Trader Refer...637429082023-02-23 10:14:0137 days 10 hrs ago0x48a0096b26fe285138b294afe0eb1dd705071dca IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003895 0.1
0xbf331d502b301f806e58480e5779c5c33199cc7a34659e790aacfbe232b28a4eRegister Code634755012023-02-22 15:26:5538 days 5 hrs ago0xff65189d2c8f748d721ce310c6cff775bfa374f7 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00007676 0.1
0x77eb8bf46a57a95dbc02e7ad6a97b07859a9adea325a7f55114045b681917882Set Trader Refer...634341022023-02-22 12:34:0638 days 7 hrs ago0xa8a9e2c366c56ce3968bbac981d1a063e58dfa85 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003984 0.1
0xda25ce0eb17eca9060e8dc3caf6d74ec0976c89131635cd00f360189d34434fdSet Trader Refer...634336822023-02-22 12:32:2638 days 7 hrs ago0xc0e33564e04b9492b0e54a1e46acb29c9fd5542d IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003882 0.1
0x50574cf5ef0cb60b62ec8803b7c1ba71b5e977a529d019c50cdb3296372df589Register Code634333162023-02-22 12:30:5438 days 7 hrs ago0xa8a9e2c366c56ce3968bbac981d1a063e58dfa85 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003904 0.1
0xd9147ea7671ec46e76f385e7a9eb948f31c936425bb49d53a8b1077438fbf9baRegister Code634312212023-02-22 12:22:1138 days 8 hrs ago0x2b6091da312a3591df6a94b24dd3c34d2b01ca22 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00004061 0.1
0x336e30c7e9a867e0109f113bcf59e5e3149653ce725a71f0f308518ddcfd70abRegister Code634258472023-02-22 12:00:0338 days 8 hrs ago0x4b2f6d3a23badb60c8405d50289ef3dab9109936 IN  0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH0.00003654 0.1
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x12104ba9bf3eac19e6c3b7cc4ca8e551826f8e0b746eda6aa41e4630db40e447720826562023-03-21 10:02:1211 days 10 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xb8cd11fb2784b132616be51a4a0e7d582c1284fe1aa8a2ef837403da0f68948a720787222023-03-21 9:46:0311 days 10 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x1ea0ae78c2f767ddded9d566cee07878f89187c27da1b00578a4bb98e33cbb87720709362023-03-21 9:14:0311 days 11 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xd3acd6a24725ba8f77eb9f1a8a3ce0c0bcf50b29bf7004915741590b78b68e61720490462023-03-21 7:44:2511 days 12 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xb0af1094bcf680f9ae75e221bac10df8ee20a4936a60afee751ef304fa58c2b1720416412023-03-21 7:13:5711 days 13 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xc6e29e9e00ee17f8e6e94187cdab09b219420bd9fe8d8ffa561f263a365a5660720411562023-03-21 7:12:0211 days 13 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xb39c15cb097efee683dcdf668d7775cb9feab13e64227349203ab8ea0c25d11d720386512023-03-21 7:01:4011 days 13 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xc1934188e3b3efd61769fe509821de784e222cf7fefe7cc33f2a364d820ba4de720327852023-03-21 6:37:3711 days 13 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xebf9a3aff9ecf2837fddaa6df0b44a98df64a60c822be90eddbcd9b5f822d63e720182852023-03-21 5:37:5711 days 14 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xa0da85c0d78adf8447f7531f6db90f22d5ab07199ae496fadf229c3689f56cbe719691722023-03-21 2:14:2611 days 18 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x61427db0d8f256f312e4c4ef3cd675324ea8011d2b40a197bd0d8dcf044abf2d719516842023-03-21 1:00:3511 days 19 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x1cf165b6c9dc2a1981d758fe01417d8c20b76d046225998188ac499b18681703719514062023-03-21 0:59:2311 days 19 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xdf18362b8bca78ee215c440254f53245780d97e54bda1f3550102b3785ed7ef4719380302023-03-21 0:02:0211 days 20 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xac18aa441bc5fc0fc2d42cb69e6746d10727df0cb39538c9ca58e8ba766cd478719343922023-03-20 23:46:3111 days 20 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x1867959a481aac59e09ac218d0d13f666c858f3e0108569aa7ddc8dd8be449b6719342962023-03-20 23:46:0711 days 20 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x58fccea3b72b12cdefc75e1a0f49a360187fe588d52b927f40d6c418a1777193719339802023-03-20 23:44:4711 days 20 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x854f5d841fc021efcc7bc03046d5300b8f4b879b911a00b1b71711c3ef8efd36719335392023-03-20 23:42:5911 days 20 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x1465c3fa6d4124f8eee6800f07a47aef3fcb451e673ba2c26388c7019f0a198c719294192023-03-20 23:25:2711 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x939ca38d5fc13288de7aa8dfa29891fe9c08d5db220d6175594cdb1f27130f08719282012023-03-20 23:20:1711 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xbbab8da27eff83256edc4297ddec3720ede65e3457bea0b830675eee67cd9905719276832023-03-20 23:18:0911 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x572e4a0b854fd770b5947856f0bb7e5a56524625f3dba2ae8be896fcd30b1c31719275552023-03-20 23:17:3711 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xaf7668103a2232d980a02ed398b4f5fd0213a04c40e24cb943f7300f15bffc99719274262023-03-20 23:17:0411 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xf55241287327c7c7f5b4d20433ced2369515a7d135996becda720d0b34364f40719273622023-03-20 23:16:4811 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0x41683facdb1734bb228c4ca94c4ef9b4254debff81e0cfc50904ff5e2dfbfdc7719270942023-03-20 23:15:4111 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 ETH
0xa718540aa81d5cbf79e1c0fe3b5d63363db3377e0a5942a30429aabbf828bf51719269622023-03-20 23:15:0711 days 21 hrs ago 0xbb214233c570b8e9b732212974e7baeffe63f0de 0x3cd316df040f8a76eb2b496b92b358d3b2efb9f50 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 override 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 view override 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 codeOwners(bytes32 _code) external view returns (address);

    function getTraderReferralInfo(address _account) external view returns (bytes32, address);

    function setTraderReferralCode(address _account, bytes32 _code) external;
}

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"}]

608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610d59806100326000396000f3fe608060405234801561001057600080fd5b50600436106100f15760003560e01c8063039af9eb146100f657806312d43a511461012c5780631582a0181461015057806336def2c8146101885780633fb8b323146101a757806346ea87af146101d3578063534ef8831461020d57806356b4b2ad1461025457806371a6a79014610280578063836a0187146102a657806385725b58146102cf5780639c8e2de9146102f55780639cb7de4b14610312578063c8b3c46014610340578063cfad57a21461035d578063dfcfa25014610383578063e1e01bf3146103af578063e1f1c4a7146103cc578063ed843134146103d4575b600080fd5b6101136004803603602081101561010c57600080fd5b5035610400565b6040805192835260208301919091528051918290030190f35b610134610419565b604080516001600160a01b039092168252519081900360200190f35b6101766004803603602081101561016657600080fd5b50356001600160a01b0316610428565b60408051918252519081900360200190f35b6101a56004803603602081101561019e57600080fd5b503561043a565b005b6101a5600480360360408110156101bd57600080fd5b506001600160a01b03813516906020013561052e565b6101f9600480360360208110156101e957600080fd5b50356001600160a01b03166105d4565b604080519115158252519081900360200190f35b6102336004803603602081101561022357600080fd5b50356001600160a01b03166105e9565b604080519283526001600160a01b0390911660208301528051918290030190f35b6101a56004803603604081101561026a57600080fd5b506001600160a01b03813516906020013561062f565b6101766004803603602081101561029657600080fd5b50356001600160a01b031661069e565b6101a5600480360360608110156102bc57600080fd5b50803590602081013590604001356106b0565b610176600480360360208110156102e557600080fd5b50356001600160a01b0316610805565b6101a56004803603602081101561030b57600080fd5b5035610817565b6101a56004803603604081101561032857600080fd5b506001600160a01b03813516906020013515156108a7565b6101346004803603602081101561035657600080fd5b5035610958565b6101a56004803603602081101561037357600080fd5b50356001600160a01b0316610973565b6101a56004803603604081101561039957600080fd5b50803590602001356001600160a01b03166109e2565b6101a5600480360360208110156103c557600080fd5b5035610ad7565b610176610ae4565b6101a5600480360360408110156103ea57600080fd5b50803590602001356001600160a01b0316610aea565b6003602052600090815260409020805460019091015482565b6000546001600160a01b031681565b60026020526000908152604090205481565b8061047a576040805162461bcd60e51b815260206004820152601e6024820152600080516020610cba833981519152604482015290519081900360640190fd5b6000818152600560205260409020546001600160a01b0316156104ce5760405162461bcd60e51b8152600401808060200182810382526024815260200180610cda6024913960400191505060405180910390fd5b60008181526005602090815260409182902080546001600160a01b03191633908117909155825190815290810183905281517f04f82286a2a3b2ee5c8555de8304dfe2ea70991613213184b73a9e408d2d8029929181900390910190a150565b6000546001600160a01b0316331461057b576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b6001600160a01b0382166000818152600260209081526040918290208490558151928352820183905280517f7696855cdbb94bb5a44cb0a95caff6f29173aa1cbfba193834b12b90827ce2bc9281900390910190a15050565b60046020526000908152604090205460ff1681565b6001600160a01b038116600090815260066020526040812054819081811561062557506000818152600560205260409020546001600160a01b03165b9092509050915091565b3360009081526004602052604090205460ff16610690576040805162461bcd60e51b815260206004820152601a6024820152792932b332b93930b629ba37b930b3b29d103337b93134b23232b760311b604482015290519081900360640190fd5b61069a8282610c02565b5050565b60016020526000908152604090205481565b6000546001600160a01b031633146106fd576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b61271082111561073e5760405162461bcd60e51b8152600401808060200182810382526024815260200180610c966024913960400191505060405180910390fd5b61271081111561077f5760405162461bcd60e51b8152600401808060200182810382526026815260200180610cfe6026913960400191505060405180910390fd5b610787610c5b565b50600083815260036020818152604080842081518083018352878152808401878152958990529383528351815593516001909401939093558251868152908101859052808301849052915190917f4ebd23a492b2bd79586cb57cae40d7793408265f20320f68b478b971e696f4c7919081900360600190a150505050565b60066020526000908152604090205481565b6127108111156108585760405162461bcd60e51b8152600401808060200182810382526026815260200180610cfe6026913960400191505060405180910390fd5b336000818152600160209081526040918290208490558151928352820183905280517fbd224f3917462b0fa80805fe3ec29be3a37f664955aad6224e5ece036224c4299281900390910190a150565b6000546001600160a01b031633146108f4576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915582519384529083015280517fd373464a39404e5f98fdb4b152b8ba9a094561e97e5c4b4ea11eb18cd9e6695e9281900390910190a15050565b6005602052600090815260409020546001600160a01b031681565b6000546001600160a01b031633146109c0576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a2f576040805162461bcd60e51b81526020600482015260156024820152600080516020610c76833981519152604482015290519081900360640190fd5b81610a6f576040805162461bcd60e51b815260206004820152601e6024820152600080516020610cba833981519152604482015290519081900360640190fd5b60008281526005602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518581529182015281517f6431f88c655dd0e2b8d09b6405c007c515c66d67f2998e69c902873a8c8f3e97929181900390910190a15050565b610ae13382610c02565b50565b61271081565b81610b2a576040805162461bcd60e51b815260206004820152601e6024820152600080516020610cba833981519152604482015290519081900360640190fd5b6000828152600560205260409020546001600160a01b0316338114610b93576040805162461bcd60e51b815260206004820152601a6024820152792932b332b93930b629ba37b930b3b29d103337b93134b23232b760311b604482015290519081900360640190fd5b60008381526005602090815260409182902080546001600160a01b0386166001600160a01b0319909116811790915582513381529182015280820185905290517f5640856798d41ce9ca0a109b54c20a06eb99ba9c36ab4547115dafb8473cf3979181900360600190a1505050565b6001600160a01b0382166000818152600660209081526040918290208490558151928352820183905280517f43825f14567dda057e821be2e51a5aa79aa51f3907a647e3ed2bd486a01050f19281900390910190a15050565b60405180604001604052806000815260200160008152509056fe476f7665726e61626c653a20666f7262696464656e0000000000000000000000526566657272616c53746f726167653a20696e76616c696420746f74616c526562617465526566657272616c53746f726167653a20696e76616c6964205f636f64650000526566657272616c53746f726167653a20636f646520616c726561647920657869737473526566657272616c53746f726167653a20696e76616c696420646973636f756e745368617265a2646970667358221220011f5cd01bd9646089315d20885c3a75e072c1fb12295d850bef32cb4335344464736f6c634300060c0033

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.