diff --git a/contracts/fio.common/fio.common.hpp b/contracts/fio.common/fio.common.hpp index 6b3e4635..b6aad3c6 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 @@ -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/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..9690446e 100755 --- a/contracts/fio.token/src/fio.token.cpp +++ b/contracts/fio.token/src/fio.token.cpp @@ -678,6 +678,45 @@ 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 + 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"); + + // 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(); + + 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()); + } + void token::trnsloctoks(const string &payee_public_key, const int32_t &can_vote, const vector periods, @@ -816,4 +855,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))