Skip to content

Refactor native_account::remove_asset to return the remaining balance #2524

@PhilippGackstatter

Description

@PhilippGackstatter

As motivated in #2523, we should avoid returning outputs identical to inputs in kernel procedures. After #2437, native_account::remove_asset currently takes and returns ASSET_VALUE. Instead of removing the return value, we can make it more useful by making it analogous to native_account::add_asset. It returns the asset after it was merged into the account's vault, which is useful to check the balance after addition without an additional kernel call. Similarly, remove_asset should return the asset remaining in the vault after the provided value was removed.

So this could be:

#! Inputs:  [ASSET_KEY, ASSET_VALUE]
#! Outputs: [REMAINING_ASSET_VALUE]

Metadata

Metadata

Labels

good first issueGood for newcomerskernelsRelated to transaction, batch, or block kernels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions