Skip to content

Commit 29c9797

Browse files
committed
fix: add risk curators as attach arg
1 parent 01c6001 commit 29c9797

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/GearboxSDK.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export interface SDKAttachOptions {
4848
* If not set, address provider address is determinted automatically from networkType
4949
*/
5050
addressProvider?: Address;
51+
/**
52+
* Risk curators, defaults to gearbox own
53+
*/
54+
riskCurators?: Address[];
5155
/**
5256
* Bring your own logger
5357
*/
@@ -99,7 +103,7 @@ export class GearboxSDK extends EventEmitter<SDKEventsMap> {
99103
public readonly contracts = new AddressMap<BaseContract<any>>();
100104

101105
public static async attach(options: SDKAttachOptions): Promise<GearboxSDK> {
102-
const { rpcURL, timeout, logger } = options;
106+
const { rpcURL, timeout, logger, riskCurators } = options;
103107
let { networkType, addressProvider, chainId } = options;
104108
const attachClient = createAnvilClient({
105109
transport: http(rpcURL, { timeout }),
@@ -128,7 +132,7 @@ export class GearboxSDK extends EventEmitter<SDKEventsMap> {
128132
return new GearboxSDK({
129133
provider,
130134
logger,
131-
}).#attach(addressProvider);
135+
}).#attach(addressProvider, riskCurators);
132136
}
133137

134138
private constructor(options: SDKOptions) {
@@ -138,7 +142,10 @@ export class GearboxSDK extends EventEmitter<SDKEventsMap> {
138142
this.priceFeeds = new PriceFeedRegister(this);
139143
}
140144

141-
async #attach(addressProviderAddress: Address): Promise<this> {
145+
async #attach(
146+
addressProviderAddress: Address,
147+
riskCurators?: Address[],
148+
): Promise<this> {
142149
const time = Date.now();
143150

144151
await this.updateBlock();
@@ -167,9 +174,9 @@ export class GearboxSDK extends EventEmitter<SDKEventsMap> {
167174
);
168175

169176
this.#marketRegister = new MarketRegister(this);
170-
await this.#marketRegister.loadMarkets([
171-
TIMELOCK[this.provider.networkType],
172-
]);
177+
await this.#marketRegister.loadMarkets(
178+
riskCurators ?? [TIMELOCK[this.provider.networkType]],
179+
);
173180

174181
try {
175182
const router = this.#addressProvider.getLatestVersion(AP_ROUTER);

0 commit comments

Comments
 (0)