tokenika / eosfactory

Python-based EOS smart-contract development & testing framework
http://eosfactory.io/
Other
243 stars 62 forks source link

Deploy contract with master account(eosio) #69

Closed tuan3w closed 5 years ago

tuan3w commented 5 years ago

Thank you for your efforts to make writing EOS smartcontract easier. I try to deploy a contract with master account. This is what i tried:

create_master_account('master')
c = Contract(master, CONTRACT_PATH)
c.build()
c.deploy()

However, I got this error:

Reading WASM from /home/tuan3w/workspace/umb.syscontractv2/build/eosio.system/eosio.system.wasm...
Publishing contract...
Error 3050003: eosio_assert_message assertion failure
Error Details:
assertion failure with message: unable to find key
pending console output:

I know master and accounts create by create_account aren't same object type. However, I want to know any way to make it works. Thanks.

stefanzarembinski commented 5 years ago

I am sorry for the long delay in response to your issue.

I see that you are trying to deploy the eosio.system contract: is is a special species. It needs numerous prerequisites to be installed. You can learn them from https://developers.eos.io/eosio-nodeos/docs/bios-boot-sequence.

See the procedure described there translated to EOSFactory:

##############################################################################

import os from eosfactory.eosf import * import eosfactory.core.cleos as cleos import eosfactory.core.setup as setup import eosfactory.core.config as config

eosio_contracts_dir = os.path.join( config.eosio_repository_dir(), "build/contracts")

reset()

create_master_account("eosio")

COMMENT('''Create important system accounts''')

create_account("eosio_bpay", eosio, "eosio.bpay") create_account("eosio_msig", eosio, "eosio.msig") create_account("eosio_names", eosio, "eosio.names") create_account("eosio_ram", eosio, "eosio.ram") create_account("eosio_ramfee", eosio, "eosio.ramfee") create_account("eosio_saving", eosio, "eosio.saving") create_account("eosio_stake", eosio, "eosio.stake") create_account("eosio_token", eosio, "eosio.token") create_account("eosio_vpay", eosio, "eosio.vpay")

COMMENT('''Install the eosio.token contract''')

contract = "eosio.token" Contract( contract, os.path.join(eosio_contracts_dir, contract), abi_file = contract + ".abi", wasm_file = contract + ".wasm" ).deploy()

COMMENT('''Set the eosio.msig contract''')

contract = "eosio.msig" Contract( contract, os.path.join(eosio_contracts_dir, contract), abi_file = contract + ".abi", wasm_file = contract + ".wasm" ).deploy()

COMMENT('''Create and allocate the SYS currency''')

eosio_token.push_action( "create", [eosio, "10000000000.0000 SYS"], (eosio_token, Permission.ACTIVE))

eosio_token.push_action( "issue", [eosio, "1000000000.0000 SYS", "memo"], (eosio, Permission.ACTIVE))

COMMENT('''Set the eosio.system contract''')

contract = "eosio.system" Contract( eosio, os.path.join(eosio_contracts_dir, contract), abi_file = contract + ".abi", wasm_file = contract + ".wasm" ).deploy()

##############################################################################

But, please, wait to the next edition of EOSFactory (soon) before trying the script: it fails because of a bug in nodeos.

Best regards.

SZ