Creating an Account and Depositing Funds
In SYMM, managing your trading capital starts with creating a dedicated sub‑account via the MultiAccount contract. These sub‑accounts allow you to interact with the SYMM system by forwarding your calls through your deployed account contract.
Step 1: Creating a Sub‑Account
Navigate to the MultiAccount Contract:
Use your preferred blockchain explorer or development tool to interact with the MultiAccount contract.
Call
addAccount()
:Call
addAccount(string name)
function, passing a name for your sub‑account.Example Call:
Check Transaction Logs:
Once the transaction is mined, look for the
AddAccount
event in the transaction logs. An AddAccount event will be emitted:
Query Your Accounts:
You can also use the view function
getAccounts(address user, uint256 start, uint256 size)
on the MultiAccount contract to retrieve an array of your sub‑accounts.Parameters:
user
: Your wallet address.start
: The starting index (for pagination).size
: The number of accounts to return.
This returns a list of Account structs that include both the sub‑account addresses and their assigned names.
Step 2: Depositing and Allocating Funds
After creating your sub‑account, the next step is to fund it. SYMM uses a two‑step process where you first deposit funds and then allocate those funds for trading.
Use the depositAndAllocateForAccount()
function on the MultiAccount contract rather than the deposit/allocate functions on the Diamond contract to deposit and allocate to a sub-account.
Call
depositAndAllocateForAccount
()
:This function deposits collateral into your sub‑account and immediately allocates it for trading.
Function Signature:
Parameters:
account
: The address of your sub‑account.amount
: The amount of collateral you wish to deposit (in the token's native decimals).
Process:
The function retrieves the collateral token address from the Symmio platform.
It then transfers the specified amount from your wallet to the MultiAccount contract.
The contract approves the Symmio contract to spend the collateral.
It calls the
depositFor(account, amount)
function on the Symmio contract.The amount is converted into 18‑decimals and passed to the
allocate(uint256)
function via an internal call.Example Call (JavaScript with web3):
Events:
On successful execution, the function emits two events:
DepositForAccount: Indicates that funds have been deposited into the sub‑account.
AllocateForAccount: Confirms that the deposited funds have been allocated for trading.
The collateral token address can be found by calling getCollateral()
on the SYMM Diamond's view facet
Last updated