Skip to content

Instantly share code, notes, and snippets.

@ID25

ID25/contract.rb Secret

Created Sep 11, 2019
Embed
What would you like to do?
# Create contract
private_key = "e19d05c5452598..."
provider = Zilliqa::Jsonrpc::Provider.new('https://dev-api.zilliqa.com')
wallet = Zilliqa::Account::Wallet.new(provider)
address = wallet.add_by_private_key(private_key)
factory = Zilliqa::Contract::ContractFactory.new(provider, wallet)
contract = factory.new_contract(TEST_CONTRACT, [
{
vname: 'owner',
type: 'ByStr20',
value: '0x124567890124567890124567890124567890',
},
],
ABI,
)
# Deploy Contract
gas_limit = TEST_CONTRACT.bytes.size + ABI.to_s.bytes.size
gas_price = 10 ** 12 # 1 zil
testnet_ver = 21_823_489
pub_key = '032cfec301...'
deploy_params = Zilliqa::Contract::DeployParams.new(nil, testnet_ver, nil, gas_price, gas_limit, pub_key)
contract.deploy(deploy_params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.