-
Notifications
You must be signed in to change notification settings - Fork 5
/
setPrices.js
43 lines (37 loc) · 1.11 KB
/
setPrices.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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: 100,
tolerance: 0.1,
maxBuyPrice: 0.9997,
minSellPrice: 0.9998,
fee: 0.8,
offset: 0.2,
blockTag: "latest",
});
} catch (error) {
console.error(error);
}
};
module.exports = { handler };