@@ -245,6 +245,15 @@ contract("Voting Token", (accounts) => {
245
245
expect ( motion . skillId ) . to . eq . BN ( domain1 . skillId ) ;
246
246
} ) ;
247
247
248
+ it ( "can lock the token when a motion is created" , async ( ) => {
249
+ const action = await encodeTxData ( colony , "makeTask" , [ 1 , UINT256_MAX , FAKE , 1 , 0 , 0 ] ) ;
250
+ await voting . createRootMotion ( ADDRESS_ZERO , action ) ;
251
+ const motionId = await voting . getMotionCount ( ) ;
252
+
253
+ const lockId = await voting . getLockId ( motionId ) ;
254
+ expect ( lockId ) . to . not . be . zero ;
255
+ } ) ;
256
+
248
257
it ( "can create a motion with an alternative target" , async ( ) => {
249
258
const action = await encodeTxData ( colony , "makeTask" , [ 1 , 0 , FAKE , 2 , 0 , 0 ] ) ;
250
259
await voting . createRootMotion ( voting . address , action ) ;
@@ -635,6 +644,18 @@ contract("Voting Token", (accounts) => {
635
644
await voting . revealVote ( motionId , SALT , NAY , { from : USER0 } ) ;
636
645
} ) ;
637
646
647
+ it ( "can unlock the token once revealed" , async ( ) => {
648
+ await voting . submitVote ( motionId , soliditySha3 ( SALT , NAY ) , { from : USER0 } ) ;
649
+
650
+ await forwardTime ( SUBMIT_PERIOD , this ) ;
651
+
652
+ await voting . revealVote ( motionId , SALT , NAY , { from : USER0 } ) ;
653
+
654
+ const lockId = await voting . getLockId ( motionId ) ;
655
+ const { lockCount } = await tokenLocking . getUserLock ( token . address , USER0 ) ;
656
+ expect ( lockCount ) . to . eq . BN ( lockId ) ;
657
+ } ) ;
658
+
638
659
it ( "can tally votes from two users" , async ( ) => {
639
660
await voting . submitVote ( motionId , soliditySha3 ( SALT , YAY ) , { from : USER0 } ) ;
640
661
await voting . submitVote ( motionId , soliditySha3 ( SALT , YAY ) , { from : USER1 } ) ;
@@ -910,6 +931,10 @@ contract("Voting Token", (accounts) => {
910
931
} ) ;
911
932
912
933
it ( "cannot take an action if there is insufficient voting power (state change actions)" , async ( ) => {
934
+ // Clear the locks
935
+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER0 } ) ;
936
+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER1 } ) ;
937
+
913
938
// Set globalClaimDelay to WAD
914
939
await colony . makeExpenditure ( 1 , UINT256_MAX , 1 ) ;
915
940
const expenditureId = await colony . getExpenditureCount ( ) ;
@@ -955,6 +980,10 @@ contract("Voting Token", (accounts) => {
955
980
} ) ;
956
981
957
982
it ( "can set vote power correctly after a vote" , async ( ) => {
983
+ // Clear the locks
984
+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER0 } ) ;
985
+ await tokenLocking . methods [ "deposit(address,uint256,bool)" ] ( token . address , 0 , true , { from : USER1 } ) ;
986
+
958
987
await colony . makeExpenditure ( 1 , UINT256_MAX , 1 ) ;
959
988
const expenditureId = await colony . getExpenditureCount ( ) ;
960
989
0 commit comments