UNPKG

@cartesi/staking-pool

Version:
423 lines 100 kB
{ "address": "0x692e8Dc1CdAda8559cc29AdBC9699583592603ff", "abi": [ { "inputs": [ { "internalType": "address", "name": "_gasOracle", "type": "address" }, { "internalType": "address", "name": "_priceOracle", "type": "address" }, { "internalType": "address", "name": "_pos", "type": "address" }, { "internalType": "uint256", "name": "_feeRaiseTimeout", "type": "uint256" }, { "internalType": "uint256", "name": "_maxGasRaise", "type": "uint256" }, { "internalType": "uint256", "name": "_maxFeePercentageRaise", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "pool", "type": "address" }, { "indexed": false, "internalType": "address", "name": "fee", "type": "address" } ], "name": "NewFlatRateCommissionStakingPool", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "pool", "type": "address" }, { "indexed": false, "internalType": "address", "name": "fee", "type": "address" } ], "name": "NewGasTaxCommissionStakingPool", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_pos", "type": "address" } ], "name": "PoSAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "pool", "type": "address" } ], "name": "ReferencePoolChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Unpaused", "type": "event" }, { "inputs": [ { "internalType": "uint256", "name": "commission", "type": "uint256" } ], "name": "createFlatRateCommission", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "gas", "type": "uint256" } ], "name": "createGasTaxCommission", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [], "name": "feeRaiseTimeout", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "gasOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getPoS", "outputs": [ { "internalType": "address", "name": "_pos", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxFeePercentageRaise", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxGasRaise", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pos", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "priceOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "referencePool", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_pos", "type": "address" } ], "name": "setPoSAddress", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_referencePool", "type": "address" } ], "name": "setReferencePool", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "stateMutability": "payable", "type": "receive" } ], "transactionHash": "0x50c5d48eb864d6111f6c7516461b6c6ff81e7be5fc975e5bfd1010370ff41432", "receipt": { "to": null, "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", "contractAddress": "0x692e8Dc1CdAda8559cc29AdBC9699583592603ff", "transactionIndex": 124, "gasUsed": "1894979", "logsBloom": "0x04000000000000000000000000000000000000000000000000800020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000020000000000000000000000000000000000000000000000000000000024000000000", "blockHash": "0x985d9d400d1a591bbb65825f33c61edd5f55895a96dbd4392d9a6f235f09418f", "transactionHash": "0x50c5d48eb864d6111f6c7516461b6c6ff81e7be5fc975e5bfd1010370ff41432", "logs": [ { "transactionIndex": 124, "blockNumber": 5242308, "transactionHash": "0x50c5d48eb864d6111f6c7516461b6c6ff81e7be5fc975e5bfd1010370ff41432", "address": "0x692e8Dc1CdAda8559cc29AdBC9699583592603ff", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x00000000000000000000000018930e8a66a1dbe21d00581216789aab7460afd0" ], "data": "0x", "logIndex": 209, "blockHash": "0x985d9d400d1a591bbb65825f33c61edd5f55895a96dbd4392d9a6f235f09418f" } ], "blockNumber": 5242308, "cumulativeGasUsed": "12010851", "status": 1, "byzantium": true }, "args": [ "0x451B611D38140993ec16a82E48aC720EBd0AB35C", "0xD304De7988a4285c8b49eC4dB751F28b1f1465B0", "0x19A8FB7d7C4D53713327cEb6ba1293d1F364c502", 120, 20000, 500 ], "numDeployments": 1, "solcInputHash": "e0af42a1786a87e4c045271b4c5b79b4", "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_gasOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_priceOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_pos\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_feeRaiseTimeout\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxGasRaise\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxFeePercentageRaise\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"fee\",\"type\":\"address\"}],\"name\":\"NewFlatRateCommissionStakingPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"fee\",\"type\":\"address\"}],\"name\":\"NewGasTaxCommissionStakingPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_pos\",\"type\":\"address\"}],\"name\":\"PoSAddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"}],\"name\":\"ReferencePoolChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"commission\",\"type\":\"uint256\"}],\"name\":\"createFlatRateCommission\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gas\",\"type\":\"uint256\"}],\"name\":\"createGasTaxCommission\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeRaiseTimeout\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPoS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_pos\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxFeePercentageRaise\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxGasRaise\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pos\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"priceOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"referencePool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pos\",\"type\":\"address\"}],\"name\":\"setPoSAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_referencePool\",\"type\":\"address\"}],\"name\":\"setReferencePool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createFlatRateCommission(uint256)\":{\"returns\":{\"_0\":\"new pool address\"}},\"createGasTaxCommission(uint256)\":{\"returns\":{\"_0\":\"new pool address\"}},\"getPoS()\":{\"returns\":{\"_pos\":\"address for the PoS contract\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"events\":{\"NewFlatRateCommissionStakingPool(address,address)\":{\"notice\":\"Event emmited when a pool is created\"},\"NewGasTaxCommissionStakingPool(address,address)\":{\"notice\":\"Event emmited when a pool is created\"}},\"kind\":\"user\",\"methods\":{\"createFlatRateCommission(uint256)\":{\"notice\":\"Creates a new staking pool emits NewStakingPool with the parameters of the new pool\"},\"createGasTaxCommission(uint256)\":{\"notice\":\"Creates a new staking pool using a gas tax commission model emits NewGasTaxCommissionStakingPool with the parameters of the new pool\"},\"getPoS()\":{\"notice\":\"Returns configuration for the working pools of the current version\"},\"setPoSAddress(address)\":{\"notice\":\"Change the pos address\"},\"setReferencePool(address)\":{\"notice\":\"Change the pool reference implementation\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/StakingPoolFactoryImpl.sol\":\"StakingPoolFactoryImpl\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _setOwner(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _setOwner(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, implementation))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\\n instance := create(0, ptr, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, implementation))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\\n instance := create2(0, ptr, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, implementation))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)\\n mstore(add(ptr, 0x38), shl(0x60, deployer))\\n mstore(add(ptr, 0x4c), salt)\\n mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))\\n predicted := keccak256(add(ptr, 0x37), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(address implementation, bytes32 salt)\\n internal\\n view\\n returns (address predicted)\\n {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0xa3bbab77849522b73d8c6cd3d2ac54bef7580e4354484f35f4cabf55d3d2b3f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0xa35b1f2a670cd2a701a52c398032c9fed72df1909fe394d77ceacbf074e8937b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/FlatRateCommission.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 Interface staking contract\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./interfaces/Fee.sol\\\";\\n\\ncontract FlatRateCommission is Fee, Ownable {\\n uint256 public immutable feeRaiseTimeout;\\n uint256 public immutable maxRaise; // 500 = 5%\\n uint256 public constant BASE = 1E4;\\n uint256 public rate;\\n uint256 public timeoutTimestamp;\\n\\n /// @notice Event emmited when a contract is created\\n /// @param commission commission charged by the pool\\n event FlatRateCommissionCreated(uint256 commission);\\n\\n /// @notice event fired when setRate function is called and successful\\n /// @param newRate commission charged by the pool effective immediatly\\n /// @param timeout timestamp for a new change if raising the fee\\n event FlatRateChanged(uint256 newRate, uint256 timeout);\\n\\n constructor(\\n uint256 _rate,\\n uint256 _feeRaiseTimeout,\\n uint256 _maxRaise\\n ) {\\n rate = _rate;\\n feeRaiseTimeout = _feeRaiseTimeout;\\n maxRaise = _maxRaise;\\n emit FlatRateChanged(_rate, timeoutTimestamp);\\n }\\n\\n /// @notice calculates the total amount of the reward that will be directed to the PoolManager\\n /// @return commissionTotal is the amount subtracted from the rewardAmount\\n function getCommission(uint256, uint256 rewardAmount)\\n external\\n view\\n override\\n returns (uint256)\\n {\\n uint256 commission = (rewardAmount * rate) / BASE;\\n\\n // cap commission to 100%\\n return commission > rewardAmount ? rewardAmount : commission;\\n }\\n\\n /// @notice allows for the poolManager to reduce how much they want to charge for the block production tx\\n function setRate(uint256 newRate) external onlyOwner {\\n if (newRate > rate) {\\n require(\\n timeoutTimestamp <= block.timestamp,\\n \\\"FlatRateCommission: the fee raise timeout is not expired yet\\\"\\n );\\n require(\\n (newRate - rate) <= maxRaise,\\n \\\"FlatRateCommission: the fee raise is over the maximum allowed percentage value\\\"\\n );\\n timeoutTimestamp = block.timestamp + feeRaiseTimeout;\\n }\\n rate = newRate;\\n emit FlatRateChanged(newRate, timeoutTimestamp);\\n }\\n}\\n\",\"keccak256\":\"0x97fb67a50bc4cb1ac08c946d26ed61c38b80b69fe6281da2187dee920843ad85\",\"license\":\"Apache-2.0\"},\"contracts/GasTaxCommission.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 Gas tax based commission model\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./interfaces/Fee.sol\\\";\\nimport \\\"./oracle/GasOracle.sol\\\";\\nimport \\\"./oracle/PriceOracle.sol\\\";\\n\\ncontract GasTaxCommission is Fee, Ownable {\\n uint256 public immutable feeRaiseTimeout;\\n uint256 public immutable maxRaise; // 21000 is one simple tx\\n GasOracle public immutable gasOracle;\\n\\n PriceOracle public immutable priceOracle;\\n uint256 public timeoutTimestamp;\\n\\n uint256 public gas;\\n\\n /// @notice event fired when setGas function is called and successful\\n /// @param timeout timestamp for a new change if raising the fee\\n event GasTaxChanged(uint256 newGas, uint256 timeout);\\n\\n constructor(\\n address _gasOracle,\\n address _priceOracle,\\n uint256 _gas,\\n uint256 _feeRaiseTimeout,\\n uint256 _maxRaise\\n ) {\\n gasOracle = GasOracle(_gasOracle);\\n priceOracle = PriceOracle(_priceOracle);\\n gas = _gas;\\n feeRaiseTimeout = _feeRaiseTimeout;\\n maxRaise = _maxRaise;\\n emit GasTaxChanged(_gas, timeoutTimestamp);\\n }\\n\\n /// @notice calculates the total amount of the reward that will be directed to the PoolManager\\n /// @return commissionTotal is the amount subtracted from the rewardAmount\\n function getCommission(uint256, uint256 rewardAmount)\\n external\\n view\\n override\\n returns (uint256)\\n {\\n // get gas price (in Wei) from chainlink oracle, at https://data.chain.link/fast-gas-gwei\\n uint256 gasPrice = gasOracle.getGasPrice();\\n\\n // gas fee (in Wei) charged by pool manager\\n uint256 gasFee = gasPrice * gas;\\n\\n // get Wei price of 1 CTSI\\n uint256 ctsiPrice = priceOracle.getPrice();\\n\\n // convert gas in Wei to gas in CTSI\\n uint256 gasFeeCTSI = ctsiPrice > 0\\n ? (gasFee * (10**18)) / ctsiPrice\\n : 0;\\n\\n // this is the commission, maxed by the reward\\n return gasFeeCTSI > rewardAmount ? rewardAmount : gasFeeCTSI;\\n }\\n\\n /// @notice allows for the poolManager to reduce how much they want to charge for the block production tx\\n function setGas(uint256 newGasCommission) external onlyOwner {\\n if (newGasCommission > gas) {\\n require(\\n timeoutTimestamp <= block.timestamp,\\n \\\"GasTaxCommission: the fee raise timeout is not expired yet\\\"\\n );\\n require(\\n (newGasCommission - gas) <= maxRaise,\\n \\\"GasTaxCommission: the fee raise is over the maximum allowed gas value\\\"\\n );\\n timeoutTimestamp = block.timestamp + feeRaiseTimeout;\\n }\\n gas = newGasCommission;\\n emit GasTaxChanged(newGasCommission, timeoutTimestamp);\\n }\\n}\\n\",\"keccak256\":\"0x6e79f59576eb07df0443d9352271b044420df1ee5a872c5b770a493de587ff46\",\"license\":\"Apache-2.0\"},\"contracts/StakingPoolFactoryImpl.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 Factory of staking pools\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport \\\"./interfaces/StakingPool.sol\\\";\\nimport \\\"./interfaces/StakingPoolFactory.sol\\\";\\nimport \\\"./FlatRateCommission.sol\\\";\\nimport \\\"./GasTaxCommission.sol\\\";\\n\\ncontract StakingPoolFactoryImpl is Ownable, Pausable, StakingPoolFactory {\\n address public referencePool;\\n address public immutable gasOracle;\\n address public immutable priceOracle;\\n uint256 public immutable feeRaiseTimeout;\\n uint256 public immutable maxGasRaise;\\n uint256 public immutable maxFeePercentageRaise;\\n\\n address public pos;\\n\\n event ReferencePoolChanged(address indexed pool);\\n event PoSAddressChanged(address indexed _pos);\\n\\n receive() external payable {}\\n\\n constructor(\\n address _gasOracle,\\n address _priceOracle,\\n address _pos,\\n uint256 _feeRaiseTimeout,\\n uint256 _maxGasRaise,\\n uint256 _maxFeePercentageRaise\\n ) {\\n require(\\n _gasOracle != address(0),\\n \\\"StakingPoolFactoryImpl: parameter can not be zero address.\\\"\\n );\\n require(\\n _priceOracle != address(0),\\n \\\"StakingPoolFactoryImpl: parameter can not be zero address.\\\"\\n );\\n gasOracle = _gasOracle;\\n priceOracle = _priceOracle;\\n feeRaiseTimeout = _feeRaiseTimeout;\\n maxGasRaise = _maxGasRaise;\\n maxFeePercentageRaise = _maxFeePercentageRaise;\\n pos = _pos;\\n }\\n\\n /// @notice Change the pool reference implementation\\n function setReferencePool(address _referencePool) external onlyOwner {\\n referencePool = _referencePool;\\n emit ReferencePoolChanged(_referencePool);\\n }\\n\\n /// @notice Change the pos address\\n function setPoSAddress(address _pos) external onlyOwner {\\n pos = _pos;\\n emit PoSAddressChanged(_pos);\\n }\\n\\n /// @notice Creates a new staking pool\\n /// emits NewStakingPool with the parameters of the new pool\\n /// @return new pool address\\n function createFlatRateCommission(uint256 commission)\\n external\\n payable\\n override\\n whenNotPaused\\n returns (address)\\n {\\n require(\\n referencePool != address(0),\\n \\\"StakingPoolFactoryImpl: undefined reference pool\\\"\\n );\\n FlatRateCommission fee = new FlatRateCommission(\\n commission,\\n feeRaiseTimeout,\\n maxFeePercentageRaise\\n );\\n address payable deployed = payable(Clones.clone(referencePool));\\n StakingPool pool = StakingPool(deployed);\\n pool.initialize(address(fee), pos);\\n pool.transferOwnership(msg.sender);\\n fee.transferOwnership(msg.sender);\\n // sends msg.value to complete hiring process\\n pool.selfhire{value: msg.value}(); //@dev: ignore reentrancy guard warning\\n\\n // returns unused user payment\\n payable(msg.sender).transfer(msg.value); //@dev: ignore reentrancy guard warning\\n\\n emit NewFlatRateCommissionStakingPool(address(pool), address(fee));\\n return address(pool);\\n }\\n\\n function createGasTaxCommission(uint256 gas)\\n external\\n payable\\n override\\n whenNotPaused\\n returns (address)\\n {\\n require(\\n referencePool != address(0),\\n \\\"StakingPoolFactoryImpl: undefined reference pool\\\"\\n );\\n GasTaxCommission fee = new GasTaxCommission(\\n gasOracle,\\n priceOracle,\\n gas,\\n feeRaiseTimeout,\\n maxGasRaise\\n );\\n address payable deployed = payable(Clones.clone(referencePool));\\n StakingPool pool = StakingPool(deployed);\\n pool.initialize(address(fee), pos);\\n pool.transferOwnership(msg.sender);\\n fee.transferOwnership(msg.sender);\\n // sends msg.value to complete hiring process\\n pool.selfhire{value: msg.value}(); //@dev: ignore reentrancy guard warning\\n\\n // returns unused user payment\\n payable(msg.sender).transfer(msg.value); //@dev: ignore reentrancy guard warning\\n\\n emit NewGasTaxCommissionStakingPool(address(pool), address(fee));\\n return address(pool);\\n }\\n\\n /// @notice Returns configuration for the working pools of the current version\\n /// @return _pos address for the PoS contract\\n function getPoS() external view override returns (address _pos) {\\n return pos;\\n }\\n\\n function pause() public whenNotPaused onlyOwner {\\n _pause();\\n }\\n\\n function unpause() external whenPaused onlyOwner {\\n _unpause();\\n }\\n}\\n\",\"keccak256\":\"0x0a9ca1f9a1819b7252a4e248e212c9dd93664201c08fa874f8a9a91d5ebf50c4\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/Fee.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\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Calculator of pool owner commission for each block reward\\n/// @author Danilo Tuler\\n/// @notice This provides flexibility for different commission models\\ninterface Fee {\\n /// @notice calculates the total amount of the reward that will be directed to the pool owner\\n /// @return amount of tokens taken by the pool owner as commission\\n function getCommission(uint256 posIndex, uint256 rewardAmount)\\n external\\n view\\n returns (uint256);\\n}\\n\",\"keccak256\":\"0x6f0bafc511d75503c33709e4bb0d6c8cf191f06331e7fa4505540d8d1836e55a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/StakingPool.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\\npragma solidity >=0.7.0;\\n\\nimport \\\"./StakingPoolManagement.sol\\\";\\nimport \\\"./StakingPoolProducer.sol\\\";\\nimport \\\"./StakingPoolStaking.sol\\\";\\nimport \\\"./StakingPoolUser.sol\\\";\\nimport \\\"./StakingPoolWorker.sol\\\";\\n\\n/// @title Staking Pool interface\\n/// @author Danilo Tuler\\n/// @notice This interface aggregates all facets of a staking pool.\\n/// It is broken down into the following sub-interfaces:\\n/// - StakingPoolManagement: management operations on the pool, called by the owner\\n/// - StakingPoolProducer: operations related to block production\\n/// - StakingPoolStaking: interaction between the pool and the staking contract\\n/// - StakingPoolUser: interaction between the pool users and the pool\\n/// - StakingPoolWorker: interaction between the pool and the worker node\\ninterface StakingPool is\\n StakingPoolManagement,\\n StakingPoolProducer,\\n StakingPoolStaking,\\n StakingPoolUser,\\n StakingPoolWorker\\n{\\n /// @notice initialize pool (from reference)\\n function initialize(address fee, address _pos) external;\\n\\n /// @notice Transfer ownership of pool to its deployer\\n function transferOwnership(address newOwner) external;\\n\\n /// @notice updates the internal settings for important pieces of the Cartesi PoS system\\n function update() external;\\n}\\n\",\"keccak256\":\"0x102c3eb490a239bfb98f38363c2218edacdeb64db46493a3a84cbcc431903b77\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/StakingPoolFactory.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\\npragma solidity >=0.7.0;\\n\\ninterface StakingPoolFactory {\\n /// @notice Creates a new staking pool using a flat commission model\\n /// emits NewFlatRateCommissionStakingPool with the parameters of the new pool\\n /// @return new pool address\\n function createFlatRateCommission(uint256 commission)\\n external\\n payable\\n returns (address);\\n\\n /// @notice Creates a new staking pool using a gas tax commission model\\n /// emits NewGasTaxCommissionStakingPool with the parameters of the new pool\\n /// @return new pool address\\n function createGasTaxCommission(uint256 gas)\\n external\\n payable\\n returns (address);\\n\\n /// @notice Returns configuration for the working pools of the current version\\n /// @return _pos address for the PoS contract\\n function getPoS() external view returns (address _pos);\\n\\n /// @notice Event emmited when a pool is created\\n /// @param pool address of the new pool\\n /// @param fee address of the commission contract\\n event NewFlatRateCommissionStakingPool(address indexed pool, address fee);\\n\\n /// @notice Event emmited when a pool is created\\n /// @param pool address of the new pool\\n /// @param fee address of thhe commission contract\\n event NewGasTaxCommissionStakingPool(address indexed pool, address fee);\\n}\\n\",\"keccak256\":\"0x5e35f11721eee583e20da68db531eefd391300d6c14a757ccf42a5c189929a7a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/StakingPoolManagement.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\\npragma solidity >=0.7.0;\\n\\ninterface StakingPoolManagement {\\n /// @notice sets a name for the