From 2020f7beb5a4f33f1eeb0424494931f96f63829d Mon Sep 17 00:00:00 2001 From: Emil Guseynov Date: Wed, 16 Dec 2020 21:54:21 +0300 Subject: [PATCH] set game params --- contracts/casino/include/casino/casino.hpp | 2 ++ contracts/casino/src/casino.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/contracts/casino/include/casino/casino.hpp b/contracts/casino/include/casino/casino.hpp index 339e7dc..d2f23f5 100644 --- a/contracts/casino/include/casino/casino.hpp +++ b/contracts/casino/include/casino/casino.hpp @@ -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")]] diff --git a/contracts/casino/src/casino.cpp b/contracts/casino/src/casino.cpp index 8fa5bfa..70f312b 100644 --- a/contracts/casino/src/casino.cpp +++ b/contracts/casino/src/casino.cpp @@ -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");