ReimbursementPool
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
This file documents a contract which is not yet deployed to Mainnet.
mapping(address => bool) isAuthorized
Authorized contracts that can interact with the reimbursment pool. Authorization can be granted and removed by the owner.
uint256 staticGas
Static gas includes:
cost of the refund function
base transaction cost
uint256 maxGasPrice
Max gas price used to reimburse a transaction submitter. Protects against malicious operator-miners.
event StaticGasUpdated(uint256 newStaticGas)
event MaxGasPriceUpdated(uint256 newMaxGasPrice)
event SendingEtherFailed(uint256 refundAmount, address receiver)
event AuthorizedContract(address thirdPartyContract)
event UnauthorizedContract(address thirdPartyContract)
event FundsWithdrawn(uint256 withdrawnAmount, address receiver)
constructor(uint256 _staticGas, uint256 _maxGasPrice) public
receive() external payable
Receive ETH
function refund(uint256 gasSpent, address receiver) external
Refunds ETH to a spender for executing specific transactions.
Ignoring the result of sending ETH to a receiver is made on purpose. For EOA receiving ETH should always work. If a receiver is a smart contract, then we do not want to fail a transaction, because in some cases the refund is done at the very end of multiple calls where all the previous calls were already paid off. It is a receiver's smart contract resposibility to make sure it can receive ETH. Only authorized contracts are allowed calling this function.
gasSpent
uint256
Gas spent on a transaction that needs to be reimbursed.
receiver
address
Address where the reimbursment is sent.
function authorize(address _contract) external
Authorize a contract that can interact with this reimbursment pool. Can be authorized by the owner only.
_contract
address
Authorized contract.
function unauthorize(address _contract) external
Unauthorize a contract that was previously authorized to interact with this reimbursment pool. Can be unauthorized by the owner only.
_contract
address
Authorized contract.
function setStaticGas(uint256 _staticGas) external
Setting a static gas cost for executing a transaction. Can be set by the owner only.
_staticGas
uint256
Static gas cost.
function setMaxGasPrice(uint256 _maxGasPrice) external
Setting a max gas price for transactions. Can be set by the owner only.
_maxGasPrice
uint256
Max gas price used to reimburse tx submitters.
function withdrawAll(address receiver) external
Withdraws all ETH from this pool which are sent to a given address. Can be set by the owner only.
receiver
address
An address where ETH is sent.
function withdraw(uint256 amount, address receiver) public
Withdraws ETH amount from this pool which are sent to a given address. Can be set by the owner only.
amount
uint256
Amount to withdraw from the pool.
receiver
address
An address where ETH is sent.