Repository for a governance upgrade which includes a registry for relayer registration and staking mechanisms for the torn token.
- Anyone can become a relayer by staking TORN into Registry contract.
- Minimum stake is governed by the Governance.
- Each Pool has its own fee % which is also set by the Governance.
- On every withdrawal via relayer, the relayer has to pay the Tornado Pool fee in TORN. The fee is deducted from his staked balance.
- All collected fees are stored into StakingReward contract.
- Any TORN holder can stake their TORN into Governance contract like they were before, but earning fees proportionately to their stake.
Caveats: Anyone can trigger price oracle update in order to adjust the calculation of how much TORN should be deducted. It uses Uniswap V3 TWAP oracle model.
git clone --recurse-submodules https://github.com/Tisamenus/tornado-relayer-registry.git
cd tornado-relayer-registry
yarn
cp .env.example .env
yarn test
This will be a top-down look on the architecture.
The governance proposal, which if executed by some party, should upgrade governance to a new version and initialize the data of all of the contracts which require data initalization outside of their construction scope.
This is for: 1. circular dependencies (one contract receives and address at construction while the other needs to register it if not being deployed by it) 2. community decided and other hardcoded parameters for regular contract functioning, 3. other necessary actions such as initializations for proxies.
This contract is not called directly and instead only the logic is used by a contract that calls it (governance). Thus, if delegatecalled, the calling contract communicates with:
- The Relayer Registry.
- The old Tornado Proxy.
- The new Tornado Proxy (TornadoProxyRegistryUpgrade).
- The Trees Contract.
This contract should store the data of each relayer, including their balance, which should be burned on withdrawals. It also stores any addresses the relayer decides to register under its own master address. When a withdrawal happens the contract decrements a relayers balance and calls the staking contract to increment the rewards.
Communicates with:
- The new Tornado Proxy.
- The Staking contract.
- The Governance contract.
- Relayers and user accounts.
This contract should upgrade the Tornado Proxy to include the following functionalities:
- Updating rewards for individual stakers on lock and unlock.
- Storing and updating the fee balance of relayers registered in the relayer registry.
- Starting the burn procedure on relayer withdrawal.
- All legacy proxy functionality.
Communicates with:
- The Relayer Registry.
- The Governance contract.
- The Pool Fee Calculator.
- Relayers and user accounts
This is an upgradeable contract which should calculate the correct fee for tornado pool withdrawals. This is contract will be deployed behind a proxy thus making logic upgradeable.
Communicates with:
- The new Tornado Proxy.
This contract should store relayer-staked torn and distribute it (update rewards) to accounts which have locked torn in governance. Each time a relayer withdraws, the amount of torn burned is added as rewards according to the SNX logic. Any account can then withdraw.
Communicates with:
- The Relayer Registry.
- The Governance Contract;
- User accounts.