NexusMutual / cover-router

Computes optimal capacity allocation per Nexus Mutual staking pool on cover purchase
MIT License
1 stars 1 forks source link

feat: Add USDC support #87

Closed MilGard91 closed 4 months ago

MilGard91 commented 4 months ago

Context

Issue: #83

Changes proposed in this pull request

/quote

{
  "quote": {
    "totalCoverAmountInAsset": "string",
    "annualPrice": "string",
    "premiumInNXM": "string",
    "premiumInAsset": "string",
    "poolAllocationRequests": [
      {
        "poolId": "string",
        "coverAmountInAsset": "string",
        "skip": false
      }
    ],
    "asset": { // <--- new asset field
      "id": "string",
      "symbol": "string",
      "decimals": 18
    }
  },
  "capacities": [
    {
      "poolId": "string",
      "capacity": [
        {
          "assetId": "string",
          "amount": "string",
          "asset": { // <--- new asset field
            "id": "string",
            "symbol": "string",
            "decimals": 18
          }
        }
      ]
    }
  ]
}

/capacity/{productId}

{
  "productId": 0,
  "availableCapacity": [
    {
      "assetId": 0,
      "amount": "string",
      "asset": { // <--- new asset field
        "id": "string",
        "symbol": "string",
        "decimals": 18
      }
    }
  ],
  "allocatedNxm": "string",
  "minAnnualPrice": "string",
  "maxAnnualPrice": "string"
}

/capacity

[
  {
    "productId": 0,
    "availableCapacity": [
      {
        "assetId": 0,
        "amount": "string",
        "asset": { // <--- new asset field
          "id": "string",
          "symbol": "string",
          "decimals": 18
        }
      }
    ],
    "allocatedNxm": "string",
    "minAnnualPrice": "string",
    "maxAnnualPrice": "string"
  }
]

Test plan

Checklist

Review

When reviewing a PR, please indicate intention in comments using the following emojis:

rackstar commented 4 months ago

looks good. as discussed maybe consider adding decimal info for the asset for the 3rd party integration (oper cover, etc..)

rackstar commented 4 months ago

looks good. as discussed maybe consider adding decimal info for the asset for the 3rd party integration (oper cover, etc..)

Added asset.decimal info

rackstar commented 4 months ago

@MilGard91 FE guys agreed that being consistent is better. so we went with:

{
  "quote": {
    ...
    "asset": { <--- asset object containing all info
      "id": "string",
      "symbol": "string",
      "decimals": 18
    }
  },
  "capacities": [
    {
      "poolId": "string",
      "capacity": [
        {
          ...
          "asset": { <--- asset object containing all info
            "id": "string",
            "symbol": "string",
            "decimals": 18
          }
        }
      ]
    }
  ]
}
rackstar commented 4 months ago

I would also bump the deployments package, everything else LGTM

done