Tiago Carvalho 33e969ad5d Allow-Block list token (#399) hai 2 meses
..
anchor 33e969ad5d Allow-Block list token (#399) hai 2 meses
public 33e969ad5d Allow-Block list token (#399) hai 2 meses
scripts 33e969ad5d Allow-Block list token (#399) hai 2 meses
src 33e969ad5d Allow-Block list token (#399) hai 2 meses
.gitignore 33e969ad5d Allow-Block list token (#399) hai 2 meses
.prettierignore 33e969ad5d Allow-Block list token (#399) hai 2 meses
.prettierrc 33e969ad5d Allow-Block list token (#399) hai 2 meses
README.md 33e969ad5d Allow-Block list token (#399) hai 2 meses
components.json 33e969ad5d Allow-Block list token (#399) hai 2 meses
eslint.config.mjs 33e969ad5d Allow-Block list token (#399) hai 2 meses
next.config.ts 33e969ad5d Allow-Block list token (#399) hai 2 meses
package.json 33e969ad5d Allow-Block list token (#399) hai 2 meses
postcss.config.mjs 33e969ad5d Allow-Block list token (#399) hai 2 meses
tsconfig.json 33e969ad5d Allow-Block list token (#399) hai 2 meses

README.md

AllowBlockList Token

An example of a allow / block list token using token extensions.

Features

Allows the creation of an allow block list with a list authority. The allow/block list is then consumed by a transfer-hook.

The list is managed by a single authority and can be used by several token mints. This enables a separation of concerns between token management and allow/block list management, ideal for scenarios where an issuer wants a 3rd party managed allow/block list or wants to share the same list across a group of assets.

Initializes new tokens with several configuration options:

  • Permanent delegate
  • Allow list
  • Block list
  • Metadata
  • Authorities

The issuer can configure the allow and block list with 3 distinct configurations:

  • Force Allow: requires everyone receiving tokens to be explicitly allowed in
  • Block: allows everyone to receive tokens unless explicitly blocked
  • Threshold Allow: allows everyone to receive tokens unless explicitly blocked up until a given transfer amount threshold. Transfers larger than the threshold require explicitly allow

These configurations are saved in the token mint metadata.

This repo includes a UI to manage the allow/block list based on the legacy-next-tailwind-basic template. It also allows creating new token mints on the spot with transfer-hook enabled along with token transfers given that most wallets fail to fetch transfer-hook dependencies on devnet and locally.

Setup

Install dependencies: yarn install

Compile the program: anchor build

Compile the UI: yarn run build

Serve the UI: yarn run dev

Local testing

There are a couple scripts to manage the local validator and deployment.

To start the local validator and deploy the program: ./scripts/start.sh

To stop the local validator: ./scripts/stop.sh