Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions contracts/eosio.token/include/eosio.token/eosio.token.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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>;
Expand Down
22 changes: 22 additions & 0 deletions contracts/eosio.token/src/eosio.token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down