Contracts for portfolio lending using perpetuals
-
To download and install
node
andnpm
visit https://nodejs.org/en/download -
To install node dependencies, run:
npm i
- To setup a local hardhat fork of arbitrum, run:
npx hardhat node --fork https://arb1.arbitrum.io/rpc
-
Download and connect metamask to local hardhat network.
4.1. If you don't have metamask extension installed, download and install the extension from here.
4.2. Add local hardhat network to metamask.
4.3. The network configuration for the local hardhat node is:
4.4. Import a hardhat user into the metamask wallet as it has funds. You can import a user using it's private key.
If you can't find the private key you can use this:0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
\ -
Initialise the forked hardhat local state with the kuru contracts. This script achieves the following:
5.1. Deploy our smart contracts to local fork.
5.2. Create an ETH long position with 0.05 eth collateral.
5.3. Executes that long by spoofing like the smartcontract.
npx hardhat run --network localhost scripts/initEnv.js
- Once this is done you can add USDC funds to the lending contract by running
npx hardhat run --network localhost scripts/sendUsdcToLending.js
- Access the app and hit launch app.