EthConnector: don't burn NEP-141 on deposit.#133
Conversation
|
The cons of the first approach seem to primarily be bookkeeping related. If we correct for the double-counting in |
|
Strongly prefer first approach. Being consistent and having a "simple" solution seems a bigger win. The cons are related to the way balances are being displayed, here we have the freedom to update them to show expected values, or educated developers consuming this interface. |
birchmd
left a comment
There was a problem hiding this comment.
One question I have about changing the behaviour here: what happens to any transfers than have already happened? Can they never exit?
mrLSD
left a comment
There was a problem hiding this comment.
Implemented solution looks clear & simple.
joshuajbouw
left a comment
There was a problem hiding this comment.
Good here. Straight forward.
|
@artob Sorry, forgot to answer it here.
@birchmd That's correct. This is not an issue for us because ETH connector hasn't been deployed to Mainnet yet, so there we will start from scratch. On Testnet I solved it just by bridging some Ropsten directly to |
* Introduce precompiles for the ETH & ERC-20 connectors. (#51) * Implement generational storage with `SELFDESTRUCT` tests. (#84) * Remove the dependency on Lunarity. (#115) * Fix Clippy complaint with `+nightly`. (#117) * Simplify the `sdk::read_u64` return type. (#118) * Add an `is_used_proof` interface. (#120) * Add an `evm-bully=yes` build to CI. (#121) * Handle transaction gas limit properly. (#123) * Fix u128 JSON parsing & tests in the ETH connector. (#125) * Fix evm-bully builds. (#130) * Add JSON custom error types. (#131) * Don't burn NEP-141 on deposit. (#133) * Fix needless borrows. (#135) * Improve and refactor the ETH connector. (#136) * Add a macro for logging. (#142) Co-authored-by: Aleksey Kladov <aleksey@near.org> Co-authored-by: Arto Bendiken <arto@aurora.dev> Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev> Co-authored-by: Frank Braun <frank@aurora.dev> Co-authored-by: Joshua J. Bouw <joshua@aurora.dev> Co-authored-by: Kirill <kirill@aurora.dev> Co-authored-by: Marcelo Fornet <marcelo@aurora.dev> Co-authored-by: Michael Birch <michael@aurora.dev>
* Introduce precompiles for the ETH & ERC-20 connectors. (#51) * Implement generational storage with `SELFDESTRUCT` tests. (#84) * Fix u128 JSON parsing & tests in the ETH connector. (#125) * Add JSON custom error types. (#131) * Don't burn NEP-141 on deposit. (#133) * Fix needless borrows. (#135) * Improve and refactor the ETH connector. (#136) * Add a macro for logging. (#142) Co-authored-by: Aleksey Kladov <aleksey@near.org> Co-authored-by: Arto Bendiken <arto@aurora.dev> Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev> Co-authored-by: Frank Braun <frank@aurora.dev> Co-authored-by: Joshua J. Bouw <joshua@aurora.dev> Co-authored-by: Kirill <kirill@aurora.dev> Co-authored-by: Marcelo Fornet <marcelo@aurora.dev> Co-authored-by: Michael Birch <michael@aurora.dev>
We used to have the following workflow for depositing ETH to Aurora:
When we call
exitToNearprecompile for ETH, we expect to burn ETH on Aurora and makeft_transferof nETH tokens from Aurora to the recipient on NEAR. The problem using the previously mentioned deposit workflow is that we don't have nETH tokens available on Aurora account when we try to perform this exit.Possible solutions:
1) Don't burn nETH tokens on Aurora account during the deposit
This solution is currently implemented in the PR.
Pros:
ft_transferwhen callingexitToNearprecompile for ETH.Cons:
total_balance_near(which should be renamed tototal_balance_nep141or something similar) will grow and will represent both nETH and ETH tokens, which might be not the thing we want.total_balancewill be the sum oftotal_balance_nearandtotal_balance_eth. And in this way is not really something meaningful.2) Add needed private functions to Aurora contract
Add the private function
self_mint_and_ft_transfer(andself_mint_and_withdrawforexitToEthereum) that will be called only from the appropriate precompile for ETH. The function will first mint the needed amount of nETH to Aurora account and then perform a regularft_transferto the recipient.Pros:
total_supply_near,total_supply_eth,total_supplyvalues remain meaningful and we don't have any redundant balance for nETH that we keep in the contract.Cons:
I expect that the 1st approach more likely will be accepted thus I implemented this here.
However, I'm more into 2nd approach so I think it worth discussing.
NB: this needs to be solved for both ETH exits:
exitToNear,exitToEthereum.