cartesi / rollups-contracts

Smart Contracts for Cartesi Rollups
https://cartesi.github.io/rollups-contracts/
Apache License 2.0
18 stars 38 forks source link

Remove ERC-20 entry points from consensus contract(s) #162

Closed guidanoli closed 9 months ago

guidanoli commented 9 months ago

šŸ“š Context

Currently, the Authority contract defines a function called withdrawERC20Tokens which is meant to serve as an entry point for the owner to withdraw ERC-20 tokens from the Authority contract to its own balance. This feature was added with the idea that the Authority contract would be the recipient of ERC-20 tokens as payment for validating DApps. In reality, however, this function is not being used by anyone, and has, instead, created more problems than solved.

One issue is that it unnecessarily complicates the consensus contract with a financial layer which could live elsewhere. For example, the Authority owner could ask for ERC-20 tokens to be deposited directly in the owner's account, instead of the contract's.

Another issue is that, for the Quorum consensus, we would use OpenZeppelin's PaymentSplitter contract to split the payment of ERC-20 tokens amongst quorum members according to some distribution of shares. However, we'd like to upgrade @openzeppelin/contracts to v5 (see #161), which has removed such contract, leaving no equivalent alternative.

āœ”ļø Solution

We should remove the withdrawERC20Tokens function from the Authority contract. As for Quorum, we don't need to implement any type of financial layer either. The financial layer can live on top of currently existing contracts.

ZzzzHui commented 9 months ago

FYI: PaymentSplitter might be back when 5.1 or 5.2 releases https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4276#issuecomment-1584175563