I'm trying to create a custom permission and push an action on my contract, but experience problems with authorization. Alice.acc is the account where the contract is set to. Giveprm is the custom permission level. The two versions I have tried are:
require_auth2(permission_level{N(alice.acc),N(giveprm) });
and
require_auth(permission_level{N(alice.acc),N(giveprm)});
When trying to access function increment, which takes no arguments, I wish to use account alice@active, so I have permissions on account alice.acc as this:
cleos get account alice.acc
privileged: false
permissions:
owner 1: 1 EOS77dNi2z2nSrwuVrdGX7QHPyohfHwLeSeZo8CbU3yZKWarbHTSv
active 2: 2 alice@active, 1 bob@active,
giveprm 2: 2 alice@active, 1 bob@active,
Calling the function like:
cleos push action alice.acc increment '""' --permission alice@active
But I'm getting error
Error 3090004: missing required authority
Ensure that you have the related authority inside your transaction!;
If you are currently using 'cleos push action' command, try to add the relevant authority using -p option.
Error Details:
missing authority of alice.acc/giveprm
Am I using require_auth in an incorrect way, or is there a problem with the permissions on the account? Thank you!