Colony SDK browser demo - local deployment - Motion workflow

First make sure that the Colony contracts are deployed locally and the Reputation Oracle is set up.

We'll be using wallet address 0xb77D57F4959eAfA0339424b83FcFaf9c15407461 to connect to the locally deployed MetaColony. This address was used to deploy the MetaColony locally and is the "owner" of it. Any transaction will automatically be signed as we have the private key hardcoded. No connection to MetaMask is needed.

1) Let's connect to the ColonyNetwork first Paste in the address from the `etherrouter-address.json` in the `colonyNetwork` directory

This will also set up the Motions&Disputes extension in the MetaColony with testing settings as well as distribute an initial amount of reputation and CLNY to the two addresses we're using for this example: 0xb77D57F4959eAfA0339424b83FcFaf9c15407461 and 0x9df24e73f40b2a911eb254a8825103723e13209c.

2) Now we install the VotingReputation extension and bootstrap some reputation (you only need to do this once for this example)

3) Now we approve some of the CLNY of 0xb77D57F4959eAfA0339424b83FcFaf9c15407461 for the Colony and the VotingReputation staking, which will remove it from the user's wallet (you only need to do this once for this example)

4) Jump forward in time - When we connected to the Colony above, the two addresses mentioned were awarded some reputation. It is awarded in cycles; in our case it's set to 1 hour. As we have full control over our local blockchain, Ganache allows us to travel to the future! Fasten your seatbelts, here we go (take a look at the console for the reputation oracle!)!

Instructions:

Note: We're using Ganache's evm_increaseTime and evm_mine methods to first increase the block time artificially by one hour and then force a block to mine. This will trigger the local reputation oracle/miner to award the pending reputation. We have to do that twice, if the reputation oracle was just started for the first time.

5) Then, we create a motion to pay some CLNY to a third address: 0x27ff0c145e191c22c75cd123c679c3e1f58a4469 (this will also incur reputation if the motion passes) (make it less than 100!)

6) Next, we look at the motion more closely

You will see the domainId in which the motion was created, the altTarget (which is the OneTxPayment extension in this case, as we want to execute the `pay` function on it), the encoded action and the stakes remaining for activation.

7) Okay, now we're ready to stake. Feel free to stake any amount, then get the motion again and see how it goes up :)

8) We can also simulate voting. For that, we activate both sides by staking the required amount on both sides from a single address. That usually won't happen in the wild (except if someone wants to force voting for some reason). Stake on both sides and then get the motion data to see if remainingYayStakes and remainingNayStakes are both 0.0

9) Reveal the vote After the voting phase is over (you will need to wait ~6 minutes - we are forwarding time again for that), the votes can be revealed. Only if a vote is revealed it is counted and the voting reward is paid out

10) If the motion was successful, we can finalize it. In our example we can only finalize it if we wait long enough (~6min - the time is forwarded again when you press the button) after staking was only activated for Yay or if we voted for Yay.

Message