In my previous post, I showed you how to send payment using Soroban Python SDK. In this post, we'll use Soroban Python SDK to deploy a wrapped token contract.
Preparation
First, create a Futurenet account, this account will be used to deploy and act as an admin of the token contract. Create account at Stellar Laboratory and make sure to fund them. The account that i will be using :
Public Key GATQFKA7BV7LYYE6UJ2LRL56W3BZRRSWTINA6TG2EM5CCDORFIERAKWV
Secret Key SCHKLGAGY7QGWUKUFDGHEQMSCPFZNMLEHQE6Y6WPGYGHQIM23T3NJE3C
Then, the python script that we're going to use is soroban_deploy_create_wrapped_token_contract.py
from Soroban Python SDK Examples Github Repository. These examples written by overcat, the maintainer of Soroban Python SDK.
Deploying the Wrapped Token Contract
To deploy the contract, open the soroban_deploy_create_wrapped_token_contract.py
file and you can adjust some of following parameters:
secret = "SCHKLGAGY7QGWUKUFDGHEQMSCPFZNMLEHQE6Y6WPGYGHQIM23T3NJE3C"
rpc_server_url = "https://horizon-futurenet.stellar.cash:443/soroban/rpc"
network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
hello_asset = Asset("HELLO", "GATQFKA7BV7LYYE6UJ2LRL56W3BZRRSWTINA6TG2EM5CCDORFIERAKWV")
secret
- Secret key for deploying contract
rpc_server_url
- RPC Server URL used to deploy the contract
network_passphrase
- Futurenet Network Passphrase
hello_asset
- Symbol of the asset and Account Public Key for Asset Issuer(admin)
Save the soroban_deploy_create_wrapped_token_contract.py
file with your changes and then run the script in a command prompt using this command :
python soroban_deploy_create_wrapped_token_contract.py
Result :
$ python soroban_deploy_create_wrapped_token_contract.py
simulated transaction: error=None results=[SimulateTransactionResult(auth=None, footprint='AAAAAAAAAAMAAAAGrAPyVAexHS7Lfq1Dh8TlMLNLMSrdfI/FPXD9Brh90u8AAAADAAAAAwAAAAasA/JUB7EdLst+rUOHxOUws0sxKt18j8U9cP0GuH3S7wAAAAQAAAABAAAAAAAAAAEAAAAFAAAABUFkbWluAAAAAAAABqwD8lQHsR0uy36tQ4fE5TCzSzEq3XyPxT1w/Qa4fdLvAAAABAAAAAEAAAAAAAAAAQAAAAUAAAAITWV0YWRhdGE=', xdr='AAAABAAAAAEAAAAGAAAAIKwD8lQHsR0uy36tQ4fE5TCzSzEq3XyPxT1w/Qa4fdLv')] cost=SimulateTransactionCost(cpu_insns=110198, mem_bytes=6463) latest_ledger=572498
setting footprint and signing transaction...
sent transaction: id='eaf6b55ae79ae6202aaff6eecbd9f69b017608ff73a719c89e8929def19ddddd' status=<TransactionStatus.PENDING: 'pending'> error=None
waiting for transaction to be confirmed...
waiting for transaction to be confirmed...
waiting for transaction to be confirmed...
transaction status: id='eaf6b55ae79ae6202aaff6eecbd9f69b017608ff73a719c89e8929def19ddddd' status=<TransactionStatus.SUCCESS: 'success'> envelope_xdr='AAAAAgAAAABtb05lTpeOTUrHyRo/keRPQ+/Rp4LYwgi2VXWHWl4XYAAAAGQACLppAAAABQAAAAEAAAAAAAAAAAAAAABkHHKJAAAAAAAAAAEAAAABAAAAAG1vTmVOl45NSsfJGj+R5E9D79GngtjCCLZVdYdaXhdgAAAAGAAAAAEAAAACAAAAAkhFTExPAAAAAAAAAAAAAABtb05lTpeOTUrHyRo/keRPQ+/Rp4LYwgi2VXWHWl4XYAAAAAEAAAAAAAAAAwAAAAasA/JUB7EdLst+rUOHxOUws0sxKt18j8U9cP0GuH3S7wAAAAMAAAADAAAABqwD8lQHsR0uy36tQ4fE5TCzSzEq3XyPxT1w/Qa4fdLvAAAABAAAAAEAAAAAAAAAAQAAAAUAAAAFQWRtaW4AAAAAAAAGrAPyVAexHS7Lfq1Dh8TlMLNLMSrdfI/FPXD9Brh90u8AAAAEAAAAAQAAAAAAAAABAAAABQAAAAhNZXRhZGF0YQAAAAAAAAAAAAAAAVpeF2AAAABAdx8pRxv6iGWD0ma0uuFV3oKebeDuaC7j80frOO7vKDwP49aWa2sFKVJ2fjph3Xj52lgSs/mNycYXJeSI8OSAAQ==' result_xdr='AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAYAAAAAAAAAAQAAAABAAAABgAAACCsA/J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dgAAAAAAAAAAAAAAABAAAAAAAAAAAAAABkAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAAEAAAAAQAAAAYAAAAgrAPyVAexHS7Lfq1Dh8TlMLNLMSrdfI/FPXD9Brh90u8AAAAA02fs2dDFBdR8GlynM9VeTwbQ7ckYHpu6eEGF9i75+6LLvEh1Deu4U1CTs96viKx/TP+HQlV2pY3iusdUrNtGFiH5L17VhmgoiSxLNEvY5WWYvlN1y13OW61N4hIpVn6q' results=[SCVal(xdr='AAAABAAAAAEAAAAGAAAAIKwD8lQHsR0uy36tQ4fE5TCzSzEq3XyPxT1w/Qa4fdLv')] error=None
contract id: ac03f25407b11d2ecb7ead4387c4e530b34b312add7c8fc53d70fd06b87dd2ef
From the result above we get a contract id of our deployed token contract which is ac03f25407b11d2ecb7ead4387c4e530b34b312add7c8fc53d70fd06b87dd2ef
.
From the contract id, admin can do various token operation such as mint, burn, set admin, and more. For more information of token operations, you can check here.
Now, we will check symbol
of our token-wrapped contract using the Soroban CLI. We will use this command :
$ soroban contract invoke --id ac03f25407b11d2ecb7ead4387c4e530b34b312add7c8fc53d70fd06b87dd2ef --secret-key SAM7O4V6QBSBQPM64IWSTCUOGN34QK6VI4RGWZERNE2OBXHVRCH2VU2V --fn symbol
success
"48454c4c4f"
From the returned value, we get 48454c4c4f
, is in hex. When converted to a string, it becomes "HELLO".
Closing
In this blog post, we have gone over the steps to Deploy a Wrapped Token Contract using Soroban Python SDK. You can try to deploy your own token, and try other token operation such as mint, burn, and more using Soroban-CLI.
Top comments (0)