Exit an AMM pool

Rate limit: 5 every second

API Overview


HTTP method

POST

Path

/api/v3/amm/exit

Summary

Return the exit request processing status

API description


HTTP Header

Field Type Required Description Example
X-API-KEY string Y ApiKey "HlkcGxbqBeaF76j4rvPaOasyfPwnkQ
6B6DQ6THZWbvrAGxzEdulXQvOKLrRW
ZLnN"

Request parameters

Field Type Required Description Example
owner string Y The account owner adderss "0xe25c94ba036d91b488
33acb637f719038f0737
2d"
poolAddress string Y AMM pool address to be joined "0xe25c94ba036d91b488
33acb637f719038f0737
2d"
exitTokens AmmPoolExitTokens Y Exit token amounts, include mint token to burn and the minimum exit tokens to be get back "{"burned": 0,"unpooled": [{"id": 0,"amount": 0}]}"
storageId integer Y Offchain request storage Id 1
maxFee string Y Maximum fee of exit request, use the last in pool token by default "1000000000000000000"
validUntil integer Y Timestamp for order to become invalid 1598431481
eddsaSignature string N AMM exit request eddsa signature "0xccf0a141fce2dc5cbb
d4f802c52220e9e2ce26
0e86704d6258603eb346
eefe2d4a450005c362b2
23b28402d087f7065ea5
eee0314531adf6a580fc
e64c25dca81c02"
ecdsaSignature string N AMM exit request ecdsa signature "0xeb14773e8a07d19bc4
fe56e36d041dcb002652
f7e92160deaf5e6bf21e
05c7a9eb14773e8a07d1
9bc4fe56e36d041dcb00
2652f7e92160deaf5e6b
f21e05c7a9eb14773e8a
07d19bc4fe56e36d041d
cb002652f7e92160deaf
5e6bf21e05c7a9"

Request example

HTTP
CURL
POST https://api3.loopring.io/api/v3/amm/exit HTTP/1.1
Host: api3.loopring.io
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: zh,en;q=0.9
X-API-KEY: sra1aavfa
Content-Type: application/json

{
    "owner" : "0xe25c94ba036d91b48833acb637f719038f07372d",
    "poolAddress" : "0xe25c94ba036d91b48833acb637f719038f07372d",
    "exitTokens" : {
        "unPooled" : [{tokenId:0, volume: 100000},{tokenId:0, volume: 100000}],
        "burned" : "1000000000"
    },
    "storageId" : 1,
    "maxFee" : "1000000000000000000",
    "validUntil" : 1598431481,
    "eddsaSignature" : "0xccf0a141fce2dc5cbbd4f802c52220e9e2ce260e86704d6258603eb346eefe2d4a450005c362b223b28402d087f7065ea5eee0314531adf6a580fce64c25dca81c02",
    "ecdsaSignature" : "0xeb14773e8a07d19bc4fe56e36d041dcb002652f7e92160deaf5e6bf21e05c7a9eb14773e8a07d19bc4fe56e36d041dcb002652f7e92160deaf5e6bf21e05c7a9eb14773e8a07d19bc4fe56e36d041dcb002652f7e92160deaf5e6bf21e05c7a9"
}
curl -X POST -H "X-API-KEY:sra1aavfa" -H "Content-Type:application/json" https://api3.loopring.io/api/v3/amm/exit -d \
'{
    "owner" : "0xe25c94ba036d91b48833acb637f719038f07372d",
    "poolAddress" : "0xe25c94ba036d91b48833acb637f719038f07372d",
    "exitTokens" : {
        "unPooled" : [{tokenId:0, volume: 100000},{tokenId:0, volume: 100000}],
        "burned" : "1000000000"
    },
    "storageId" : 1,
    "maxFee" : "1000000000000000000",
    "validUntil" : 1598431481,
    "eddsaSignature" : "0xccf0a141fce2dc5cbbd4f802c52220e9e2ce260e86704d6258603eb346eefe2d4a450005c362b223b28402d087f7065ea5eee0314531adf6a580fce64c25dca81c02",
    "ecdsaSignature" : "0xeb14773e8a07d19bc4fe56e36d041dcb002652f7e92160deaf5e6bf21e05c7a9eb14773e8a07d19bc4fe56e36d041dcb002652f7e92160deaf5e6bf21e05c7a9eb14773e8a07d19bc4fe56e36d041dcb002652f7e92160deaf5e6bf21e05c7a9"
}'

Response fields

Field Type Required Description Example
hash string Y The order hash identifier set by the user at the time of submission "0x1d923ca7834dc90484
fa2eb611f0f0bc7e741b
b107007ebea19ba8caea
b4f9d3"
status string Y Whether the order was successfully submitted or not, please note, user may query after a while to get real process status, as most offchain requests are async processed
Allowable : ['received', 'processing', 'processed', 'failed']
"received"
isIdempotent boolean Y Idempotent of submit order response, submit same order again when order was UNKNOWN or WAIT_FREEZE_BALANCE in relayer, idempotent will be true
Allowable : [True, False]
"true"

Response example

{
    "hash" : "0x1d923ca7834dc90484fa2eb611f0f0bc7e741bb107007ebea19ba8caeab4f9d3",
    "status" : "received",
    "isIdempotent" : true
}

Status code

Value Description
100000 Unknown error
100001 Invalid argument
102001 Exchange ID is incorrect
102021 Nonce is invalid
102022 Transfer sender is invalid
102023 Transfer receiver is invalid
102024 Fee token is unsupported
102025 Transfer token isnt consistent with fee token

Model


AmmPoolExitTokens

escribes an AMM join transaction

Field Type Required Description Example
unPooled List[TokenVolumeV3] Y Describes list of the amount of a specific token to be removed from the pool, tokens seq should be same as AMM pool info "[{tokenId:0, volume: 100000},{tokenId:0, volume: 100000}]"
burned string Y The minimum amoun of LP token to burn "1000000000"

TokenVolumeV3

Wrapper object used to describe a token associated with a certain quantity.

Field Type Required Description Example
tokenId integer Y The Loopring's token identifier. 0
volume string Y The volume of the token "1000000000000"

results matching ""

    No results matching ""