tezos-checker / checker

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

Add TZIP16 metadata for wtez, wctez, and the mock FA2 contract #306

Closed gkaracha closed 2 years ago

gkaracha commented 2 years ago

Closes #295

gkaracha commented 2 years ago

@dorranh I'm turning this into a draft PR in case you wanna have a quick look (I'll ping you once it's done anyway so no hurry). There's one last thing missing that is a little annoying: view_total_supply is meant to "return [the] total number of tokens for the given token-id if known or fail if not". To be able to implement that we have to keep track of these values in the storage of each contract. Pity, since we don't really have any other use for the total amount of token in circulation, but it could come in handy for testing later (like we do in checker using fa2_get_total_kit_balance and fa2_get_total_lqt_balance).

github-actions[bot] commented 2 years ago
Gas costs 30bba1a4420197da491a1a67fc88547c7fb9aeb1 c189d2f2d6e42a4d33315beab190fa015a092a2f Diff
checker%set_burrow_delegate 18304 None -18304
checker%touch 42380 30887 -11493
checker%create_burrow 22283 12581 -9702
checker%deactivate_burrow 23378 15205 -8173
checker%deposit_collateral 19985 11812 -8173
checker%activate_burrow 19801 11628 -8173
checker%withdraw_collateral 23019 14846 -8173
mock_fa2%mint None 3671 3671
mock_fa2%update_operators None 3318 3318
checker%add_liquidity 12574 12427 -147
checker%buy_kit 12420 12274 -146
checker%sell_kit 12419 12274 -145
checker%remove_liquidity 13269 13124 -145
checker%update_operators 5591 5587 -4
checker%touch_burrow 6104 6101 -3
checker%transfer 6313 6310 -3
Entrypoint sizes 30bba1a4420197da491a1a67fc88547c7fb9aeb1 c189d2f2d6e42a4d33315beab190fa015a092a2f Diff
touch 56556 56749 193
Test coverage 30bba1a4420197da491a1a67fc88547c7fb9aeb1 c189d2f2d6e42a4d33315beab190fa015a092a2f Diff
price.ml 100 76.92 -23.08
TOTAL 92.57 92.47 -0.09999999999999432
github-actions[bot] commented 2 years ago
Gas costs 30bba1a4420197da491a1a67fc88547c7fb9aeb1 71040275731343b31c530cab8801cc51beac5659 Diff
checker%touch 42380 None -42380
checker%deactivate_burrow 23378 None -23378
checker%withdraw_collateral 23019 None -23019
checker%create_burrow 22283 None -22283
checker%deposit_collateral 19985 None -19985
checker%activate_burrow 19801 None -19801
checker%set_burrow_delegate 18304 None -18304
checker%remove_liquidity 13269 None -13269
wtez%transfer 12726 None -12726
checker%add_liquidity 12574 None -12574
checker%buy_kit 12420 None -12420
checker%sell_kit 12419 None -12419
wtez%withdraw 9875 None -9875
wctez%mint 9127 None -9127
wctez%redeem 8655 None -8655
wtez%set_delegate 8409 None -8409
wtez%deposit 7490 None -7490
checker%burn_kit 7361 None -7361
checker%mint_kit 7133 None -7133
checker%transfer 6313 None -6313
checker%touch_burrow 6104 None -6104
checker%update_operators 5591 None -5591
wctez%transfer 4902 None -4902
mockFA2%transfer 4776 None -4776
wtez%update_operators 4170 None -4170
mockFA2%redeem 3671 None -3671
wctez%update_operators 3444 None -3444
mockFA2%mint 3436 None -3436
mockFA2%update_operators 3318 None -3318
Entrypoint sizes 30bba1a4420197da491a1a67fc88547c7fb9aeb1 71040275731343b31c530cab8801cc51beac5659 Diff
touch 56556 None -56556
mark_for_liquidation 16949 None -16949
touch_liquidation_slices 14350 None -14350
cancel_liquidation_slice 12130 None -12130
liquidation_auction_place_bid 2141 None -2141
remove_liquidity 1998 None -1998
add_liquidity 1878 None -1878
mint_kit 1537 None -1537
burn_kit 1514 None -1514
deactivate_burrow 1465 None -1465
buy_kit 1395 None -1395
sell_kit 1391 None -1391
withdraw_collateral 1298 None -1298
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_ctez_marginal_price 140 None -140
receive_price 120 None -120
Test coverage 30bba1a4420197da491a1a67fc88547c7fb9aeb1 71040275731343b31c530cab8801cc51beac5659 Diff
cfmm.ml 100 None -100
kit.ml 100 None -100
error.ml 100 None -100
tokenMetadata.ml 100 None -100
fa2Implementation.ml 100 None -100
cfmmTypes.ml 100 None -100
constants.ml 100 None -100
driftDerivative.ml 100 None -100
parameters.ml 100 None -100
liquidationAuctionTypes.ml 100 None -100
price.ml 100 None -100
fixedPoint.ml 100 None -100
ptr.ml 100 None -100
fa2Ledger.ml 100 None -100
mem.ml 100 None -100
checkerEntrypoints.ml 97.73 None -97.73
common.ml 97.59 None -97.59
burrow.ml 96.21 None -96.21
sliceList.ml 95.38 None -95.38
checker.ml 94.93 None -94.93
checkerMain.ml 93.33 None -93.33
avl.ml 91.05 None -91.05
tok.ml 78.38 None -78.38
liquidationAuction.ml 77.83 None -77.83
checkerTypes.ml 77.78 None -77.78
ctok.ml 72.97 None -72.97
lqt.ml 72.97 None -72.97
burrowOrigination.ml 8 None -8
TOTAL 92.57 None -92.57
gkaracha commented 2 years ago

