What’s happening?
In December last year, a PR was opened to to deprecate Currency and introduce holds and freezing into fungible traits. As part of this PR, Balances::set_balance
was replaced by Balances::force_set_balance
and Balances::transfer
was replaced with Balances::transfer_allow_death
.
As much of the ecosystem uses transfer
, a compatibility stub was added to give ecosystem teams time to move to these replacements. This time has elapsed and the stub has been removed in this PR.
Why was this change made?
Some improvements were made along with the deprecation of the Currency trait. The hope is that these changes make the dispatchable's names better reflect their functions.
For example, when calling transfer
, it was not immediately apparent that it could end up with an account being reaped. However, transfer_allow_death
is more explicit about the potential repercussions of using this dispatchable over an alternative such as transfer_keep_alive
.
Code changes
You should use the fungible trait API for Balances rather than calling these dispatchables directly, as the long-term plan is to remove the dispatchables and have all pallet access be via XCM.
However, if you need to refactor your code to use the replacements, note the following:
-
Balances::set_balance
becomesBalances::force_set_balance
and only accepts the free balance (not the reserved balance since this no longer makes sense). -
Balances::transfer
becomesBalances::transfer_allow_death
orBalances::transfer_keep_alive
Find out more
Learn more about this change on the Polkadot forum or in the original PR.
Top comments (0)