-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: keep oracle history by using address as the ID
- Loading branch information
Showing
13 changed files
with
136 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ config/addresses.ts | |
config/generatedAddresses.json | ||
tests/.bin | ||
.vscode | ||
.latest.json | ||
.latest.json | ||
.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export let ORACLE_CONFIGURATION_ABI = | ||
"(string,(string,string,string,string,string,string,string,string,string))" | ||
export let TUPLE_OFFSET_HEX = "0x0000000000000000000000000000000000000000000000000000000000000020" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
import { log, BigInt, Bytes } from "@graphprotocol/graph-ts"; | ||
import { StoreCache } from "./store-cache"; | ||
import { TUPLE_OFFSET_HEX } from './constants'; | ||
|
||
export function parseCalldata(calldata: Bytes): Bytes { | ||
// Remove function signature | ||
let dataWithoutSignature = calldata.toHexString().slice(10); | ||
let result = TUPLE_OFFSET_HEX + dataWithoutSignature; | ||
return Bytes.fromHexString(result); | ||
|
||
// ethabi expects a tuple offset if your tuple contains dynamic data | ||
// https://medium.com/@r2d2_68242/indexing-transaction-input-data-in-a-subgraph-6ff5c55abf20 | ||
let hexStringToDecode = '0x0000000000000000000000000000000000000000000000000000000000000020' + | ||
dataWithoutSignature; | ||
return Bytes.fromHexString(hexStringToDecode); | ||
} | ||
|
||
export function isSubmitterAllowed( | ||
cache: StoreCache, | ||
oracleIndex: String, | ||
submitter: String, | ||
submitter: Bytes | ||
): boolean { | ||
let oracle = cache.getOracle(oracleIndex); | ||
return oracle.address.toHexString() == submitter; | ||
let oracle = cache.getOracle(submitter); | ||
return oracle.active && oracle.index == oracleIndex; | ||
} | ||
|
||
|
||
export function getOracleVoteId( | ||
subgraphDeploymentID: String, | ||
oracleIndex: String, | ||
oracleAddress: String, | ||
timestamp: String | ||
): string { | ||
return [subgraphDeploymentID, oracleIndex, timestamp].join("-") as string; | ||
return [subgraphDeploymentID, oracleAddress, timestamp].join("-") as string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.