diff --git a/Clarinet.toml b/Clarinet.toml index 8fd0eb4..182cb42 100644 --- a/Clarinet.toml +++ b/Clarinet.toml @@ -153,7 +153,7 @@ path = "contracts/proposals/ccip014-pox-3-v2.clar" clarity_version = 2 epoch = 2.4 -[contracts.ccip017] +[contracts.ccip017-extend-sunset-period] path = "contracts/proposals/ccip017-extend-direct-execute-sunset-period.clar" clarity_version = 2 epoch = 2.4 diff --git a/tests/proposals/ccip017-extend-direct-execute-sunset-period.test.ts b/tests/proposals/ccip017-extend-direct-execute-sunset-period.test.ts index 83424bb..0027571 100644 --- a/tests/proposals/ccip017-extend-direct-execute-sunset-period.test.ts +++ b/tests/proposals/ccip017-extend-direct-execute-sunset-period.test.ts @@ -500,7 +500,6 @@ Clarinet.test({ ccd007CityStacking.getCurrentRewardCycle().result.expectUint(5); // act - // execute yes and no vote // user 1 has more voting power const votingBlock = chain.mineBlock([ccip017ExtendDirectExecuteSunsetPeriod.voteOnProposal(user1, false), ccip017ExtendDirectExecuteSunsetPeriod.voteOnProposal(user2, true)]); @@ -508,13 +507,37 @@ Clarinet.test({ // assert // overall totals - assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoteTotals().result.expectSome().expectTuple(), { noTotal: types.uint(938), noVotes: types.uint(1), yesTotal: types.uint(469), yesVotes: types.uint(1) }); + assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoteTotals().result.expectSome().expectTuple(), { + noTotal: types.uint(941), + noVotes: types.uint(1), + yesTotal: types.uint(470), + yesVotes: types.uint(1), + }); + // user 1 - assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user1Id).result.expectTuple(), { claimable: types.uint(0), stacked: types.uint(500) }); - assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user1Id).result.expectSome().expectTuple(), { mia: types.uint(438), nyc: types.uint(500), total: types.uint(938), vote: types.bool(false) }); + + assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user1Id).result.expectTuple(), { + claimable: types.uint(0), + stacked: types.uint(500), + }); + assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user1Id).result.expectSome().expectTuple(), { + mia: types.uint(441), + nyc: types.uint(500), + total: types.uint(941), + vote: types.bool(false), + }); + // user 2 - assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user2Id).result.expectTuple(), { claimable: types.uint(0), stacked: types.uint(250) }); - assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user2Id).result.expectSome().expectTuple(), { mia: types.uint(219), nyc: types.uint(250), total: types.uint(469), vote: types.bool(true) }); + assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user2Id).result.expectTuple(), { + claimable: types.uint(0), + stacked: types.uint(250), + }); + assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user2Id).result.expectSome().expectTuple(), { + mia: types.uint(220), + nyc: types.uint(250), + total: types.uint(470), + vote: types.bool(true), + }); // act @@ -524,19 +547,39 @@ Clarinet.test({ // assert // overall totals - assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoteTotals().result.expectSome().expectTuple(), { noTotal: types.uint(469), noVotes: types.uint(1), yesTotal: types.uint(938), yesVotes: types.uint(1) }); + assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoteTotals().result.expectSome().expectTuple(), { + noTotal: types.uint(470), + noVotes: types.uint(1), + yesTotal: types.uint(941), + yesVotes: types.uint(1), + }); // user 1 - assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user1Id).result.expectTuple(), { claimable: types.uint(0), stacked: types.uint(500) }); - assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user1Id).result.expectSome().expectTuple(), { mia: types.uint(438), nyc: types.uint(500), total: types.uint(938), vote: types.bool(true) }); + assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user1Id).result.expectTuple(), { + claimable: types.uint(0), + stacked: types.uint(500), + }); + assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user1Id).result.expectSome().expectTuple(), { + mia: types.uint(441), + nyc: types.uint(500), + total: types.uint(941), + vote: types.bool(true), + }); // user 2 - assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user2Id).result.expectTuple(), { claimable: types.uint(0), stacked: types.uint(250) }); - assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user2Id).result.expectSome().expectTuple(), { mia: types.uint(219), nyc: types.uint(250), total: types.uint(469), vote: types.bool(false) }); + assertEquals(ccd007CityStacking.getStacker(mia.cityId, cycleId, user2Id).result.expectTuple(), { + claimable: types.uint(0), + stacked: types.uint(250), + }); + assertEquals(ccip017ExtendDirectExecuteSunsetPeriod.getVoterInfo(user2Id).result.expectSome().expectTuple(), { + mia: types.uint(220), + nyc: types.uint(250), + total: types.uint(470), + vote: types.bool(false), + }); // execute ccip-017 const block = passProposal(chain, accounts, PROPOSALS.CCIP_017); // assert - //console.log(`\nexecute block:\n${JSON.stringify(block, null, 2)}`); block.receipts[2].result.expectOk().expectUint(3); }, }); diff --git a/utils/common.ts b/utils/common.ts index 60b1869..098bbbe 100644 --- a/utils/common.ts +++ b/utils/common.ts @@ -39,7 +39,7 @@ export const PROPOSALS = { CCIP_013: ADDRESS.concat(".ccip013-migration"), CCIP_014: ADDRESS.concat(".ccip014-pox-3"), CCIP_014_V2: ADDRESS.concat(".ccip014-pox-3-v2"), - CCIP_017: ADDRESS.concat(".ccip017"), + CCIP_017: ADDRESS.concat(".ccip017-extend-sunset-period"), TEST_CCD001_DIRECT_EXECUTE_001: ADDRESS.concat(".test-ccd001-direct-execute-001"), TEST_CCD001_DIRECT_EXECUTE_002: ADDRESS.concat(".test-ccd001-direct-execute-002"), TEST_CCD001_DIRECT_EXECUTE_003: ADDRESS.concat(".test-ccd001-direct-execute-003"),