Hey @dorranh this should be ready for review now, assuming CI will be green :slightly_smiling_face:

github-actions[bot] commented 2 years ago
Gas costs 30bba1a4420197da491a1a67fc88547c7fb9aeb1 14d6659d94e3be282fd6bc2ce3af46f347b63a57 Diff
checker%deposit_collateral 19985 20048 63
checker%withdraw_collateral 23019 23082 63
checker%deactivate_burrow 23378 23441 63
checker%create_burrow 22283 22346 63
checker%set_burrow_delegate 18304 18367 63
checker%activate_burrow 19801 19864 63
wtez%update_operators 4170 4221 51
wtez%transfer 12726 12777 51
wtez%deposit 7490 7540 50
wtez%withdraw 9875 9925 50
wtez%set_delegate 8409 8459 50
checker%add_liquidity 12574 12601 27
checker%sell_kit 12419 12446 27
checker%buy_kit 12420 12447 27
checker%remove_liquidity 13269 13296 27
wctez%update_operators 3444 3466 22
wctez%transfer 4902 4924 22
wctez%redeem 8655 8677 22
wctez%mint 9127 9149 22
mockFA2%update_operators 3318 3338 20
mockFA2%redeem 3671 3691 20
mockFA2%mint 3436 3456 20
mockFA2%transfer 4776 4796 20

Entrypoint sizes: No change. Test coverage: No change.

github-actions[bot] commented 2 years ago
Gas costs 2f97225f5b7ae9e5d7315a13563582fe277ccf05 976a4ee33794143b8371c41220f5aaef736633d7 Diff
checker%deactivate_burrow 23374 23437 63
checker%activate_burrow 19797 19860 63
checker%deposit_collateral 19981 20044 63
checker%set_burrow_delegate 18300 18363 63
checker%withdraw_collateral 23015 23078 63
checker%create_burrow 22280 22342 62
wtez%update_operators 4170 4221 51
wtez%transfer 12726 12777 51
wtez%withdraw 9875 9925 50
wtez%set_delegate 8409 8459 50
wtez%deposit 7490 7540 50
checker%remove_liquidity 13265 13293 28
checker%sell_kit 12415 12443 28
checker%add_liquidity 12570 12597 27
checker%buy_kit 12416 12443 27
wctez%transfer 4902 4924 22
wctez%redeem 8655 8677 22
wctez%update_operators 3444 3466 22
wctez%mint 9127 9149 22
mockFA2%mint 3436 3456 20
mockFA2%redeem 3671 3691 20
mockFA2%update_operators 3318 3338 20
mockFA2%transfer 4776 4796 20

