-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add service provider address to config #93
Merged
jahabeebs
merged 7 commits into
dev
from
feat/grt-229-add-service-prov-address-to-config
Nov 22, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1d0d9ae
feat: add service provider address to config
jahabeebs e6accab
chore: cleanup types and docs
jahabeebs f764db0
chore: cleanup docs
jahabeebs e5db40f
chore: cleanup docs
jahabeebs 0d7cd9d
fix: pr comments
jahabeebs 54fbd3a
fix: pr comments
jahabeebs 43bfebb
Merge branch 'dev' into feat/grt-229-add-service-prov-address-to-config
jahabeebs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ import { ProtocolProvider } from "@ebo-agent/automated-dispute/src/index.js"; | |
import { mockLogger } from "@ebo-agent/automated-dispute/tests/mocks/logger.mocks.js"; | ||
import { Caip2ChainId } from "@ebo-agent/shared"; | ||
import * as dotenv from "dotenv"; | ||
import { Address, Hex, isHex } from "viem"; | ||
import { Address, Hex, isAddress, isHex } from "viem"; | ||
import { z } from "zod"; | ||
|
||
dotenv.config(); | ||
|
@@ -70,6 +70,12 @@ const envSchema = z.object({ | |
CONTRACTS_ADDRESSES: stringToJSONSchema.pipe(contractsAddressesSchema), | ||
BONDED_RESPONSE_MODULE_ADDRESS: z.string().min(1, "BONDED_RESPONSE_MODULE_ADDRESS is required"), | ||
BOND_ESCALATION_MODULE_ADDRESS: z.string().min(1, "BOND_ESCALATION_MODULE_ADDRESS is required"), | ||
SERVICE_PROVIDER_ADDRESS: z | ||
.string() | ||
.refine((val) => isAddress(val), { | ||
message: "SERVICE_PROVIDER_ADDRESS must be a valid blockchain address", | ||
}) | ||
.optional(), | ||
Comment on lines
+73
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This env var is fine, it can stay as we are not using yaml config files for the scripts. |
||
}); | ||
|
||
const envResult = envSchema.safeParse(process.env); | ||
|
@@ -103,7 +109,13 @@ const rpcConfig = { | |
|
||
const contracts = env.CONTRACTS_ADDRESSES; | ||
|
||
const provider = new ProtocolProvider(rpcConfig, contracts, env.PRIVATE_KEY as Hex, mockLogger()); | ||
const provider = new ProtocolProvider( | ||
rpcConfig, | ||
contracts, | ||
env.PRIVATE_KEY as Hex, | ||
env.SERVICE_PROVIDER_ADDRESS, | ||
mockLogger(), | ||
); | ||
|
||
/** | ||
* Approves the necessary modules by calling approveModule on ProtocolProvider. | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we specify the
accessControl
property here (which is good, it's what we want), the user needs to include theaccessControl
object within theprotocolProvider
object in the config YAML file.Thus we don't need the env var.
Remember that as a general approach, we generally want public values to be in the config YAML file and secrets to be in env vars.