Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

charge storage fee to support non native asset #2045

Merged
merged 37 commits into from
May 16, 2022
Merged

Conversation

zqhxuyuan
Copy link
Contributor

@zqhxuyuan zqhxuyuan commented Apr 19, 2022

closes: #2039

change evm reserve_storage from T::Currency::reserve_named() to T::ChargeTransactionPayment::reserve_fee(), and we can add our own fee strategy in transaction payment module's reserve_fee(). That is, reserve_fee now can support none native token.

T::Currency::reserve_named(&RESERVE_ID_STORAGE_DEPOSIT, &user, amount)

we do not need to change unreserve_storage and charge_storage in evm, because reserve_storage happend before those two operation. That is, unreserve_storage and charge_storage always have native token.


If we have this feature, I think bodhi.js Metamask needs support this too, currently if an eth account not bind to substrate account, it have enough none-native token, but not enough native token, the transfer can't proceed
image

@codecov
Copy link

codecov bot commented Apr 19, 2022

Codecov Report

Merging #2045 (1f2b6f1) into master (42f41c8) will decrease coverage by 86.45%.
The diff coverage is n/a.

❗ Current head 1f2b6f1 differs from pull request most recent head 53661fa. Consider uploading reports for the commit 53661fa to get more accurate results

@@            Coverage Diff             @@
##           master   #2045       +/-   ##
==========================================
- Coverage   86.45%       0   -86.46%     
==========================================
  Files          99       0       -99     
  Lines       21240       0    -21240     
==========================================
- Hits        18362       0    -18362     
+ Misses       2878       0     -2878     
Impacted Files Coverage Δ
modules/asset-registry/src/lib.rs
modules/cdp-engine/src/lib.rs
modules/cdp-engine/src/tests.rs
modules/evm-utility/macro/src/lib.rs
modules/evm/src/lib.rs
modules/evm/src/precompiles/blake2/mod.rs
modules/honzon/src/lib.rs
modules/honzon/src/tests.rs
modules/idle-scheduler/src/lib.rs
modules/support/src/evm.rs
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ca13ff...53661fa. Read the comment docs.

@zqhxuyuan zqhxuyuan marked this pull request as ready for review April 26, 2022 15:06
@xlc
Copy link
Member

xlc commented Apr 28, 2022

It is ok if Metamask can't handle it as that's basically the same behaviour of Ethereum. This however will be useful for polkadot.js extension user or dApp using EIP712 signature format.

modules/transaction-payment/src/lib.rs Outdated Show resolved Hide resolved
modules/transaction-payment/src/lib.rs Outdated Show resolved Hide resolved
@zqhxuyuan zqhxuyuan changed the title charge storage fee charge storage fee to support non native asset May 6, 2022
scripts/polkadot-launch/acala-launch.json Outdated Show resolved Hide resolved
modules/transaction-payment/src/lib.rs Outdated Show resolved Hide resolved
xlc
xlc previously approved these changes May 9, 2022
xlc
xlc previously approved these changes May 16, 2022
@zqhxuyuan zqhxuyuan merged commit 5378517 into master May 16, 2022
@zqhxuyuan zqhxuyuan deleted the charge_storage_fee branch May 16, 2022 10:02
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.

use ChargeTransactionPayment to charge the storage fee in evm
3 participants