Skip to content
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

Allow referencing existing Defender resources #27

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/defender-test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"license": "MIT",
"devDependencies": {
"@openzeppelin/defender-as-code": "2.1.0",
"@openzeppelin/defender-as-code": "^2.0.0",
"serverless": "^3.20.0"
}
}
25 changes: 16 additions & 9 deletions examples/defender-test-project/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ resources:
name: 'Hello world from serverless'
path: './actions/hello-world'
# optional
relayer: ${self:resources.relayers.relayer-1}
relayer: ${self:resources.relayers.relayer-3}
trigger:
type: 'schedule' # or webhook
# optional if not cron
Expand All @@ -44,6 +44,7 @@ resources:
trigger:
type: 'webhook'
paused: false
action-example-4: '516dfd2f-9715-47d4-bcdf-d1f9a7b4d80d'

policies:
policy-1:
Expand Down Expand Up @@ -75,6 +76,7 @@ resources:
abi: ${file(./abis/demoflash.json.abi)}
# optional
nat-spec: null
contract-2: 'goerli-0xd70d6A0480420b4C788AF91d0E1b0ca6141A9De8'

relayers:
relayer-1:
Expand All @@ -93,6 +95,14 @@ resources:
address-from-relayer: ${self:resources.relayers.relayer-1}
# optional
policy: ${self:resources.policies.policy-1}
relayer-3: 'bcb659c6-7e11-4d37-a15b-0fa9f3d3442c' # relayerId referenced from Defender
relayer-4:
name: 'Test Relayer 4'
network: 'mainnet'
min-balance: 1000
address-from-relayer: ${self:resources.relayers.relayer-3}
# optional
policy: ${self:resources.policies.policy-1}

notifications:
email-1:
Expand Down Expand Up @@ -134,9 +144,10 @@ resources:
type: 'BLOCK'
network: 'goerli'
risk-category: 'TECHNICAL' # optional
addresses:
- '0x0f06aB75c7DD497981b75CD82F6566e3a5CAd8f2'
# optional
# optional - either contracts OR addresses should be defined
contracts:
- ${self:resources.contracts.contract-2}
# optional - will default to first contract in contracts if not defined
abi: ${file(./abis/erc721.json.abi)}
# optional
alert-threshold:
Expand All @@ -145,7 +156,7 @@ resources:
# optional
paused: false
# optional
action-condition: ${self:resources.actions.action-example-1}
action-condition: ${self:resources.actions.action-example-4}
# optional
action-trigger: null
# optional
Expand All @@ -167,10 +178,6 @@ resources:
forta-example:
name: 'Forta Example'
type: 'FORTA'
network: 'mainnet'
# optional if agent-ids is defined
addresses:
- '0x318958A61A3dFa42fBdAA6A28A4F481678D943cC'
# optional
alert-threshold:
amount: 2
Expand Down
Loading