false
false

Contract Address Details

0xe2813B8cF36B7B1e831F642CED1417f515fC7185

Contract Name
MojitoOracleProxy
Creator
0x7b11d3–9d29aa at 0x765968–6fd83f
Balance
0 KCS
Tokens
Fetching tokens...
Transactions
5 Transactions
Transfers
0 Transfers
Gas Used
173,090
Last Balance Update
51659468
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
MojitoOracleProxy




Optimization enabled
true
Compiler version
v0.7.6+commit.7338295f




Optimization runs
20000
EVM Version
default




Verified at
2022-06-08T11:56:18.761260Z

Constructor Arguments

0000000000000000000000001f57afc1eb83e8b0f12aeb4c88b902a2da5cf9e8

Arg [0] (address) : 0x1f57afc1eb83e8b0f12aeb4c88b902a2da5cf9e8

              

Contract source code

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

interface OwnableInterface {
  function owner() external returns (address);

  function transferOwnership(address recipient) external;

  function acceptOwnership() external;
}


// File contracts/ConfirmedOwnerWithProposal.sol




/**
 * @title The ConfirmedOwner contract
 * @notice A contract with helpers for basic contract ownership.
 */
contract ConfirmedOwnerWithProposal is OwnableInterface {
  address private s_owner;
  address private s_pendingOwner;

  event OwnershipTransferRequested(address indexed from, address indexed to);
  event OwnershipTransferred(address indexed from, address indexed to);

  constructor(address newOwner, address pendingOwner) {
    require(newOwner != address(0), "Cannot set owner to zero");

    s_owner = newOwner;
    if (pendingOwner != address(0)) {
      _transferOwnership(pendingOwner);
    }
  }

  /**
   * @notice Allows an owner to begin transferring ownership to a new address,
   * pending.
   */
  function transferOwnership(address to) public override onlyOwner {
    _transferOwnership(to);
  }

  /**
   * @notice Allows an ownership transfer to be completed by the recipient.
   */
  function acceptOwnership() external override {
    require(msg.sender == s_pendingOwner, "Must be proposed owner");

    address oldOwner = s_owner;
    s_owner = msg.sender;
    s_pendingOwner = address(0);

    emit OwnershipTransferred(oldOwner, msg.sender);
  }

  /**
   * @notice Get the current owner
   */
  function owner() public view override returns (address) {
    return s_owner;
  }

  /**
   * @notice validate, transfer ownership, and emit relevant events
   */
  function _transferOwnership(address to) private {
    require(to != msg.sender, "Cannot transfer to self");

    s_pendingOwner = to;

    emit OwnershipTransferRequested(s_owner, to);
  }

  /**
   * @notice validate access
   */
  function _validateOwnership() internal view {
    require(msg.sender == s_owner, "Only callable by owner");
  }

  /**
   * @notice Reverts if called by anyone other than the contract owner.
   */
  modifier onlyOwner() {
    _validateOwnership();
    _;
  }
}


// File contracts/ConfirmedOwner.sol




/**
 * @title The ConfirmedOwner contract
 * @notice A contract with helpers for basic contract ownership.
 */
contract ConfirmedOwner is ConfirmedOwnerWithProposal {
  constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {}
}


// File contracts/interfaces/IMojitoOracle.sol





interface IMojitoOracle {
  function getMojitoTwap(bytes32 pairId) external view returns (uint256);

  function currencyPairId(string memory) external view returns (bytes32);

  function lookupERC2362ID(bytes32 _erc2362id) external view returns (string memory _caption);
}


// File contracts/mojito/MojitoOracleProxy.sol





