Reference
Contracts
Biloa has two contracts on Elysium. Neither has an owner, an upgrade path or a pause switch, and both are verified on the Elysium explorer.
Addresses
Elysium mainnet, chain ID 99901. The SDK exports these as MAINNET.
| Contract | Address |
|---|---|
| BiloaLock | 0xB0cE75b7485674dA15f331247CBb388529638Fa2 |
| BiloaRegistry | 0x34e1a121f8a9FbfBCb0516E580dd76aC6c46e1dA |
| USDC (Circle) | 0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65 |
The deploy transactions and constructor values are in deployments/elysium-mainnet.json.
BiloaLock
BiloaLock holds the Elysium side of every swap. A lock pays its payee when someone presents the secret behind its point before the deadline, and returns to its payer after the deadline.
Fixed parameters
| Parameter | Value |
|---|---|
FEE_BPS |
3, taken from each claim’s payout |
MAX_WINDOW |
1 hour, the latest deadline a lock can set |
MIN_CLAIM_WINDOW |
2 minutes, the least a signed lock leaves its payee to claim |
maxUsdc |
1,000 USDC per lock |
maxHype |
15 HYPE per lock |
feeRecipient |
0xCd270Fc54539265414E11E34137ec7F51AA1Cd94 |
The fee is a constant in the code. The caps and the fee recipient were set at deploy and cannot change.
Functions
| Function | What it does |
|---|---|
lock(payee, token, amount, point, deadline, payeeSig) |
Locks USDC, or HYPE as address(0), for payee under point until deadline. payeeSig is empty or the payee’s EIP-712 signature of the terms. Returns the lock’s id. |
claim(id, secret) |
Pays the payee, minus the fee, and publishes the secret. Anyone may call it before the deadline. |
refund(id) |
Returns the full amount to the payer once the deadline has passed. Anyone may call it. |
sendFees(token) |
Sends the fees collected in token to the fee recipient. Anyone may call it. |
hashTerms(payer, token, amount, point, deadline) |
The EIP-712 digest a payee signs for a lock. |
pointOf(secret) |
The address of a secret’s point, as locks store it. |
locks(id) |
A lock’s payer, deadline, state, signed flag, payee, token, amount and point. |
records(payee) |
A payee’s signed locks: claimed, expired, and the deadline of the latest expired one. |
fees(token) |
Fees collected in token and not sent yet. |
usdc() |
The USDC address the lock accepts. |
A lock’s id is the hash of its payer, payee, token, amount, point and deadline. A payee cannot sign a lock to itself, so it cannot add to its own record that way.
Events
event Locked(bytes32 indexed id, address indexed payer, address indexed payee,
address token, uint256 amount, address point, uint256 deadline, bool signed);
event Claimed(bytes32 indexed id, uint256 secret, uint256 fee);
event Refunded(bytes32 indexed id);
event FeesSent(address indexed token, uint256 amount);
BiloaRegistry
BiloaRegistry is the public list of LP agents and their quote endpoints for one BiloaLock. It holds no funds and has no owner. Each LP manages only its own entry.
| Function | What it does |
|---|---|
register(endpoint) |
Adds the caller, or replaces its endpoint. The endpoint is 1 to MAX_ENDPOINT (256) bytes. |
unregister() |
Removes the caller. |
count() |
The number of listed LPs. |
list(start, limit) |
Up to limit LPs from index start, with their endpoints. |
endpointOf(lp) |
An LP’s endpoint. |
lock() |
The BiloaLock this registry belongs to. |
event Registered(address indexed lp, string endpoint);
event Unregistered(address indexed lp);
Takers rank LPs by their record in BiloaLock, not by this list, and check that the list belongs to the lock they use.