Skip to content

Commit baaa8d1

Browse files
Merge pull request #518 from curvefi/chore/dependencies
chore: sync dependencies
2 parents 65ef04f + af84f18 commit baaa8d1

18 files changed

+157
-93
lines changed

Diff for: apps/dao/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
"@hookform/resolvers": "^3.9.0",
3030
"@lingui/react": "^4.6.0",
3131
"@supercharge/promise-pool": "^2.3.2",
32-
"bignumber.js": "^9.0.1",
32+
"bignumber.js": "^9.1.2",
3333
"curve-common": "*",
3434
"curve-lib": "*",
3535
"curve-ui-kit": "*",
3636
"dayjs": "^1.11.7",
37-
"ethers": "^6.9.0",
37+
"ethers": "^6.13.4",
3838
"focus-visible": "5.2.0",
3939
"fuse.js": "^6.6.2",
4040
"immer": "^9.0.12",
4141
"intersection-observer": "^0.12.0",
4242
"lightweight-charts": "4.1.2",
4343
"lodash": "4.17.21",
4444
"make-plural": "^7.1.0",
45-
"memoizee": "^0.4.15",
45+
"memoizee": "^0.4.17",
4646
"next": "^13.5.6",
4747
"next-images": "^1.8.5",
4848
"react": "*",

Diff for: apps/lend/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@
2828
"@lingui/detect-locale": "^4.6.0",
2929
"@lingui/react": "^4.6.0",
3030
"@supercharge/promise-pool": "^2.3.2",
31-
"bignumber.js": "^9.0.1",
31+
"bignumber.js": "^9.1.2",
3232
"cross-fetch": "^3.1.5",
3333
"curve-common": "*",
3434
"curve-lib": "*",
3535
"curve-ui-kit": "*",
3636
"dayjs": "^1.11.7",
37-
"ethers": "^6.11.0",
37+
"ethers": "^6.13.4",
3838
"external-rewards": "*",
3939
"focus-visible": "5.2.0",
4040
"fuse.js": "^6.6.2",
4141
"immer": "^9.0.12",
4242
"intersection-observer": "^0.12.0",
4343
"lodash": "4.17.21",
4444
"make-plural": "^7.1.0",
45-
"memoizee": "^0.4.15",
45+
"memoizee": "^0.4.17",
4646
"next": "^13.5.6",
4747
"next-images": "^1.8.5",
4848
"numbro": "^2.4.0",

Diff for: apps/loan/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
"@lingui/detect-locale": "^4.6.0",
3030
"@lingui/react": "^4.6.0",
3131
"@supercharge/promise-pool": "^2.3.2",
32-
"bignumber.js": "^9.0.1",
32+
"bignumber.js": "^9.1.2",
3333
"cross-fetch": "^3.1.5",
3434
"curve-common": "*",
3535
"curve-lib": "*",
3636
"curve-ui-kit": "*",
3737
"dayjs": "^1.11.7",
38-
"ethers": "^5",
38+
"ethers": "^6.13.4",
3939
"focus-visible": "5.2.0",
4040
"fuse.js": "^6.6.2",
4141
"immer": "^9.0.12",
4242
"intersection-observer": "^0.12.0",
4343
"lodash": "4.17.21",
4444
"make-plural": "^7.1.0",
45-
"memoizee": "^0.4.15",
45+
"memoizee": "^0.4.17",
4646
"next": "^13.5.6",
4747
"next-images": "^1.8.5",
4848
"numbro": "^2.4.0",

