56 releases (6 stable)

2.0.0 Mar 26, 2024
1.1.2 Nov 23, 2023
1.1.0 Jun 19, 2023
1.0.1 Dec 19, 2022
0.3.2 Oct 28, 2020

#815 in Magic Beans

Download history 335/week @ 2024-04-22 257/week @ 2024-04-29 241/week @ 2024-05-06 180/week @ 2024-05-13 248/week @ 2024-05-20 765/week @ 2024-05-27 1448/week @ 2024-06-03 1493/week @ 2024-06-10 1667/week @ 2024-06-17 1798/week @ 2024-06-24 1052/week @ 2024-07-01 1678/week @ 2024-07-08 1194/week @ 2024-07-15 1033/week @ 2024-07-22 801/week @ 2024-07-29 643/week @ 2024-08-05

3,715 downloads per month
Used in 31 crates (4 directly)

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–7MB
~142K SLoC