Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIPs 36-40 #361

Merged
merged 7 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions libraries/chain/include/eosio/chain/contract_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ namespace eosio {
}
};

struct newfioacc {
string fio_public_key;
authority owner;
authority active;
int64_t max_fee;
name actor;
string tpid;

static account_name get_account() {
return N(eosio);
}

static action_name get_name() {
return N(newfioacc);
}
};

struct lockperiodv2 {
int64_t duration = 0; //duration in seconds. each duration is seconds after grant creation.
int64_t amount; //this is the percent to be unlocked
Expand Down Expand Up @@ -320,6 +337,7 @@ FC_REFLECT(eosio::chain::unlinkauth, (account)(code)(type))
FC_REFLECT(eosio::chain::canceldelay, (canceling_auth)(trx_id))
FC_REFLECT(eosio::chain::onerror, (sender_id)(sent_trx))
FC_REFLECT(eosio::chain::trnsfiopubky, (payee_public_key)(amount)(max_fee)(actor)(tpid))
FC_REFLECT(eosio::chain::newfioacc, (fio_public_key)(owner)(active)(max_fee)(actor)(tpid))
FC_REFLECT(eosio::chain::regaddress, (fio_address)(owner_fio_public_key)(max_fee)(actor)(tpid))
FC_REFLECT(eosio::chain::regdomain, (fio_domain)(owner_fio_public_key)(max_fee)(actor)(tpid))
FC_REFLECT(eosio::chain::burnaddress, (fio_address)(max_fee)(actor)(tpid))
Expand Down
27 changes: 27 additions & 0 deletions libraries/chain/include/eosio/chain/fioio/fio_common_validator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,33 @@ namespace fioio {
return true;
}


inline bool isAccountValid(const string &name) {
ericbutz marked this conversation as resolved.
Show resolved Hide resolved

//must not be longer than 12 chars
if(name.length() > 12){
return false;
}

// must contain only these chars ".,abcdefghijklmmopqrstuvwxyz12345
if (name.find_first_not_of("abcdefghijklmnopqrstuvwxyz12345.,") != std::string::npos) {
return false;
}

// first char must be lower case a-z
if (name.find_first_of("abcdefghijklmnopqrstuvwxyz") != 0) {
return false;
}

//must not end in a dot
if(name.back() == '.'){
return false;
}

return true;
}


inline bool validateFioNameFormat(const FioAddress &fa) {
if (fa.domainOnly) {
if (fa.fiodomain.size() < 1 || fa.fiodomain.size() > maxFioDomainLen) {
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/fioio/fioerror.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ namespace fioio {
constexpr auto ErrorNoFioActionsFound = ident | httpLocationError | 157; // no actions found
constexpr auto ErrorDomainOwner = ident | httpInvalidError | 158;
constexpr auto ErrorNoEscrowListingsFound = ident | httpInvalidError | 159;
constexpr auto ErrorInvalidAccount = ident | httpDataError | 160; // Account name not valid

/**
* Helper funtions for detecting rich error messages and extracting bitfielded values
Expand Down
14 changes: 14 additions & 0 deletions plugins/chain_api_plugin/chain_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,14 @@ namespace eosio {
CHAIN_RO_CALL(get_required_keys, 200),
CHAIN_RO_CALL(get_transaction_id, 200),
CHAIN_RO_CALL(get_fio_balance, 200),
//FIP-39 begin
CHAIN_RO_CALL(get_encrypt_key, 200),
//FIP-39 end
CHAIN_RO_CALL(get_actor, 200),
CHAIN_RO_CALL(get_fio_names, 200),
//FIP-36 begin
CHAIN_RO_CALL(get_account_fio_public_key, 200),
//FIP-36 end
CHAIN_RO_CALL(get_fio_domains, 200),
CHAIN_RO_CALL(get_fio_addresses, 200),
CHAIN_RO_CALL(get_oracle_fees, 200),
Expand Down Expand Up @@ -155,6 +161,10 @@ namespace eosio {
chain_apis::read_write::remove_all_pub_addresses_results, 202),
CHAIN_RW_CALL_ASYNC(transfer_tokens_pub_key,
chain_apis::read_write::transfer_tokens_pub_key_results, 202),
//FIP-38 begin
CHAIN_RW_CALL_ASYNC(new_fio_chain_account,
chain_apis::read_write::new_fio_chain_account_results, 202),
//FIP-38 end
CHAIN_RW_CALL_ASYNC(transfer_locked_tokens,
chain_apis::read_write::transfer_locked_tokens_results, 202),
CHAIN_RW_CALL_ASYNC(burn_expired,
Expand Down Expand Up @@ -190,6 +200,10 @@ namespace eosio {
chain_apis::read_write::submit_fee_ratios_results, 202),
CHAIN_RW_CALL_ASYNC(submit_fee_multiplier,
chain_apis::read_write::submit_fee_multiplier_results, 202),
//FIP-39 begin
CHAIN_RW_CALL_ASYNC(update_encrypt_key,
chain_apis::read_write::update_encrypt_key_results, 202),
//FIP-39 end
CHAIN_RW_CALL_ASYNC(renew_fio_domain,
chain_apis::read_write::renew_fio_domain_results, 202),
CHAIN_RW_CALL_ASYNC(renew_fio_address,
Expand Down