hardhat-deployer 0.0.1
Install from the command line:
Learn more about npm packages
$ npm install @superfluid-finance/hardhat-deployer@0.0.1
Install via package.json:
"@superfluid-finance/hardhat-deployer": "0.0.1"
About this version
This plugin brings a Superfluid framework deployer for development environments using ethers
.
NOTICE: This is not suitable for public deployments. This is designed for local testing andd requires unusually high gas limits.
The @superfluid-finance/hardhat-deployer
plugin handles deployment and initialization of Superfluid contracts in a
development environment.
npm install @superfluid-finance/hardhat-deployer @superfluid-finance/ethereum-contracts
Import the plugin in hardhat.config.js
:
require("@superfluid-finance/hardhat-deployer");
Or in a Typescript file, use the following in hardhat.config.ts
:
import "@superfluid-finance/hardhat-deployer";
This plugin creates no additional tasks.
This plugin extends the Hardhat Runtime Environment by adding the superfluidFrameworkDeployer
object, of type SuperfluidFrameworkDeployer
. See "Usage" for details.
NOTICE: The deployments' gas limits are set to 6 million each. The default Hardhat network configuration accomodates this, but if you use other local networks such as Anvil, you will need to manually set the network gasLimit to at least 6 million.
Once the dependency is installed and imported into the Hardhat configuration file, you can import the deployer into your test file as follows.
const { superfluidFrameworkDeployer } = require("hardhat");
Or in a Typescript file, use the following.
import { superfluidFrameworkDeployer } from "hardhat";
You can now use the deployer to deploy the framework, as well as test tokens. It is recommended to deploy these contracts before any unit tests are run.
// Note that `ethers` can be imported, assuming the `hardhat-ethers` dependency has been installed
// and imported into the Hardhat configuration file.
import { ethers, superfluidFrameworkDeployer } from "hardhat";
describe("Super App Unit Tests", async function () {
let deployer;
before(async function () {
[deployer] = await ethers.getSigners();
// This deploys the entire framework.
// This MUST happen before deploying Super Tokens.
await superfluidFrameworkDeployer.deploy(deployer);
// This deploys an ERC20 token and a Wrapper Super Token
// The `deployer` has mint permission on the ERC20
const { underlyingToken: fDAI, superToken: fDAIx } =
await superfluidFrameworkDeployer.deployMockSuperToken("Fake DAI", "fDAI", deployer);
// Mint 100 Fake DAI to `deployer`
await fDAI.mint(deployer.address, ethers.utils.parseEther("100"));
// Approve Super Fake DAI for Upgrade
await fDAI.approve(fDAIx.address, ethers.constants.MaxUint256);
// Upgrade 100 Fake DAI to 100 Super Fake DAI
await fDAIx.upgrade(ethers.utils.parseEther("100"));
});
});
The deploy
function does the following, in order.
- Deploy the
ERC1820Registry
to its appropriate address (if not deployed) - Deploy
Resolver
- Deploy
TestGovernance
- Register
TestGovernance
withResolver
- Deploy
Superfluid
- Initialize
Superfluid
withTestGovernance
- Register
Superfluid
withResolver
- Initialize
TestGovernance
- Deploy
ConstantFlowAgreementV1
- Register
ConstantFlowAgreementV1
withTestGovernance
- Deploy
SlotsBitmapLibrary
- Deploy
InstantDistributionAgreementV1
with link toSlotsBitmapLibrary
- Register
InstantDistributionAgreementV1
withTestGovernance
- Deploy
SuperTokenFactoryHelper
- Deploy
SuperTokenFactory
- "Update Code" with
TestGovernance
, registering theSuperTokenFactory
withSuperfluid
- Return the
Resolver
address
The deployMockSuperToken
function does the following, in order.
- Deploy
ERC20PresetMinterPauser
with mint and pause permission to thedeployer
- Calls
createERC20Wrapper
on theSuperTokenFactory
with theERC20PresetMinterPauser
- Returns both in a Javascript Object
Details
- hardhat-deployer
- superfluid-finance
- over 2 years ago
- MIT
- 20 dependencies
Assets
- hardhat-deployer-0.0.1-npm.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0