ETH Price: $3,338.00 (-0.16%)

Contract

0x3B6d4021191Ea968EDe5537E61B8Fe08a61ce3d9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Register173891062023-06-01 23:07:47575 days ago1685660867IN
0x3B6d4021...8a61ce3d9
0 ETH0.0025808334.83617191
Register173855012023-06-01 10:55:47575 days ago1685616947IN
0x3B6d4021...8a61ce3d9
0 ETH0.001710423.08712785
Register173846282023-06-01 7:58:23575 days ago1685606303IN
0x3B6d4021...8a61ce3d9
0 ETH0.0025209134.02736223
Register173840482023-06-01 6:00:47575 days ago1685599247IN
0x3B6d4021...8a61ce3d9
0 ETH0.0031715542.80966011
Register173652682023-05-29 14:34:59578 days ago1685370899IN
0x3B6d4021...8a61ce3d9
0 ETH0.0041789356.40734592
Register173652132023-05-29 14:23:47578 days ago1685370227IN
0x3B6d4021...8a61ce3d9
0 ETH0.0031336842.29847173
Register173634292023-05-29 8:22:35578 days ago1685348555IN
0x3B6d4021...8a61ce3d9
0 ETH0.0024862733.5597676
Register173585192023-05-28 15:51:11579 days ago1685289071IN
0x3B6d4021...8a61ce3d9
0 ETH0.0027954437.73292913
Register173578032023-05-28 13:26:23579 days ago1685280383IN
0x3B6d4021...8a61ce3d9
0 ETH0.0027883329.49433647
Register173575422023-05-28 12:33:23579 days ago1685277203IN
0x3B6d4021...8a61ce3d9
0 ETH0.0018559625.0518263
Register173534802023-05-27 22:51:59580 days ago1685227919IN
0x3B6d4021...8a61ce3d9
0 ETH0.0021159722.38222543
Register173524782023-05-27 19:29:47580 days ago1685215787IN
0x3B6d4021...8a61ce3d9
0 ETH0.0020686427.9226277
Register173524652023-05-27 19:27:11580 days ago1685215631IN
0x3B6d4021...8a61ce3d9
0 ETH0.000877336.50884217
Register173524602023-05-27 19:26:11580 days ago1685215571IN
0x3B6d4021...8a61ce3d9
0 ETH0.0025009433.75784319
Register173510882023-05-27 14:48:59580 days ago1685198939IN
0x3B6d4021...8a61ce3d9
0 ETH0.0021194228.608014
Register165838392023-02-08 11:43:11688 days ago1675856591IN
0x3B6d4021...8a61ce3d9
0 ETH0.0026738123.36472179

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AffiliateProgram

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 2 : AffiliateProgram.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.8.17;

import "./interfaces/IAffiliateProgram.sol";

//
contract AffiliateProgram is IAffiliateProgram {
    struct Account {
        bool registered;
        address affiliate;
        address[] referrals;
    }

    mapping(address => Account) public accounts;

    event RegisteredAffiliate(address affiliate);
    event RegisteredReferer(address affiliate, address referrer);

    function register() external {
        require(!accounts[msg.sender].registered, "Already registered");

        accounts[msg.sender].registered = true;
        emit RegisteredAffiliate(msg.sender);
    }

    // @dev called by referral
    function register(address _affiliate) external {
        require(!accounts[msg.sender].registered, "Already registered");
        require(_affiliate != address(0), "Zero address affiliate");
        require(_affiliate != msg.sender, "You cannot refer yourself");

        uint len = accounts[_affiliate].referrals.length;
        if (len == 0) {
            accounts[_affiliate].registered = true;
            emit RegisteredAffiliate(_affiliate);
        }

        accounts[_affiliate].referrals.push(msg.sender);
        accounts[msg.sender].affiliate = _affiliate;
        accounts[msg.sender].registered = true;
        emit RegisteredAffiliate(msg.sender);
        emit RegisteredReferer(_affiliate, msg.sender);
    }

    /**
     * @dev Utils function for check whether an address has the referrer
     */
    function hasAffiliate(address _addr) external view override returns (bool result) {
        result = accounts[_addr].affiliate != address(0);
    }

    /**
     * @dev Utils function for check whether an address has the referrer
     */
    function countReferrals(address _addr) external view override returns (uint256 amount) {
        amount = accounts[_addr].referrals.length;
    }

    /**
     * @dev Utils function for check whether an address has the referrer
     */
    function getAffiliate(address _addr) external view override returns (address result) {
        result = accounts[_addr].affiliate;
    }

    /**
     * @dev Utils function for check whether an address has the referrer
     */
    function getReferrals(address _addr) external view override returns (address[] memory result) {
        result = accounts[_addr].referrals;
    }
}

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

pragma solidity =0.8.17;

interface IAffiliateProgram {
    function hasAffiliate(address _addr) external view returns (bool result);

    function countReferrals(address _addr) external view returns (uint256 amount);

    function getAffiliate(address _addr) external view returns (address account);

