Skip to content

Celo ​

Celo carries USDC and USDT through the exchange's own contract, AgriEscrow. The exchange's warehouse receipts already live on Celo; this contract handles the money beside them.

Being released

The money rails described here are built and tested, and are being rolled out. Until a rail is switched on for the exchange, invoices are paid by bank transfer or mobile money and recorded by Finance, as today.

Network

The exchange uses the Celo Sepolia test network, with test USDC and USDT, until it is switched to the main network.

Paying in is a contract call ​

On Celo a payment is not a plain transfer with a memo. A plain transfer of the coin cannot be matched to anything. The payer's wallet makes two calls:

  1. approve on the coin, letting AgriEscrow take the amount;
  2. then one of:
    • pay(ref, token, amount) for an invoice. The coin goes to the exchange's treasury, and the contract records the invoice id as the reference.
    • fund(ref, token, amount, beneficiary) for an escrow. The coin stays in the contract, held for the beneficiary.

The public invoice page and the escrow's funding instructions show the contract, the coin, the call and the amount, and a Pay with wallet button that does both calls from the payer's own browser wallet (MetaMask, Valora or any wallet that works in the browser). It switches the wallet to the right network first. The exchange never sees the payer's key.

Amounts are in the coin's six decimal places: 1.00 USDT is 1000000.

The exchange reads the contract's events within seconds and applies the payment, or keeps it as not applied with the reason (no invoice by that reference, the wrong coin, an escrow funded for the wrong amount or the wrong beneficiary).

Escrow on the contract ​

The contract holds an escrow until two different approver keys agree:

CallEffect
approveRelease(ref)The second approval, from a different approver key, pays the escrow to its beneficiary
approveRefund(ref)The second approval refunds the escrow to whoever funded it

On the exchange, each Finance approval is one of those calls, from its own key. The first approval is recorded on the chain; the contract moves the money on the second. If the network does not answer the first, the second approval makes the first call again before its own.

An escrow can be funded for:

  • the exchange, as holder of record (the treasury is the beneficiary);
  • or a named party, who then needs a Celo (0x…) wallet on their record in the registry. The exchange refuses to open a Celo escrow for a party without one (no_wallet).

Paying out ​

On Celo, only escrow moves today. Payouts, freight and advances go on Stellar or mobile money.

AgriTrade Exchange