Recently , I need add permission control in my contract , that only one account can operate it , the result of require_auth() function , is not I need , does any one can tell my the right way?
Tip: clearly stating your question would help you get better and more accurate answers
require_auth(N(YOUR_HARDCODED_ACCOUNT));
@xJonathanLEI
More specifically is , I want set the contract owner , and the contract owner is only one who can operate this contract , but when I use require_auth() , this function only can recognize , the account which is in eosio , so in eosio every account can operate my contract.
I have some idea , that is through multi_index to record , who is owner in this contract , or set a defult owner account in contract , thet use eosio_assert in every functions to determine who can access.
Does eosio have provide the offcial function that can check the contract owner or deployer?
@taokayan
Thank for your reply , so the require_auth(N(YOUR_HARDCODED_ACCOUNT)); can use to determine who is the contract owner?
require_auth is not just for eosio accounts. Just put your "owner" account name inside. The function throws when a valid permission from the said account is not present.
@taokayan I try it , and it work well, thank you!
@xJonathanLEI Thanks for reply , it is work , thank you!
Most helpful comment
require_auth(N(YOUR_HARDCODED_ACCOUNT));