NexusMutual / cover-router

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

Quote price value is different/smaller than the contract computed value causing the buy cover tx to fail #59

Open mixplore opened 5 months ago

mixplore commented 5 months ago

Context

A user has trouble purchasing a cover, turned out they were getting a PriceExceedsMaxPremiumInAsset from the contract when trying to execute the tx. After further investigation, it looks like the premium value we get from the cover router is different (smaller) from the one in the contract. See the repro steps below:

  1. Connect wallet with account: 0xE4994082A0E7f38B565e6c5f4afD608de5EDDfBb
  2. Go to https://app.nexusmutual.io/cover/buy/get-quote?productId=68
  3. Insert amount value: 205
  4. Change cover asset to DAI
  5. Change payment asset to NXM

Pasted Graphic

  1. Check Network Tab for cover router fetch quote call and check premiumInNXM value (14712328767123287)

Pasted Graphic 2

  1. Click Buy cover button
  2. Check dev console for Tenderly simulation link:

Pasted Graphic 1

  1. Run simulation on Tenderly
  2. Scroll down to debug code and notice premiumInNXM param value (17917808219178082) - it’s different from the one in the quote endpoint response Pasted Graphic 3