Skip to content

Commit

Permalink
Moved assert balances into its own entry
Browse files Browse the repository at this point in the history
  • Loading branch information
glottologist committed Oct 28, 2023
1 parent 49de0db commit e917111
Show file tree
Hide file tree
Showing 7 changed files with 3,565 additions and 4,042 deletions.
1,518 changes: 711 additions & 807 deletions batcher/michelson/btctz-vault-ghostnet.tz

Large diffs are not rendered by default.

1,518 changes: 711 additions & 807 deletions batcher/michelson/eurl-vault-ghostnet.tz

Large diffs are not rendered by default.

1,518 changes: 711 additions & 807 deletions batcher/michelson/tzbtc-vault-ghostnet.tz

Large diffs are not rendered by default.

1,518 changes: 711 additions & 807 deletions batcher/michelson/usdt-vault-ghostnet.tz

Large diffs are not rendered by default.

1,518 changes: 711 additions & 807 deletions batcher/michelson/usdtz-vault-ghostnet.tz

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion batcher/utils.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ let send_add_reward
token_id = token_id;
} in
let cb_opt : balance_of_response list contract option = Tezos.get_entrypoint_opt "%balance_response_fa2" callback in
let bo_opt : balance_of_param contract option = Tezos.get_entrypoint_opt "%balance_of" token_addr in
let bo_opt = Tezos.get_entrypoint_opt "%balance_of" token_addr in
match cb_opt,bo_opt with
| None, _ -> failwith unable_to_get_response_entrypoint_from_vault
| _, None -> failwith unable_to_get_balance_of_entrypoint_from_token
Expand Down
15 changes: 9 additions & 6 deletions batcher/vault.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ let assert_balances
let deposit
(deposit_address : address)
(deposited_token : token_amount)
(storage:storage): operation list =
(_storage:storage): operation list =
let treasury_vault = get_vault () in
let deposit_op = Treasury_Utils.handle_transfer deposit_address treasury_vault deposited_token in
let bal_ops = assert_balances storage in
deposit_op :: bal_ops
(* let bal_ops = assert_balances storage in
deposit_op :: bal_ops *)
[ deposit_op ]

[@inline]
let find_liquidity_amount
Expand Down Expand Up @@ -159,9 +160,9 @@ let remove_liquidity_from_market_maker
let treasury_vault = get_vault () in
let tok_ops = Treasury_Utils.transfer_holdings treasury_vault holder tam in
let vault_holdings = VaultHoldings.remove holder storage.vault_holdings in
let bal_ops = assert_balances storage in
let trans_ops: operation list =if unclaimed_tez > 0mutez then tez_op :: tok_ops else tok_ops in
let ops = concatlo trans_ops bal_ops in
(* let bal_ops = assert_balances storage in *)
let ops: operation list =if unclaimed_tez > 0mutez then tez_op :: tok_ops else tok_ops in
(* let ops = concatlo trans_ops bal_ops in *)
let storage = { storage with vault_holdings = vault_holdings; } in
(ops, storage)

Expand Down Expand Up @@ -365,6 +366,7 @@ type entrypoint =
| Claim
| AddReward of tez
| InjectLiquidity of liquidity_injection_request
| AssertBalances
| Balance_response_fa2 of balance_of_response
| Balance_response_fa12 of nat
| Change_admin_address of address
Expand All @@ -384,6 +386,7 @@ let main
(* MarketMaker endpoints *)
| InjectLiquidity lir -> Vault.inject_liquidity lir storage
(* Balance endpoints *)
| AssertBalances -> (Vault.assert_balances storage, storage)
| Balance_response_fa2 r -> Vault.process_balance_response_fa2 r storage
| Balance_response_fa12 r -> Vault.process_balance_response_fa12 r storage
(* Admin endpoints *)
Expand Down

0 comments on commit e917111

Please sign in to comment.