Signing
All executes are signed using EIP712. Each execute request contains:
A piece of structured data that includes the sender address i.e: the
primaryType
that needs to be signed.A signature of the hash of that structured data, signed by the sender.
Domain
The following is the domain required as part of the EIP712 structure:
{
name: 'Vertex',
version: '0.0.1',
chainId: chainId,
verifyingContract: contractAddress
}
You can retrieve the corresponding chain id and verifying contract via the contracts query.
EIP712 Types
See below the EIP712 type for each execute:
Place Order**](#place-order)
Primary Type: Order
Solidity struct that needs to be signed:
struct Order {
bytes32 sender;
int128 priceX18;
int128 amount;
uint64 expiration;
uint64 nonce;
}
JSON representation:
{
Order: [
{ name: 'sender', type: 'bytes32' },
{ name: 'priceX18', type: 'int128' },
{ name: 'amount', type: 'int128' },
{ name: 'expiration', type: 'uint64' },
{ name: 'nonce', type: 'uint64' },
],
}
Cancel Orders(#cancel-orders)
Primary Type: Cancellation
Solidity struct that needs to be signed:
struct Cancellation {
bytes32 sender;
uint32[] productIds;
bytes32[] digests;
uint64 nonce;
}
JSON representation:
{
Cancellation: [
{ name: 'sender', type: 'bytes32' },
{ name: 'productIds', type: 'uint32[]' },
{ name: 'digests', type: 'bytes32[]' },
{ name: 'nonce', type: 'uint64' },
],
}
Cancel Product Orders(#cancel-product-orders)
Primary Type: CancellationProducts
Solidity struct that needs to be signed:
struct CancellationProducts {
bytes32 sender;
uint32[] productIds;
uint64 nonce;
}
JSON representation:
{
CancellationProducts: [
{ name: 'sender', type: 'bytes32' },
{ name: 'productIds', type: 'uint32[]' },
{ name: 'nonce', type: 'uint64' },
],
}
Withdraw Collateral**](#withdraw-collateral)
Primary Type: WithdrawCollateral
Solidity struct that needs to be signed:
struct WithdrawCollateral {
bytes32 sender;
uint32 productId;
uint128 amount;
uint64 nonce;
}
JSON representation:
{
WithdrawCollateral: [
{ name: 'sender', type: 'bytes32' },
{ name: 'productId', type: 'uint32' },
{ name: 'amount', type: 'uint128' },
{ name: 'nonce', type: 'uint64' },
],
}
Liquidate Subaccount(#liquidate-subaccount)
Primary Type: LiquidateSubaccount
Solidity struct that needs to be signed:
struct LiquidateSubaccount {
bytes32 sender;
bytes32 liquidatee;
uint32 productId;
bool isEncodedSpread;
int128 amount;
uint64 nonce;
}
JSON representation:
{
LiquidateSubaccount: [
{ name: 'sender', type: 'bytes32' },
{ name: 'liquidatee', type: 'bytes32' },
{ name: 'productId', type: 'uint32' },
{ name: 'isEncodedSpread', type: 'bool' },
{ name: 'amount', type: 'int128' },
{ name: 'nonce', type: 'uint64' },
],
}
[Mint LP](#mint-lp)
Primary Type: MintLp
Solidity struct that needs to be signed:
struct MintLp {
bytes32 sender;
uint32 productId;
uint128 amountBase;
uint128 quoteAmountLow;
uint128 quoteAmountHigh;
uint64 nonce;
}
JSON representation:
{
MintLp: [
{ name: 'sender', type: 'bytes32' },
{ name: 'productId', type: 'uint32' },
{ name: 'amountBase', type: 'uint128' },
{ name: 'quoteAmountLow', type: 'uint128' },
{ name: 'quoteAmountHigh', type: 'uint128' },
{ name: 'nonce', type: 'uint64' },
],
}
[Burn LP](#burn-lp)
Primary Type: BurnLp
Solidity struct that needs to be signed:
struct BurnLp {
bytes32 sender;
uint32 productId;
uint128 amount;
uint64 nonce;
}
JSON representation:
{
BurnLp: [
{ name: 'sender', type: 'bytes32' },
{ name: 'productId', type: 'uint32' },
{ name: 'amount', type: 'uint128' },
{ name: 'nonce', type: 'uint64' },
],
}
[Link Signer](#link-signer)
Primary Type: LinkSigner
Solidity struct that needs to be signed:
struct LinkSigner {
bytes32 sender;
bytes32 signer;
uint64 nonce;
}
JSON representation:
{
LinkSigner: [
{ name: 'sender', type: 'bytes32' },
{ name: 'signer', type: 'bytes32' },
{ name: 'nonce', type: 'uint64' },
],
}
[List Trigger Orders](#list-trigger-orders)
Primary Type: ListTriggerOrders
Solidity struct that needs to be signed:
struct ListTriggerOrders {
bytes32 sender;
uint64 recvTime;
}
JSON representation:
{
ListTriggerOrders: [
{ name: 'sender', type: 'bytes32' },
{ name: 'recvTime', type: 'uint64' },
],
}
Authenticate Subscription Streams
Primary Type: StreamAuthentication
Struct that needs to be signed:
struct StreamAuthentication {
bytes32 sender;
uint64 expiration;
}
JSON representation:
{
StreamAuthentication: [
{ name: 'sender', type: 'bytes32' },
{ name: 'expiration', type: 'uint64' },
],
}
Last updated