/idle-staking

Idle Single Token Staking

Primary LanguageJavaScriptOtherNOASSERTION

IDLE Staking Contracts

This repo contains the idle single token staking smart contracts. The staking contracts are based on the curve staking contracts and are located under ./contracts/curve/. These contracts have been slightly modified to be compatiable with the idle token.

stkIDLE is a given to stakers based the amount of IDLE they stake, and for how long they stake. Stakers stkIDLE balance decreases linearly from the lock date, untill the unlock date. Stakers can choose to either lock more IDLE, or increase the unlock duration to increase their stkIDLE balance. The following staking calculator has been developed to help calculate potential.rewards

The diagram below illustrates at a high level how the staking contracts interact with the IDLE ecosystem.

Staking Diagram

Idle tokens which have been staked are vote delegated to the idle staking multisig.

Deployed Addresses

Other addresses

Installation

This project was developed using hardhat. Due to some issues with the vyper plugin this project does not currently build on windows.

  1. npm install -i
  2. Create .env file from .env.template

For local testing you only need to populate the ALCHEMY_API_KEY key, the rest are optional.

Running Unit Tests

Unit tests are defined under ./test and can be executed by calling. These scripts verify the functionality of the contracts using mock contracts.

npx hardhat test

Running Fork Tests

A number of fork tests are defined under ./scripts. These scripts verify that the contracts deployed on mainnet interact correctly.

The can be run by executing: npx hardhat run scripts/<scriptname>

Deployment

The deployment scripts are located under ./deploy

These script can be run on a local fork, or on mainnet. The behaviour of these scripts will slightly change when running on mainnet. Scripts which fund test accounts will not execute on mainnet deployment.

npx hardhat deploy --network <network_name>

Mainnet deployment meta data is stored under deployments/mainnet/

Tasks

This repo also defines a number of tasks which are helpful for local testing. They are located under ./tasks.

These scripts use the default signers from ethers.getSigners()

The following tasks are available

  • npx hardhat mockdeploy Deploys the contracts to a local fork.
  • npx hardhat sendidle Sends idle. You can specify which account to send funds to by including --signernum.
  • npx hardhat stake Stakes some idle. use --stkidle to specify a staking contract address.
  • npx hardhat stakebalance Print info on current stake.
  • npx hardhat topup Send some idle to the feeDistributor. use --feedistributor to specify a fee distributor address.
  • npx hardhat claimbalance Print info on how much fees an account can claim from feeDistributor.