Note - Only the ETH staking contracts implementation transparent proxy pattern using openzeppelin contracts, rest are written completely by me.
This project contains three upgradable staking contracts:
- Native ETH Staking: Allows users to stake their native ETH.
- ERC20 Token Staking: Allows users to stake ERC20 tokens.
- NFT Staking: Allows users to stake NFTs.
- Upgradable Contracts: All staking contracts are upgradable, ensuring flexibility and future enhancements.
- Secure Staking: Implements secure staking mechanisms for ETH, ERC20 tokens, and NFTs.
- Foundry Framework: Utilizes the Foundry framework for development, testing, and deployment.
- Openzeppelin Contracts Used: ERC20, IERC20, StorageSlot, IERC721
- Formula: ((block.timestamp - lastUpdateInStakedAmount) * dailyReward * stakers[_user].amount) / (1 days * 1 ether).
Note - Consider changing the formula for erc20 staking contract as it was made originally eth staking.
- Foundry installed
-
Clone the repository:
git clone https://github.com/bhivgadearav/proxy-staking-contract.git cd proxy-staking-contract
-
Install openzeppelin contracts:
forge install OpenZeppelin/openzeppelin-contracts
-
Build the project:
forge build
Run the tests to ensure everything is working correctly:
forge test
Run the tests and get more detailed logs:
forge test -vvvvvvvvvvvvv
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under The Unlicense.