UPDATE: Checkpoint 2 Update
First let’s recall the goals of Checkpoint 2:
UDTswap’s UX/UI MVP model, Test case, and documents were released at this checkpoint.
UDTswap UX/UI:
UDTswap’s overall UX/UI has been made familiar to existing swap users, so you can proceed with swap without learning.
Swap:
Send:
Pool(Add):
Pool (Remove):
Pool (Create):
Documents:
In the documentation, you can see the basic introduction of the basic UDTswap, technical specification, script architecture, and User Defined Token Listing form.
Documents:https://docs.udtswap.io/
Test case
We created swap, pool(add/remove/create), multiple pool swap test cases for CKB/UDT pair and UDT/UDT pair to test scripts and functions of UDTswap. If you want to see the contents of this, please refer to GitHub.
Src:
https://github.com/bannplayer/UDTswap/tree/master/src
Test:
https://github.com/bannplayer/UDTswap/tree/master/test
Prerequisite
- local testnet (private) node rpc endpoint
- 1 account for deploying UDTswap scripts
- 2 accounts for minting test UDT
- 1 account for testing (all accounts should have enough ckb)
How to test
Compile
sudo docker run --rm -it -vpwd:/code nervos/ckb-riscv-gnu-toolchain:xenial bashcd /code/UDTswap_scriptsriscv64-unknown-elf-gcc -c bn.car rc libbn.a bn.oriscv64-unknown-elf-gcc -o UDTswap_udt_based UDTswap_udt_based.c -L ./ -lbn
- Execute 3. 4. only once
- Execute 5. with same name for all scripts (test_udt.c, UDTswap_liquidity_UDT_udt_based.c, UDTswap_lock_udt_based.c, UDTswap_udt_based.c)
Deploy
npm install- Change
skto deploying account’s secret key in ‘/src/udtswap_consts.js’ - Change
nodeUrlto local testnet node rpc endpoint in ‘/src/udtswap_consts.js’ - Compile scripts
node deploy_scripts 0in ‘/test/deploy’- Change
udtswap_type_script_code_hash_buf,udtswap_lock_code_hash_buf,udtswap_liquidity_udt_code_hash_bufto 5. outputs - Compile scripts again
node deploy_scripts 1in ‘/test/deploy’- Change CodeHash, Deps, Type to 5. outputs and 8. outputs
Mint test UDTs
- Change
UDT1Owner,UDT2Owner,skTestingto 2 accounts secret key minting test UDT, 1 account’s secret key testing node deploy_scripts 2in ‘test/deploy’
Test
npm test
We made it easy to test UDTswap thanks to the @harryliu team.




