hats-finance / Tokemak-0x4a2d708ea6b0c04186ecb774cfad1e50fb5efc0b

0 stars 0 forks source link

Audit Competition for Tokemak

This repository is for the audit competition for the Tokemak. To participate, submit your findings only by using the on-chain submission process on https://app.hats.finance/vulnerability .

How to participate

Github Actions Foundry semantic-release: conventional commits protected by: gitleaks License: MIT

Contracts for the Tokemak Autopilot System Details on the system can be found here.

Getting Started

Install the same version of foundry that the CI will use. Ensures formatting stays consistent

 foundryup --version nightly-293fad73670b7b59ca901c7f2105bf7a29165a90

From there:

npm install

Additional setup info:

Glossary

Some common terms that are used in our documentation:

System Overview

There are many pieces to the system, but they can largely be broken down and thought of as smaller subsystems. We will try to break them down here, explore them piece by piece, and look at the system from the view of various actors.

End-Users View

A user will largely only interact with the Router directly (the exception being rewards+staking) The Router includes safety and convenience methods for interacting with the ERC4626 compatible Autopilot Vaults. From a safety perspective, this includes slippage-based variants of deposit/mint/redeem/withdraw(), and for migrating between vaults, redeemToDeposit().

basic user flow

The only time a user should be interacting with the vault directly is when claiming rewards. Each Autopilot Vault has a Rewarder paired to it. The main reward token for every Autopilot Rewarder is TOKE. We expect that additional reward tokens will be added later. A user can claim directly from the Rewarder or through the Autopilot Vault itself

basic user flow

Upon claiming from the Rewarder, regardless of how, the path those reward tokens take depend on what they are. If the rewarder token is TOKE, then it is goes into accToke to be unlocked at a later point. Any other reward token is sent directly to the user. Once the lock is up, the user may go to the accToke contract and pick up their tokens.

basic user flow

System View

The entire system revolves around a single contract, the SystemRegistry. This is the contract that ties all other contracts together and from this contract we should be able to enumerate every other contract in the system. A registry of registries almost. It is our plan that there will be multiple "Systems" running concurrently on the same chain. One for ETH based assets, LSTs and such. Another for USD stable-coins. Etc. Given the configuration complexity of these contracts, having a central reference that two contracts must agree upon will save in accidental mis-configurations down the line.

The System Registry can be thought of holding two types of references: supporting contracts, sub-system entry points:

basic user flow

For a new contract to be configured in the system, it only needs to be given a reference to the SystemRegistry. The subsystem entry points would be

Readmes should be available in the folders of those areas