tokenika / eosfactory

Python-based EOS smart-contract development & testing framework
http://eosfactory.io/
Other
243 stars 62 forks source link

How to set permissions for call action in another contract with eosfactory? #83

Closed golovin closed 5 years ago

golovin commented 5 years ago

In case when contract B should call method from contract A (eosio.token) on behalf of active user we have to set eosio.code permission. Manually it can be done by this command cleos set account permission user1 active '{"threshold": 1,"keys": [{"key": "PRIVATE_KEY","weight": 1}],"accounts": [{"permission":{"actor":"contractB","permission":"eosio.code"},"weight":1}]}' owner -p user1

How it can be done via eosfactory?

jakub-zarembinski commented 5 years ago

As of now, EOS Factory lacks this functionality.

However, we do consider it important for smart-contract testing and we'll aim to have it in the next release.

Thanks for the suggestion.

golovin commented 5 years ago

I can make PR with that functionality if needed

jakub-zarembinski commented 5 years ago

I can make PR with that functionality if needed

That'd be great. Please do it against the dev branch.

LukeDickerson19 commented 5 years ago

thank you so much golovin!

shouldn't "PRIVATE_KEY" be "PUBLIC_KEY" though?

Just going off of what cleos set account permission -h says.

stefanzarembinski commented 5 years ago

Done, will be effective in the next edition

jakub-zarembinski commented 5 years ago

@golovin Permissions should be working in the current release. Please refer to these docs: http://eosfactory.io/build/html/patterns/set/set_account_permission.html http://eosfactory.io/build/html/patterns/set/set_action_permission.html