Skip to content

Feat/dex modification#214

Open
Raziievskyi-Illia wants to merge 13 commits intoStableTechnologies:trunkfrom
Raziievskyi-Illia:feat/dex_modification
Open

Feat/dex modification#214
Raziievskyi-Illia wants to merge 13 commits intoStableTechnologies:trunkfrom
Raziievskyi-Illia:feat/dex_modification

Conversation

@Raziievskyi-Illia
Copy link
Copy Markdown
Contributor

Updated DEX Contracts — Testing Report

Overview

This report documents the manual testing of updated DEX smart contracts deployed on Shadownet (Tezos testnet). The pool was deployed using the updated deployment script (FA2 token standard), and the following scenarios were verified.


Deployed Contracts

Contract Address
Pool KT1L8ugtefoFLWEeK8N3DhUbeRBTA5GmXGbu
LQT Token KT1KerNiDTW74ft9wBZTGzMa1jXfaoEhTdPz

The pool was deployed using the updated deployment script with an FA2 token, validating the script's correctness.


✅ Test Cases

1. View: quote_tez_to_token

Called the view with 1,000,000 mutez (1 XTZ) as input.

Value
Input 1,000,000 mutez (1 XTZ)
View result 352,264 tokens
image

Verification swap: ooBFjRitZw79KC...

✅ The actual swap output matched the view result exactly.


2. View: quote_token_to_tez

Called the view with 1,000,000 tokens as input.

Value
Input 1,000,000 tokens
View result 2,679,927 mutez
image

Verification swap: onwtHscw7Ywk...

✅ The actual swap output matched the view result exactly.


3. Accumulated Protocol Fee Verification

Three swaps were performed in total. The accumulated fees were verified against the expected values based on the configured fee rate of 100 bps (1%).

XTZ Fee Accumulation

Swap Amount In Expected Fee (1%) Accumulated
Swap 1 499,999 mutez 4,999 mutez 4,999 mutez
Swap 2 1,000,000 mutez (1 XTZ) 10,000 mutez 14,999 mutez

Token Fee Accumulation

Swap Amount In Expected Fee (1%) Accumulated
Swap 3 1,000,000 tokens 10,000 tokens 10,000 tokens

✅ Both accumulated_protocol_fee_xtz = 14,999 and accumulated_protocol_fee_token = 10,000 matched the expected values.


4. Protocol Fee Withdrawal — Access Control

Fee recipient address: tz1LuVooxD45DLjJfdu4CqySCyoRM9MH8AYu

4a. Unauthorized Withdrawal Attempt

An attempt was made to withdraw fees from a different address (non-recipient).

image

The transaction failed with error code 39, as defined in the contract:

[@inline] let error_ONLY_RECIPIENT_CAN_CLAIM_PROTOCOL_FEE = 39n

✅ Access control is working correctly — only the designated recipient can claim fees.

4b. Authorized XTZ Fee Withdrawal

Withdrawal performed from the correct recipient address:

🔗 onwhD137G19A...

✅ Transaction succeeded. accumulated_protocol_fee_xtz reset to 0.

image

4c. Authorized Token Fee Withdrawal

🔗 opPHcPVxNtFN...

✅ Transaction succeeded. accumulated_protocol_fee_token reset to 0.

image

5. Fee Recipient Update

The fee recipient address was updated via admin:

🔗 oo9mcvVckKu6...

After performing an additional swap to make fees non-zero, an attempt was made to withdraw from the old recipient address (which is also the contract admin).

The call failed with error 39 — the old address no longer has the right to claim fees after the recipient update.

Withdrawal with the new recipient address succeeded:

🔗 ooz31T3mBQfH...

✅ Fee recipient update works correctly. Old recipient loses access, new recipient can claim.


6. Fee Rate Update

The protocol fee was updated from 100 bps (1%) to 50 bps (0.5%):

🔗 oouCqfAc57kB...

A swap of 1 XTZ was performed after the update.

Before update (1%) After update (0.5%)
Fee from 1 XTZ swap 10,000 mutez 5,000 mutez
image

✅ The fee rate update works correctly. The new fee is applied to subsequent swaps immediately.


📋 Summary

Test Case Result
Deployment with updated script (FA2) ✅ Pass
quote_tez_to_token view accuracy ✅ Pass
quote_token_to_tez view accuracy ✅ Pass
Protocol fee accumulation (XTZ) ✅ Pass
Protocol fee accumulation (Token) ✅ Pass
Unauthorized fee withdrawal rejected ✅ Pass
Authorized XTZ fee withdrawal ✅ Pass
Authorized Token fee withdrawal ✅ Pass
Fee recipient update ✅ Pass
Old recipient loses access after update ✅ Pass
Fee rate update (1% → 0.5%) ✅ Pass

All test cases passed successfully. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant