broadcast()
action. Upon hearing the broadcast, our contract will read the final results, determine the winning candidate, and then send an inline action back to Telos Decide to update a committee with the election winner.testaccounta
account on Telos Testnet and own a balance of 1200 TLOS
. These funds will be used to pay the setup fees for a new treasury, new committee, and new ballot, with some left over.1200 TLOS
into Telos Decide by simply sending a transfer()
with telos.decide
as the recipient.newtreasury()
action on the telos.decide
contract. We will supply the following arguments:testaccounta
500.0 EXMPL
public
1,EXMPL
since we chose to use 1 decimal place of precision and the EXMPL ticker.1000 TLOS
regcommittee()
action on the telos.decide
contract. We will supply the following arguments:examplecmte
1,EXMPL
newtreasury()
action. Don't forget the precision.["seat1", "seat2", "seat3"]
testaccounta
100 TLOS
newballot()
action on the telos.decide
contract. We will supply the following arguments:examplebal
election
testaccounta
1,EXMPL
EXMPL
holder, including ourselves, will be able to cast a vote on this ballot.1token1vote
["testaccountx", "testaccounty", "testaccountz"]
openvoting()
. This can be done at any time, so we will wait until we finish setting up our example contract.30 TLOS
build.sh
provided in this repository's contracts folder, but you can build with the eosio-cpp
tool in the eosio.cdt
if that is preferable.testaccounta
account, we will use the provided deploy.sh
script, but you can deploy manually with the cleos set contract
command as well.broadcast()
action. To do this we simply call the watchballot()
action. We will be pushing this transaction to the testaccounta
account, since that's where we deployed our example contract. We'll give it the following arguments:examplebal
examplebal
ballot on Telos Decide.1,EXMPL
examplecmte
seat1
assignseat()
action so we can immediately elect our winning candidate. To do this we want to add the virtual eosio.code
permission to our contract's active authority with the cleos set account permission
command, like so:openvoting()
action to Telos Decide.openvoting()
action:examplebal
2019-11-14T13:00:00
YYYY-MM-DDTHH:MM:SS
closevoting()
action. We will supply the following arguments:examplebal
true
closed
to show the ballot has been properly ended.broadcast()
action that then notifies the ballot publisher account.testaccounta
account catches this broadcast()
notification from Telos Decide and interprets the final ballot results to determine the winner. Once determined, our contract automatically executes an inline action to Trail's assignseat()
action, which emplaces the winner into seat1
on the example committee.