Last look is implemented by servers that provide quotes and accept signed orders provided by clients.
In Last Look protocols, the client is the order signer and server the order sender.
Given a token pair, return a quote object with the maximum amounts a maker is willing to trade.
getMaxQuote(signerToken: string, // Token the sender would transfersenderToken: string // Token the signer would transfer)
A successful getMaxQuote
returns a Quote object.
Given a senderAmount
and token pair, return a complete quote. The signerAmount
value is the amount the maker would send. The taker is selling to the maker.
getSignerSideQuote(senderAmount: string, // Amount the sender would transfersignerToken: string, // Token the sender would transfersenderToken: string // Token the signer would transfer)
A successful getSignerSideQuote
returns a Quote object including the requested signerAmount
Given a signerAmount
and token pair, return a complete quote. The senderAmount
value is the amount the taker would send. The taker is buying from the maker.
getSenderSideQuote(signerAmount: string, // Amount the signer would transfersignerToken: string, // Token the sender would transfersenderToken: string // Token the signer would transfer)
A successful getSenderSideQuote
returns a Quote object including the requested senderAmount
.
Given a token pair, return a quote object with the maximum amounts a maker is willing to trade.
provideQuote(signerToken: string, // Token the sender would transfersenderToken: string // Token the signer would transfer)
Given an Order, assess its price, and conditionally perform a swap.
provideOrder(order: Order // Order to fill)
A Quote
has the following properties:
Property | Type | Description |
signer |
| Party to the trade that sets and signs terms. |
sender |
| Party to the trade that accepts and sends terms. |
timestamp |
| (optional) Timestamp of the quote. |
version |
| (optional) Swap contract intended for settlement. |
locator |
| (optional) Locator URL of the server quoting. |
Each Party
has the following properties.
Property | Type | Description |
kind |
|
|
token |
| Contract address of the token. |
amount |
| Amount of the token (ERC-20, ERC-1155). |
id |
| ID of the token (ERC-721, ERC-1155). |
The following is an example of a getMaxQuote
request.
POST / HTTP/1.1Content-Length: ...Content-Type: application/json​{"jsonrpc": "2.0","id": 123,"method": "getMaxQuote","params": {"senderToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","signerToken": "0xdac17f958d2ee523a2206206994597c13d831ec7"}}
HTTP/1.1 200 OKAccess-Control-Allow-Origin: *Access-Control-Allow-Headers: *Access-Control-Allow-Methods: POST, OPTIONSContent-Length: ...Content-Type: application/json​{"jsonrpc": "2.0","id": 123,"result": {"timestamp": "1566941284","version": "0xc549a5c701cb6e6cbc091007a80c089c49595468","locator": "maker.example.com","signer": {"kind": "0x36372b07","token": "0xdac17f958d2ee523a2206206994597c13d831ec7","amount": "10000","id": "0"},"sender": {"kind": "0x36372b07","token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","amount": "100000000","id": "0"}}}