Ragequit redemption for all accounts. Developed and deployed as the Ragequitter solidity singleton.
V1 Deployment: 0x0000000000008743D388E5279B2A9EF87A3115Ae
Let's say you have a Gnosis Safe or smart account or DAO treasury. And you want to make it so people can take tokens out of your account without a proposal by burning other tokens ("redemption", and those other tokens, "loot"). The classic use case of this is the "Moloch DAO ragequit", which is a game theory mechanism that serves trustless crowdfunding ("tribute") by guaranteeing contributors that they can always get their share of tribute back if they burn loot.
Such moloch-style ragequit functionality can be extended to a variety of contract accounts today (and in the near future, even EOAs via EIP-3074) as a module through a singleton contract instance that serves to route token approvals and redemptions based on basic "fair share" (muldiv) math (basically, your '%' of total loot supply should equate to the '%' of assets you can claim).
How? Well, most account contracts are usually capable of executing arbitrary logic and calldata payloads approved by their owners. One such logic is to make an ERC20 token approval that gives another account the right to spend tokens on their behalf (up to a certain capped amount that is always ultimately adjustable by the approving account). Within this standard and delegation practices, accounts can similarly leverage Ragequitter
by giving it token approvals up to amounts they want to attribute as ragequittable by their loot holders (these approvals effectively fill the potential array of assets
subject to ragequit
). Loot shares are then able to minted and burned remotely by such parent accounts to grant the right to claim approved assets
. A timespan can also be adjusted for ragequit redemption windows (see, Settings
). When loot holders want to claim such tokens (and within such settings), they call ragequit
on Ragequitter
and their fair share of assets are pulled from the parent account and into theirs. The relevant account loot shares are then burned and the total supply of loot is also adjusted to reflect each redemption (where each loot id
is just the number cast of the account
as uint256(uint160(account))
).
The ERC6909 minimal multitoken standard is used to represent loot shares and handle their accounting and event logs. Loot is optionally transferable and non-transferable with the ability to include arbitrary conditions and logic through the extension of authority
contracts attributed to each account's general Metadata
hosted in Ragequitter
.
Run: curl -L https://foundry.paradigm.xyz | bash && source ~/.bashrc && foundryup
Build the foundry project with forge build
. Run tests with forge test
. Measure gas with forge snapshot
. Format with forge fmt
.
Contracts will be tested and gas measured on every push and pull request.
You can edit the CI script in .github/workflows/ci.yml.
lib
├─ account — https://github.com/NaniDAO/accounts
├─ forge-std — https://github.com/foundry-rs/forge-std
├─ solady — https://github.com/vectorized/solady
src
├─ Ragequitter — Ragequitter Contract
test
└─ Ragequitter.t - Test Ragequitter Contract
These smart contracts and testing suite are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of anything provided herein or through related user interfaces. This repository and related code have not been audited and as such there can be no assurance anything will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.
See LICENSE for more details.