Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hoakbuilds/ctw-token
Confidential Transfers Wrapped Token Program
https://github.com/hoakbuilds/ctw-token
anchor-lang program rust-lang smart-contract solana spl-token spl-token-2022
Last synced: 4 months ago
JSON representation
Confidential Transfers Wrapped Token Program
- Host: GitHub
- URL: https://github.com/hoakbuilds/ctw-token
- Owner: hoakbuilds
- Created: 2024-03-02T04:14:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-09T22:30:23.000Z (11 months ago)
- Last Synced: 2024-04-19T04:13:44.242Z (10 months ago)
- Topics: anchor-lang, program, rust-lang, smart-contract, solana, spl-token, spl-token-2022
- Language: Rust
- Homepage:
- Size: 223 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Confidential Transfer Wrapped Token Program (CTW Token)
This repository contains a Solana program built with the new SPL Token Extensions, the goal is to give users the ability to perform Confidential Transfers on SPL Token Mints OR SPL Token Extensions Mints which do not have the Confidential Transfers Extension, along with a CLI and a small TS SDK to help potential integrations.
## Program
The program features only three instructions:
- Initialize
- This permissionless instruction allows creating a CTW Mint for any given SPL Token Mint
- All CTW Token Mints have the same number of decimals as their SPL Token Mint counterpart
- The freeze authority of the existing SPL Token Mint is COPIED over to the CTW Mint, meaning if it is set it will also be set on the new Mint
- Wrap
- This instruction allows wrapping a given amount of an SPL Token Mint OR SPL Token Extensions Mint for the corresponding amount of the equivalent CTW Mint
- An initialized and configured Confidential Transfer Account (CTA) must be passed in
- The given amount of SPL Token is transferred from the user's Legacy Token Account into the program's vault and an equivalent amount of the CTW Token is minted into the public component of the CTA and instantly deposited
- Integrators still need to execute `ApplyPendingBalance` after calling this instruction
- Unwrap
- This instruction allows unwrapping a given amount of a CTW Mint for the corresponding amount of the equivalent SPL Token Mint
- A CTA with enough balance in it's public component must be passed in
- The given amount of CTW Token is burned by the program and an equivalent amount of the SPL Token Mint is transferred from the program's vault into the user's Legacy Token Account
- Integrators may need to execute `Withdraw` and `VerifyWithdraw` beforehand to guarantee the previous point## Notes
- The program is currently unable to be used in any of the clusters due to `zk-token-proof` not being present.
- In order to successfully test the program using `solana-program-test`, the SPL Token Extensions Program had to be built locally with the `zk-ops` feature enabled and the output was used to override the `spl_token_2022` program available.## Tests
In order to run the tests with `solana-program-test`:
`cargo test-bpf --features client`