Diff for: apps/loan/src/hooks/usePageOnMount.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu
123123
setStorageValue('APP_CACHE', { walletName: walletState.label, timestamp: Date.now().toString() })
124124
const walletChainId = getWalletChainId(walletState)
125125
if (walletChainId && walletChainId !== parsedParams.rChainId) {
126-
const success = await setChain({ chainId: ethers.utils.hexValue(parsedParams.rChainId) })
126+
const success = await setChain({ chainId: ethers.toQuantity(parsedParams.rChainId) })
127127
if (success) {
128128
updateConnectState('loading', CONNECT_STAGE.CONNECT_API, [parsedParams.rChainId, true])
129129
} else {
@@ -166,7 +166,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu
166166
const [currChainId, newChainId] = options
167167
if (wallet) {
168168
try {
169-
const success = await setChain({ chainId: ethers.utils.hexValue(newChainId) })
169+
const success = await setChain({ chainId: ethers.toQuantity(newChainId) })
170170
if (!success) throw new Error('reject network switch')
171171
updateConnectState('loading', CONNECT_STAGE.CONNECT_API, [newChainId, true])
172172
} catch (error) {

Diff for: apps/loan/src/lib/apiCrvusd.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import type { FormValues as SwapFormValues } from '@/components/PageLoanManage/L
22
import type { LiqRange, Provider, MaxRecvLeverage } from '@/store/types'
33
import type { MaxRecvLeverage as MaxRecvLeverageForm } from '@/components/PageLoanCreate/types'
44
import type { FormDetailInfo as FormDetailInfoDeleverage } from '@/components/PageLoanManage/LoanDeleverage/types'
5-
6-
import { ethers } from 'ethers'
5+
import { BrowserProvider } from 'ethers'
76
import PromisePool from '@supercharge/promise-pool'
87

98
import { fulfilledValue, getErrorMessage, log } from '@/utils/helpers'
@@ -94,10 +93,10 @@ const helpers = {
9493
}
9594
},
9695
waitForTransaction: async (hash: string, provider: Provider) =>
97-
(provider as ethers.providers.Web3Provider).waitForTransaction(hash),
96+
(provider as BrowserProvider).waitForTransaction(hash),
9897
waitForTransactions: async (hashes: string[], provider: Provider) => {
9998
const { results, errors } = await PromisePool.for(hashes).process(
100-
async (hash) => await (provider as ethers.providers.Web3Provider).waitForTransaction(hash),
99+
async (hash) => await (provider as BrowserProvider).waitForTransaction(hash),
101100
)
102101
if (Array.isArray(errors) && errors.length > 0) {
103102
throw errors

Diff for: apps/loan/src/store/createAppSlice.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Locale } from '@/lib/i18n'
55

66
import produce from 'immer'
77

8-
import { ethers, Contract } from 'ethers'
8+
import { ethers, Contract, ContractRunner } from 'ethers'
99
import { Interface } from '@ethersproject/abi'
1010
import { httpFetcher, log } from '@/utils/helpers'
1111
import { setStorageValue } from '@/utils/storage'
@@ -39,7 +39,7 @@ type SliceState = {
3939

4040
// prettier-ignore
4141
export interface AppSlice extends SliceState {
42-
getContract(jsonModuleName: string, contractAddress: string, provider: Provider): Promise<ethers.Contract | null>
42+
getContract(jsonModuleName: string, contractAddress: string, provider: ContractRunner): Promise<ethers.Contract | null>
4343
fetchCrvUSDTotalSupply(api: Curve): Promise<void>
4444
fetchDailyVolume(): Promise<void>
4545
setAppCache<T>(key: AppCacheKeys, value: T): void

Diff for: apps/loan/src/store/createGasSlice.ts

+24-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { GetState, SetState } from 'zustand'
22
import type { State } from '@/store/useStore'
33
import type { GasInfo } from '@/store/types'
44

5-
import { ethers } from 'ethers'
5+
import { JsonRpcProvider } from 'ethers'
66
import cloneDeep from 'lodash/cloneDeep'
77

88
import { gweiToWai } from '@/shared/curve-lib'
@@ -118,38 +118,43 @@ function parseEthereumGasInfo(gasInfo, chainId: ChainId) {
118118
}
119119
}
120120

121-
// @ts-ignore
122-
async function parseGasInfoFromRpcUrl(rpcUrl) {
123-
const provider = new ethers.providers.JsonRpcProvider(rpcUrl)
121+
async function parseGasInfoFromRpcUrl(rpcUrl: string) {
122+
if (rpcUrl) {
123+
const provider = new JsonRpcProvider(rpcUrl)
124124

125-
if (provider) {
126125
const gasInfo = await provider.getFeeData()
127126
const { gasPrice, maxPriorityFeePerGas, maxFeePerGas } = gasInfo
128127

129128
if (gasPrice) {
130-
const base = gasPrice.toNumber()
129+
const base = toNumber(gasPrice)
131130

132131
if (maxPriorityFeePerGas && maxFeePerGas) {
133132
return {
134133
gasInfo: {
135134
base,
136-
priority: [maxPriorityFeePerGas.toNumber()],
137-
max: [maxFeePerGas.toNumber()],
138-
basePlusPriority: [gasPrice.add(maxPriorityFeePerGas).toNumber()],
139-
},
140-
label: ['fast'],
141-
}
142-
} else {
143-
return {
144-
gasInfo: {
145-
base,
146-
priority: [0],
147-
max: [0],
148-
basePlusPriority: [gasPrice.add(gweiToWai(25)).toNumber()],
135+
priority: [toNumber(maxPriorityFeePerGas)],
136+
max: [toNumber(maxFeePerGas)],
137+
basePlusPriority: [toNumber(gasPrice + maxPriorityFeePerGas)],
149138
},
150139
label: ['fast'],
151140
}
152141
}
142+
return {
143+
gasInfo: {
144+
base,
145+
priority: [0],
146+
max: [0],
147+
basePlusPriority: [toNumber(gasPrice) + gweiToWai(25)],
148+
},
149+
label: ['fast'],
150+
}
153151
}
154152
}
155153
}
154+
155+
const toNumber = (value: bigint) => {
156+
if (value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER) {
157+
return Number(value)
158+
}
159+
throw new Error(`Value: "${value}" is out of bounds to be a Number`)
160+
}

Diff for: apps/loan/src/store/createPegKeepersSlice.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ const createPegKeepersSlice = (set: SetState<State>, get: GetState<State>): PegK
7272
debtCeilingContract ? debtCeilingContract['debt_ceiling'](pegKeeperAddress) : () => '',
7373
])
7474
results[pegKeeperAddress] = {
75-
debt: ethers.utils.formatUnits(debt, 'ether'),
76-
estCallerProfit: ethers.utils.formatUnits(estCallerProfit, 'ether'),
77-
debtCeiling: ethers.utils.formatUnits(debtCeiling, 'ether'),
75+
debt: ethers.formatEther(debt),
76+
estCallerProfit: ethers.formatEther(estCallerProfit),
77+
debtCeiling: ethers.formatEther(debtCeiling),
7878
}
7979
})
8080

@@ -95,7 +95,7 @@ const createPegKeepersSlice = (set: SetState<State>, get: GetState<State>): PegK
9595
const estCallerProfit = await contract.estimate_caller_profit()
9696
sliceState.setStateByActiveKey('detailsMapper', pegKeeperAddress, {
9797
...detailsMapper[pegKeeperAddress],
98-
estCallerProfit: ethers.utils.formatUnits(estCallerProfit, 'ether'),
98+
estCallerProfit: ethers.formatEther(estCallerProfit),
9999
})
100100
} catch (error) {
101101
console.error(error)

Diff for: apps/loan/src/store/createScrvUsdSlice.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ async function _fetchSavingsYield(provider?: Provider | null): Promise<PricesYie
189189
provider.getBlock('latest'),
190190
])
191191
return {
192-
last_updated: new Date(block.timestamp).toISOString(),
193-
last_updated_block: block.number,
192+
last_updated: new Date(block?.timestamp ?? 0).toISOString(),
193+
last_updated_block: block?.number ?? 0,
194194
proj_apr: supply > 0 ? (unlock_amount * 1e-12 * YEAR) / supply : 0,
195195
supply: supply / 1e18,
196196
}

Diff for: apps/loan/src/store/createWalletSlice.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import type { State } from '@/store/useStore'
33
import type { CustomNotification, NotificationType } from '@web3-onboard/core/dist/types'
44
import type { Provider } from '@/store/types'
55
import type { OnboardAPI, UpdateNotification } from '@web3-onboard/core'
6-
76
import cloneDeep from 'lodash/cloneDeep'
8-
import { ethers } from 'ethers'
7+
import { BrowserProvider } from 'ethers'
98

109
type StateKey = keyof typeof DEFAULT_STATE
1110

@@ -116,11 +115,10 @@ const createWalletSlice = (set: SetState<State>, get: GetState<State>): WalletSl
116115
export default createWalletSlice
117116

118117
export function getProvider(wallet: Wallet) {
119-
return new ethers.providers.Web3Provider(wallet.provider)
118+
return new BrowserProvider(wallet.provider)
120119
}
121120

122121
export function getWalletChainId(wallet: Wallet | undefined | null) {
123122
if (!wallet) return null
124-
const chainId = (wallet as Wallet).chains[0].id
125-
return ethers.BigNumber.from(chainId).toNumber()
123+
return +(wallet as Wallet).chains[0].id
126124
}

Diff for: apps/loan/src/store/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ethers } from 'ethers'
1+
import { BrowserProvider } from 'ethers'
22

