Usually if you have a permission to call action (imagine, issueTokens) directly, you can call issueTokens and it will immediately mint some tokens:
// 1 - Grant myself ISSUE_TOKENS permission// i should be the owner of _dao OR i should have MANAGE_GROUPS permission// to call addGroupMember and allowActionByAnyMemberOfGroup_dao.addGroupMember("Managers", msg.sender);_dao.allowActionByAnyMemberOfGroup(_dao.ISSUE_TOKENS(), ”Managers”);// 2 - Check permission// this should be 'true'bool yesICan = _dao.isCanDoAction(msg.sender, _dao.ISSUE_TOKENS());// 3 - Mint 100 tokens to employee1// _dao is an owner of repToken and controlls it// to call this action you should have ISSUE_TOKENS permission granted// to your account (current msg.sender)_dao.issueTokens(repToken.address, employee1, 100);// this will fail because I AM NOT an owner of the repToken// but _dao isrepToken.mint(employee1, 100);
But sometimes you will want to set permission that this call will rather start voting instead of directly minting tokens.
// 1 - ISSUE_TOKENS can be called with voting_dao.allowActionByVoting(dao.ISSUE_TOKENS(), token.address);// 2 - Check permission// this should be 'false'bool yesICan = _dao.isCanDoAction(msg.sender, _dao.ISSUE_TOKENS());// 3 - Mint 100 tokens to employee1// now this will create new proposal and start new voting automatically_dao.issueTokens(repToken.address, employee1, 100);
In this case Thetta will automatically create a new Proposal and start a new Voting. Once voting is finished with "yes", action will called automatically: