Cargo.toml
README.md
src
    admin_fee.rs
    cli.yml
    main.rs
    math.rs

# curve-tool

计算invariant D
```
$ curve-tool calc_d -a 240 -c 23739540956798478700217,23693993795556946583088,12799207746085091106157

calc_d : 60231588734883860151122
```
计算Xtoken新值之下的Ytoken新值(保证 invariant D 不变)
```
$ curve-tool  calc_y -a 240 -x 100000000000000000000 -c 23739540956798478700217,23693993795556946583088,12799207746085091106157 -i 0 -o 1 

compute_y : 48534043600605104365063
```
计算添加流动性
```
$ curve-tool calc_add_liquidity -a 240 -d 100000000000000000000,0,0 -o 23739540956798478700217,23693993795556946583088,12799207746085091106157 -p 60229882460024116126568 -t 5 -e 2000 

fee 0 : 6059017140754929
fee 1 : 3933421610185250
fee 2 : 2124786592589641
minted : 99975046215242192434
fee_part : 12116477271572430
```
计算按份额移除流动性
```
$ curve-tool calc_remove_liquidity -s 100000000000000000000 -c 23739540956798478700217,23693993795556946583088,12799207746085091106157 -o 60229882460024119712683

calc_remove_liquidity : [39414888402870331522, 39339266204417988939, 21250593929981854266]
```
计算按token移除流动性
```
$ curve-tool calc_remove_liquidity_by_tokens -a 240 -r 100000000000000000000,0,0 -o 23739540956798478700217,23693993795556946583088,12799207746085091106157 -p 60229882460024116126568 -t 5 -e 2000 

fee 0 : 6059011948075237
fee 1 : 3933426792902162
fee 2 : 2124789392230386
burned : 99999410922274146210
fee_part : 12116485642804691
```
计算swap
```
curve-tool calc_swap -a 240 -x 0 -c 100000000000000000000 -y 1 -o 23739540956798478700217,23693993795556946583088,12799207746085091106157 -t 5 -e 2000   

swap_out : 99949729878143970601
fee_part : 49999864871507739
```
