Skip to content
Commit 2541efdb authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

pallet-asset: Fix transfer of a large amount of an asset (#11241)



* pallet-asset: Fix transfer of a large amount of an asset

Before this pr transferring a large amount of an asset would check that transferring the asset would
not overflow the supply of the asset. However, it doesn't make sense to check for asset supply
overflow when we just transfer from one account to another account and don't increase the supply in
any way. It also required to extend the `can_deposit` method of `fungible` and `fungibles` with a
`mint` parameter. If this parameter is set to `true`, it means we want to mint the amount of an
asset before transferring it into an account. For `can_withdraw` we don't need to add an extra
parameter, because withdrawing should never be able to underflow the supply. If that would happen,
it would mean that somewhere the supply wasn't increased while increasing the balance of an account.

* Update frame/assets/src/functions.rs

* Update frame/assets/src/functions.rs

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarShawn Tabrizi <[email protected]>

* FMT

Co-authored-by: default avatarShawn Tabrizi <[email protected]>
parent 914db49d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment