0.0.5 • Published 4 years ago
buidler-erasure v0.0.5
buidler-erasure
Buidler plugin for Erasure protocol
What
This plugin will help you integrate your dapp with the erasure protocol by letting you easily invoke erasure's contracts and interact with them.
Installation
This plugin relies on the smart contracts of the erasure protocol.
npm install buidler-erasure ethers github:erasureprotocol/erasure-protocol#master
And add the following statement to your buidler.config.js
:
usePlugin("buidler-erasure");
Required plugins
Tasks
This plugin adds the following tasks to Buidler:
erasure:deploy-full
: Deploy the whole platformerasure:create-instance
: Creates a new instance from a factoryerasure:create-agreement
: Creates an Simple Agreementerasure:stake
: Stake NMR in an Simple Griefing Agreementerasure:copy-contracts
: Temporal task. Copy the erasure protocol contracts into your project's sources folder.
Environment extensions
This plugin extends the Buidler Runtime Environment by adding the following elements:
erasure: {
deploySetup: ErasureDeploySetup;
getDeployedAddresses(name: string): Promise<string[]>;
getDeployedContracts(contractName: string): Promise<Contract[]>;
saveDeployedContract(name: string, instance: any): void;
getContractInstance(name: string, address: string, account: string | Signer): Contract;
}
deploySetup
: the erasure deploy setup.getDeployedAddresses
: a function that retrieves the deployed addresses of a given contract name.getDeployedContracts
: a function that retrieves the deployed contracts of a given contract name.saveDeployedContract
: store a contract's address into the deployment state.getContractInstance
: retrieves an instance of a contract attached to an address
Configuration
There is no configuration required for this plugin.
Usage
You must copy the erasure protocol contracts into your sources folder. You can do it manually:
cp node_modules/erasure-protocol/contracts/**/*.sol <source_folder>
Or use a (temporal) task I've created to do this:
npx buidler erasure:copy-contracts
I'm working on a solution to avoid this.