User accounts are stored only on the IDS in this map and all accounts operations could be found in this module. There is no concept of accounts for EDS and there are no actions performed by an account on EDS. The only action a user performs directly on EDS is the deposit but this does not create a user account on EDS, just records the entry of a deposit in deposits table which is later removed once the deposit is processed by IDS.

A bluefin Pro account is created off-chain in margining engine (ME) when a user deposits funds/assets to the EDS and its AssetBankDeposit event is received by the ME.

   // asset bank deposit event
   struct AssetBankDeposit has copy, drop {
        eds_id: ID,
        asset:String,
        from: address,
        to: address,
        amount: u64,
        nonce: u128,
        sequence_number: u128
    }

Once a request from ME is sent to sequencer to perform deposit to the internal bank or IDS only then an account is added to the table of accounts in the IDS.

The structure below shows the state of account stored on-chain:

    /// For storing an account's information in the system
    struct Account has store {
        // Address of the Account. This is the owner of the account.
        address: address,

        // Addresses of users/wallets that are authorized to perform
        // actions on the account's behalf ( everything excluding withdrawal)
        authorized: vector<address>,

        // the list of assets currently collateralizing the user cross position.
        assets: vector<DepositedAsset>,

        // list of cross positions the account has
        cross_positions: vector<Position>,
        
        // list of isolated positions
        isolated_positions: vector<Position>,
        
        // trading fees to be applied on the user
        trading_fees: TradeFee,

        is_institution: bool,
    
        // symbol of the asset to be used for payment of trade fees
        fee_asset: String       
    }

<aside> 💡

The protocol allows a user to have both a cross and isolated position at the same time for same market. Both these positions are treated completely differently.

</aside>