-
Notifications
You must be signed in to change notification settings - Fork 5
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
f855b86
commit af3a99d
Showing
10 changed files
with
237 additions
and
151 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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const { Defender } = require("@openzeppelin/defender-sdk"); | ||
const { ethers } = require("ethers"); | ||
|
||
const { setPrices } = require("../tasks/lidoPrices"); | ||
const { mainnet } = require("../utils/addresses"); | ||
const lidoARMAbi = require("../../abis/LidoARM.json"); | ||
|
||
// Entrypoint for the Defender Action | ||
const handler = async (event) => { | ||
// Initialize defender relayer provider and signer | ||
const client = new Defender(event); | ||
const provider = client.relaySigner.getProvider({ ethersVersion: "v6" }); | ||
const signer = await client.relaySigner.getSigner(provider, { | ||
speed: "fastest", | ||
ethersVersion: "v6", | ||
}); | ||
|
||
console.log( | ||
`DEBUG env var in handler before being set: "${process.env.DEBUG}"` | ||
); | ||
|
||
// References to contracts | ||
const arm = new ethers.Contract(mainnet.lidoARM, lidoARMAbi, signer); | ||
|
||
try { | ||
await setPrices({ | ||
signer, | ||
arm, | ||
curve: true, | ||
amount: 50, | ||
tolerance: 0.2, | ||
maxBuyPrice: 0.9997, | ||
minSellPrice: 0.9999, | ||
fee: 1, | ||
blockTag: "latest", | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
module.exports = { handler }; |
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.