Skip to main content

Deposit liquidity

Step 1: find a pool​

curl $BFX/api/v2/pools

Each pool has a ref resource id. URL-encode it in paths, for example stellar-testnet%3ACBW3...%3Apool%2F1.

Step 2: prepare the deposit​

curl -X POST "$BFX/api/v2/pools/$POOL/deposits/prepare" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "amount": "500" }'

Sign and relay the returned transaction as in Create protection. Minimum 10 USDC. External deposits require the pool to allow them (allowExternalLp).

Step 3: read your position​

curl "$BFX/api/v2/pools/$POOL/lp" -H "Authorization: Bearer $TOKEN"

Returns your free, reserved, earned, paid and pending withdrawal amounts, and your backing preferences.

Preferences​

curl -X POST "$BFX/api/v2/pools/$POOL/preferences/prepare" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "backing": true, "maxTenorDays": 30 }'

maxTenorDays: 0 means any tenor.

Withdraw​

# set aside free money
curl -X POST "$BFX/api/v2/pools/$POOL/withdrawals/prepare" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "shares": "200" }'

# list requests, then complete one
curl "$BFX/api/v2/withdrawals" -H "Authorization: Bearer $TOKEN"
curl -X POST "$BFX/api/v2/withdrawals/stellar-testnet/7/execute/prepare" \
-H "Authorization: Bearer $TOKEN"

shares is a USDC amount; the name is kept for compatibility. Requests unlock immediately.