UNPKG

@cartesi/staking-pool

Version:
230 lines 13.7 kB
{ "address": "0xB5F89791E79Fa5DbaF4C2bFE81dCe855D9a00211", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "int256", "name": "current", "type": "int256" }, { "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" } ], "name": "AnswerUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" } ], "name": "NewRound", "type": "event" }, { "inputs": [ { "internalType": "uint256", "name": "roundId", "type": "uint256" } ], "name": "getAnswer", "outputs": [ { "internalType": "int256", "name": "", "type": "int256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "roundId", "type": "uint256" } ], "name": "getTimestamp", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestAnswer", "outputs": [ { "internalType": "int256", "name": "", "type": "int256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRound", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestTimestamp", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "int256", "name": "answer", "type": "int256" } ], "name": "setAnswer", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "transactionHash": "0x8d27f94b5770f32ddd98d1e160477fcd2b19aa7fa58b743a76dcd2db5fd269e7", "receipt": { "to": null, "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", "contractAddress": "0xB5F89791E79Fa5DbaF4C2bFE81dCe855D9a00211", "transactionIndex": 19, "gasUsed": "171319", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1c5bfbcc0b9005b413e4172496a5a02b340b7e9f50f773aa8406a14d89c8c16b", "transactionHash": "0x8d27f94b5770f32ddd98d1e160477fcd2b19aa7fa58b743a76dcd2db5fd269e7", "logs": [], "blockNumber": 5434471, "cumulativeGasUsed": "20092038", "status": 1, "byzantium": true }, "args": [], "solcInputHash": "85dbea9097cd8afef05a23bb24c383ad", "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"}],\"name\":\"setAnswer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/test/MockAggregator.sol\":\"MockAggregator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface AggregatorInterface {\\n function latestAnswer()\\n external\\n view\\n returns (\\n int256\\n );\\n \\n function latestTimestamp()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n function latestRound()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n function getAnswer(\\n uint256 roundId\\n )\\n external\\n view\\n returns (\\n int256\\n );\\n\\n function getTimestamp(\\n uint256 roundId\\n )\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n event AnswerUpdated(\\n int256 indexed current,\\n uint256 indexed roundId,\\n uint256 updatedAt\\n );\\n\\n event NewRound(\\n uint256 indexed roundId,\\n address indexed startedBy,\\n uint256 startedAt\\n );\\n}\\n\",\"keccak256\":\"0x1a5dc81544a6479f64437a8aca22c869769dd54ee3522c7ef5ebae0d329a28f0\",\"license\":\"MIT\"},\"contracts/test/MockAggregator.sol\":{\"content\":\"// Copyright 2021 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title Mock implementation of Chainlink aggregator, for testnet\\npragma solidity ^0.8.0;\\n\\nimport \\\"@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol\\\";\\n\\ncontract MockAggregator is AggregatorInterface {\\n uint256 _round;\\n\\n mapping(uint256 => int256) _answers;\\n\\n mapping(uint256 => uint256) _timestamps;\\n\\n function setAnswer(int256 answer) external {\\n _round++;\\n _answers[_round] = answer;\\n _timestamps[_round] = block.timestamp;\\n\\n emit NewRound(_round, msg.sender, block.timestamp);\\n emit AnswerUpdated(answer, _round, block.timestamp);\\n }\\n\\n function latestAnswer() external view override returns (int256) {\\n return _answers[_round];\\n }\\n\\n function latestTimestamp() external view override returns (uint256) {\\n return _timestamps[_round];\\n }\\n\\n function latestRound() external view override returns (uint256) {\\n return _round;\\n }\\n\\n function getAnswer(uint256 roundId)\\n external\\n view\\n override\\n returns (int256)\\n {\\n return _answers[roundId];\\n }\\n\\n function getTimestamp(uint256 roundId)\\n external\\n view\\n override\\n returns (uint256)\\n {\\n return _timestamps[roundId];\\n }\\n}\\n\",\"keccak256\":\"0xbec005e6a9220988c2110c1c357117c9d09d396f1cb18aa498678526635bc6ff\",\"license\":\"Apache-2.0\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610223806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806350d25bcd14610067578063668a0f021461008a5780638205bf6a1461009257806399213cd8146100a7578063b5ab58dc146100bc578063b633620c146100dc575b600080fd5b600080548152600160205260409020545b60405190815260200160405180910390f35b600054610078565b60008054815260026020526040902054610078565b6100ba6100b53660046101ab565b6100fc565b005b6100786100ca3660046101ab565b60009081526001602052604090205490565b6100786100ea3660046101ab565b60009081526002602052604090205490565b60008054908061010b836101c4565b90915550506000805481526001602090815260408083208490558254835260028252808320429081905592549051928352339290917f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271910160405180910390a3600054817f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f426040516101a091815260200190565b60405180910390a350565b6000602082840312156101bd57600080fd5b5035919050565b60006000198214156101e657634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220e7f9bbdd4b0c4db22bbe08e9221eb304ad48088ad719dee0357114ecf86b4f5264736f6c63430008070033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c806350d25bcd14610067578063668a0f021461008a5780638205bf6a1461009257806399213cd8146100a7578063b5ab58dc146100bc578063b633620c146100dc575b600080fd5b600080548152600160205260409020545b60405190815260200160405180910390f35b600054610078565b60008054815260026020526040902054610078565b6100ba6100b53660046101ab565b6100fc565b005b6100786100ca3660046101ab565b60009081526001602052604090205490565b6100786100ea3660046101ab565b60009081526002602052604090205490565b60008054908061010b836101c4565b90915550506000805481526001602090815260408083208490558254835260028252808320429081905592549051928352339290917f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271910160405180910390a3600054817f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f426040516101a091815260200190565b60405180910390a350565b6000602082840312156101bd57600080fd5b5035919050565b60006000198214156101e657634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220e7f9bbdd4b0c4db22bbe08e9221eb304ad48088ad719dee0357114ecf86b4f5264736f6c63430008070033", "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 }, "storageLayout": { "storage": [ { "astId": 3661, "contract": "contracts/test/MockAggregator.sol:MockAggregator", "label": "_round", "offset": 0, "slot": "0", "type": "t_uint256" }, { "astId": 3665, "contract": "contracts/test/MockAggregator.sol:MockAggregator", "label": "_answers", "offset": 0, "slot": "1", "type": "t_mapping(t_uint256,t_int256)" }, { "astId": 3669, "contract": "contracts/test/MockAggregator.sol:MockAggregator", "label": "_timestamps", "offset": 0, "slot": "2", "type": "t_mapping(t_uint256,t_uint256)" } ], "types": { "t_int256": { "encoding": "inplace", "label": "int256", "numberOfBytes": "32" }, "t_mapping(t_uint256,t_int256)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => int256)", "numberOfBytes": "32", "value": "t_int256" }, "t_mapping(t_uint256,t_uint256)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => uint256)", "numberOfBytes": "32", "value": "t_uint256" }, "t_uint256": { "encoding": "inplace", "label": "uint256", "numberOfBytes": "32" } } } }