Create account

Create account on Arcadia

Base
Base

Acts onchain

Opens an Arcadia Account, a smart account its owner deposits assets into and, for a Margin account, borrows against. The Factory deploys the account and mints its ERC-721 to the sender, who owns it; createAccount returns the account. A Spot account takes any token or liquidity position and borrows nothing. A Margin account is opened against one lending pool, which is its creditor: it takes only the assets Arcadia's Registry prices and the pool accepts, borrows that pool's asset against them, and refuses any withdrawal that would leave it unhealthy. The account's address comes from CREATE2 over a salt read when the creation runs, the low bits of the sender's address's hash plus the Factory's count of every account it has deployed mixed with the parent block's hash, joined to the low 32 bits of the transaction's origin. The count only grows, so an account the sender made and handed away never gives its salt back, and nobody can take the salt ahead of the creation: deploying an account to occupy it moves the count the creation reads. A collision with an account already deployed reverts and touches no account, and the next block's hash moves the salt for the next attempt. Standing as a program's only write, the wallet sends it itself and owns the account; composed with other writes it runs in the Plug account's program, which then owns the account and works it in every later program. Reach for it to open an account and deposit into it in the same run, coiling the account into the deposit, the borrow, or a stored record of the account.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

Open an Arcadia Margin Account With 100 USDC

arcadia
2actions
  1. 1·Create account

    Step one opens a new Arcadia margin account under the Margin USDC contract, creating the smart account that will hold deposits and serve as the borrowing base.

  2. 2·Deposit

    Next, 100 of USDC is deposited into the account created in step one, wired from slot 0.1 so the deposit lands in the account just opened rather than a fixed address.

Create an Arcadia account
Deposit into
  • Open an Arcadia Margin Account With 100 USDC

    arcadia

More on Arcadia · 7