Skip to content

RobotFactory-02 is the extended RobotFactory project used for the live demo at the second EOS Developers Meetup.

License

Notifications You must be signed in to change notification settings

infinitex-tech/RobotFactory-02

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Factory - Live Demo

Setup environment (for Mac OS)

  • Clone EOSIO repo recursively
git clone https://github.com/eosio/eos --recursive
  • Go to the eos folder and run the eosio_build.sh script with the following command
sh ./eosio_build.sh darwin

Note: It could take quite some time before all the dependencies are installed and then built.

Running local testnet:

nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --contracts-console --verbose-http-errors

Commands:

  1. Creating a wallet
# cleos wallet create -n {wallet_name}

cleos wallet create -n factory

Note: Don't forget to save your password

  1. Import the eosio private key in the wallet
cleos wallet import --private-key=5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 -n factory
  1. Creating three new accounts
# cleos create account eosio {new_account_name} {public_OwnerKey} {public_ActiveKey}
# "eosio" is the name of the account who will create the new one

# Used to deploy "RobotFactory" Smart Contract 
cleos create account eosio weyland EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV

# Used to deploy "Messenger" Smart Contract 
cleos create account eosio messenger EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV

# Used to deploy "RobotMarketplace" Smart Contract 
cleos create account eosio market EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV 
  1. Add permissions for eosio.code
# Weyland
cleos set account permission weyland active '{"threshold": 1,"keys": [{"key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight": 1}],"accounts": [{"permission":{"actor":"weyland","permission":"eosio.code"},"weight":1}]}' owner -p weyland

# Market
cleos set account permission market active '{"threshold": 1,"keys": [{"key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight": 1}],"accounts": [{"permission":{"actor":"market","permission":"eosio.code"},"weight":1}]}' owner -p market

# Messenger
cleos set account permission messenger active '{"threshold": 1,"keys": [{"key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight": 1}],"accounts": [{"permission":{"actor":"messenger","permission":"eosio.code"},"weight":1}]}' owner -p messenger
  1. Creating the smart contract

  2. Generating the WAST file

eosiocpp -o RobotFactory.wast RobotFactory.cpp
eosiocpp -o Messenger.wast Messenger.cpp
eosiocpp -o RobotMarketplace.wast RobotMarketplace.cpp
  1. Generating the ABI file
eosiocpp -g RobotFactory.abi RobotFactory.cpp
eosiocpp -g Messenger.abi Messenger.cpp
eosiocpp -g RobotMarketplace.abi RobotMarketplace.cpp
  1. Deploying the smart contract
# cleos set contract {account} {path_to_contract_folder} {path_to_.wast_file} {path_to_.abi_file}
cleos set contract weyland . RobotFactory.wast RobotFactory.abi
cleos set contract messenger . Messenger.wast Messenger.abi
cleos set contract market . RobotMarketplace.wast RobotMarketplace.abi
  1. Creating new robot
# cleos push action {account} {action_name} '{data}' -p {account}
cleos push action weyland create '{"account":"weyland","newRobot":{"series_number":14001992,"model":"A330","operating_system":"DX42","profession":"engineer","owner":"","manufactured":0}}' -p weyland

Example data for robots:

Series Number Model OS Profession
14001992 A330 DX42 engineer
14001993 A720 DX49 babysitter
14001994 U835 D33R farmer
14001995 XS33 DZ4S neurosurgeon
14001996 XS33 X99A cashier

About

RobotFactory-02 is the extended RobotFactory project used for the live demo at the second EOS Developers Meetup.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published