33
/* createAppSlice */
44

@@ -52,7 +52,7 @@ export type LiqRangeSliderIdx = LiqRange & { sliderIdx: number }
5252
export type LiqRangesMapper = { [n: string]: LiqRangeSliderIdx }
5353

5454
/* createWalletSlice */
55-
export type Provider = ethers.providers.Web3Provider
55+
export type Provider = BrowserProvider
5656

5757
export type PricesYieldDataResponse = PricesYieldData
5858

Diff for: apps/loan/src/types/global.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { BrowserProvider } from 'ethers'
12
import type { INetworkName } from '@curvefi/stablecoin-api/lib/interfaces'
23
import type { LlammaTemplate } from '@curvefi/stablecoin-api/lib/llammas'
34
import type { Locale } from '@/lib/i18n'
@@ -31,7 +32,7 @@ declare global {
3132
type Curve = typeof stablecoinApi & { chainId: ChainId }
3233
type LendApi = typeof lendingApi & { chainId: ChainId }
3334
type NetworkEnum = INetworkName
34-
type Provider = ethers.providers.web3Provider
35+
type Provider = BrowserProvider
3536

3637
type RFormType = 'loan' | 'deleverage' | 'collateral' | 'leverage' | ''
3738
type RouterParams = {

Diff for: apps/main/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"@hookform/resolvers": "^3.9.0",
3030
"@lingui/react": "^4.6.0",
3131
"@supercharge/promise-pool": "^2.3.2",
32-
"bignumber.js": "^9.0.1",
32+
"bignumber.js": "^9.1.2",
3333
"cross-fetch": "^3.1.5",
3434
"curve-common": "*",
3535
"curve-lib": "*",
3636
"curve-ui-kit": "*",
3737
"dayjs": "^1.11.7",
38-
"ethers": "^6.11.0",
38+
"ethers": "^6.13.4",
3939
"external-rewards": "*",
4040
"focus-visible": "5.2.0",
4141
"fuse.js": "^6.6.2",
@@ -44,7 +44,7 @@
4444
"lightweight-charts": "4.1.2",
4545
"lodash": "4.17.21",
4646
"make-plural": "^7.1.0",
47-
"memoizee": "^0.4.15",
47+
"memoizee": "^0.4.17",
4848
"next": "^13.5.6",
4949
"next-images": "^1.8.5",
5050
"numbro": "^2.4.0",

Diff for: packages/curve-common/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@web3-onboard/trezor": "^2.4.6",
2424
"@web3-onboard/trust": "^2.1.2",
2525
"@web3-onboard/walletconnect": "^2.6.1",
26-
"ethers": "^6.11.0"
26+
"ethers": "^6.13.4"
2727
},
2828
"devDependencies": {
2929
"@babel/core": "^7.25.2",

Diff for: packages/curve-lib/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@tanstack/react-query": "^5.59.0",
1414
"@tanstack/react-query-devtools": "^5.59.0",
1515
"@tanstack/react-query-persist-client": "^5.59.0",
16-
"ethers": "^6.11.0",
16+
"ethers": "^6.13.4",
1717
"react": "^18.2.0",
1818
"type-fest": "^4.26.1"
1919
},

Diff for: packages/ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"dependencies": {
1212
"@carbon/icons-react": "11.17.0",
1313
"@lingui/detect-locale": "^4.6.0",
14-
"bignumber.js": "^9.0.1",
15-
"ethers": "^6.11.0",
14+
"bignumber.js": "^9.1.2",
15+
"ethers": "^6.13.4",
1616
"lodash": "4.17.21",
1717
"react-aria": "3.22.0",
1818
"react-stately": "3.18.0"

Diff for: tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"chai-bigint": "^0.2.0",
2626
"cypress": "^13.9.0",
2727
"dotenv-flow": "^4.1.0",
28-
"ethers": "^6.11.0",
28+
"ethers": "^6.13.4",
2929
"hardhat": "^2.22.10",
3030
"tsconfig": "*",
3131
"wait-on": "^8.0.1"

0 commit comments

Comments
 (0)