Skip to content

Commit

Permalink
fix proposal id query due to subgraph update
Browse files Browse the repository at this point in the history
Signed-off-by: david <[email protected]>
  • Loading branch information
daywiss committed Jul 6, 2023
1 parent 4800d21 commit 78f8586
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/plugins/safeSnap/utils/umaModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,11 @@ const findAssertionsGql = async (
return result?.assertions ?? [];
};
// Search optimistic governor for individual proposal
const findProposalGql = async (
network: string,
params: { ogAddress: string; proposalHash: string }
) => {
const findProposalGql = async (network: string, params: { assertionId }) => {
const subgraph = getOptimisticGovernorSubgraph(network);
const request = `
{
proposal(id:"${params.ogAddress.toLowerCase()}-${params.proposalHash.toLowerCase()}"){
proposal(id:"${assertionId}"){
id
executed
}
Expand Down Expand Up @@ -300,9 +297,9 @@ export const getModuleDetailsUma = async (
// Get the full proposal events (with state).
const fullAssertionEvent = await Promise.all(
thisModuleAssertionEvent.map(async event => {
const assertion = await oracleContract.getAssertion(
const assertion = (await oracleContract.getAssertion(
event.args?.assertionId
) as Promise<{
)) as Promise<{
expirationTime: BigNumber;
settled: boolean;
}>;
Expand All @@ -311,7 +308,7 @@ export const getModuleDetailsUma = async (
Math.floor(Date.now() / 1000) >= assertion.expirationTime.toNumber();

return {
assertionId:event?.args?.assertionId,
assertionId: event?.args?.assertionId,
expirationTimestamp: assertion.expirationTime,
isExpired: isExpired,
isSettled: assertion.settled,
Expand Down Expand Up @@ -465,10 +462,11 @@ export const getModuleDetailsUmaGql = async (
}
: undefined;

const proposal = await findProposalGql(network, {
ogAddress:moduleAddress,
proposalHash,
});
const proposal = assertionEvent.assertionId
? await findProposalGql(network, {
assertionId: assertionEvent.assertionId
})
: undefined;
const proposalExecuted = proposal?.executed ? true : false;

return {
Expand Down

0 comments on commit 78f8586

Please sign in to comment.