ETH Price: $1,981.16 (-4.43%)

Contract

0x5ECF7C4cb6aa851382aF02E2AA25A8550D5d33Da
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute149567902022-06-13 15:51:001362 days ago1655135460IN
0x5ECF7C4c...50D5d33Da
0 ETH0.0066032486.17618093

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
-149280532022-06-08 17:51:371367 days ago1654710697  Contract Creation0 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StaticRelayer

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 8000 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2022-06-08
*/

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

// Lightweight interface for Collybus
// Source: https://github.com/fiatdao/fiat-lux/blob/f49a9457fbcbdac1969c35b4714722f00caa462c/src/interfaces/ICollybus.sol
interface ICollybus {
    function updateDiscountRate(uint256 tokenId_, uint256 rate_) external;

    function updateSpot(address token_, uint256 spot_) external;
}interface IRelayer {
    enum RelayerType {
        DiscountRate,
        SpotPrice,
        COUNT
    }

    function execute() external returns (bool);

    function executeWithRevert() external;
}
contract StaticRelayer is IRelayer {
    /// @notice Emitted during executeWithRevert() if the Collybus was already updated
    error StaticRelayer__executeWithRevert_collybusAlreadyUpdated(
        IRelayer.RelayerType relayerType
    );

    /// ======== Events ======== ///

    event UpdatedCollybus(
        bytes32 tokenId,
        uint256 rate,
        IRelayer.RelayerType relayerType
    );

    /// ======== Storage ======== ///

    address public immutable collybus;
    IRelayer.RelayerType public immutable relayerType;
    bytes32 public immutable encodedTokenId;
    uint256 public immutable value;

    // Flag used to ensure that the value is pushed to Collybus only once
    bool private _updatedCollybus;

    /// @param collybusAddress_ Address of the collybus
    /// @param type_ Relayer type, DiscountRate or SpotPrice
    /// @param encodedTokenId_ Encoded token Id that will be used to push the value to Collybus
    /// uint256 for discount rate, address for spot price
    /// @param value_ The value that will be pushed to Collybus
    constructor(
        address collybusAddress_,
        IRelayer.RelayerType type_,
        bytes32 encodedTokenId_,
        uint256 value_
    ) {
        collybus = collybusAddress_;
        relayerType = type_;
        encodedTokenId = encodedTokenId_;
        value = value_;
        _updatedCollybus = false;
    }

    /// @notice Pushes the hardcoded value to Collybus for the hardcoded token id
    /// @dev The execute will exit early after the first update
    function execute() public override(IRelayer) returns (bool) {
        if (_updatedCollybus) return false;

        _updatedCollybus = true;
        if (relayerType == IRelayer.RelayerType.DiscountRate) {
            ICollybus(collybus).updateDiscountRate(
                uint256(encodedTokenId),
                value
            );
        } else if (relayerType == IRelayer.RelayerType.SpotPrice) {
            ICollybus(collybus).updateSpot(
                address(uint160(uint256(encodedTokenId))),
                value
            );
        }

        emit UpdatedCollybus(encodedTokenId, value, relayerType);
        return true;
    }

    /// @notice The function will call `execute()` and will revert if _updatedCollybus is true
    function executeWithRevert() public override(IRelayer) {
        if (!execute()) {
            revert StaticRelayer__executeWithRevert_collybusAlreadyUpdated(
                relayerType
            );
        }
    }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"collybusAddress_","type":"address"},{"internalType":"enum IRelayer.RelayerType","name":"type_","type":"uint8"},{"internalType":"bytes32","name":"encodedTokenId_","type":"bytes32"},{"internalType":"uint256","name":"value_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"enum IRelayer.RelayerType","name":"relayerType","type":"uint8"}],"name":"StaticRelayer__executeWithRevert_collybusAlreadyUpdated","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"enum IRelayer.RelayerType","name":"relayerType","type":"uint8"}],"name":"UpdatedCollybus","type":"event"},{"inputs":[],"name":"collybus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"encodedTokenId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"execute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"executeWithRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"relayerType","outputs":[{"internalType":"enum IRelayer.RelayerType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"value","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

61010060405234801561001157600080fd5b5060405161075938038061075983398101604081905261003091610080565b6001600160a01b03841660805282600281111561004f5761004f6100d8565b60a0816002811115610063576100636100d8565b90525060c09190915260e05250506000805460ff191690556100ee565b6000806000806080858703121561009657600080fd5b84516001600160a01b03811681146100ad57600080fd5b6020860151909450600381106100c257600080fd5b6040860151606090960151949790965092505050565b634e487b7160e01b600052602160045260246000fd5b60805160a05160c05160e0516105e06101796000396000818160b9015281816102ab015281816103e501526104ac01526000818161011001528181610285015281816103bd015261048b015260008181607c0152818161018c015281816102280152818161034b01526104cd015260008181610137015281816102d1015261040b01526105e06000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063614619541161005057806361461954146100f357806379c7e4e01461010b578063e88c2f831461013257600080fd5b806302d3f718146100775780633fa4f245146100b457806351a7754c146100e9575b600080fd5b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516100ab9190610573565b60405180910390f35b6100db7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100ab565b6100f161017e565b005b6100fb6101e9565b60405190151581526020016100ab565b6100db7f000000000000000000000000000000000000000000000000000000000000000081565b6101597f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ab565b6101866101e9565b6101e7577f00000000000000000000000000000000000000000000000000000000000000006040517f3739b05e0000000000000000000000000000000000000000000000000000000081526004016101de9190610573565b60405180910390fd5b565b6000805460ff16156101fb5750600090565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781557f0000000000000000000000000000000000000000000000000000000000000000600281111561025857610258610509565b03610347576040517fe90fd61e0000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060048201527f000000000000000000000000000000000000000000000000000000000000000060248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063e90fd61e90604401600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b50505050610468565b60017f0000000000000000000000000000000000000000000000000000000000000000600281111561037b5761037b610509565b03610468576040517f4320c62700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301527f000000000000000000000000000000000000000000000000000000000000000060248301527f00000000000000000000000000000000000000000000000000000000000000001690634320c62790604401600060405180830381600087803b15801561044f57600080fd5b505af1158015610463573d6000803e3d6000fd5b505050505b7fbe80b9b2541931ae2549a6c39361a4f1155c321c8d959b17e23635511f0a5d967f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040516104fb93929190610587565b60405180910390a150600190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6003811061056f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b602081016105818284610538565b92915050565b83815260208101839052606081016105a26040830184610538565b94935050505056fea2646970667358221220a21f4b60984d6fbaa649c24862c8734a2d4f193ef2017021fd39556390d6f8b664736f6c634300080d0033000000000000000000000000d503383ffabbec8eb85eaed448fe1ffec0a8148a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012c00000000000000000000000000000000000000000000000000000000b4241e89

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063614619541161005057806361461954146100f357806379c7e4e01461010b578063e88c2f831461013257600080fd5b806302d3f718146100775780633fa4f245146100b457806351a7754c146100e9575b600080fd5b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516100ab9190610573565b60405180910390f35b6100db7f00000000000000000000000000000000000000000000000000000000b4241e8981565b6040519081526020016100ab565b6100f161017e565b005b6100fb6101e9565b60405190151581526020016100ab565b6100db7f000000000000000000000000000000000000000000000000000000000000012c81565b6101597f000000000000000000000000d503383ffabbec8eb85eaed448fe1ffec0a8148a81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ab565b6101866101e9565b6101e7577f00000000000000000000000000000000000000000000000000000000000000006040517f3739b05e0000000000000000000000000000000000000000000000000000000081526004016101de9190610573565b60405180910390fd5b565b6000805460ff16156101fb5750600090565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781557f0000000000000000000000000000000000000000000000000000000000000000600281111561025857610258610509565b03610347576040517fe90fd61e0000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000012c60048201527f00000000000000000000000000000000000000000000000000000000b4241e8960248201527f000000000000000000000000d503383ffabbec8eb85eaed448fe1ffec0a8148a73ffffffffffffffffffffffffffffffffffffffff169063e90fd61e90604401600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b50505050610468565b60017f0000000000000000000000000000000000000000000000000000000000000000600281111561037b5761037b610509565b03610468576040517f4320c62700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000012c811660048301527f00000000000000000000000000000000000000000000000000000000b4241e8960248301527f000000000000000000000000d503383ffabbec8eb85eaed448fe1ffec0a8148a1690634320c62790604401600060405180830381600087803b15801561044f57600080fd5b505af1158015610463573d6000803e3d6000fd5b505050505b7fbe80b9b2541931ae2549a6c39361a4f1155c321c8d959b17e23635511f0a5d967f000000000000000000000000000000000000000000000000000000000000012c7f00000000000000000000000000000000000000000000000000000000b4241e897f00000000000000000000000000000000000000000000000000000000000000006040516104fb93929190610587565b60405180910390a150600190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6003811061056f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b602081016105818284610538565b92915050565b83815260208101839052606081016105a26040830184610538565b94935050505056fea2646970667358221220a21f4b60984d6fbaa649c24862c8734a2d4f193ef2017021fd39556390d6f8b664736f6c634300080d0033

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

000000000000000000000000d503383ffabbec8eb85eaed448fe1ffec0a8148a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012c00000000000000000000000000000000000000000000000000000000b4241e89

-----Decoded View---------------
Arg [0] : collybusAddress_ (address): 0xD503383fFABbec8Eb85eAED448fE1fFEc0a8148A
Arg [1] : type_ (uint8): 0
Arg [2] : encodedTokenId_ (bytes32): 0x000000000000000000000000000000000000000000000000000000000000012c
Arg [3] : value_ (uint256): 3022265993

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d503383ffabbec8eb85eaed448fe1ffec0a8148a
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [3] : 00000000000000000000000000000000000000000000000000000000b4241e89


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.