Skip to content
Verified contractPartial

RelayRegistry

Address0xfa0bfd3a79be6effe2107f0d7b3f5e279ed214d9
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.5.2

 

Same code

16 more contracts

 

Details

Compiler
solc 0.5.2+commit.1df8f40c
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
7,578,653
Creation transaction
0x2b30379a29…2102c5b620
Main copy (most transactions)
0x3ddfe5e9…cf0457f7

2 files

RelayRegistry.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.5.2;

import "./IRelayRegistry.sol";

/**
 * @title Relay registry store data about white list and provide interface for master
 */
contract RelayRegistry is IRelayRegistry {
    bool internal initialized_;
    address private owner_;

    mapping(address => address[]) private _relayWhiteList;

    constructor () public {
        initialize(msg.sender);
    }

    /**
     * Initialization of smart contract.
     */
    function initialize(address owner) public {
        require(!initialized_);
        owner_ = owner;
        initialized_ = true;
    }

    /**
     * Store relay address and appropriate whitelist of addresses
     * @param relay contract address
     * @param whiteList white list
     */
    function addNewRelayAddress(address relay, address[] calldata whiteList) external {
        require(msg.sender == owner_);
        require(_relayWhiteList[relay].length == 0);
        _relayWhiteList[relay] = whiteList;
        emit AddNewRelay(relay, whiteList);
    }

    /**
     * Check if some address is in the whitelist
     * @param relay contract address
     * @param who address in whitelist
     * @return true if address in the whitelist
     */
    function isWhiteListed(address relay, address who) external view returns (bool) {
        if (_relayWhiteList[relay].length == 0) {
            return true;
        }
        if (_relayWhiteList[relay].length > 0) {
            for (uint i = 0; i < _relayWhiteList[relay].length; i++) {
                if (who == _relayWhiteList[relay][i]) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * Get entire whitelist by relay address
     * @param relay contract address
     * @return array of the whitelist
     */
    function getWhiteListByRelay(address relay) external view returns (address[] memory ) {
        require(relay != address(0));
        require(_relayWhiteList[relay].length != 0);
        return _relayWhiteList[relay];
    }
}

IRelayRegistry.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.5.2;

/**
 * @title Relay registry interface
 */
interface IRelayRegistry {

    /**
     * Store relay address and appropriate whitelist of addresses
     * @param relay contract address
     * @param whiteList with allowed addresses
     * @return true if data was stored
     */
    function addNewRelayAddress(address relay, address[] calldata whiteList) external;

    /**
     * Check if some address is in the whitelist
     * @param relay contract address
     * @param who address in whitelist
     * @return true if address in the whitelist
     */
    function isWhiteListed(address relay, address who) external view returns (bool);

    /**
     * Get entire whitelist by relay address
     * @param relay contract address
     * @return array of the whitelist
     */
    function getWhiteListByRelay(address relay) external view returns (address[] memory);

    event AddNewRelay (
        address indexed relayAddress,
        address[] indexed whiteList
    );
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.