Crates.io | gfx-swap |
lib.rs | gfx-swap |
version | 0.1.0 |
source | src |
created_at | 2021-11-16 22:22:39.535646 |
updated_at | 2021-11-16 22:22:39.535646 |
description | gfx-swap is an anchor re-implement of the token-swap program in solana-program-library. |
homepage | |
repository | https://github.com/GooseFX1/gfx-swap |
max_upload_size | |
id | 483020 |
size | 275,113 |
This is a re-implement of the swap program in solana-program-library https://github.com/solana-labs/solana-program-library/tree/master/token-swap.
This repo is audited by Halborn. The auditing report is under audit/GooseFX_Swap_Program_Security_Audit_Report_Halborn_Final.pdf
For how to call this contract, please take a look at the examples and the tests.
.env
fileRUST_BACKTRACE=1
RUST_LOG=gfx_swap=info
TOKEN_A=2uig6CL6aQNS8wPL9YmfRNUNcQMgq9purmXK53pzMaQ6
TOKEN_B=8FUPzLY58ojDaj5yh1MKwyJnGNhCDMbStbHNVkBQ9KjJ
ADMIN_WALLET="~/.config/solana/id.json"
USER_WALLET="~/.config/solana/id.json"
You might want to provide different addresses for TOKEN_A and TOKEN_B.
Run just keygen gfx-swap
.
Run just deploy gfx-swap --features ci
.
Run just cli create_pool
.
create_pool
will create the associated token account (ATA) for USER_WALLET
.
This command will print out a bunch of information, in which you need to write down the seed into .env. The seed is a unique identifier to the pool.
Run just cli pool_status
.
This will print out a snapshot of the current pool status.
You can combine it with the watch
command, i.e. watch just cli pool_status
to constantly monitor the pool.
Run just cli deposit2 --lp-amount <amount>
.
This basically askes the pool I'd like to get <amount> LP tokens and you can deduct some amount of token A and B from my wallet for that.
Run just cli withdraw2 --lp-amount <amount>
.
This is the inverse operation to the deposit
command.
Run just cli swap --swap-in A --amount <amount>
.
This swaps in some token A for some token B.