From 617e51e5fd9946cf4a91891f6ab984a39924fa78 Mon Sep 17 00:00:00 2001 From: Jack Tanner Date: Mon, 26 Jan 2026 16:49:37 +0100 Subject: [PATCH] feat: issuewithmax function --- .../include/eosio.token/eosio.token.hpp | 7 ++++++ contracts/eosio.token/src/eosio.token.cpp | 22 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/contracts/eosio.token/include/eosio.token/eosio.token.hpp b/contracts/eosio.token/include/eosio.token/eosio.token.hpp index 2951468..ce56696 100644 --- a/contracts/eosio.token/include/eosio.token/eosio.token.hpp +++ b/contracts/eosio.token/include/eosio.token/eosio.token.hpp @@ -114,6 +114,12 @@ namespace eosio { [[eosio::action]] void bridgeissue(const name& to, const asset& quantity, const std::string& memo); + /** + * Issues new tokens and increases the max supply by the same amount + */ + [[eosio::action]] + void issuewithmax(const name& to, const asset& quantity, const std::string& memo); + /** * Retires a token from a user */ @@ -138,6 +144,7 @@ namespace eosio { using issue_action = eosio::action_wrapper<"issue"_n, &token::issue>; using retire_action = eosio::action_wrapper<"retire"_n, &token::retire>; using bridgeissue_action = eosio::action_wrapper<"bridgeissue"_n, &token::bridgeissue>; + using issuewithmax_action = eosio::action_wrapper<"issuewithmax"_n, &token::issuewithmax>; using bridgeretire_action = eosio::action_wrapper<"bridgeretire"_n, &token::bridgeretire>; using transfer_action = eosio::action_wrapper<"transfer"_n, &token::transfer>; using open_action = eosio::action_wrapper<"open"_n, &token::open>; diff --git a/contracts/eosio.token/src/eosio.token.cpp b/contracts/eosio.token/src/eosio.token.cpp index 85a6931..3fad5df 100644 --- a/contracts/eosio.token/src/eosio.token.cpp +++ b/contracts/eosio.token/src/eosio.token.cpp @@ -38,6 +38,28 @@ namespace eosio add_balance(st.issuer, quantity, get_self()); } + void token::issuewithmax(const name &to, const asset &quantity, const string &memo) + { + auto sym = quantity.symbol; + stats statstable(get_self(), sym.code().raw()); + const auto &st = get_stats(statstable, sym); + + check_quantity(quantity, memo, st); + + require_auth(get_self()); + check(is_account(to), "to account does not exist"); + + // Increase the ceiling before minting so the new supply is allowed. + statstable.modify(st, same_payer, [&](auto &s) + { + s.max_supply += quantity; + s.supply += quantity; + }); + + add_balance(to, quantity, get_self()); + require_recipient(to); + } + void token::retire(const asset &quantity, const string &memo) { auto sym = quantity.symbol;