API Reference

Deposit USDB from a Blast account to rysk account.

To deposit funds into a subaccount to be used as collateral for margin you must deposit funds on-chain following the process below. Right now the deposit contract only accepts USDB as a deposit asset. This process can either be done via the rysk UI or can be done programmatically in whatever language you choose.

Deposit process:

  1. Make sure the address you are depositing with has sufficient ETH on the host chain.

This is the programmatic process, if you are not familiar with on-chain interactions via RPC we recommend depositing manually via the rysk UI.

  1. Approve a value of USDC for spending on Ciao (spender) on the USDB ERC20 contract, this is a compulsory step to allow the Ciao contract to receive funds via the deposit function.

function approve(address spender, uint256 value) external returns (bool);

  1. Depositing funds to the rysk protocol is done by calling the deposit function on the Ciao contract, currently the only asset supported is USDC. Each user account can have 256 sub accounts, which are represented by the subAccountId, these are discrete margin accounts, so a deposit quantity to one subaccount will have no impact to the margin of another subaccount.
    /// @notice Deposit new assets into margin account represented as a subaccount
    /// @dev Requires approval from `msg.sender`
    /// @param account the account to take funds from for the deposit
    /// @param subAccountId the sub account to be used for the deposit
    /// @param quantity quantity of the asset to deposit
    /// @param asset address representing the product being deposited
    function deposit(
        address account,
        uint8 subAccountId,
        uint256 quantity,
        address asset
    )
  1. The funds will appear in your margin account in under 10 seconds.

ABI

[{"inputs":[],"name":"BalanceInsufficient","type":"error"},{"inputs":[],"name":"DepositQuantityInvalid","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ProductInvalid","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"SenderInvalid","type":"error"},{"inputs":[],"name":"WithdrawQuantityInvalid","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"subAccount","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"int256","name":"balanceBefore","type":"int256"},{"indexed":false,"internalType":"int256","name":"balanceAfter","type":"int256"}],"name":"BalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"blastGasRecipient","type":"address"}],"name":"BlastGasRecipientChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BlastYieldClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"blastYieldRecipient","type":"address"}],"name":"BlastYieldRecipientChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint8","name":"subAccountId","type":"uint8"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint8","name":"subAccountId","type":"uint8"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ExecuteWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeRecipient","type":"address"}],"name":"FeeRecipientChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"insurance","type":"address"}],"name":"InsuranceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"minDepositAmount","type":"uint256"}],"name":"MinDepositAmountChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint8","name":"subAccountId","type":"uint8"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"RequestWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"requiresDispatchCall","type":"bool"}],"name":"RequiresDispatchCallSet","type":"event"},{"inputs":[],"name":"BLAST","outputs":[{"internalType":"contract IBlast","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addressManifest","outputs":[{"internalType":"contract IAddressManifest","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"subAccount","type":"address"},{"internalType":"uint256","name":"_i","type":"uint256"}],"name":"assetAtIndexInSubAccountAssetSet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blastGasRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blastYieldRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claimBlastYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimGasRebate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newGovernor","type":"address"}],"name":"configureBlastGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"configureNewBlastYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"coreCollateralAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"coreCollateralDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint8","name":"subAccountId","type":"uint8"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"address","name":"asset","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint8","name":"subAccountId","type":"uint8"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"address","name":"asset","type":"address"}],"name":"executeWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"subAccount","type":"address"}],"name":"getSubAccountAssets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"incrementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addressManifest","type":"address"},{"internalType":"address","name":"_coreCollateralAddress","type":"address"},{"internalType":"address","name":"_feeRecipient","type":"address"},{"internalType":"address","name":"_insurance","type":"address"},{"internalType":"address","name":"_usdbRebateAddress","type":"address"},{"internalType":"address","name":"_wethRebateAddress","type":"address"},{"internalType":"address","name":"_blastAddress","type":"address"},{"internalType":"address","name":"_blastPointsAddress","type":"address"},{"internalType":"address","name":"_blastPointsOperator","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insurance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"subAccount","type":"address"},{"internalType":"address","name":"_a","type":"address"}],"name":"isAssetInSubAccountAssetSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"subAccountId","type":"uint8"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"address","name":"asset","type":"address"}],"name":"requestWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requiresDispatchCall","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"setBlastGasRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"setBlastYieldRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_insurance","type":"address"}],"name":"setInsurance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_minDepositAmount","type":"uint256"}],"name":"setMinDepositAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_requiresDispatchCall","type":"bool"}],"name":"setRequiresDispatchCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"subAccount","type":"address"},{"internalType":"int256","name":"coreCollateralQuantity","type":"int256"}],"name":"settleCoreCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"subAccount","type":"address"}],"name":"subAccountAssetSetLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"takerSubAccount","type":"address"},{"internalType":"address","name":"makerSubAccount","type":"address"},{"internalType":"uint256","name":"baseQuantity","type":"uint256"},{"internalType":"uint256","name":"quoteQuantity","type":"uint256"},{"internalType":"uint32","name":"productId","type":"uint32"},{"internalType":"bool","name":"isTakerBuy","type":"bool"},{"internalType":"uint256","name":"takerFee","type":"uint256"},{"internalType":"uint256","name":"makerFee","type":"uint256"},{"internalType":"uint256","name":"sequencerFee","type":"uint256"}],"name":"updateBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"withdrawalReceipts","outputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"requestTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"}]

https://arbiscan.io/address/0xD8eB81D7D31b420b435Cb3C61a8B4E7805e12Eff