-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7a9a9a
commit 56251bd
Showing
16 changed files
with
1,452 additions
and
18 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
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 |
---|---|---|
|
@@ -121,6 +121,7 @@ type Feed struct { | |
baseBenchmarkPrice *big.Int | ||
baseBid *big.Int | ||
baseAsk *big.Int | ||
baseMarketStatus uint32 | ||
} | ||
|
||
func randomFeedID(version uint16) [32]byte { | ||
|
@@ -467,3 +468,97 @@ chainID = 1337 | |
nativeFeedID, | ||
)) | ||
} | ||
|
||
func addV4MercuryJob( | ||
t *testing.T, | ||
node Node, | ||
i int, | ||
verifierAddress common.Address, | ||
bootstrapPeerID string, | ||
bootstrapNodePort int, | ||
bmBridge, | ||
bidBridge, | ||
askBridge, | ||
marketStatusBridge string, | ||
servers map[string]string, | ||
clientPubKey ed25519.PublicKey, | ||
feedName string, | ||
feedID [32]byte, | ||
linkFeedID [32]byte, | ||
nativeFeedID [32]byte, | ||
) { | ||
srvs := make([]string, 0, len(servers)) | ||
for u, k := range servers { | ||
srvs = append(srvs, fmt.Sprintf("%q = %q", u, k)) | ||
} | ||
serversStr := fmt.Sprintf("{ %s }", strings.Join(srvs, ", ")) | ||
|
||
node.AddJob(t, fmt.Sprintf(` | ||
type = "offchainreporting2" | ||
schemaVersion = 1 | ||
name = "mercury-%[1]d-%[11]s" | ||
forwardingAllowed = false | ||
maxTaskDuration = "1s" | ||
contractID = "%[2]s" | ||
feedID = "0x%[10]x" | ||
contractConfigTrackerPollInterval = "1s" | ||
ocrKeyBundleID = "%[3]s" | ||
p2pv2Bootstrappers = [ | ||
"%[4]s" | ||
] | ||
relay = "evm" | ||
pluginType = "mercury" | ||
transmitterID = "%[9]x" | ||
observationSource = """ | ||
// Benchmark Price | ||
price1 [type=bridge name="%[5]s" timeout="50ms" requestData="{\\"data\\":{\\"from\\":\\"ETH\\",\\"to\\":\\"USD\\"}}"]; | ||
price1_parse [type=jsonparse path="result"]; | ||
price1_multiply [type=multiply times=100000000 index=0]; | ||
price1 -> price1_parse -> price1_multiply; | ||
// Bid | ||
bid [type=bridge name="%[6]s" timeout="50ms" requestData="{\\"data\\":{\\"from\\":\\"ETH\\",\\"to\\":\\"USD\\"}}"]; | ||
bid_parse [type=jsonparse path="result"]; | ||
bid_multiply [type=multiply times=100000000 index=1]; | ||
bid -> bid_parse -> bid_multiply; | ||
// Ask | ||
ask [type=bridge name="%[7]s" timeout="50ms" requestData="{\\"data\\":{\\"from\\":\\"ETH\\",\\"to\\":\\"USD\\"}}"]; | ||
ask_parse [type=jsonparse path="result"]; | ||
ask_multiply [type=multiply times=100000000 index=2]; | ||
ask -> ask_parse -> ask_multiply; | ||
// Market Status | ||
marketstatus [type=bridge name="%[14]s" timeout="50ms" requestData="{\\"data\\":{\\"from\\":\\"ETH\\",\\"to\\":\\"USD\\"}}"]; | ||
marketstatus_parse [type=jsonparse path="result" index=3]; | ||
marketstatus -> marketstatus_parse; | ||
""" | ||
[pluginConfig] | ||
servers = %[8]s | ||
linkFeedID = "0x%[12]x" | ||
nativeFeedID = "0x%[13]x" | ||
[relayConfig] | ||
chainID = 1337 | ||
`, | ||
i, | ||
verifierAddress, | ||
node.KeyBundle.ID(), | ||
fmt.Sprintf("%[email protected]:%d", bootstrapPeerID, bootstrapNodePort), | ||
bmBridge, | ||
bidBridge, | ||
askBridge, | ||
serversStr, | ||
clientPubKey, | ||
feedID, | ||
feedName, | ||
linkFeedID, | ||
nativeFeedID, | ||
marketStatusBridge, | ||
)) | ||
} |
Oops, something went wrong.