1 stable release

1.2.2 Jan 24, 2024

#5 in #cw1

Download history 158/week @ 2024-11-13 135/week @ 2024-11-20 52/week @ 2024-11-27 74/week @ 2024-12-04 98/week @ 2024-12-11 53/week @ 2024-12-18 11/week @ 2024-12-25 37/week @ 2025-01-01 40/week @ 2025-01-08 29/week @ 2025-01-15 22/week @ 2025-01-22 32/week @ 2025-01-29 30/week @ 2025-02-05 21/week @ 2025-02-12 27/week @ 2025-02-19 35/week @ 2025-02-26

122 downloads per month
Used in 3 crates

Apache-2.0

8KB
64 lines

CW1 Spec: Proxy Contracts

CW1 is a specification for proxy contracts based on CosmWasm. It is a very simple, but flexible interface designed for the case where one contract is meant to hold assets (or rights) on behalf of other contracts.

The simplest example is a contract that will accept messages from the creator and resend them from its address. Simply by making this transferable, you can then begin to transfer non-transferable assets (eg. staked tokens, voting power, etc).

You can imagine more complex examples, such as a "1 of N" multisig, or conditional approval, where "sub-accounts" have the right to spend a limited amount of funds from this account, with a "admin account" retaining full control.

The common denominator is that they allow you to immediately execute arbitrary CosmosMsg in the same transaction.

Messages

Execute{msgs} - This accepts Vec<CosmosMsg> and checks permissions before re-dispatching all those messages from the contract address. It emits the following attributes:

Key Value
"action" "execute"
"owner" [msg sender]

Queries

CanExecute{sender, msg} - This accepts one CosmosMsg and checks permissions, returning true or false based on the permissions. If CanExecute returns true then a call to Execute from that sender, with the same message, before any further state changes, should also succeed. This can be used to dynamically provide some client info on a generic cw1 contract without knowing the extension details. (eg. detect if they can send coins or stake)

Dependencies

~3.5–5.5MB
~121K SLoC