Entrypoint sizes: No change. Test coverage: No change.

dorranh commented 2 years ago

@gkaracha, I went ahead and tested out deploying to granadanet using this PR and it seems to be working without issue. I think we can go ahead and merge this.

github-actions[bot] commented 2 years ago
Gas costs 2f97225f5b7ae9e5d7315a13563582fe277ccf05 78f6ae0ddfb94f33695f1f8204dc7b4d55d16f8e Diff
checker%touch 42373 None -42373
checker%deactivate_burrow 23374 None -23374
checker%withdraw_collateral 23015 None -23015
checker%create_burrow 22280 None -22280
checker%deposit_collateral 19981 None -19981
checker%activate_burrow 19797 None -19797
checker%set_burrow_delegate 18300 None -18300
checker%remove_liquidity 13265 None -13265
wtez%transfer 12726 None -12726
checker%add_liquidity 12570 None -12570
checker%buy_kit 12416 None -12416
checker%sell_kit 12415 None -12415
wtez%withdraw 9875 None -9875
wctez%mint 9127 None -9127
wctez%redeem 8655 None -8655
wtez%set_delegate 8409 None -8409
wtez%deposit 7490 None -7490
checker%burn_kit 7358 None -7358
checker%mint_kit 7129 None -7129
checker%transfer 6309 None -6309
checker%touch_burrow 6100 None -6100
checker%update_operators 5587 None -5587
wctez%transfer 4902 None -4902
mockFA2%transfer 4776 None -4776
wtez%update_operators 4170 None -4170
mockFA2%redeem 3671 None -3671
wctez%update_operators 3444 None -3444
mockFA2%mint 3436 None -3436
mockFA2%update_operators 3318 None -3318
Entrypoint sizes 2f97225f5b7ae9e5d7315a13563582fe277ccf05 78f6ae0ddfb94f33695f1f8204dc7b4d55d16f8e Diff
touch 56749 None -56749
mark_for_liquidation 16949 None -16949
touch_liquidation_slices 14350 None -14350
cancel_liquidation_slice 12130 None -12130
liquidation_auction_place_bid 2141 None -2141
remove_liquidity 1998 None -1998
add_liquidity 1878 None -1878
mint_kit 1537 None -1537
burn_kit 1514 None -1514
deactivate_burrow 1465 None -1465
buy_kit 1395 None -1395
sell_kit 1391 None -1391
withdraw_collateral 1298 None -1298
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_ctez_marginal_price 140 None -140
receive_price 120 None -120
Test coverage 2f97225f5b7ae9e5d7315a13563582fe277ccf05 78f6ae0ddfb94f33695f1f8204dc7b4d55d16f8e Diff
ptr.ml 100 None -100
liquidationAuctionTypes.ml 100 None -100
tokenMetadata.ml 100 None -100
cfmm.ml 100 None -100
fa2Ledger.ml 100 None -100
kit.ml 100 None -100
mem.ml 100 None -100
parameters.ml 100 None -100
fixedPoint.ml 100 None -100
error.ml 100 None -100
fa2Implementation.ml 100 None -100
driftDerivative.ml 100 None -100
constants.ml 100 None -100
cfmmTypes.ml 100 None -100
checkerEntrypoints.ml 97.73 None -97.73
common.ml 97.59 None -97.59
burrow.ml 96.21 None -96.21
sliceList.ml 95.38 None -95.38
checker.ml 94.93 None -94.93
checkerMain.ml 93.33 None -93.33
avl.ml 91.05 None -91.05
tok.ml 78.38 None -78.38
liquidationAuction.ml 77.83 None -77.83
checkerTypes.ml 77.78 None -77.78
price.ml 76.92 None -76.92
lqt.ml 72.97 None -72.97
ctok.ml 72.97 None -72.97
burrowOrigination.ml 8 None -8
TOTAL 92.47 None -92.47
github-actions[bot] commented 2 years ago
Gas costs 2f97225f5b7ae9e5d7315a13563582fe277ccf05 ca3c9a7396f368de2631141cdb0414c81c33708f Diff
checker%deposit_collateral 19981 20044 63
checker%activate_burrow 19797 19860 63
checker%withdraw_collateral 23015 23078 63
checker%deactivate_burrow 23374 23437 63
checker%set_burrow_delegate 18300 18363 63
checker%create_burrow 22280 22342 62
wtez%transfer 12726 12777 51
wtez%update_operators 4170 4221 51
wtez%deposit 7490 7540 50
wtez%set_delegate 8409 8459 50
wtez%withdraw 9875 9925 50
checker%sell_kit 12415 12443 28
checker%remove_liquidity 13265 13293 28
checker%buy_kit 12416 12443 27
checker%add_liquidity 12570 12597 27
wctez%redeem 8655 8677 22
wctez%update_operators 3444 3466 22
wctez%transfer 4902 4924 22
wctez%mint 9127 9149 22
mockFA2%mint 3436 3456 20
mockFA2%redeem 3671 3691 20
mockFA2%update_operators 3318 3338 20
mockFA2%transfer 4776 4796 20
Entrypoint sizes 2f97225f5b7ae9e5d7315a13563582fe277ccf05 ca3c9a7396f368de2631141cdb0414c81c33708f Diff
touch 56749 56556 -193

