false
false
0

Contract Address Details

0x62F4187e3B1Dd3E0b493EF30BF2bdb493AfCb1A8

Contract Name
DIARandomOracle
Creator
0x1f3254–f44d76 at 0x0c3d70–0b53fe
Balance
0 Fuse
Tokens
Fetching tokens...
Transactions
457,795 Transactions
Transfers
0 Transfers
Gas Used
190,926,834,882
Last Balance Update
23693567
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
DIARandomOracle




Optimization enabled
false
Compiler version
v0.8.4+commit.c7e474f2




EVM Version
default




Verified at
2022-10-06T14:37:05.798930Z

Contract source code

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

contract DIARandomOracle {

struct Random { 
   string randomness;
   string signature;
   string previousSignature;
}
 
    mapping (uint256 => Random) public values;
    uint256 public lastRound = 0;

    address public oracleUpdater;
    
    event OracleUpdate(string key, uint128 value, uint128 timestamp);
    event UpdaterAddressChange(address newUpdater);
    
    constructor() {
        oracleUpdater = msg.sender;
    }
    
    // function setValue(string memory key, uint128 value, uint128 timestamp) public {
    //     require(msg.sender == oracleUpdater,"not a updater");
    //     uint256 cValue = (((uint256)(value)) << 128) + timestamp;
    //     values[key] = cValue;
    //     emit OracleUpdate(key, value, timestamp);
    // }

    function setRandomValue(uint256 _round, string memory _randomness,string memory _signature,string memory _previousSignature) public {
             require(msg.sender == oracleUpdater,"not a updater");
             require(lastRound<_round, "old round");
             lastRound = _round;
             values[_round] = Random(_randomness,_signature,_previousSignature);
    }
    
    function getValue(uint256 _round) external view returns ( Random memory) {
        return values[_round];
    }
    
    function updateOracleUpdaterAddress(address newOracleUpdaterAddress) public {
        require(msg.sender == oracleUpdater,"not a updater");
        oracleUpdater = newOracleUpdaterAddress;
        emit UpdaterAddressChange(newOracleUpdaterAddress);
    }

    function getRandomValueFromRound(uint256 _round ) external view returns (string memory){
        return values[_round].randomness;
    }
     function getRandomValueFromRoundWithSignature(uint256 _round ) external view returns (Random memory){
        return values[_round];
    }

    function getLastRound()public view returns(uint256){
        return lastRound;
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"OracleUpdate","inputs":[{"type":"string","name":"key","internalType":"string","indexed":false},{"type":"uint128","name":"value","internalType":"uint128","indexed":false},{"type":"uint128","name":"timestamp","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"UpdaterAddressChange","inputs":[{"type":"address","name":"newUpdater","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLastRound","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getRandomValueFromRound","inputs":[{"type":"uint256","name":"_round","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DIARandomOracle.Random","components":[{"type":"string","name":"randomness","internalType":"string"},{"type":"string","name":"signature","internalType":"string"},{"type":"string","name":"previousSignature","internalType":"string"}]}],"name":"getRandomValueFromRoundWithSignature","inputs":[{"type":"uint256","name":"_round","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DIARandomOracle.Random","components":[{"type":"string","name":"randomness","internalType":"string"},{"type":"string","name":"signature","internalType":"string"},{"type":"string","name":"previousSignature","internalType":"string"}]}],"name":"getValue","inputs":[{"type":"uint256","name":"_round","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastRound","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oracleUpdater","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRandomValue","inputs":[{"type":"uint256","name":"_round","internalType":"uint256"},{"type":"string","name":"_randomness","internalType":"string"},{"type":"string","name":"_signature","internalType":"string"},{"type":"string","name":"_previousSignature","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateOracleUpdaterAddress","inputs":[{"type":"address","name":"newOracleUpdaterAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"randomness","internalType":"string"},{"type":"string","name":"signature","internalType":"string"},{"type":"string","name":"previousSignature","internalType":"string"}],"name":"values","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]}]
              

Contract Creation Code

0x6080604052600060015534801561001557600080fd5b5033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506111d8806100666000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80636f9aa784116100665780636f9aa78414610134578063805d64a01461016457806382bc07e614610182578063a921a502146101a0578063bfcd5771146101d057610093565b80630ff4c916146100985780634231a2c3146100c85780635e383d21146100e65780636aa45efc14610118575b600080fd5b6100b260048036038101906100ad9190610c41565b6101ec565b6040516100bf9190610f12565b60405180910390f35b6100d06103ce565b6040516100dd9190610f34565b60405180910390f35b61010060048036038101906100fb9190610c41565b6103d8565b60405161010f93929190610e86565b60405180910390f35b610132600480360381019061012d9190610c18565b61059a565b005b61014e60048036038101906101499190610c41565b6106a5565b60405161015b9190610e64565b60405180910390f35b61016c61074c565b6040516101799190610e49565b60405180910390f35b61018a610772565b6040516101979190610f34565b60405180910390f35b6101ba60048036038101906101b59190610c41565b610778565b6040516101c79190610f12565b60405180910390f35b6101ea60048036038101906101e59190610c6a565b61095a565b005b6101f4610ac2565b60008083815260200190815260200160002060405180606001604052908160008201805461022190611050565b80601f016020809104026020016040519081016040528092919081815260200182805461024d90611050565b801561029a5780601f1061026f5761010080835404028352916020019161029a565b820191906000526020600020905b81548152906001019060200180831161027d57829003601f168201915b505050505081526020016001820180546102b390611050565b80601f01602080910402602001604051908101604052809291908181526020018280546102df90611050565b801561032c5780601f106103015761010080835404028352916020019161032c565b820191906000526020600020905b81548152906001019060200180831161030f57829003601f168201915b5050505050815260200160028201805461034590611050565b80601f016020809104026020016040519081016040528092919081815260200182805461037190611050565b80156103be5780601f10610393576101008083540402835291602001916103be565b820191906000526020600020905b8154815290600101906020018083116103a157829003601f168201915b5050505050815250509050919050565b6000600154905090565b60006020528060005260406000206000915090508060000180546103fb90611050565b80601f016020809104026020016040519081016040528092919081815260200182805461042790611050565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b50505050509080600101805461048990611050565b80601f01602080910402602001604051908101604052809291908181526020018280546104b590611050565b80156105025780601f106104d757610100808354040283529160200191610502565b820191906000526020600020905b8154815290600101906020018083116104e557829003601f168201915b50505050509080600201805461051790611050565b80601f016020809104026020016040519081016040528092919081815260200182805461054390611050565b80156105905780601f1061056557610100808354040283529160200191610590565b820191906000526020600020905b81548152906001019060200180831161057357829003601f168201915b5050505050905083565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062190610ef2565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f121e958a4cadf7f8dadefa22cc019700365240223668418faebed197da07089f8160405161069a9190610e49565b60405180910390a150565b606060008083815260200190815260200160002060000180546106c790611050565b80601f01602080910402602001604051908101604052809291908181526020018280546106f390611050565b80156107405780601f1061071557610100808354040283529160200191610740565b820191906000526020600020905b81548152906001019060200180831161072357829003601f168201915b50505050509050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b610780610ac2565b6000808381526020019081526020016000206040518060600160405290816000820180546107ad90611050565b80601f01602080910402602001604051908101604052809291908181526020018280546107d990611050565b80156108265780601f106107fb57610100808354040283529160200191610826565b820191906000526020600020905b81548152906001019060200180831161080957829003601f168201915b5050505050815260200160018201805461083f90611050565b80601f016020809104026020016040519081016040528092919081815260200182805461086b90611050565b80156108b85780601f1061088d576101008083540402835291602001916108b8565b820191906000526020600020905b81548152906001019060200180831161089b57829003601f168201915b505050505081526020016002820180546108d190611050565b80601f01602080910402602001604051908101604052809291908181526020018280546108fd90611050565b801561094a5780601f1061091f5761010080835404028352916020019161094a565b820191906000526020600020905b81548152906001019060200180831161092d57829003601f168201915b5050505050815250509050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e190610ef2565b60405180910390fd5b8360015410610a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2590610ed2565b60405180910390fd5b836001819055506040518060600160405280848152602001838152602001828152506000808681526020019081526020016000206000820151816000019080519060200190610a7e929190610ae3565b506020820151816001019080519060200190610a9b929190610ae3565b506040820151816002019080519060200190610ab8929190610ae3565b5090505050505050565b60405180606001604052806060815260200160608152602001606081525090565b828054610aef90611050565b90600052602060002090601f016020900481019282610b115760008555610b58565b82601f10610b2a57805160ff1916838001178555610b58565b82800160010185558215610b58579182015b82811115610b57578251825591602001919060010190610b3c565b5b509050610b659190610b69565b5090565b5b80821115610b82576000816000905550600101610b6a565b5090565b6000610b99610b9484610f74565b610f4f565b905082815260208101848484011115610bb157600080fd5b610bbc84828561100e565b509392505050565b600081359050610bd381611174565b92915050565b600082601f830112610bea57600080fd5b8135610bfa848260208601610b86565b91505092915050565b600081359050610c128161118b565b92915050565b600060208284031215610c2a57600080fd5b6000610c3884828501610bc4565b91505092915050565b600060208284031215610c5357600080fd5b6000610c6184828501610c03565b91505092915050565b60008060008060808587031215610c8057600080fd5b6000610c8e87828801610c03565b945050602085013567ffffffffffffffff811115610cab57600080fd5b610cb787828801610bd9565b935050604085013567ffffffffffffffff811115610cd457600080fd5b610ce087828801610bd9565b925050606085013567ffffffffffffffff811115610cfd57600080fd5b610d0987828801610bd9565b91505092959194509250565b610d1e81610fd2565b82525050565b6000610d2f82610fa5565b610d398185610fb0565b9350610d4981856020860161101d565b610d5281611111565b840191505092915050565b6000610d6882610fa5565b610d728185610fc1565b9350610d8281856020860161101d565b610d8b81611111565b840191505092915050565b6000610da3600983610fc1565b9150610dae82611122565b602082019050919050565b6000610dc6600d83610fc1565b9150610dd18261114b565b602082019050919050565b60006060830160008301518482036000860152610df98282610d24565b91505060208301518482036020860152610e138282610d24565b91505060408301518482036040860152610e2d8282610d24565b9150508091505092915050565b610e4381611004565b82525050565b6000602082019050610e5e6000830184610d15565b92915050565b60006020820190508181036000830152610e7e8184610d5d565b905092915050565b60006060820190508181036000830152610ea08186610d5d565b90508181036020830152610eb48185610d5d565b90508181036040830152610ec88184610d5d565b9050949350505050565b60006020820190508181036000830152610eeb81610d96565b9050919050565b60006020820190508181036000830152610f0b81610db9565b9050919050565b60006020820190508181036000830152610f2c8184610ddc565b905092915050565b6000602082019050610f496000830184610e3a565b92915050565b6000610f59610f6a565b9050610f658282611082565b919050565b6000604051905090565b600067ffffffffffffffff821115610f8f57610f8e6110e2565b5b610f9882611111565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610fdd82610fe4565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561103b578082015181840152602081019050611020565b8381111561104a576000848401525b50505050565b6000600282049050600182168061106857607f821691505b6020821081141561107c5761107b6110b3565b5b50919050565b61108b82611111565b810181811067ffffffffffffffff821117156110aa576110a96110e2565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f6f6c6420726f756e640000000000000000000000000000000000000000000000600082015250565b7f6e6f742061207570646174657200000000000000000000000000000000000000600082015250565b61117d81610fd2565b811461118857600080fd5b50565b61119481611004565b811461119f57600080fd5b5056fea2646970667358221220cce52c7d85ea65f3115284c3108b257131872c5659e241a9cef3a9d942e32b4664736f6c63430008040033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100935760003560e01c80636f9aa784116100665780636f9aa78414610134578063805d64a01461016457806382bc07e614610182578063a921a502146101a0578063bfcd5771146101d057610093565b80630ff4c916146100985780634231a2c3146100c85780635e383d21146100e65780636aa45efc14610118575b600080fd5b6100b260048036038101906100ad9190610c41565b6101ec565b6040516100bf9190610f12565b60405180910390f35b6100d06103ce565b6040516100dd9190610f34565b60405180910390f35b61010060048036038101906100fb9190610c41565b6103d8565b60405161010f93929190610e86565b60405180910390f35b610132600480360381019061012d9190610c18565b61059a565b005b61014e60048036038101906101499190610c41565b6106a5565b60405161015b9190610e64565b60405180910390f35b61016c61074c565b6040516101799190610e49565b60405180910390f35b61018a610772565b6040516101979190610f34565b60405180910390f35b6101ba60048036038101906101b59190610c41565b610778565b6040516101c79190610f12565b60405180910390f35b6101ea60048036038101906101e59190610c6a565b61095a565b005b6101f4610ac2565b60008083815260200190815260200160002060405180606001604052908160008201805461022190611050565b80601f016020809104026020016040519081016040528092919081815260200182805461024d90611050565b801561029a5780601f1061026f5761010080835404028352916020019161029a565b820191906000526020600020905b81548152906001019060200180831161027d57829003601f168201915b505050505081526020016001820180546102b390611050565b80601f01602080910402602001604051908101604052809291908181526020018280546102df90611050565b801561032c5780601f106103015761010080835404028352916020019161032c565b820191906000526020600020905b81548152906001019060200180831161030f57829003601f168201915b5050505050815260200160028201805461034590611050565b80601f016020809104026020016040519081016040528092919081815260200182805461037190611050565b80156103be5780601f10610393576101008083540402835291602001916103be565b820191906000526020600020905b8154815290600101906020018083116103a157829003601f168201915b5050505050815250509050919050565b6000600154905090565b60006020528060005260406000206000915090508060000180546103fb90611050565b80601f016020809104026020016040519081016040528092919081815260200182805461042790611050565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b50505050509080600101805461048990611050565b80601f01602080910402602001604051908101604052809291908181526020018280546104b590611050565b80156105025780601f106104d757610100808354040283529160200191610502565b820191906000526020600020905b8154815290600101906020018083116104e557829003601f168201915b50505050509080600201805461051790611050565b80601f016020809104026020016040519081016040528092919081815260200182805461054390611050565b80156105905780601f1061056557610100808354040283529160200191610590565b820191906000526020600020905b81548152906001019060200180831161057357829003601f168201915b5050505050905083565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062190610ef2565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f121e958a4cadf7f8dadefa22cc019700365240223668418faebed197da07089f8160405161069a9190610e49565b60405180910390a150565b606060008083815260200190815260200160002060000180546106c790611050565b80601f01602080910402602001604051908101604052809291908181526020018280546106f390611050565b80156107405780601f1061071557610100808354040283529160200191610740565b820191906000526020600020905b81548152906001019060200180831161072357829003601f168201915b50505050509050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b610780610ac2565b6000808381526020019081526020016000206040518060600160405290816000820180546107ad90611050565b80601f01602080910402602001604051908101604052809291908181526020018280546107d990611050565b80156108265780601f106107fb57610100808354040283529160200191610826565b820191906000526020600020905b81548152906001019060200180831161080957829003601f168201915b5050505050815260200160018201805461083f90611050565b80601f016020809104026020016040519081016040528092919081815260200182805461086b90611050565b80156108b85780601f1061088d576101008083540402835291602001916108b8565b820191906000526020600020905b81548152906001019060200180831161089b57829003601f168201915b505050505081526020016002820180546108d190611050565b80601f01602080910402602001604051908101604052809291908181526020018280546108fd90611050565b801561094a5780601f1061091f5761010080835404028352916020019161094a565b820191906000526020600020905b81548152906001019060200180831161092d57829003601f168201915b5050505050815250509050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e190610ef2565b60405180910390fd5b8360015410610a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2590610ed2565b60405180910390fd5b836001819055506040518060600160405280848152602001838152602001828152506000808681526020019081526020016000206000820151816000019080519060200190610a7e929190610ae3565b506020820151816001019080519060200190610a9b929190610ae3565b506040820151816002019080519060200190610ab8929190610ae3565b5090505050505050565b60405180606001604052806060815260200160608152602001606081525090565b828054610aef90611050565b90600052602060002090601f016020900481019282610b115760008555610b58565b82601f10610b2a57805160ff1916838001178555610b58565b82800160010185558215610b58579182015b82811115610b57578251825591602001919060010190610b3c565b5b509050610b659190610b69565b5090565b5b80821115610b82576000816000905550600101610b6a565b5090565b6000610b99610b9484610f74565b610f4f565b905082815260208101848484011115610bb157600080fd5b610bbc84828561100e565b509392505050565b600081359050610bd381611174565b92915050565b600082601f830112610bea57600080fd5b8135610bfa848260208601610b86565b91505092915050565b600081359050610c128161118b565b92915050565b600060208284031215610c2a57600080fd5b6000610c3884828501610bc4565b91505092915050565b600060208284031215610c5357600080fd5b6000610c6184828501610c03565b91505092915050565b60008060008060808587031215610c8057600080fd5b6000610c8e87828801610c03565b945050602085013567ffffffffffffffff811115610cab57600080fd5b610cb787828801610bd9565b935050604085013567ffffffffffffffff811115610cd457600080fd5b610ce087828801610bd9565b925050606085013567ffffffffffffffff811115610cfd57600080fd5b610d0987828801610bd9565b91505092959194509250565b610d1e81610fd2565b82525050565b6000610d2f82610fa5565b610d398185610fb0565b9350610d4981856020860161101d565b610d5281611111565b840191505092915050565b6000610d6882610fa5565b610d728185610fc1565b9350610d8281856020860161101d565b610d8b81611111565b840191505092915050565b6000610da3600983610fc1565b9150610dae82611122565b602082019050919050565b6000610dc6600d83610fc1565b9150610dd18261114b565b602082019050919050565b60006060830160008301518482036000860152610df98282610d24565b91505060208301518482036020860152610e138282610d24565b91505060408301518482036040860152610e2d8282610d24565b9150508091505092915050565b610e4381611004565b82525050565b6000602082019050610e5e6000830184610d15565b92915050565b60006020820190508181036000830152610e7e8184610d5d565b905092915050565b60006060820190508181036000830152610ea08186610d5d565b90508181036020830152610eb48185610d5d565b90508181036040830152610ec88184610d5d565b9050949350505050565b60006020820190508181036000830152610eeb81610d96565b9050919050565b60006020820190508181036000830152610f0b81610db9565b9050919050565b60006020820190508181036000830152610f2c8184610ddc565b905092915050565b6000602082019050610f496000830184610e3a565b92915050565b6000610f59610f6a565b9050610f658282611082565b919050565b6000604051905090565b600067ffffffffffffffff821115610f8f57610f8e6110e2565b5b610f9882611111565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610fdd82610fe4565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561103b578082015181840152602081019050611020565b8381111561104a576000848401525b50505050565b6000600282049050600182168061106857607f821691505b6020821081141561107c5761107b6110b3565b5b50919050565b61108b82611111565b810181811067ffffffffffffffff821117156110aa576110a96110e2565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f6f6c6420726f756e640000000000000000000000000000000000000000000000600082015250565b7f6e6f742061207570646174657200000000000000000000000000000000000000600082015250565b61117d81610fd2565b811461118857600080fd5b50565b61119481611004565b811461119f57600080fd5b5056fea2646970667358221220cce52c7d85ea65f3115284c3108b257131872c5659e241a9cef3a9d942e32b4664736f6c63430008040033