#allowlist #contract #ibc #messages #admin #execute #neutron

astroport-whitelist

Implementation of proxy contract using a whitelist. Supports general IBC and Neutron IbcTransfer messages

2 stable releases

2.0.0 Jun 20, 2024
1.0.1 Jul 20, 2023

#7 in #neutron

Download history 62/week @ 2024-07-26 94/week @ 2024-08-02 132/week @ 2024-08-09 222/week @ 2024-08-16 202/week @ 2024-08-23 126/week @ 2024-08-30 58/week @ 2024-09-06 41/week @ 2024-09-13 70/week @ 2024-09-20 49/week @ 2024-09-27 88/week @ 2024-10-04 84/week @ 2024-10-11 73/week @ 2024-10-18 59/week @ 2024-10-25 87/week @ 2024-11-01 34/week @ 2024-11-08

267 downloads per month
Used in 4 crates (via cw-it)

Apache-2.0

35KB
602 lines

CW1 Whitelist

This may be the simplest implementation of CW1, an address whitelist registry. It contains a set of admins that are defined upon creation. Any of those admins may Execute any message via the contract, per the CW1 spec.

To make this slightly less minimalistic, you can allow the admin set to be mutable or immutable. If it is mutable, then any admin may (a) change the admin set and (b) freeze it (making it immutable).

While largely an example contract for CW1, this has various real-world use-cases, such as a common account that is shared among multiple trusted devices, or trading an entire account (used as 1 of 1 mutable). Most of the time, this can be used as a framework to build your own, more advanced cw1 implementations.

Allowing Custom Messages

By default, this doesn't support CustomMsg in order to be fully generic among blockchains. However, all types are Generic over T, and this is only fixed in handle. You can import this contract and just redefine your handle function, setting a different parameter to ExecuteMsg, and you can produce a chain-specific message.

Running This Contract

You will need Rust 1.44.1+ with wasm32-unknown-unknown target installed.

You can run unit tests on this via:

cargo test

Once you are happy with the content, you can compile it to wasm via:

RUSTFLAGS='-C link-arg=-s' cargo wasm
cp ../../target/wasm32-unknown-unknown/release/cw1_whitelist.wasm .
ls -l cw1_whitelist.wasm
sha256sum cw1_whitelist.wasm

Or for a production-ready (optimized) build, run a build command in the the repository root: https://github.com/CosmWasm/cw-plus#compiling.

Dependencies

~16MB
~338K SLoC