Skip to content

Commit

Permalink
Merge pull request #38 from DaoCasino/game_params
Browse files Browse the repository at this point in the history
set game params
  • Loading branch information
justefg authored Dec 17, 2020
2 parents 1c2779e + 2020f7b commit 55370f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/casino/include/casino/casino.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class [[eosio::contract("casino")]] casino: public eosio::contract {
void add_game(uint64_t game_id, game_params_type params);
[[eosio::action("rmgame")]]
void remove_game(uint64_t game_id);
[[eosio::action("setgameparam")]]
void set_game_param(uint64_t game, game_params_type params);
[[eosio::action("setowner")]]
void set_owner(name new_owner);
[[eosio::on_notify("eosio.token::transfer")]]
Expand Down
8 changes: 8 additions & 0 deletions contracts/casino/src/casino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ void casino::add_game(uint64_t game_id, game_params_type params) {
});
}

void casino::set_game_param(uint64_t game_id, game_params_type params) {
require_auth(get_owner());
const auto itr = games.require_find(game_id, "id not in the games list");
games.modify(itr, get_self(), [&](auto& row) {
row.params = params;
});
}

void casino::remove_game(uint64_t game_id) {
require_auth(get_owner());
const auto game_itr = games.require_find(game_id, "the game was not added");
Expand Down

0 comments on commit 55370f4

Please sign in to comment.