-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathsetPricesEtherFi.ts
More file actions
134 lines (131 loc) · 3.83 KB
/
Copy pathsetPricesEtherFi.ts
File metadata and controls
134 lines (131 loc) · 3.83 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { ethers } from "ethers";
import { types } from "hardhat/config";
import { action } from "../lib/action";
import { setPrices } from "../armPrices";
import { setPricesForBases } from "../../utils/priceActionUtils";
import { mainnet } from "../../utils/addresses";
const etherFiARMAbi = require("../../../abis/EtherFiARM.json");
action({
name: "setPricesEtherFi",
description: "Set prices for EtherFi ARM",
chains: [1],
// Price points are operator-overridable from the scheduled command in
// talos (talos UI → schedules → command field). Defaults match what
// was hardcoded previously so existing seed commands without overrides
// keep their old behavior.
params: (t) =>
t
.addOptionalParam(
"buyPrice",
"Exact buy price; when set, sellPrice must also be set (ETH per base asset).",
undefined,
types.float,
)
.addOptionalParam(
"sellPrice",
"Exact sell price; when set, buyPrice must also be set (base asset per ETH).",
undefined,
types.float,
)
.addOptionalParam(
"maxBuyPrice",
"Upper bound for buy-side price (ETH per eETH).",
0.9998,
types.float,
)
.addOptionalParam(
"minBuyPrice",
"Lower bound for buy-side price (ETH per eETH).",
0.99,
types.float,
)
.addOptionalParam(
"maxSellPrice",
"Upper bound for sell-side price (eETH per ETH).",
1.0,
types.float,
)
.addOptionalParam(
"minSellPrice",
"Lower bound for sell-side price (eETH per ETH).",
0.99996,
types.float,
)
.addOptionalParam(
"amount",
"Override the automatically detected DEX swap amount used to fetch the reference price quote.",
undefined,
types.float,
)
.addOptionalParam(
"inch",
"Use 1Inch as the aggregator price source.",
false,
types.boolean,
)
.addOptionalParam(
"kyber",
"Use Kyber as the aggregator price source.",
true,
types.boolean,
)
.addOptionalParam(
"offset",
"Price offset applied to aggregator quotes.",
0.2,
types.float,
)
.addOptionalParam(
"dynamicOffset",
"Use a dynamic offset that scales from zero at cross price to the DEX spread at the full-spread price.",
false,
types.boolean,
)
.addOptionalParam(
"dynamicOffsetFullSpreadPrice",
"DEX sell price where dynamic offset reaches 100% of the DEX spread.",
0.999,
types.float,
)
.addOptionalParam(
"tolerance",
"Tolerance used when comparing target and current prices.",
0.09,
types.float,
)
.addOptionalParam(
"fee",
"Swap fee in basis points used by setPrices when computing target prices.",
2,
types.float,
),
run: async ({ signer, log, args }) => {
const arm = new ethers.Contract(mainnet.etherfiARM, etherFiARMAbi, signer);
log.info("Setting prices for EtherFi ARM");
await setPricesForBases({
setPrices,
bases: ["EETH", "WEETH"],
options: {
signer,
arm,
armName: "EtherFi",
buyPrice: args.buyPrice,
sellPrice: args.sellPrice,
maxSellPrice: args.maxSellPrice,
minSellPrice: args.minSellPrice,
maxBuyPrice: args.maxBuyPrice,
minBuyPrice: args.minBuyPrice,
kyber: args.kyber,
inch: args.inch,
amount: args.amount,
tolerance: args.tolerance,
fee: args.fee,
offset: args.offset,
dynamicOffset: args.dynamicOffset,
dynamicOffsetFullSpreadPrice: args.dynamicOffsetFullSpreadPrice,
priceOffset: true,
blockTag: "latest",
},
});
},
});