NFT Yield Farming on BSC
【Introduction of the NFT Yield Farming on BSC】
- This is a smart contract that enable a user to farm yield by staking LP tokens (BEP20) into a NFT pool.
- Once a user stake LP tokens into a NFT pool, reward token (Governance Token) are mined every block.
- User who staked can receive the Governance Tokens as rewards (as farmed-yield) when that user un-stake.
- This smart contract works on BSC (Binance Smart Chain).
【Workflow】
- Diagram / Workflow
【Setup】
① Install modules
- Install npm modules in the root directory
$ npm install
② Add .env
to the root directory.
③ Compile contracts (on BSC testnet)
$ npm run compile:bsc-testnet
④ Test
- Execute test of the smart-contracts (on the BSC testnet)
- [Note]: Sometime, timeout happen on this test. So I recommend that you try
⑤ Script
below instead of this test.
$ npm run test:nft-yield-farming_bsc-testnet
($ truffle test ./test/test-bsc/NFTYieldFarmingOnBSC.test.js --network bsc_testnet)
⑤ Script
- Execute script of the smart-contracts on the BSC testnet (with
truffle exec
command)
$ npm run script:nft-yield-farming_bsc-testnet
($ truffle exec ./scripts/script-bsc/NFTYieldFarmingOnBSC.script.js --network bsc_testnet)
(※ Note: In advance, please check whether your deployer' wallet address on BSC testnet has enough BNB balance or not)
【Remarks】
- Governance Token
- At the moment, Governance Token is used as a reward token.
- Although it has not implemented yet, I will implement Governance Token for governance strucure (e.g. Governance Token holders can vote, etc...) in the future.
- LP tokens
- LP token is created by BEP20.
- Assuming LP tokens is a pair between the Governance Token and BNB.
- But, pool to create this pair (LP tokens) has not been implemented yet. (at the mement)
- Version
- Solidity (Solc): v0.6.12
- Truffle: v5.1.60
- web3.js: v1.2.9
- openzeppelin-solidity: v3.2.0
【References】