Follow these steps to get started with the ParaSpace development 🛠️
yarn
touch .env
make init
make build
make test
make fast-test
- Download artifacts
wget https://paraspace-static-files.s3.amazonaws.com/contracts/goerli/latest/deployed-contracts.json
- Prepare envs
NETWORK=localhost
ALCHEMY_KEY=
DEPLOYER_MNEMONIC=<goerli admin mnemonic>
ETHERSCAN_VERIFICATION=false
MOCHA_JOBS=1
DB_PATH=deployed-contracts.json
FORK=goerli
JSONRPC_VARIANT=hardhat
make shutdown
make hardhat
make reset-pool
make upgrade-ntoken
make upgrade-ptoken
make upgrade-debt-token
make upgrade-p2p-pair-staking
make upgrade-configurator
make upgrade-auto-compound-ape
make upgrade-timelock
Before upgrading, you need to update REVISIONs of Pools, NTokens, PTokens
NETWORK=localhost
ALCHEMY_KEY=
DEPLOYER_MNEMONIC=
ETHERSCAN_VERIFICATION=false
MOCHA_JOBS=1
DB_PATH=deployed-contracts.json # must be the live fork's deployed-contracts.json
RPC_URL=http://localhost:8545 # impersonate to paraspace admin for upgrading
FORK=goerli|mainnet
make upgrade
Before upgrading, you need to update REVISIONs of Pools, NTokens, PTokens
NETWORK=goerli|mainnet
DEPLOYER_MNEMONIC=
ALCHEMY_KEY=
ETHERSCAN_VERIFICATION=false
MOCHA_JOBS=1
DB_PATH=deployed-contracts.json
make upgrade
aws s3 cp deployed-contracts.json s3://paraspace-static-files/contracts/goerli/latest/deployed-contracts.json
aws s3 cp deployed-contracts.json s3://paraspace-static-files/contracts/goerli/v1.4.6/deployed-contracts.json
make help
Use flatten layout
- Use fixtures to manage evm state: We have a pre-built pure evm snapshot call
testEnv
which contains all used contracts and necessary transactions.
Example 1: You make a story that contains two steps, and steps have to be executed in sequence. You should init the testEnv at the before hook.
describe("A story", () => {
let testEnv: TestEnv;
before(async () => {
testEnv = await loadFixture(testEnvFixture);
});
it("Step 01", async () => {});
it("Step 02", async () => {});
});
Example 2: You wanna do a serial of tests for different paths of a certain scenario. You make changes and wanna reset to that state during following steps.
const fixture = async () => {
const testEnv = await loadFixture(testEnvFixture);
testEnv.doSomething();
return testEnv;
};
describe("A secenrio", () => {
it("Should succeed", async () => {
const testEnv = await loadFixture(fixture);
});
it("should fail", async () => {
const testEnv = await loadFixture(fixture);
});
});
Hint: Happy to see you fix the code smell when you were refacting this file.