Native Documentation
  • introduction
    • What is Native
    • About Native V2
    • Benefits for Key Players
  • SOLUTION
    • Native Credit Pool
    • Native Swap Engine
  • CONCEPTS
    • Orderbook
    • Firm Quote Orders
    • Auto Sign Orders
    • Swap Fees
    • Slippage
    • Base and Listed Assets
    • Single-Sided Liquidity Pools
    • Total Available Liquidity
    • Liquidity Pairing
    • Liquidity Bootstrapping
    • Health Ratio
    • Earning Fees and Incentives
    • Credit-Based Swap
      • Collateral Factor
      • PMM Credit
      • Settlement and Liquidation
    • Market-Responsive Pricing
    • Risks
  • USER GUIDE
    • Add Liquidity
    • Pair Liquidity
    • Claim Rewards
    • Swap with Native
  • Build with Native
    • Swap Aggregators
      • Guide
      • FirmQuote Swap APIs
        • GET Orderbook
        • GET Indicative quote
        • GET Firm quote
    • Asset Issuers
      • For Pegged Assets
      • For General Assets
  • Resources
    • Addresses
    • Audits
    • Github
    • System Status
    • Business Source License
    • Media Kit
Powered by GitBook
On this page
  1. Build with Native
  2. Private Market Makers[june]
  3. PMM API

POST Request settlement

Last updated 10 months ago

Example response

{
    "id": "d49c39ed-ff63-41c0-bf3a-75f6d56f7346",
    "nonce": "6168514449590345",
    "recipient": "0x9B85B4A413Efe69684290816a3E814B4aA1EFf63",
    "chain": "base",
    "positionUpdates": [
        {
            "tokenAddress": "0x4200000000000000000000000000000000000006",
            "amount": "-5000000000"
        }
    ],
    "creditChangeUsd": -0.00001168615,
    "trader": "0x9B85B4A413Efe69684290816a3E814B4aA1EFf63",
    "requestAt": "2024-01-31T08:09:22.645Z",
    "enableAt": "2024-01-31T08:14:22.645Z",
    "expiresAt": "2024-01-31T08:15:22.645Z",
    "type": "settlement"
}

Error responses

// Try to withdraw more than long position amount
{
    "statusCode": 400,
    "message": "Cannot make long position to become short position",
    "error": "Bad Request"
}

// Try to deposit into long position
{
    "statusCode": 400,
    "message": "Cannot increasing existing long position",
    "error": "Bad Request"
}

// Try to deposit more than short position amount
{
    "statusCode": 400,
    "message": "Cannot make short position to become long position",
    "error": "Bad Request"
}

// Try to withdraw from short position
{
    "statusCode": 400,
    "message": "Cannot decreasing existing short position",
    "error": "Bad Request"
}

// Invalid token address
{
    "statusCode": 400,
    "message": "Cannot settle unexist position",
    "error": "Bad Request"
}

// Invalid mm
{
    "statusCode": 404,
    "message": "MM Settings not found",
    "error": "Not Found"
}

Creates a settlement request and starts the time delay. Note that Market Maker will be paused from other activities at this point.

post
Header parameters
apiKeystringRequired

The API key that was assigned to you by Native

Body
chainstring ยท enumRequired

Native blockchain name, eg: ethereum, bsc, etc

Example: ethereumPossible values:
recipientstringRequired

The address of the market maker or the settler

Pattern: ^0x[a-fA-F0-9]{40}$
traderstringRequired

The address of the trader

Pattern: ^0x[a-fA-F0-9]{40}$
Responses
201
Success
application/json
500
There was an exception with the server
post
POST /lend/v1/lend/request-settlement HTTP/1.1
Host: newapi.native.org
apiKey: text
Content-Type: application/json
Accept: */*
Content-Length: 115

{
  "chain": "ethereum",
  "recipient": "text",
  "positionUpdates": [
    {
      "tokenAddress": "text",
      "amount": "text"
    }
  ],
  "trader": "text"
}
{
  "chain": "ethereum",
  "recipient": "text",
  "positionUpdates": [
    {
      "tokenAddress": "text",
      "amount": "text"
    }
  ],
  "trader": "text"
}