Buying nexus covers with wNXM is cheaper then standard way (paying ETH/DAI or regular NXM)
What it does
allows for buying covers with wNXM which can be bought from DEXes at 1/3 of regular NXM price. We've designed Distributor2 contract that accepts wNXM, unwraps them and pays for covers in NXM instead of paying with ETH/DAI.
How we built it
Had a conversation with Anatol from Nexus Mutual team, who gave me a possible direction and pointed to important pieces of nexusmutual contracts code. Then took existing Distributor contract and extended it with functions that consumes wNXM instead of ETH/DAI.
Challenges we ran into
1) buying covers with Distributor didn't work initially with test provided by Nexus. Solved with Anatol. 2) the magic function that allows for creating Covers in exchange of NXM is deep-deep inside internal contracts. It consumes bunch of parameters that you have to grab and forward from other contracts. "Stack too deep" was a constant pain in ass. 3) there is no wNXM in Kovan, no trading pairs. Had to deploy that myself. Consumed some time, not critical.
Accomplishments that we're proud of
Cool new Distributor2 contract that can accept wNXM, as well as ETH or DAI when user purchases covers
What we learned
- Nexus Mutual protocol internals :)) A lot.
- how to debug with Tenderly
What's next for Nexus Cover Buyer
- Probably add extra function for the mainnet that allows to buy wNXM for ETH on DEXes instantly and then buy cover with that wNXM.