tezos-checker / checker

An in-development "robocoin" system for the Tezos blockchain
24 stars 16 forks source link

Use a different curve when tracking_type=token #319

Closed gkaracha closed 2 years ago

gkaracha commented 2 years ago

This is currently work in progress, meant to close #318.

github-actions[bot] commented 2 years ago
Gas costs 5f8cedc05662b275deed75d663245e55f3ef005a 3068fb10c3041427f5e59265d2a8ca4c023cb970 Diff
checker%touch 47061 47552 491
checker%create_burrow 14788 14777 -11
checker%add_liquidity 7675 7666 -9
checker%sell_kit 7352 7344 -8
checker%withdraw_collateral 14161 14153 -8
checker%remove_liquidity 8163 8156 -7
checker%deactivate_burrow 14495 14488 -7
checker%buy_kit 7352 7345 -7
checker%activate_burrow 11324 11319 -5
checker%deposit_collateral 11483 11478 -5
checker%set_burrow_delegate 9679 9675 -4
checker%burn_kit 4591 4588 -3
wtez%transfer 7384 7383 -1
wtez%deposit 3933 3932 -1
checker%touch_burrow 2984 2985 1
wctez%redeem 5000 5001 1
Entrypoint sizes 5f8cedc05662b275deed75d663245e55f3ef005a 3068fb10c3041427f5e59265d2a8ca4c023cb970 Diff
touch 56880 None -56880
mark_for_liquidation 17046 None -17046
touch_liquidation_slices 14350 None -14350
cancel_liquidation_slice 12122 None -12122
liquidation_auction_place_bid 2157 None -2157
remove_liquidity 1998 None -1998
add_liquidity 1878 None -1878
mint_kit 1531 None -1531
burn_kit 1514 None -1514
deactivate_burrow 1459 None -1459
buy_kit 1395 None -1395
sell_kit 1391 None -1391
withdraw_collateral 1292 None -1292
activate_burrow 1272 None -1272
create_burrow 1192 None -1192
deposit_collateral 1145 None -1145
liquidation_auction_claim_win 1096 None -1096
touch_burrow 611 None -611
set_burrow_delegate 457 None -457
update_operators 435 None -435
receive_price 289 None -289
receive_ctez_marginal_price 140 None -140
Test coverage 5f8cedc05662b275deed75d663245e55f3ef005a 3068fb10c3041427f5e59265d2a8ca4c023cb970 Diff
fixedPoint.ml 100 None -100
liquidationAuctionTypes.ml 100 None -100
ptr.ml 100 None -100
driftDerivative.ml 100 None -100
parameters.ml 100 None -100
constants.ml 100 None -100
cfmmTypes.ml 100 None -100
tokenMetadata.ml 100 None -100
fa2Ledger.ml 100 None -100
kit.ml 100 None -100
mem.ml 100 None -100
fa2Implementation.ml 100 None -100
error.ml 100 None -100
cfmm.ml 100 None -100
targetCalculation.ml 100 None -100
checkerEntrypoints.ml 97.73 None -97.73
burrow.ml 96.21 None -96.21
sliceList.ml 95.38 None -95.38
checker.ml 94.98 None -94.98
checkerMain.ml 93.33 None -93.33
avl.ml 91.05 None -91.05
common.ml 90.36 None -90.36
checkerTypes.ml 78.57 None -78.57
tok.ml 78.38 None -78.38
liquidationAuction.ml 77.83 None -77.83
price.ml 76.92 None -76.92
getOracleEntrypoint.ml 75 None -75
ctok.ml 72.97 None -72.97
lqt.ml 72.97 None -72.97
mockFA2.ml 18.52 None -18.52
wctez.ml 14.29 None -14.29
burrowOrigination.ml 8 None -8
wtez.ml 4.78 None -4.78
TOTAL 81.88 None -81.88
github-actions[bot] commented 2 years ago
Gas costs 5f8cedc05662b275deed75d663245e55f3ef005a d0c68b1cd10c11dce179a7e2fda117dfb9e179c6 Diff
checker%touch 47061 47552 491
checker%create_burrow 14788 14777 -11
checker%add_liquidity 7675 7666 -9
checker%withdraw_collateral 14161 14153 -8
checker%sell_kit 7352 7344 -8
checker%remove_liquidity 8163 8156 -7
checker%buy_kit 7352 7345 -7
checker%deactivate_burrow 14495 14488 -7
checker%deposit_collateral 11483 11478 -5
checker%activate_burrow 11324 11319 -5
checker%set_burrow_delegate 9679 9675 -4
checker%burn_kit 4591 4588 -3
wctez%redeem 5000 5001 1
checker%touch_burrow 2984 2985 1
wtez%deposit 3933 3932 -1
wtez%transfer 7384 7383 -1
Entrypoint sizes 5f8cedc05662b275deed75d663245e55f3ef005a d0c68b1cd10c11dce179a7e2fda117dfb9e179c6 Diff
touch 56880 53675 -3205
mark_for_liquidation 17046 16099 -947
touch_liquidation_slices 14350 13777 -573
cancel_liquidation_slice 12122 11559 -563
add_liquidity 1878 1835 -43
remove_liquidity 1998 1963 -35
sell_kit 1391 1356 -35
buy_kit 1395 1362 -33
liquidation_auction_place_bid 2157 2141 -16
create_burrow 1192 1182 -10
touch_burrow 611 619 8
burn_kit 1514 1506 -8
liquidation_auction_claim_win 1096 1090 -6
update_operators 435 431 -4
activate_burrow 1272 1274 2
receive_price 289 287 -2
deposit_collateral 1145 1147 2
Test coverage 5f8cedc05662b275deed75d663245e55f3ef005a d0c68b1cd10c11dce179a7e2fda117dfb9e179c6 Diff
vaultTypes.ml 0 100 100
liquidationAuctionPrimitiveTypes.ml 0 100 100
fa12Interface.ml 0 100 100
burrowTypes.ml 0 100 100
fa2Interface.ml 0 100 100
price.ml 76.92 100 23.08
checkerMain.ml 93.33 93.18 -0.14999999999999147
TOTAL 81.88 81.93 0.05000000000001137
dorranh commented 2 years ago

I've had a look at the existing changes on this branch and implemented the remaining steps of:

  1. Plugging the new "flat curve" into the CFMM logic in tokenCfmm.ml.jinja
  2. Adding custom error messages for dx / dy estimation functions
  3. Disabling a limited set of tight unit tests which do not hold for both cfmm implementations

While I think this PR is in decent shape, I would caution that these changes to Checker's CFMM for cases where Checker is configured to track on-chain tokens are new and still experimental. As such they will need additional rounds of testing and verification in the future.