Giter Site home page Giter Site logo

ctw-token's Introduction

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

ctw-token's People

Contributors

hoakbuilds avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.