    function getReferrals(address _addr) external view returns (address[] memory results);
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"affiliate","type":"address"}],"name":"RegisteredAffiliate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"affiliate","type":"address"},{"indexed":false,"internalType":"address","name":"referrer","type":"address"}],"name":"RegisteredReferer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accounts","outputs":[{"internalType":"bool","name":"registered","type":"bool"},{"internalType":"address","name":"affiliate","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"countReferrals","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"getAffiliate","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"getReferrals","outputs":[{"internalType":"address[]","name":"result","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"hasAffiliate","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_affiliate","type":"address"}],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506107e1806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80635e5c06e21161005b5780635e5c06e2146100c8578063691c10f214610134578063898ee25914610184578063bc019eed146101cb57600080fd5b80631aa3a0081461008257806341a0894d1461008c5780634420e486146100b5575b600080fd5b61008a61022e565b005b61009f61009a366004610714565b610319565b6040516100ac9190610751565b60405180910390f35b61008a6100c3366004610714565b6103aa565b6101086100d6366004610714565b60006020819052908152604090205460ff811690610100900473ffffffffffffffffffffffffffffffffffffffff1682565b60408051921515835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016100ac565b610174610142366004610714565b73ffffffffffffffffffffffffffffffffffffffff908116600090815260208190526040902054610100900416151590565b60405190151581526020016100ac565b6101bd610192366004610714565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090206001015490565b6040519081526020016100ac565b6102096101d9366004610714565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526020819052604090205461010090041690565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ac565b3360009081526020819052604090205460ff16156102ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f416c72656164792072656769737465726564000000000000000000000000000060448201526064015b60405180910390fd5b336000818152602081815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527f3a7ae7020e7cdeb58caa0f6fa4bc8f8bdfb718c1390b974b940b2dfff1eaa9c5910160405180910390a1565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260409182902060010180548351818402810184019094528084526060939283018282801561039e57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610373575b50505050509050919050565b3360009081526020819052604090205460ff1615610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f416c72656164792072656769737465726564000000000000000000000000000060448201526064016102a4565b73ffffffffffffffffffffffffffffffffffffffff81166104a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f5a65726f206164647265737320616666696c696174650000000000000000000060448201526064016102a4565b3373ffffffffffffffffffffffffffffffffffffffff821603610520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f596f752063616e6e6f7420726566657220796f757273656c660000000000000060448201526064016102a4565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040812060010154908190036105d25773ffffffffffffffffffffffffffffffffffffffff82166000818152602081815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527f3a7ae7020e7cdeb58caa0f6fa4bc8f8bdfb718c1390b974b940b2dfff1eaa9c5910160405180910390a15b73ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320600190810180548083018255908552838520018054337fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091558085529382902080547fffffffffffffffffffffff000000000000000000000000000000000000000000166101009096027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016959095171790935591519081527f3a7ae7020e7cdeb58caa0f6fa4bc8f8bdfb718c1390b974b940b2dfff1eaa9c5910160405180910390a16040805173ffffffffffffffffffffffffffffffffffffffff841681523360208201527ffaf63637882ff2d63ca76881cf92fb857130e36f350c926f9cc884b499b42b77910160405180910390a15050565b60006020828403121561072657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461074a57600080fd5b9392505050565b6020808252825182820181905260009190848201906040850190845b8181101561079f57835173ffffffffffffffffffffffffffffffffffffffff168352928401929184019160010161076d565b5090969550505050505056fea2646970667358221220c2ad070b4b61707f7144fe79c01f20ea073f3fa72e377910cc754bd431c6d40264736f6c63430008110033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80635e5c06e21161005b5780635e5c06e2146100c8578063691c10f214610134578063898ee25914610184578063bc019eed146101cb57600080fd5b80631aa3a0081461008257806341a0894d1461008c5780634420e486146100b5575b600080fd5b61008a61022e565b005b61009f61009a366004610714565b610319565b6040516100ac9190610751565b60405180910390f35b61008a6100c3366004610714565b6103aa565b6101086100d6366004610714565b60006020819052908152604090205460ff811690610100900473ffffffffffffffffffffffffffffffffffffffff1682565b60408051921515835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016100ac565b610174610142366004610714565b73ffffffffffffffffffffffffffffffffffffffff908116600090815260208190526040902054610100900416151590565b60405190151581526020016100ac565b6101bd610192366004610714565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090206001015490565b6040519081526020016100ac565b6102096101d9366004610714565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526020819052604090205461010090041690565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ac565b3360009081526020819052604090205460ff16156102ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f416c72656164792072656769737465726564000000000000000000000000000060448201526064015b60405180910390fd5b336000818152602081815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527f3a7ae7020e7cdeb58caa0f6fa4bc8f8bdfb718c1390b974b940b2dfff1eaa9c5910160405180910390a1565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260409182902060010180548351818402810184019094528084526060939283018282801561039e57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610373575b50505050509050919050565b3360009081526020819052604090205460ff1615610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f416c72656164792072656769737465726564000000000000000000000000000060448201526064016102a4565b73ffffffffffffffffffffffffffffffffffffffff81166104a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f5a65726f206164647265737320616666696c696174650000000000000000000060448201526064016102a4565b3373ffffffffffffffffffffffffffffffffffffffff821603610520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f596f752063616e6e6f7420726566657220796f757273656c660000000000000060448201526064016102a4565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040812060010154908190036105d25773ffffffffffffffffffffffffffffffffffffffff82166000818152602081815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527f3a7ae7020e7cdeb58caa0f6fa4bc8f8bdfb718c1390b974b940b2dfff1eaa9c5910160405180910390a15b73ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320600190810180548083018255908552838520018054337fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091558085529382902080547fffffffffffffffffffffff000000000000000000000000000000000000000000166101009096027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016959095171790935591519081527f3a7ae7020e7cdeb58caa0f6fa4bc8f8bdfb718c1390b974b940b2dfff1eaa9c5910160405180910390a16040805173ffffffffffffffffffffffffffffffffffffffff841681523360208201527ffaf63637882ff2d63ca76881cf92fb857130e36f350c926f9cc884b499b42b77910160405180910390a15050565b60006020828403121561072657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461074a57600080fd5b9392505050565b6020808252825182820181905260009190848201906040850190845b8181101561079f57835173ffffffffffffffffffffffffffffffffffffffff168352928401929184019160010161076d565b5090969550505050505056fea2646970667358221220c2ad070b4b61707f7144fe79c01f20ea073f3fa72e377910cc754bd431c6d40264736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.