From 124fe3b29149bb37b4d8cc1be136f5b4ec123ee0 Mon Sep 17 00:00:00 2001 From: nicolas Date: Wed, 18 Mar 2026 11:36:31 +0100 Subject: [PATCH 1/2] Implement FIP-53: Mint 50M FIO for Handles Giveaway Reallocate 50M FIO from New User Bounties to FIO Handles Giveaways account (pkfbwyi2qzii). Reduces MAXBOUNTYTOKENSTOMINT from 125M to 75M SUFs and adds fipliii action that mints tokens via issue inline action with bounty capacity validation. Co-Authored-By: Claude Haiku 4.5 --- contracts/fio.common/fio.common.hpp | 2 +- .../fio.token/include/fio.token/fio.token.hpp | 7 ++++ contracts/fio.token/src/fio.token.cpp | 35 ++++++++++++++++++- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/contracts/fio.common/fio.common.hpp b/contracts/fio.common/fio.common.hpp index 6b3e4635..7e416037 100644 --- a/contracts/fio.common/fio.common.hpp +++ b/contracts/fio.common/fio.common.hpp @@ -28,7 +28,7 @@ #define SECONDSPERDAY 86400 #define DOMAINWAITFORBURNDAYS 90 * SECONDSPERDAY #define ADDRESSWAITFORBURNDAYS 365 * SECONDSPERDAY -#define MAXBOUNTYTOKENSTOMINT 125000000000000000 +#define MAXBOUNTYTOKENSTOMINT 75000000000000000 //#define MINVOTEDFIO 10'000'000'000000000 //TESTNET ONLY #define MINVOTEDFIO 65'000'000'000000000 #define MINUTE 60 diff --git a/contracts/fio.token/include/fio.token/fio.token.hpp b/contracts/fio.token/include/fio.token/fio.token.hpp index 1a94aa88..d93011c8 100755 --- a/contracts/fio.token/include/fio.token/fio.token.hpp +++ b/contracts/fio.token/include/fio.token/fio.token.hpp @@ -39,6 +39,9 @@ static const vector fip48reallocationlist = { static const uint64_t fip48expectedtotaltransferamount = 38505959400000000; static const name fip48recevingaccount = name("pkfbwyi2qzii"); +static const uint64_t fip53mintamount = 50000000000000000; // 50,000,000 FIO in SUFs +static const name fip53receivingaccount = name("pkfbwyi2qzii"); + //FIP-38 begin struct bind2eosio { name accountName; @@ -114,6 +117,10 @@ namespace eosio { [[eosio::action]] void fipxlviii(); + //fip53 + [[eosio::action]] + void fipliii(); + [[eosio::action]] void trnsloctoks(const string &payee_public_key, const int32_t &can_vote, diff --git a/contracts/fio.token/src/fio.token.cpp b/contracts/fio.token/src/fio.token.cpp index d4d84883..ebd6ddbb 100755 --- a/contracts/fio.token/src/fio.token.cpp +++ b/contracts/fio.token/src/fio.token.cpp @@ -678,6 +678,39 @@ namespace eosio { send_response(response_string.c_str()); } + //fip53 + void token::fipliii() { + // Authorization: only callable by eosio (BP msig) + eosio_assert(has_auth(SYSTEMACCOUNT), + "missing required authority of eosio"); + + // Contract account validation + eosio_assert(get_self() == TokenContract, + "fipliii must be called on fio.token contract"); + + // Recipient account validation + check(is_account(fip53receivingaccount), + "fip53 receiving account does not exist"); + + // Bounty capacity check + bounties_table bounties(TPIDContract, TPIDContract.value); + check(bounties.exists(), "fip53 bounties table not found"); + check(fip53mintamount <= MAXBOUNTYTOKENSTOMINT - bounties.get().tokensminted, + "quantity exceeds available bounty tokens supply"); + + // Mint and transfer via "issue" action (includes 1B supply cap validation) + action( + permission_level{SYSTEMACCOUNT, "active"_n}, + TokenContract, "issue"_n, + make_tuple(fip53receivingaccount, + asset(fip53mintamount, FIOSYMBOL), + string("minted tokens for fip53")) + ).send(); + + const string response_string = string("{\"status\": \"OK\"}"); + send_response(response_string.c_str()); + } + void token::trnsloctoks(const string &payee_public_key, const int32_t &can_vote, const vector periods, @@ -816,4 +849,4 @@ namespace eosio { } } /// namespace eosio -EOSIO_DISPATCH( eosio::token, (create)(issue)(mintfio)(transfer)(trnsfiopubky)(trnsloctoks)(retire)(fipxlviii)) +EOSIO_DISPATCH( eosio::token, (create)(issue)(mintfio)(transfer)(trnsfiopubky)(trnsloctoks)(retire)(fipxlviii)(fipliii)) From 3cc63b1e494013187fc4683f27160129dd83c63c Mon Sep 17 00:00:00 2001 From: nicolas Date: Wed, 18 Mar 2026 15:15:34 +0100 Subject: [PATCH 2/2] Add FIP-53 execution guard and improve fipliii action safety - Add fip53state singleton to fio.common.hpp to track execution state - Replace eosio_assert with check for contract validation - Add re-execution guard to prevent fipliii from being called twice - Remove bounty capacity check (no longer needed) - Add transaction size validation after mint Co-Authored-By: Claude Sonnet 4.6 --- contracts/fio.common/fio.common.hpp | 7 +++++++ contracts/fio.token/src/fio.token.cpp | 22 ++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/contracts/fio.common/fio.common.hpp b/contracts/fio.common/fio.common.hpp index 7e416037..b6aad3c6 100644 --- a/contracts/fio.common/fio.common.hpp +++ b/contracts/fio.common/fio.common.hpp @@ -276,6 +276,13 @@ namespace fioio { typedef singleton<"bounties"_n, bounty> bounties_table; + // FIP-53 execution guard + struct [[eosio::table]] fip53state { + bool executed = false; + EOSLIB_SERIALIZE(fip53state, (executed)) + }; + typedef singleton<"fip53state"_n, fip53state> fip53state_table; + //this will call update tpid in the tpid contract, //add the info to the tpid table for this TPID and also set up the auto proxy if needed. void set_auto_proxy(const string &tpid, const uint64_t &amount, const name &auth, const name &actor){ diff --git a/contracts/fio.token/src/fio.token.cpp b/contracts/fio.token/src/fio.token.cpp index ebd6ddbb..9690446e 100755 --- a/contracts/fio.token/src/fio.token.cpp +++ b/contracts/fio.token/src/fio.token.cpp @@ -685,19 +685,20 @@ namespace eosio { "missing required authority of eosio"); // Contract account validation - eosio_assert(get_self() == TokenContract, - "fipliii must be called on fio.token contract"); + check(get_self() == TokenContract, + "fipliii must be called on fio.token contract"); + + // Re-execution guard + fip53state_table fip53_guard(get_self(), get_self().value); + if (!fip53_guard.exists()) { + fip53_guard.set(fioio::fip53state{false}, get_self()); + } + check(!fip53_guard.get().executed, "fip53 has already been executed"); // Recipient account validation check(is_account(fip53receivingaccount), "fip53 receiving account does not exist"); - // Bounty capacity check - bounties_table bounties(TPIDContract, TPIDContract.value); - check(bounties.exists(), "fip53 bounties table not found"); - check(fip53mintamount <= MAXBOUNTYTOKENSTOMINT - bounties.get().tokensminted, - "quantity exceeds available bounty tokens supply"); - // Mint and transfer via "issue" action (includes 1B supply cap validation) action( permission_level{SYSTEMACCOUNT, "active"_n}, @@ -707,7 +708,12 @@ namespace eosio { string("minted tokens for fip53")) ).send(); + fip53_guard.set(fioio::fip53state{true}, get_self()); + const string response_string = string("{\"status\": \"OK\"}"); + fio_400_assert(transaction_size() <= MAX_TRX_SIZE, "transaction_size", std::to_string(transaction_size()), + "Transaction is too large", ErrorTransactionTooLarge); + send_response(response_string.c_str()); }