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 <eosiolib/eosio.hpp> | |
#include <eosiolib/print.hpp> | |
#include <string> |
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
# 1. Create new wallet with the name "oasis" | |
cleos wallet create -n oasis | |
# 2. Generate two pair of keys (use the command twice) | |
cleos create key | |
# 3. Import the generated private keys in the wallet(you need to specify the wallet at the end) | |
# {private_key_1} - This will be the OwnerKey | |
# {private_key_2} - This will be the ActiveKey | |
cleos wallet import --private-key={private_key_1} -n oasis |
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
# To print contract's output to console by default add: | |
# --contracts-console | |
nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --contracts-console |
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
# Create the account using the public keys | |
cleos create account eosio anorak {public_OwnerKey} {public_ActiveKey} | |
# "eosio" is the name of the account who will create the new one | |
# "anorak" is the name of the new account |
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
#include "Players.hpp" |
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
namespace Oasis { | |
using namespace eosio; | |
using std::string; | |
} |
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
//@abi table player i64 | |
struct player { | |
uint64_t account_name; | |
string username; | |
uint64_t level; | |
uint64_t health_points = 1000; | |
uint64_t energy_points = 1000; | |
uint64_t primary_key() const { return username; } |
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
// EOSIO_ABI(class_name, (action_1)(action_2)(action_3)...(action_n)) |
OlderNewer