Test coverage: No change.

github-actions[bot] commented 2 years ago
Gas costs 2f97225f5b7ae9e5d7315a13563582fe277ccf05 408476e51351309e8db519a76067b96ff1b68a77 Diff
checker%set_burrow_delegate 18300 18363 63
checker%activate_burrow 19797 19860 63
checker%deposit_collateral 19981 20044 63
checker%withdraw_collateral 23015 23078 63
checker%deactivate_burrow 23374 23437 63
checker%create_burrow 22280 22342 62
wtez%update_operators 4170 4221 51
wtez%transfer 12726 12777 51
wtez%set_delegate 8409 8459 50
wtez%withdraw 9875 9925 50
wtez%deposit 7490 7540 50
checker%sell_kit 12415 12443 28
checker%remove_liquidity 13265 13293 28
checker%buy_kit 12416 12443 27
checker%add_liquidity 12570 12597 27
wctez%transfer 4902 4924 22
wctez%mint 9127 9149 22
wctez%update_operators 3444 3466 22
wctez%redeem 8655 8677 22
mockFA2%transfer 4776 4796 20
mockFA2%redeem 3671 3691 20
mockFA2%mint 3436 3456 20
mockFA2%update_operators 3318 3338 20
Entrypoint sizes 2f97225f5b7ae9e5d7315a13563582fe277ccf05 408476e51351309e8db519a76067b96ff1b68a77 Diff
touch 56749 56556 -193
Test coverage 2f97225f5b7ae9e5d7315a13563582fe277ccf05 408476e51351309e8db519a76067b96ff1b68a77 Diff
price.ml 76.92 100 23.08
mockFA2.ml None 18.52 18.52
wctez.ml None 14.29 14.29
wtez.ml None 4.78 4.78
TOTAL 92.47 82 -10.469999999999999
gkaracha commented 2 years ago

Thanks for the patches and the e2e tests @dorranh! :pray: I also added a few unit tests on the OCaml side (see 408476e51351309e8db519a76067b96ff1b68a77, 52666759d5a46f0777995668b9b657ac014fac86, and 4042ab42ace526f833d840b3d3ec2402e27964bd) though there are many more we should add. I don't want this PR to linger though so once CI is green I'll go ahead and merge it. We can add more unit and property-based tests incrementally.

dorranh commented 2 years ago

No problem, and that sounds good!