0.1.1-alpha • Published 3 years ago

truffle-cfx-patch v0.1.1-alpha

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Ethers Cfx Patch

Description

truffle-cfx-patch is used for compatiable @truffle/xxx packages with conflux network. The purpose is to overwrite some methods to compatibale with cfx network, most are functions related address and transaction. And it will not break origin features.

Install

$ npm install truffle-cfx-patch

Usage

Overwrite methods

Load truffle-cfx-patch package in the head of your project. It will overwrite methods.

// load pacakge to overwrite methods
require("truffle-cfx-patch")
// your project
// ...

Example

When use @openzeppelin/truffle-upgrades to deploy an upgradable contract, you should use truffle-cfx-patch to patch for conflux network.

require("truffle-cfx-patch");
var { deployProxy } = require("@openzeppelin/truffle-upgrades");
module.exports = async function (deployer, network, accounts) {

    //
    var tmpAdmin = cfxFormat.hexAddress(accounts[0]);
    var genesisSupplyAmount = "500000000000000000000";
    await deployProxy(StableToken, [tmpAdmin, genesisSupplyAmount], {
        deployer: deployer,
        unsafeAllowCustomTypes: true,
    });
    // var stableToken = await StableToken.deployed();
    // console.log(stableToken)
};