7 : Mint from a wrapped token in Soroban.
Last updated
Last updated
Check this guide in
Edit this guide in it's repo:
Contribute to this guide in the of the repo
In the previous chapters we have already:
Issued a (classic) Stellar Assets in the (classic) Stellar blockchain.
Wrapped this asset into a SAC (Stellar Asset Contract) token into Soroban
In this chapter we will mint some units of this SAC token inside the Soroban chain, so this token can be used by smart contracts!
Configure your soroban-cli to use the token-admin
identity
Check last chapter if you don't know what this means.
From last chapter, you'll need to have your SAC's id, that can be something like this:
As when issuing an asset in Stellar Classic, in order to mint a token in Soroban, you need to send units of this token to some receiver, hence we will set a receiver address:
If you are following our code, and you are using the settings.json
file, you can do
In order to mint, we will use the soroban invoke
command in the soroban-cli
in order to invoke a function inside the SAC contract.
The transfer function in a SAC contract is the xfer function and receives 3 arguments:
from
to
amount
Here is a piece of code of the SAC contract
If we invoke the xfer function from the issuer we will actually mint some units of the token, hence, we will do:
Here, src/contracts/token/soroban_token_spec.wasm
is the path of token wasm file. We provide you the one used when wrapping the token.
How can we know if we in fact minted the token?
In fact, when we wrap the token, both balances of the token Soroban/Classic are shared. Hence, if we ask Stellar Classic it yould say that there are not 5 units anymore, but 10.
And if we ask to the SAC token, it should say the same.
In chapter 5 we took information about the Stellar Asset in the classic Stellar. Let's ask Stellar Classic (check chapter 5!)
The answer:
We have now 10 units of the token! We managed to suscesfully mint a wrapped asset in Soroban!
You can run it by:
In this chapter we minted units in Soroban, but we checked the total balance in Classic. In the next chapter we will use the SAC contract to get information about the token in Soroban. We should get the same information than in classic. Why? Because balances are shared!
Are you ready?
If you followed our , you should have this id inside the .soroban/token_id
file
If you want to learn more about the SAC code in the
If you want to use our code in the , you can just call our script with the soroban-preview-7
docker containter
Check all the code of our mint_with_just_token_id.sh
script
This Playground has been developed by in collaboration with from