Skip to content

feat: remove mGNO#31

Merged
dapplion merged 8 commits intognosischain:ib-withdrawal-contract-partfrom
filoozom:feat/remove-mgno
Mar 22, 2023
Merged

feat: remove mGNO#31
dapplion merged 8 commits intognosischain:ib-withdrawal-contract-partfrom
filoozom:feat/remove-mgno

Conversation

@filoozom
Copy link
Copy Markdown
Contributor

Summary

This PR illustrates an example of how mGON could be removed altogether from the deposit and withdraw contracts.

Reason

Gas efficiency

Unwrapping all the mGNO to GNO once, instead of once per withdrawl, would make withdrawals more efficient. The same goes for deposits, as the wrapping step would be entirely removed.

UX

For the user, mGNO is just confusing. Why does it even need to exist in the first place? It feels like a hacky attempt to look like Ethereum, but in the end has no advantages except making integrations slightly easier. When users look at their balances, they want to know how much GNO they have, not how much mGNO, so they can divide it by 32 to get GNO. When users deposit, it would also appear clearly in MetaMask that this is a deposit contract call, rather than a transferAndCall on some obscure token. This could actually even be seen as a security feature in that sense.

Complexity

The mGNO concept makes all the contracts more complex, which makes them harder to audit and reason about. It's also code that impacts external tools like deposit UIs, and make their development more complicated.

Key stakeholders

Beacon chain explorers

Beacon chain explorers would need to be updated in order to display GNO instead of mGNO. For now, these are:

Deposit UIs

Deposit UIs need to replace the transferAndCall logic with a simple deposit / batchDeposit call on the deposit contract.

Community

In general the community seems to prefer to using GNO as well: https://forum.gnosis.io/t/should-gnosis-chain-withdrawals-disperse-mgno-or-gno/6620

This PR

I have to refactor it, but at least we can get the conversation going here.

@filoozom filoozom requested review from Barichek and dapplion March 22, 2023 07:51
Copy link
Copy Markdown
Contributor

@Barichek Barichek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the rest from the smart contract part seems good at first glance.

@@ -429,12 +396,7 @@ contract SBCDepositContract is

for (uint256 i = 0; i < _amounts.length; ++i) {
uint256 amount = uint256(_amounts[i]) * 1 gwei;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here should be also / 32, as currently amount is multiplied by 32.

@dapplion dapplion marked this pull request as ready for review March 22, 2023 12:55
@dapplion dapplion merged commit 2254f34 into gnosischain:ib-withdrawal-contract-part Mar 22, 2023
dapplion added a commit that referenced this pull request Mar 22, 2023
* withdrawal part first commit

* finalized withdrawals

* naming and lints

* few more checks on withdrawals in deposit.ts tests

* Additional reentrancy check on failed withdrawals + whenNotPaused for manual failed withdrawal processing

* added gasLimit for withdrawals

* call of processFailedWithdrawalsFromPointer in executeSystemWithdrawals

* comments above IWithdrawalContract functions

* Skip bad withdrawals

* Only drop address 0 withdrawal

* Test bad withdrawals

* Add assertSuccessfulWithdrawal

* Handle multiple event sin assertSuccessfulWithdrawal

* Update test

* feat: remove `mGNO` (#31)

* wip: remove mGNO

* test: fix remaining tests

* chore: update error message

* feat: add `unwrapTokens` function

* wip: upgradeToAndCall

* chore: remove package-lock and reset yarn.lock

* Add division on withdraw

---------

Co-authored-by: dapplion <35266934+dapplion@users.noreply.github.com>

* Fix lint

* Drop 'should upgrade and unwrap' test

* Drop EIP1967UpgradeToAndCall

* Update test EIP1967UpgradeToAndCall

* Drop duplicated bad withdrawals tests for GNO / mGNO

---------

Co-authored-by: dapplion <35266934+dapplion@users.noreply.github.com>
Co-authored-by: Philippe Schommers <philippe@schommers.be>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants