/staking-multiple-reward-tokens

This is a modified Synthetix staking implementation that uses more than one ERC20 token as reward tokens.

Primary LanguageCairo

Staking multiple reward tokens

This is a modified Synthetix staking implementation that uses more than one ERC20 token as reward tokens.

How it works

Using similar staking mechanism as the Synthetix staking reward contract, the multiple reward tokens allows that users can set more than one ERC20 token as reward which means, when a user stakes, they can get more than one reward tokens as their reward for staking.

This contract using a staking position that separates each user's stake. When a user stakes multiple times e.g 3 times, all 3 stakes are independent, the staking amount is not cumulative.

Testing

Test cases were covered using unit and feature testing. We also did onchain interaction to test functions using https://sepolia.voyager.online with the following deployed contract addresses:

See interactions: https://sepolia.voyager.online/contract/0x0204699f98282c34ea7147290dae81c5cc702f3795a961ee62f4afe7f48be276

Deployed addresses on Starknet Sepolia:

Staking token contract: 0x4a11dd45a62aeca462aeeca9d5168dc8cd11298db14dbdbb105505cd6631924

Reward token1 contract: 0xc2e627839c48db9de26bafb4dcff52cf0c22d154d887c9abd9c726b911156f

Reward token2 contract: 0x775a9e2b7ed8b02beaa1d19c90c053042aedecddd917a9c445f3036f19a1e1c

Staking Multi Reward contract: 0x204699f98282c34ea7147290dae81c5cc702f3795a961ee62f4afe7f48be276

Deployment

deploy-r-t1: deploys the reward token 1 using: npm run deploy-r-t1
deploy-r-t2: deploys the reward token 2 using: npm run deploy-r-t2
deploy-s-t: deploys the staking token using: npm run deploy-s-t
deploy: deploys the Staking contract using: npm run deploy