Skip to content

bgd-labs/stake-token

Repository files navigation

Stake token

New version of the Aave Safety Module stk tokens.

Summary of Changes

The StakeToken is a token deployed on Ethereum, with the main utility of participating in the Aave safety module.

There are currently two proxy contracts which utilize a StakeToken:

The implementation can be found here Together with all the standard ERC20 functionalities, the current implementation includes extra logic for:

  • entering and exiting the safety module
  • management & accounting for safety module rewards
  • management & accounting of voting and proposition power
  • slashing mechanics for slashing in the case of shortfall events

The new iteration of the generic StakeToken is intended for new Deployments only. While it does not alter any core mechanics, the new iteration cleans up numerous historical artifacts.

The main goals here are:

  • simpler inheritance chain
  • cleaner storage layout
  • updated/modernized libraries

Development

This project uses Foundry. See the book for detailed instructions on how to install and use Foundry. The template ships with sensible default so you can use default foundry commands without resorting to MakeFile.

Setup

cp .env.example .env
forge install

Test

forge test

Advanced features

Diffing

For contracts upgrading implementations it's quite important to diff the implementation code to spot potential issues and ensure only the intended changes are included. Therefore the Makefile includes some commands to streamline the diffing process.

Download

You can download the current contract code of a deployed contract via make download chain=polygon address=0x00. This will download the contract source for specified address to src/etherscan/chain_address. This command works for all chains with a etherscan compatible block explorer.

Git diff

You can git-diff a downloaded contract against your src via make git-diff before=./etherscan/chain_address after=./src out=filename. This command will diff the two folders via git patience algorithm and write the output to diffs/filename.md.

Caveat: If the onchain implementation was verified using flatten, for generating the diff you need to flatten the new contract via forge flatten and supply the flattened file instead fo the whole ./src folder.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published