Open mkurnikov opened 1 year ago
So to clarify the request is to allow Mint and Burn outside the confines of the CoinStore
similar to the last line of mint / burn, but without interacting with a CoinStore.
I can see the use case for the Burn, but likely for minting, it may be more intentional to always store it in the CoinStore
which is the storage location for managed coins, unless it is to support other coin stores.
I assume the original intention of the managed_coin.move
was to support easier token creation, mint/burn are supposed to be called as a transaction runs, that's why they're entry
.
My use-case for the module is tests, next call after mint_coins
would be to put this coin resource object into some module-level function.
Yes, I would like to have the same mint
function, but without coin::deposit
in the end, just
let coins_minted = coin::mint(amount, &capabilities.mint_cap);
coins_minted
Now I need to write this function
fun mint_coins<CoinType>(admin: &signer, amount: u64): Coin<CoinType> {
let admin_addr = signer::address_of(admin);
if (!coin::is_account_registered<CoinType>(admin_addr)) {
coin::register<CoinType>(admin);
};
managed_coin::mint<CoinType>(admin, admin_addr, amount);
coin::withdraw<CoinType>(admin, amount)
}
which is really sub-optimal.
This issue is stale because it has been open 45 days with no activity. Remove the stale
label or comment - otherwise this will be closed in 15 days.
This issue is stale because it has been open 45 days with no activity. Remove the stale
label or comment - otherwise this will be closed in 15 days.
🚀 Feature Request
Add
to the
aptos_framework::managed_coin
module.Motivation
Is your feature request related to a problem? Please describe.
Aptos has a nice
managed_coin.move
that removes a need to re-implement theCoinCapabilities
resource in every single package for tests. It would be nice to have module-level mint and burn functions to be able to work with theCoin<CoinType>
resource, not with coin balances.APT-4