This project eases the process of setting up a hardhat localfork with Rari Capital's products.
Setup
-
You first run
npm install
-
The next step is compilation but one contract needs to be modified before because of incompatible solidity compilator versions
Go to
node_modules/@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol
in Line 2 you'll find:
pragma solidity >=0.7.0;
change it to:
pragma solidity 0.6.12;
please let me know if theres a better way to do this I couldn't find it :)
-
Run
npx hardhat compile
-
Start hardhat node
npx hardhat node
This will start a mainnet fork pinned at block: 14167154
-
Open a second terminal and run:
npx hardhat deploy-fuse --network localhost
This will deploy a clean instance of fuse in your localnode.
Fuse
Interacion
Deploy an empty pool
npx hardhat deploy-pool --network localhost
Deploy a cToken/market
npx hardhat deploy-market --comptroller 0x00...0000 --underlying 0x00...0000 --cfactor 5 --rfactor 0.5 --adminfee 0.05 --network localhost
Deploy a rewards distributor to a given pool
npx hardhat deploy-rd-to-pool --underlying 0x00...0000 --comptroller 0x00...0000 --network localhost
Deploy Uniswap V2 Twap Oracle
npx hardhat deploy-unitwap-v2
Market Interaction
Supply
npx hardhat supply --underlying 0x00...0000 --market 0x00...0000 --comptroller 0x00...0000 --amount 1000 --collateralize true --user 0x00...0000
Borrow
npx hardhat borrow --market 0x00...0000 --amount 1000 --token 0x00..0000
Repay
npx hardhat repay --market 0x00...0000 --amount 1000 --token 0x00..0000