Skip to main content
POST
Create a deposit
Opens a trading account under the MarginEngine and funds it, or tops up an existing account, with one signed Action. The venue pays the gas. One account trades both cNGN-USDC spot and the cNGN futures.
EIP-7702 wallets: Matching treats an EOA with a 7702 delegation as a contract wallet. The deposit is refused with OV_InvalidSignature unless the delegate implements ERC-1271’s isValidSignature. Use an undelegated EOA or an ERC-1271 wallet. The same applies to orders and withdrawals.

Before your first deposit

From the wallet that will own the account, approve the DepositModule for at least the deposit amount:
USDC on Base is 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913. cNGN is 0x46C85152bFe9f96829aA94755D9f915F9B10EF5F.

Or sign a permit instead

USDC only. cNGN has no permit, and a cNGN deposit carrying one is refused with 400. Sign an EIP-2612 Permit with USDC’s domain (name USD Coin, version 2, chain 8453), spender set to the DepositModule, a value of at least the deposit, and your current USDC nonce. Send it with the action:
The permit is skipped if your allowance already covers the deposit. A permit USDC refuses returns 400.

Signing the action

Sign an Action against the Matching domain: asset must be one of:
  • amount uses the token’s 6 decimals: 1000000000 is 1,000. type(uint256).max is refused.
  • managerForNewAccount is the MarginEngine, 0x0705219a1594d5Fc5dC2573da4082cAf3e1B0950. It is ignored on a top-up, so send the same address or zero.
cNGN counts toward margin at a 50% factor and shares one cap. A deposit over the cap returns 400 with the room left. Send the fields as strings, with data as hex:

Errors

The outcome

Use subaccount_id on your orders. amount_usdc and credited_cash_e18 appear on USDC deposits only. permit_tx_hash appears when a permit was used.

Checking a deposit

Read the record with GET /deposits/{action_hash}. action_hash is the EIP-712 hash of your signed action.
After a timeout or 502, look up the deposit or resend the same signed request, which never submits twice. Do not sign a new one: a second signed deposit is a second deposit.

Body

application/json
action
object
required

A Matching Action for the DepositModule, signed with EIP-712 against the Matching domain.

signature
string
required

EIP-712 signature by signer: 65 bytes, or longer for an ERC-1271 wallet.

permit
object

Optional EIP-2612 permit instead of an approve. USDC only.

Response

Submitted. receipt_status timeout means broadcast but not yet confirmed; resubmit the same request for the outcome.

accepted
boolean
required

True once mined successfully.

tx_hash
string
required
asset
string
required

The wrapped asset credited: the cash asset (USDC) or the cNGN escrow.

asset_symbol
enum<string>
required
Available options:
USDC,
cNGN
amount
string
required

The deposit in the token, with 6 decimal places.

amount_units
string
required

The same amount in the token's 6-decimal base units, as signed.

credited_e18
string
required

What the account's balance of the asset rises by, at the ledger's 18 decimals.

action_hash
string

EIP-712 hash of the signed action (Matching.getActionHash); the key for GET /deposits/{action_hash}.

status
enum<string>
Available options:
pending,
submitted,
confirmed,
reverted,
rejected,
unknown
receipt_status
enum<string>

timeout: broadcast, not yet confirmed.

Available options:
success,
reverted,
timeout
block_number
string
subaccount_id
string

The account credited: your new account when subaccount_id was 0. Absent until the receipt is known.

amount_usdc
string

Same as amount; USDC deposits only.

credited_cash_e18
string

Same as credited_e18; USDC deposits only.

permit_tx_hash
string

The permit's transaction, when the deposit carried a permit and it was needed.