LighterCodec
Builds Lighter commands that move no money to a chosen receiver. It holds nothing and has no permission. Deposits and the collection of finished withdrawals are not here: the vault builds them itself with its own address as the receiver. It runs behind a UUPS proxy.
Deployer
initialize
function initialize() external;
Once, through the proxy, in the transaction that deploys it.
Read
market
function market() external view returns (IGedhoMarket);
Market whose orders it builds.
| Returns | Type |
|---|---|
- | IGedhoMarket |
target
function target() external view returns (address);
Contract that receives the commands.
| Returns | Type |
|---|---|
- | address |
closeShort
function closeShort(
uint48 accountIndex,
uint256 size,
uint256 maxPrice
) external view returns (bytes memory);
Market order that can only reduce the short. Lighter refuses it when size times price is above the quote limit of the market.
| Parameter | Type | Description |
|---|---|---|
accountIndex | uint48 | |
size | uint256 | In the decimals of the asset, a multiple of the lot. Zero means the whole short. |
maxPrice | uint256 | Worst price with 8 decimals, rounded up to the Lighter price step. |
| Returns | Type |
|---|---|
- | bytes |
cancelAllOrders
function cancelAllOrders(
uint48 accountIndex
) external view returns (bytes memory);
| Parameter | Type |
|---|---|
accountIndex | uint48 |
| Returns | Type |
|---|---|
- | bytes |
withdraw
function withdraw(
uint48 accountIndex,
uint256 amount
) external view returns (bytes memory);
Withdrawal to the owner of the account, which is the vault.
| Parameter | Type | Description |
|---|---|---|
accountIndex | uint48 | |
amount | uint256 | USDG with 6 decimals. |
| Returns | Type |
|---|---|
- | bytes |
setApiKey
function setApiKey(
uint48 accountIndex,
uint8 slot,
bytes calldata publicKey
) external view returns (bytes memory);
Installs an API key.
| Parameter | Type |
|---|---|
accountIndex | uint48 |
slot | uint8 |
publicKey | bytes |
| Returns | Type |
|---|---|
- | bytes |
removeApiKey
function removeApiKey(
uint48 accountIndex,
uint8 slot
) external view returns (bytes memory);
Replaces an API key by a key that nobody owns.
| Parameter | Type |
|---|---|
accountIndex | uint48 |
slot | uint8 |
| Returns | Type |
|---|---|
- | bytes |
Errors
ValueOutOfRange
error ValueOutOfRange();
The size, price or key does not fit the Lighter format.