Skip to content

Commit 5a73747

Browse files
committed
Update zilswap pool contract
1 parent 60abc8b commit 5a73747

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/zilswap-v2/contracts/ZilSwapPool.scilla

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,12 @@ let unsafe_pow_in_precision =
199199
fun (k: Uint256) =>
200200
let z_in_precision = get_z_in_precision x_in_precision k in
201201

202-
let m = Uint32 128 in
203-
let m_nat = u32_to_nat_or_zero m in (* max no of loops is fixed at 128 times *)
202+
let m = Uint32 256 in
203+
let m_nat = u32_to_nat_or_zero m in (* max no of loops is fixed at 256 times *)
204204

205205
let xz_pair = Pair {Uint256 Uint256} x_in_precision z_in_precision in
206-
let init_pair = Pair {Uint256 (Pair Uint256 Uint256)} k xz_pair in
206+
let k_divided_by_2 = builtin div k two_u256 in
207+
let init_pair = Pair {Uint256 (Pair Uint256 Uint256)} k_divided_by_2 xz_pair in
207208

208209
let foldk = @nat_foldk (Pair Uint256 (Pair Uint256 Uint256)) in (* k (Pair x_in_precision z_in_precision) *)
209210
let iter =
@@ -221,7 +222,7 @@ let unsafe_pow_in_precision =
221222
let new_k = builtin div k two_u256 in
222223
let inter_x_in_precision = builtin mul x_in_precision x_in_precision in
223224
let new_x_in_precision = builtin div inter_x_in_precision precision in
224-
let mod = builtin rem new_k two_u256 in
225+
let mod = builtin rem k two_u256 in
225226
let is_odd = builtin eq mod one_u256 in
226227
match is_odd with
227228
| False =>
@@ -963,7 +964,7 @@ transition Mint(to : ByStr20)
963964
Update is_amp_pool data;
964965
UpdateLastK is_amp_pool data;
965966

966-
e = {_eventname: "PoolMinted"; minter: _sender; amount0: amount0; amount1: amount1};
967+
e = {_eventname: "PoolMinted"; minter: _origin; router: _sender; amount0: amount0; amount1: amount1; liquidity: liquidity};
967968
event e
968969
end
969970
end
@@ -1052,7 +1053,7 @@ transition Burn()
10521053
Update is_amp_pool data;
10531054
UpdateLastK is_amp_pool data;
10541055

1055-
e = {_eventname: "PoolBurnt"; burner: _sender; amount0: amount0; amount1: amount1};
1056+
e = {_eventname: "PoolBurnt"; burner: _origin; router: _sender; amount0: amount0; amount1: amount1; liquidity: liquidity};
10561057
event e
10571058
end
10581059

0 commit comments

Comments
 (0)