MultiAccount
The MultiAccount contract is a critical component of the SYMM architecture that enables users to create dedicated sub‑accounts.
MultiAccounts are contracts typically deployed by frontends that are whitelisted by hedgers. They enable users to create sub-accounts to trade with.
These sub‑accounts are smart contracts deployed via the MultiAccount contract. By default, all positions within an account are considered for liquidation, each account is in CROSS. By using sub‑accounts, users can isolate risk by using separate sub‑accounts.
Deploying a MultiAccount
Frontends must deploy a MultiAccount and get whitelisted by SYMM. If you're a frontend looking to deploy a MultiAccount, please refer to this guide.
MultiAccount Flow
How It Works:
Account Creation: Your wallet calls the MultiAccount contract and specifies which sub‑account to use for executing functions. When you create a sub‑account using
addAccount()
, a new contract is deployed using the current account implementation and linked to your wallet as the owner.Forwarding Calls: When you call the
_call()
function on MultiAccount, the call is forwarded to your sub‑account, which in turn sends the call to the SYMM Diamond. Since the Diamond’s logic operates based on themsg.sender
, actions must originate from the sub‑account to correctly update storage and state.Parameter Encoding: All function calls are encoded using the SYMM Diamond’s ABI. This means you must encode the parameters for the desired function using the ABI, and pass that data to the
_call()
method. For example:const encodedSendQuoteWithAffiliateData = web3.eth.abi.encodeFunctionCall(sendQuoteWithAffiliateFunctionAbi, sendQuoteParameters); const _callData = [ subAccountAddress, [ encodedSendQuoteData ] ]; const sendQuoteWithAffiliateReceipt = await multiAccountContract.methods._call(..._callData).send({ from: account.address, gas: adjustedGasLimit.toString(), gasPrice: sendQuotePrice.toString() });
Last updated