Skip to content

Commit

Permalink
OffchainVoting updates (#11)
Browse files Browse the repository at this point in the history
* update tribute-contracts lib

* fix mapping for updated OffchainVoting adapter
  • Loading branch information
jdville03 authored Dec 2, 2021
1 parent 6dfb4c1 commit aeeff6b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ganache-cli": "^6.12.1",
"hardhat-typechain": "^0.3.5",
"keccak256": "^1.0.0",
"tribute-contracts": "^2.2.5",
"tribute-contracts": "^2.3.0",
"truffle": "^5.2.6",
"ts-generator": "^0.1.1",
"typechain": "^4.0.3",
Expand Down
36 changes: 20 additions & 16 deletions subgraphs/Core/mappings/helpers/vote-results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,38 @@ export function loadProposalAndSaveVoteResults(
Address.fromString(votingAdapterAddress.toHex()) as Address
);
// get vote results and state
let voteResults = offchainVotingContract.votes(daoAddress, proposalId);
let voteResults = offchainVotingContract.getVote(
daoAddress,
proposalId
);
let voteState = offchainVotingContract.voteResult(
daoAddress,
proposalId
);

// assign voting data
vote.nbYes = voteResults.value3;
vote.nbNo = voteResults.value4;
vote.nbYes = voteResults.nbYes;
vote.nbNo = voteResults.nbNo;

vote.adapterName = votingAdapterName;
vote.adapterAddress = votingAdapterAddress;
vote.proposal = maybeProposalId;

if (proposal) {
proposal.snapshot = voteResults.value0;
proposal.reporter = voteResults.value1;
proposal.resultRoot = voteResults.value2;

proposal.nbYes = voteResults.value3;
proposal.nbNo = voteResults.value4;

proposal.startingTime = voteResults.value5;
proposal.gracePeriodStartingTime = voteResults.value6;
proposal.isChallenged = voteResults.value7;
proposal.stepRequested = voteResults.value8;
proposal.forceFailed = voteResults.value9;
proposal.fallbackVotesCount = voteResults.value10;
proposal.snapshot = voteResults.snapshot;
proposal.reporter = voteResults.reporter;
proposal.resultRoot = voteResults.resultRoot;

proposal.nbYes = voteResults.nbYes;
proposal.nbNo = voteResults.nbNo;

proposal.startingTime = voteResults.startingTime;
proposal.gracePeriodStartingTime =
voteResults.gracePeriodStartingTime;
proposal.isChallenged = voteResults.isChallenged;
proposal.stepRequested = voteResults.stepRequested;
proposal.forceFailed = voteResults.forceFailed;
proposal.fallbackVotesCount = voteResults.fallbackVotesCount;

proposal.votingState = voteState.toString();
proposal.votingResult = voteId;
Expand Down

0 comments on commit aeeff6b

Please sign in to comment.