Skip to content

Commit

Permalink
Adjusted vault process response
Browse files Browse the repository at this point in the history
  • Loading branch information
glottologist committed Oct 30, 2023
1 parent fa03d3d commit ff06943
Show file tree
Hide file tree
Showing 8 changed files with 577 additions and 569 deletions.
225 changes: 113 additions & 112 deletions batcher/michelson/btctz-vault-ghostnet.tz

Large diffs are not rendered by default.

225 changes: 113 additions & 112 deletions batcher/michelson/eurl-vault-ghostnet.tz

Large diffs are not rendered by default.

225 changes: 113 additions & 112 deletions batcher/michelson/tzbtc-vault-ghostnet.tz

Large diffs are not rendered by default.

225 changes: 113 additions & 112 deletions batcher/michelson/usdt-vault-ghostnet.tz

Large diffs are not rendered by default.

225 changes: 113 additions & 112 deletions batcher/michelson/usdtz-vault-ghostnet.tz

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions batcher/types.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,10 @@ type balance_of_response =
balance : nat;
}

type balance_of_responses = balance_of_response list

type balance_of =
[@layout:comb] {
requests : balance_request list;
callback : balance_of_response contract;
callback : balance_of_response list contract;
}

2 changes: 1 addition & 1 deletion batcher/utils.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ let entrypoints_exist
token_id = token_id;
} in
let bo_opt: balance_of contract option = Tezos.get_entrypoint_opt "%balance_of" token_addr in
let cb_opt: balance_of_response contract option = Tezos.get_entrypoint_opt "%balance_response_fa2" callback in
let cb_opt: balance_of_response list contract option = Tezos.get_entrypoint_opt "%balance_response_fa2" callback in
match cb_opt,bo_opt with
| None, _ -> failwith unable_to_get_balance_response_fa2_entrypoint_from_vault
| _, None -> failwith unable_to_get_balance_of_entrypoint_from_fa2_token
Expand Down
14 changes: 8 additions & 6 deletions batcher/vault.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,15 @@ let process_balance_response_fa12

[@inline]
let process_balance_response_fa2
(r: balance_of_response)
(rs: balance_of_response list)
(storage:storage): result =
let token_contract = Tezos.get_sender () in
let amount = r.balance in
let token_id = r.request.token_id in
let storage = update_native_token_balance token_contract amount token_id storage in
let storage = update_foreign_token_balances token_contract amount token_id storage in
let process_responses (s,r:storage * balance_of_response):storage =
let amount = r.balance in
let token_id = r.request.token_id in
let s = update_native_token_balance token_contract amount token_id s in
update_foreign_token_balances token_contract amount token_id s in
let storage = List.fold process_responses rs storage in
no_op storage

end
Expand All @@ -374,7 +376,7 @@ type entrypoint =
| AddReward of tez
| InjectLiquidity of liquidity_injection_request
| AssertBalances
| Balance_response_fa2 of balance_of_response
| Balance_response_fa2 of balance_of_responses
| Balance_response_fa12 of nat
| Change_admin_address of address
| Change_batcher_address of address
Expand Down

0 comments on commit ff06943

Please sign in to comment.