KlimaDAO / klimadao-solidity

Solidity Contracts for KlimaDAO protocol

Home Page:https://solidity-nine.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade RA v2 to allow for any pool to pool swap through Klima

ShimonD-KlimaDAO opened this issue · comments

Currently, in RA V2, we can only swap (s/ws)klima>anything and usdc->anything.
BCT->"any pool token" would also work for small amounts, but not vice versa since we don't have USDC liquidity for any other pool token.

Libswap has default logic which swaps the source token to USDC first if a path is not pre-defined. That's good for non-pool tokens, and works for small amounts for BCT->other as described above.

We should implement a function that checks if (s.isPoolToken[sourceToken]), and swaps to Klima first. This would likely require 5 new mappings in DiamondInit.sol, for the following paths:

s.swap[C.klima()][C.bct()]
s.swap[C.klima()][C.nct()]
s.swap[C.klima()][C.ubo()]
s.swap[C.klima()][C.nbo()]
s.swap[C.klima()][C.mco2()]