Last active
March 6, 2019 06:27
-
-
Save qianbin/3d4734643e8446f76f06cabce0c0c948 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(10 /* remove 0x prefix and 4bytes sig */) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment