File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
src/sdk/core/address-provider Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 11import type { Address } from "viem" ;
22
33import { iVersionAbi } from "../../../abi/iVersion.js" ;
4- import { isV300 , isV310 } from "../../constants/index.js" ;
4+ import {
5+ ADDRESS_PROVIDER_V310 ,
6+ isV300 ,
7+ isV310 ,
8+ } from "../../constants/index.js" ;
59import type { GearboxSDK } from "../../GearboxSDK.js" ;
10+ import { hexEq } from "../../utils/hex.js" ;
611import { AddressProviderV300Contract } from "./AddressProviderV300Contract.js" ;
712import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js" ;
813import type {
@@ -14,11 +19,16 @@ export async function createAddressProvider(
1419 sdk : GearboxSDK ,
1520 address : Address ,
1621) : Promise < IAddressProviderContract > {
17- const v = await sdk . client . readContract ( {
18- address,
19- abi : iVersionAbi ,
20- functionName : "version" ,
21- } ) ;
22+ let v : bigint ;
23+ if ( hexEq ( address , ADDRESS_PROVIDER_V310 ) ) {
24+ v = 310n ;
25+ } else {
26+ v = await sdk . client . readContract ( {
27+ address,
28+ abi : iVersionAbi ,
29+ functionName : "version" ,
30+ } ) ;
31+ }
2232 return newAddressProvider ( sdk , address , Number ( v ) ) ;
2333}
2434
You can’t perform that action at this time.
0 commit comments