Hi All
I was speaking to some community smart contract devs and they raised an issue with how fees for the Balanced DEX are currently handled. Right now, it requires a ton of manual maintenance. Here are the two key maintenance issues:
1.) Creating routes: When a new token is added to the Balanced DEX, fees in the form of that new token are sent to the Fee Handler. But currently, they will just sit there until a specific route for that token is defined. For example, VOID tokens just sit on the Fee Handler. I believe FRMD also. A trusted account needs to set a route of VOID â bnUSD â BALN in order for the fees to be swapped to BALN and distributed to stakers/DAO Fund. So, if a route is not created, BALN stakers and DAO Fund get nothing.
2.) Triggering routes: This is less of a problem as the first issue. Right now, IF a token has a route, somebody must call the âroute_balancesâ method. Anybody can do it, but of course it costs some gas. It must be called once per token type on Balanced (i.e. 5 times if the contract has VOID, FRMD, OMM, FIN, and CFT). As more routes and more tokens are added, this will continue to increase time and gas cost for whoever writes a bot to handle this.
Iâd say the first point is the biggest issue, and we came up with a proposed solution, open to suggestions though:
1.) Only charge fee in quote token: Available quote tokens are sICX, bnUSD, IUSDC and USDS. The quote token is the right-side token in a pair, and Balanced limits this to the aforementioned 4 tokens. If the fee is always charged in the right-side token only, weâll never need any new routes. For example, VOID/bnUSD (bnUSD is quote token), we donât need a new VOID route to get VOID â BALN, we just charge a fee in bnUSD and keep it there.
Downside of this strategy is that the only time fees are used to buy BALN is for pairs that are token/USDS and token/IUSDC.
2.) Option 1 + route sICX into BALN: This removes the downside of option 1, but adds the potential downside (depending on your opinion) that fee distributions wonât include sICX anymore, only BALN and bnUSD. DAO Fund will also stop accumulating sICX and only accumulate BALN & bnUSD. So for example, FIN/sICX pool, fees would be charged always in sICX
Neither of these really solve the âtrigger routesâ issue, but that transaction can be piggy-backed on claiming network fees as a solution. So when somebody claims their network fees, it can also trigger the routing + distribution of any tokens on the Fee Handler contract. The primary issue is route-management, outlined in the first issue.