DODO Docs
Search…
⌃K

Create Order

URL

https://api.dodoex.io/limit-order/create

Request

Method

POST

Request Example

curl --location --request POST 'https://api.dodoex.io/limit-order/create' \
--header 'Authorization: ${token}' \
--header 'User-Agent: DODO-${your_id}' \
--data-raw '{
"order":{
"makerToken":"0xab0733588776B8881F7712f6AbCa98F510e6B63D",
"takerToken":"0x0aDCBAE18580120667f7Ff6c6451A426B13c67B7",
"makerAmount":"3000000000",
"takerAmount":"110000000",
"maker":"0x709f0d38142e7f8d95a21529b9ad576555bd6755",
"taker":"0x0adcbae18580120667f7ff6c6451a426b13c67b7",
"expiration":1653234564456,
"salt":"1832645"
},
"signature":"0xd13b9ce1b72b606918bde9276d3bc10114f1b2dc743c996f...",
"network":"rinkeby"
}'

Request Example

name
param type
type
option
default
description
Authorization
header
string
require
the auth token
User-Agent
header
string
require
the [User-Agent] you have requested
order
body
object
require
order info object
order.makerToken
body
string
require
your token address
order.takerToken
body
string
require
swap token address
order.makerAmount
body
string
require
your token amount
order.takerAmount
body
string
require
swap token amount
order.maker
body
string
require
your wallet address
order.taker
body
string
require
contract address
order.expiration
body
integer
require
order expire time
order.salt
body
string
require
order salt
signature
body
string
require
signature
network
body
string
require
network name,enum:['ethereum', 'bsc', 'polygon', 'rinkeby']

Get signature example

const ethers = require("ethers");
const EIP712_DOMAIN = [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' },
];
const ORDER_STRUCTURE = [
{ name: 'makerToken', type: 'address' },
{ name: 'takerToken', type: 'address' },
{ name: 'makerAmount', type: 'uint256' },
{ name: 'takerAmount', type: 'uint256' },
{ name: 'maker', type: 'address' },
{ name: 'taker', type: 'address' },
{ name: 'expiration', type: 'uint256' },
{ name: 'salt', type: 'uint256' },
];
const buildLimitOrderTypedData = ({
order,
verifyingContract,
chainId,
}) {
return {
primaryType: 'Order',
types: {
EIP712Domain: EIP712_DOMAIN,
Order: ORDER_STRUCTURE,
},
domain: {
name: 'DODO Limit Order Protocol',
version: '1',
chainId,
verifyingContract,
},
message: order
};
}
const privateKey = Buffer.from(
process.env.YOUR_PK,
"hex"
);
(async () => {
const wallet = new ethers.Wallet(privateKey);
const address = await wallet.getAddress();
const order = {
makerToken: "0x0aDCBAE18580120667f7Ff6c6451A426B13c67B7", // your token
takerToken: "0xab0733588776B8881F7712f6AbCa98F510e6B63D", // swap token
makerAmount: "50000000", // your token amount
takerAmount: "50100000", // swap token amount
maker: address,
taker: "0xa2c1eA946dA567248c70F792b64D5F2551f29204", // limit order bot contract address
expiration: 4817087944, // order expire time
salt: "1217718059922" // generate random number
}
const buildLimitOrderData = buildLimitOrderTypedData({
order,
verifyingContract: '0x3dd629473a2ed7f3c6299ffd9f3e0c283d073f11', // limit order contract address
chainId: 4 });
const signature = await wallet._signTypedData(domain, {
Order: ORDER_STRUCTURE,
}, order);
console.log("signature", signature);
})()
Contract
chain
limit order bot address
limit order address
1
0xD9B825d16E09f28D0c715fe004364046E5524Dbb
0x093b68BFe0859D3C857Fc3529952897C30dD17EB
56
0x187da347dEbf4221B861EeAFC9808d8Cf89cF5fE
0xdc5E86654e768d21f7D298690687eA02db7b2a04
137
0xA7263eb38b9A61B72397c884b5f9bFb5C34A7840
0x5F43046eAD98012044CfC1C3427A1bcEf921d3f3
4
0xa2c1eA946dA567248c70F792b64D5F2551f29204
0xFC8fb4CD3A77F138E53F92F5EC483e9887508CCe

Response

Success

code: 200
content:
{
"code": 0,
"message": "success",
"data": {
"createdAt": "2022-09-08T15:20:40.670Z",
"id": 26743,
"network": "rinkeby",
"order": {
"makerToken": "0x0aDCBAE18580120667f7Ff6c6451A426B13c67B7",
"takerToken": "0xab0733588776B8881F7712f6AbCa98F510e6B63D",
"makerAmount": "30000000",
"takerAmount": "29700000",
"maker": "0xEeE13739763A1b0f062846eF4a102886673c89Bd",
"taker": "0xa2c1eA946dA567248c70F792b64D5F2551f29204",
"expiration": "4816250441",
"salt": "1134929404266",
},
"progress": "FRESH",
"signature": "0x878dee6df39f5666173d7aa39e47a8a866ae1ed558cbd47cf37f7418d9e8c24d5cbc271d635a21846d1714f27a1c9cff69476ef31ddcd2bb5727679bf2abc82a1c",
"updatedAt": "2022-09-08T15:20:40.670Z",
}
}

Fail

code: 200
content:
{
"code": 10001,
"message": "invalid signature",
"data": null
}

Response Params

name
type
description
code
integer
status code: 0: ok, 1000x: error
message
string
status description
data
object
order info

data.schema

name
type
description
id
integer
order id
network
string
network name
order
object
order info object
order.makerToken
string
your token address
order.takerToken
string
swap token address
order.makerAmount
string
your token amount
order.takerAmount
string
swap token amount
order.maker
string
your wallet address
order.taker
string
contract address
progress
string
order status,enum:['FRESH', 'BROADCAST', 'COMPLETE', 'FAILED']//pending order,order broadcast,order success,order fail
signature
string
order signature
createdAt
string
create time
updatedAt
string
update time