Inspired by @ryanberckmans (twitter account): deposit (stake) capital against a petition
The goal is to build a canonical place for users to provide feedback to corporations and institutions by voting with their money. This project allows anyone to permissionlessly create petitions, and users can support the petitions by voting with their funds or without funds.
The DePetition project benefits from the UUPS upgradeable pattern and contains three main contracts:
-
Proxy contract The proxy contract, which is 'DePetitionProxy.sol', is a home for strorage variables on the implementation contract and also handles the proxy logic.
-
Ledger contract Our upgradeable contract is 'PetitionLedgerImpl', which is responsible for managing the funds that people send to support a petition, as well as upgrade logic. Notice that per upgrade, the 'VERSION' variable should be increased by one, and updating it with '2**64 - 1' will make the contract nonupgradeable forever.
-
Petition contract The petition contract, which is 'Petition.sol', will be deployed by the ledger contract through the 'deployNewPetition function' at the same deterministic address with the same given salt on every EVM compatible chain. This contract has a third-party owner, which is the petition creator, which is different for each petition. Funds will be managed by the PetitionLedgerImpl contract, which the third party (petition owner) has no influence over.
-
Go to the proxy address here invoke the deployNewPetition function (the argument salt is an arbitrary number). If it succeeds, it will return the address for your petition. You are the petition creator!
-
The petition supporter can support the petition you've created by sending funds via 'the'signWithToken' and 'signWithETH' functions, or no funds by simply invoking 'signWithNoFund'.
-
for signWithToken: mint TST1 and TST2 as test token and approve proxy address the amount you want to support.
-
You can withdraw your funds through 'withdrawETH' and 'withdrawToken' whenever you want.
-
Users are able to deposit any token on any chain.
-
Contract should be deployed on all chains at the same address.
-
The frontend UI aggregates all petitions and token balances on any chain into a single petition system.
- featuring the contract with an NFT that has three levels (gold, silver, and bronze) based on how long the supporter staked the coin or how many coins.