contract MojitoOracleProxy is IMojitoOracle, ConfirmedOwner {
  IMojitoOracle private s_currentMojitoOracle;
  IMojitoOracle private s_proposedMojitoOracle;

  event MojitoOracleProposed(address indexed current, address indexed proposed);
  event MojitoOracleConfirmed(address indexed previous, address indexed latest);

  constructor(address mojitoOracleAddress) ConfirmedOwner(msg.sender) {
    setMojitoOracle(mojitoOracleAddress);
  }

  function setMojitoOracle(address mojitoOracleAddress) internal {
    s_currentMojitoOracle = IMojitoOracle(mojitoOracleAddress);
  }

  function getMojitoTwap(bytes32 pairId) external view override returns (uint256) {
    return s_currentMojitoOracle.getMojitoTwap(pairId);
  }

  /**
   * @notice returns the current mojito oracle address.
   */
  function mojitoOracle() external view returns (address) {
    return address(s_currentMojitoOracle);
  }

  /**
   * @notice returns the current proposed mojito oracle
   */
  function proposedMojitoOracle() external view returns (address) {
    return address(s_proposedMojitoOracle);
  }

  /**
   * @notice Allows the owner to propose a new address for the mojito oracle
   * @param mojitoOracleAddress The new address for the mojito oracle contract
   */
  function proposeMojitoOracle(address mojitoOracleAddress) external onlyOwner {
    s_proposedMojitoOracle = IMojitoOracle(mojitoOracleAddress);
    emit MojitoOracleProposed(address(s_currentMojitoOracle), mojitoOracleAddress);
  }

  /**
   * @notice Allows the owner to confirm and change the address
   * to the proposed mojito oracle
   * @dev Reverts if the given address doesn't match what was previously
   * proposed
   * @param mojitoOracleAddress The new address for the mojito oracle contract
   */
  function confirmMojitoOracle(address mojitoOracleAddress) external onlyOwner {
    require(mojitoOracleAddress == address(s_proposedMojitoOracle), "Invalid proposed mojito oracle");
    address previousMojitoOracle = address(s_currentMojitoOracle);
    delete s_proposedMojitoOracle;
    setMojitoOracle(mojitoOracleAddress);
    emit MojitoOracleConfirmed(previousMojitoOracle, mojitoOracleAddress);
  }

  function proposedGetMojitoTwap(bytes32 pairId) external view hasProposal returns (uint256) {
    return s_proposedMojitoOracle.getMojitoTwap(pairId);
  }

  function currencyPairId(string memory _caption) external view override returns (bytes32) {
    return s_currentMojitoOracle.currencyPairId(_caption);
  }

  function lookupERC2362ID(bytes32 pairId) external view override returns (string memory _caption) {
    return s_currentMojitoOracle.lookupERC2362ID(pairId);
  }

  /*
   * Modifiers
   */

  modifier hasProposal() {
    require(address(s_proposedMojitoOracle) != address(0), "No proposed mojito oracle present");
    _;
  }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"mojitoOracleAddress","internalType":"address"}]},{"type":"event","name":"MojitoOracleConfirmed","inputs":[{"type":"address","name":"previous","internalType":"address","indexed":true},{"type":"address","name":"latest","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"MojitoOracleProposed","inputs":[{"type":"address","name":"current","internalType":"address","indexed":true},{"type":"address","name":"proposed","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferRequested","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"confirmMojitoOracle","inputs":[{"type":"address","name":"mojitoOracleAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"currencyPairId","inputs":[{"type":"string","name":"_caption","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getMojitoTwap","inputs":[{"type":"bytes32","name":"pairId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"_caption","internalType":"string"}],"name":"lookupERC2362ID","inputs":[{"type":"bytes32","name":"pairId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"mojitoOracle","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"proposeMojitoOracle","inputs":[{"type":"address","name":"mojitoOracleAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"proposedGetMojitoTwap","inputs":[{"type":"bytes32","name":"pairId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proposedMojitoOracle","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"to","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50604051610e05380380610e058339818101604052602081101561003357600080fd5b5051338060008161008b576040805162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f0000000000000000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03848116919091179091558116156100bb576100bb816100d3565b5050506100cd8161018260201b60201c565b506101a4565b6001600160a01b038116331415610131576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b610c52806101b36000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063835262f511610081578063a30fadfb1161005b578063a30fadfb146102de578063b0c039e3146102e6578063f2fde38b14610303576100c9565b8063835262f51461019e5780638da5cb5b1461024457806399d32a041461024c576100c9565b806326300a3b116100b257806326300a3b146101325780634d17c6f81461016357806379ba509714610196576100c9565b80630ca55a8e146100ce5780630ca69f93146100fd575b600080fd5b6100eb600480360360208110156100e457600080fd5b5035610336565b60408051918252519081900360200190f35b6101306004803603602081101561011357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166103da565b005b61013a610459565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101306004803603602081101561017957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610475565b6101306105ae565b6100eb600480360360208110156101b457600080fd5b8101906020810181356401000000008111156101cf57600080fd5b8201836020820111156101e157600080fd5b8035906020019184600183028401116401000000008311171561020357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106b0945050505050565b61013a61077e565b6102696004803603602081101561026257600080fd5b503561079a565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a357818101518382015260200161028b565b50505050905090810190601f1680156102d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a61091e565b6100eb600480360360208110156102fc57600080fd5b503561093a565b6101306004803603602081101561031957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610a1d565b600254604080517f0ca55a8e00000000000000000000000000000000000000000000000000000000815260048101849052905160009273ffffffffffffffffffffffffffffffffffffffff1691630ca55a8e916024808301926020929190829003018186803b1580156103a857600080fd5b505afa1580156103bc573d6000803e3d6000fd5b505050506040513d60208110156103d257600080fd5b505192915050565b6103e2610a31565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600254604051919216907fafc536cd4de2b8505ff42c38d6f5ec1a5095bee4c72c339ace9b4a998814a54b90600090a350565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b61047d610a31565b60035473ffffffffffffffffffffffffffffffffffffffff82811691161461050657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f496e76616c69642070726f706f736564206d6f6a69746f206f7261636c650000604482015290519081900360640190fd5b600254600380547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff1661055082610ab9565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f24a95087bb6f35374d9d5f8b3af26b9df061bf5f4fdac850c59c5a5cefc959c260405160405180910390a35050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461063457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e657200000000000000000000604482015290519081900360640190fd5b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6002546040517f835262f500000000000000000000000000000000000000000000000000000000815260206004820181815284516024840152845160009473ffffffffffffffffffffffffffffffffffffffff169363835262f5938793928392604401918501908083838b5b8381101561073457818101518382015260200161071c565b50505050905090810190601f1680156107615780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156103a857600080fd5b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600254604080517f99d32a0400000000000000000000000000000000000000000000000000000000815260048101849052905160609273ffffffffffffffffffffffffffffffffffffffff16916399d32a04916024808301926000929190829003018186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052602081101561086757600080fd5b810190808051604051939291908464010000000082111561088757600080fd5b90830190602082018581111561089c57600080fd5b82516401000000008111828201881017156108b657600080fd5b82525081516020918201929091019080838360005b838110156108e35781810151838201526020016108cb565b50505050905090810190601f1680156109105780820380516001836020036101000a031916815260200191505b506040525050509050919050565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b60035460009073ffffffffffffffffffffffffffffffffffffffff166109ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610bfc6021913960400191505060405180910390fd5b600354604080517f0ca55a8e00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630ca55a8e91602480820192602092909190829003018186803b1580156103a857600080fd5b610a25610a31565b610a2e81610b00565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ab757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116331415610b8557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a35056fe4e6f2070726f706f736564206d6f6a69746f206f7261636c652070726573656e74a264697066735822122088d859ff23e528162c981871ba59fe247cdafb40303625b3b6afd3fbfd4d17a764736f6c634300070600330000000000000000000000001f57afc1eb83e8b0f12aeb4c88b902a2da5cf9e8

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063835262f511610081578063a30fadfb1161005b578063a30fadfb146102de578063b0c039e3146102e6578063f2fde38b14610303576100c9565b8063835262f51461019e5780638da5cb5b1461024457806399d32a041461024c576100c9565b806326300a3b116100b257806326300a3b146101325780634d17c6f81461016357806379ba509714610196576100c9565b80630ca55a8e146100ce5780630ca69f93146100fd575b600080fd5b6100eb600480360360208110156100e457600080fd5b5035610336565b60408051918252519081900360200190f35b6101306004803603602081101561011357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166103da565b005b61013a610459565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101306004803603602081101561017957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610475565b6101306105ae565b6100eb600480360360208110156101b457600080fd5b8101906020810181356401000000008111156101cf57600080fd5b8201836020820111156101e157600080fd5b8035906020019184600183028401116401000000008311171561020357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106b0945050505050565b61013a61077e565b6102696004803603602081101561026257600080fd5b503561079a565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a357818101518382015260200161028b565b50505050905090810190601f1680156102d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a61091e565b6100eb600480360360208110156102fc57600080fd5b503561093a565b6101306004803603602081101561031957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610a1d565b600254604080517f0ca55a8e00000000000000000000000000000000000000000000000000000000815260048101849052905160009273ffffffffffffffffffffffffffffffffffffffff1691630ca55a8e916024808301926020929190829003018186803b1580156103a857600080fd5b505afa1580156103bc573d6000803e3d6000fd5b505050506040513d60208110156103d257600080fd5b505192915050565b6103e2610a31565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600254604051919216907fafc536cd4de2b8505ff42c38d6f5ec1a5095bee4c72c339ace9b4a998814a54b90600090a350565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b61047d610a31565b60035473ffffffffffffffffffffffffffffffffffffffff82811691161461050657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f496e76616c69642070726f706f736564206d6f6a69746f206f7261636c650000604482015290519081900360640190fd5b600254600380547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff1661055082610ab9565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f24a95087bb6f35374d9d5f8b3af26b9df061bf5f4fdac850c59c5a5cefc959c260405160405180910390a35050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461063457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e657200000000000000000000604482015290519081900360640190fd5b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6002546040517f835262f500000000000000000000000000000000000000000000000000000000815260206004820181815284516024840152845160009473ffffffffffffffffffffffffffffffffffffffff169363835262f5938793928392604401918501908083838b5b8381101561073457818101518382015260200161071c565b50505050905090810190601f1680156107615780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156103a857600080fd5b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600254604080517f99d32a0400000000000000000000000000000000000000000000000000000000815260048101849052905160609273ffffffffffffffffffffffffffffffffffffffff16916399d32a04916024808301926000929190829003018186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052602081101561086757600080fd5b810190808051604051939291908464010000000082111561088757600080fd5b90830190602082018581111561089c57600080fd5b82516401000000008111828201881017156108b657600080fd5b82525081516020918201929091019080838360005b838110156108e35781810151838201526020016108cb565b50505050905090810190601f1680156109105780820380516001836020036101000a031916815260200191505b506040525050509050919050565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b60035460009073ffffffffffffffffffffffffffffffffffffffff166109ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610bfc6021913960400191505060405180910390fd5b600354604080517f0ca55a8e00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630ca55a8e91602480820192602092909190829003018186803b1580156103a857600080fd5b610a25610a31565b610a2e81610b00565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ab757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015290519081900360640190fd5b565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116331415610b8557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a35056fe4e6f2070726f706f736564206d6f6a69746f206f7261636c652070726573656e74a264697066735822122088d859ff23e528162c981871ba59fe247cdafb40303625b3b6afd3fbfd4d17a764736f6c63430007060033