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
#include "Players.hpp" | |
namespace Oasis { | |
using namespace eosio; | |
using std::string; | |
class Players : public contract { | |
using contract::contract; | |
public: |
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
// EOSIO_ABI(class_name, (action_1)(action_2)(action_3)...(action_n)) |
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
EOSLIB_SERIALIZE(player, (account_name)(username)(level)(health_points)(energy_points)) | |
EOSIO_ABI(Players, (add)(update)(health)(energy)(getplayer)) |
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
eosiocpp -o Players.wast Players.cpp |
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
cleos push action weyland1 create '{"account":"weyland1","newRobot":{"series_number":14441993,"model":"A330","operating_system":"DX42","profession":"engineer","owner":"","manufactured":0}}' -p weyland1 | |
executed transaction: 5f45b48877aac9d03172616a2443b7a9079ee9f74a124a0976d2fcf0b756e985 176 bytes 2722 us | |
# weyland1 <= weyland1::create {"account":"weyland1","newRobot":{"series_number":14441993,"model":"A330","operating_system":"DX42",... | |
# market <= market::forsale {"account":"weyland1","robotForSale":{"series_number":14441993,"model":"A330","manufactured":0}} | |
# No notification for printmessage action |
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
void RobotFactory::create(account_name account, robot newRobot) { | |
robotIndex robots(_self, _self); | |
auto iterator = robots.find(newRobot.series_number); | |
eosio_assert(iterator == robots.end(), "Robot with this series number already exists"); | |
robots.emplace(account, [&](auto& robot) { | |
robot.series_number = newRobot.series_number; | |
robot.model = newRobot.model; | |
robot.operating_system = newRobot.operating_system; |
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
cleos push action weyland create '{"account":"weyland","newRobot":{"series_number":14441992,"model":"A330","operating_system":"DX42","profession":"engineer","owner":"","manufactured":0}}' -p weyland | |
executed transaction: 9874a8a5f516ca540c44cafd8b9b371c856fe7958be1fc6268641cc7ab67fdaf 136 bytes 6000 us | |
# weyland <= weyland::create {"account":"weyland","newRobot":{"series_number":14441992,"model":"A330","operating_system":"DX42",... | |
# market <= market::forsale {"account":"weyland","robotForSale":{"series_number":14441992,"model":"A330","manufactured":0}} | |
# messenger <= messenger::printmessage {"message":"A330"} | |
>> ==== For sale | Robot model: A330 |
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
void RobotFactory::create(account_name account, robot newRobot) { | |
robotIndex robots(_self, _self); | |
auto iterator = robots.find(newRobot.series_number); | |
eosio_assert(iterator == robots.end(), "Robot with this series number already exists"); | |
robots.emplace(account, [&](auto& robot) { | |
robot.series_number = newRobot.series_number; | |
robot.model = newRobot.model; | |
robot.operating_system = newRobot.operating_system; |
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
void RobotFactory::create(account_name account, robot newRobot) { | |
robotIndex robots(_self, _self); | |
auto iterator = robots.find(newRobot.series_number); | |
eosio_assert(iterator == robots.end(), "Robot with this series number already exists"); | |
robots.emplace(account, [&](auto& robot) { | |
robot.series_number = newRobot.series_number; | |
robot.model = newRobot.model; | |
robot.operating_system = newRobot.operating_system; |
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
cd ~/eos/build/programs/cleos/ | |
# Outputs a password that you need to save to be able to lock/unlock the wallet | |
# If you don't want to use the "default" wallet add: -n {your_wallet_name} at the end of your command | |
cleos wallet create |
NewerOlder