ReimbursementPool

ReimbursementPool

This file documents a contract which is not yet deployed to Mainnet.

isAuthorized

mapping(address => bool) isAuthorized

Authorized contracts that can interact with the reimbursment pool. Authorization can be granted and removed by the owner.

staticGas

uint256 staticGas

Static gas includes:

  • cost of the refund function

  • base transaction cost

maxGasPrice

uint256 maxGasPrice

Max gas price used to reimburse a transaction submitter. Protects against malicious operator-miners.

StaticGasUpdated

event StaticGasUpdated(uint256 newStaticGas)

MaxGasPriceUpdated

event MaxGasPriceUpdated(uint256 newMaxGasPrice)

SendingEtherFailed

event SendingEtherFailed(uint256 refundAmount, address receiver)

AuthorizedContract

event AuthorizedContract(address thirdPartyContract)

UnauthorizedContract

event UnauthorizedContract(address thirdPartyContract)

FundsWithdrawn

event FundsWithdrawn(uint256 withdrawnAmount, address receiver)

constructor

constructor(uint256 _staticGas, uint256 _maxGasPrice) public

receive

receive() external payable

Receive ETH

refund

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.

Parameters

Name
Type
Description

gasSpent

uint256

Gas spent on a transaction that needs to be reimbursed.

receiver

address

Address where the reimbursment is sent.

authorize

function authorize(address _contract) external

Authorize a contract that can interact with this reimbursment pool. Can be authorized by the owner only.

Parameters

Name
Type
Description

_contract

address

Authorized contract.

unauthorize

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.

Parameters

Name
Type
Description

_contract

address

Authorized contract.

setStaticGas

function setStaticGas(uint256 _staticGas) external

Setting a static gas cost for executing a transaction. Can be set by the owner only.

Parameters

Name
Type
Description

_staticGas

uint256

Static gas cost.

setMaxGasPrice

function setMaxGasPrice(uint256 _maxGasPrice) external

Setting a max gas price for transactions. Can be set by the owner only.

Parameters

Name
Type
Description

_maxGasPrice

uint256

Max gas price used to reimburse tx submitters.

withdrawAll

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.

Parameters

Name
Type
Description

receiver

address

An address where ETH is sent.

withdraw

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.

Parameters

Name
Type
Description

amount

uint256

Amount to withdraw from the pool.

receiver

address

An address where ETH is sent.

Last updated