Exchange eccUSDC for SHELL via Accumulator
This guide explains how to exchange eccUSDC for SHELL by sending an internal message from a user wallet to the Accumulator contract.
Prerequisites
A deployed
UpdateCustodianMultisigWallet_v2wallet; the Acki Nacki Wallet app cannot submit this raw contract transaction. To deploy one: How to deploy a Multisig WalletThe wallet's full
<WALLET_DAPP_ID>::<WALLET_ACCOUNT_ID>address and the keys file required to sign transactionsThe
UpdateCustodianMultisigWallet_v2.abi.jsonABI file available locallyAt least
1 eccUSDC(ECC currency ID3); only whole eccUSDC amounts can be exchangedMore than
0.1 VMSHELLin the wallet to cover the message value and transaction fees
Summary
To perform the exchange, send the following to the Accumulator address:
eccUSDC as an ECC currency with ID
3;0.1 VMSHELL(100000000base units) to execute the message;an empty
payload.
The purchased SHELL will be sent back to the address of the contract from which the Accumulator received the message.
The current Accumulator address is:
This is the legacy address format that must be used in ABI fields such as dest, buyer, recipient, and other message parameters.
In tvm-cli 3.x commands where the address is the target of the command itself (--addr, account, runx, or callx), Mainnet/Shellnet requires the full dapp_id::account_id format. The full CLI address of the Accumulator is:
Exchange Rate and Base Units
The exchange rate is fixed:
Message amounts are specified in base units:
1 eccUSDC = 1,000,000eccUSDC units;1 SHELL = 1,000,000,000SHELL units.
The Accumulator accepts only whole USDC amounts. The eccUSDC amount must be greater than zero and divisible by 1,000,000.
Sent
Value in cc["3"]
Received
1 eccUSDC
1000000
100 SHELL
10 eccUSDC
10000000
1,000 SHELL
100 eccUSDC
100000000
10,000 SHELL
Use this formula when preparing the message:
Before You Exchange
Do not send eccUSDC together with other ECC currencies in the same message. The Accumulator rejects messages containing multiple currencies.
Message Parameters
Use these parameters to purchase SHELL for 1 USDC:
dest
Accumulator address
Contract that performs the exchange
value
100000000
0.1 VMSHELL for executing the internal message
cc
{"3":"1000000"}
1 eccUSDC in base units
bounce
true
Returns the message to the sender if execution fails
flags
0
Deducts the forwarding fee from the specified value
payload
Empty string
Invokes the Accumulator's receive() handler
Some wallets may name the ECC currency field ecc or currencies instead of cc. The meaning is the same: key 3 is the eccUSDC identifier, and its value is the amount in base units.
Send from an UpdateCustodianMultisigWallet_v2 Multisig
For a wallet with one custodian, call the sendTransaction method.
The following Shellnet example exchanges 1 USDC:
The dapp_id field in this wallet version is used for transfer reporting. The Accumulator DApp ID is 1.
Do not use the legacy 0:<WALLET_ACCOUNT_ID> address in the --addr parameter. The current tvm-cli accepts only the full <WALLET_DAPP_ID>::<WALLET_ACCOUNT_ID> format here. The dest value inside the JSON must remain in the legacy 0:3535... format.
If the wallet has multiple custodians, use submitTransaction with the same parameters instead of sendTransaction, and then collect the required number of confirmations through the wallet's usual process.
Do not use outdated multisig versions.
Receive SHELL at Another Address
With an empty payload, the SHELL recipient is msg.sender. If a multisig contract sends the message, the SHELL is credited to that multisig contract's balance.
To send the purchased SHELL to another address, call the following Accumulator method:
First, generate the ABI-encoded call body:
Pass the resulting Message value in the transaction's payload field instead of an empty string. The message must still include eccUSDC with ID 3 and 0.1 VMSHELL for execution.
Example wallet parameters:
The buyer address determines the SHELL recipient. In this case, the SHELL is not returned to the sender.
Verify the Result
The event contains:
buyer: the SHELL recipient address;usdcAmount: the amount of eccUSDC received;shellFromSellers: SHELL obtained from existing seller orders;shellMinted: additional SHELL minted by the system.
The source of the SHELL does not change the result for the user: shellFromSellers + shellMinted is sent to the recipient in a single transaction.
How the queues, lots and payouts work: Accumulator contract system.
Check the wallet balance with:
In the ecc_balance field:
key
3contains the eccUSDC balance in micro-USDC;key
2contains the SHELL balance in nanoSHELL.
After exchanging 1 USDC, the balance under key 3 should decrease by 1000000, and the balance under key 2 should increase by 100000000000.
Common Errors
Important
Before sending a large amount, perform a test exchange of 1 USDC and confirm that the SHELL arrived at the expected address. Blockchain transactions are irreversible.
Last updated