gear-tech / apps

Gear Apps
GNU General Public License v3.0
8 stars 9 forks source link

Refactoring and improvements in Curve-AMM program #11

Open shamilsan opened 2 years ago

shamilsan commented 2 years ago

@vivekvpandya Maybe it's better to make Curve-Amm a library? Because when developing dex, curve liquidity pools will be used many times. I also think for a better understanding of program logic it would be better to make mathematical calculations in separate files

Originally posted by @LouiseMedova in https://github.com/gear-tech/apps/issues/7#issuecomment-1004776528

shamilsan commented 2 years ago

I also think it's necessary to add reading of contracts state off-chain (in fungible-token and curve-amm). Then in fungible-token contract in functions mint, burn, transfer, approve you need to check the msg::source(). And maybe it's even better to reduce arguments in these functions (for example sender in transfer function can be removed and replaced with msg::source()). In curve amm there are comments TODO and usage of mutex, which is only needed to test the contract. But there should not be in the finished contract.

Originally posted by @LouiseMedova in https://github.com/gear-tech/apps/issues/7#issuecomment-1004831783

vivekvpandya commented 2 years ago

burn() has issue about how it handles amount > user's balance. Thanks to @LouiseMedova for testing and reporting!