Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions contracts/partials/TTMethodDex.ligo
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ function initialize_exchange(
params.pair.token_b_type
) # operations;
}
| Swap(n) -> skip
| Invest(n) -> skip
| Divest(n) -> skip
| Swap(_) -> skip
| Invest(_) -> skip
| Divest(_) -> skip
end
} with (operations, s)

Expand Down Expand Up @@ -350,7 +350,7 @@ function token_to_token_route(
block {
var operations: list(operation) := list[];
case p of
| AddPair(n) -> skip
| AddPair(_) -> skip
| Swap(params) -> {
if s.entered
then failwith("Dex/reentrancy")
Expand Down Expand Up @@ -431,8 +431,8 @@ function token_to_token_route(
end;
operations := last_operation # operations;
}
| Invest(n) -> skip
| Divest(n) -> skip
| Invest(_) -> skip
| Divest(_) -> skip
end
} with (operations, s)

Expand All @@ -445,8 +445,8 @@ function invest_liquidity(
block {
var operations: list(operation) := list[];
case p of
| AddPair(n) -> skip
| Swap(n) -> skip
| AddPair(_) -> skip
| Swap(_) -> skip
| Invest(params) -> {
if s.entered
then failwith("Dex/reentrancy")
Expand Down Expand Up @@ -539,7 +539,7 @@ function invest_liquidity(
params.pair.token_b_type
) # operations;
}
| Divest(n) -> skip
| Divest(_) -> skip
end
} with (operations, s)

Expand All @@ -551,9 +551,9 @@ function divest_liquidity(
block {
var operations: list(operation) := list[];
case p of
| AddPair(token_amount) -> skip
| Swap(n) -> skip
| Invest(n) -> skip
| AddPair(_) -> skip
| Swap(_) -> skip
| Invest(_) -> skip
| Divest(params) -> {
if s.entered
then failwith("Dex/reentrancy")
Expand Down
12 changes: 4 additions & 8 deletions contracts/partials/TTMethodFA2.ligo
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
(* Helper function to get allowance for an account *)
function get_allowance (const owner_account : account_info; const spender : address; const s : dex_storage) : bool is
owner_account.allowances contains spender

(* Perform transfers from one owner *)
[@inline] function iterate_transfer (const s : dex_storage; const user_trx_params : transfer_param) : dex_storage is
block {
Expand Down Expand Up @@ -84,16 +80,16 @@ function transfer (const p : token_action; var s : dex_storage; const this : add
| ITransfer(params) -> {
s := List.fold(iterate_transfer, params, s);
}
| IBalance_of(params) -> skip
| IUpdate_operators(params) -> skip
| IBalance_of(_) -> skip
| IUpdate_operators(_) -> skip
end
} with (operations, s)

function get_balance_of (const p : token_action; const s : dex_storage; const this : address) : return is
block {
var operations: list(operation) := list[];
case p of
| ITransfer(params) -> skip
| ITransfer(_) -> skip
| IBalance_of(balance_params) -> {
(* Perform single balance lookup *)
function look_up_balance(const l: list (balance_of_response); const request : balance_of_request) : list (balance_of_response) is
Expand All @@ -112,7 +108,7 @@ function get_balance_of (const p : token_action; const s : dex_storage; const th
const accumulated_response : list (balance_of_response) = List.fold(look_up_balance, balance_params.requests, (nil: list(balance_of_response)));
operations := list[Tezos.transaction(accumulated_response, 0mutez, balance_params.callback)];
}
| IUpdate_operators(params) -> skip
| IUpdate_operators(_) -> skip
end
} with (operations, s)

Expand Down