Created
March 6, 2019 06:13
-
-
Save qianbin/50a1194627eb3c58121dafa52bdf847d to your computer and use it in GitHub Desktop.
deployment data for contract with constructor arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { abi } from 'thor-devkit' | |
// assume we have a demo contract | |
// contract DemoContract { | |
// constructor(int arg) public { | |
// } | |
// } | |
const byteCode = '0x....' | |
const constructorABI = { | |
"inputs": [ | |
{ | |
"name": "arg", | |
"type": "int256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
} | |
const coder = new abi.Function(constructorABI) | |
const dataToDeploy = byteCode + coder.encode(1).slice(2 /* remove 0x prefix */) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment