CW20 Clawback


Bitcoin Vaults with covenants and some internal discussions.

What it does

It's a prototype contract code for "clawbacks" of native and CW20 tokens. A clawback works as follows:

  • There is a "holder" key/account, a "backup" key/account, and a "clawback period" (which determines when the clawback expires).
  • Within a "clawback period", "holder" can transfer to "holders" / other clawbacks (provided their terms match the outgoing contract: they have the same "backup", "clawback period" is at least as long, and they support the same tokens) or refresh the clawback duration. After the clawback period expires, "holder" can withdraw the tokens.
  • Within a "clawback period", "backup" can transfer to other holder, refresh the clawback duration or burn the tokens / destroy the contract.

Check out README or see this simplified explanation in Google Slides for more information.

How I built it

With CosmWasm and Rust!

Challenges I ran into

Getting the hang of CosmWasm + time management for other higher priority responsibilities outside the hackathon.

Accomplishments that I'm proud of

It's fairly productive to write smart contracts in Rust.

What I learned

CosmWasm's architecture and tooling.

What's next for CW20 Clawback

Depending on the feedback, there are two possible routes to take:

  1. "native" module: write ADR + implementation for adding account types with this behaviour to Cosmos SDK;
  2. CosmWasm contract improvements: e.g. burning to deposit tokens to the community pool.

Built With

  • cosmwasm
  • cw20
  • rust
  • webassembly
Share this project: