Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"@types/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"@project-serum/[email protected]": "patches/@[email protected]",
Expand All @@ -149,7 +148,6 @@
"@walletconnect/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"@chainsafe/[email protected]": "patches/@[email protected]",
"@protobufjs/[email protected]": "patches/@[email protected]",
Expand Down
1 change: 1 addition & 0 deletions packages/base/src/utils/parseURLs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import parser from 'anchorme'

export function parseURLs(text: string, requireProtocol = true) {
// CJS-ESM compatibility
const lib = parser.default || parser
Expand Down
4 changes: 2 additions & 2 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"use-subscription": "^1.8.0",
"uuid": "^9.0.0",
"wallet.ts": "^1.0.1",
"web3-core-helpers": "1.8.0",
"web3-utils": "1.8.0",
"web3-core-helpers": "1.10.0",
"web3-utils": "1.10.0",
"zod": "^3.21.4"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { memo, useMemo } from 'react'
import { noop } from 'lodash-es'
import { BigNumber } from 'bignumber.js'
import { useContainer } from 'unstated-next'
import { Box, Button, buttonClasses, styled, Typography } from '@mui/material'
import { Icons } from '@masknet/icons'
import { MaskColorVar } from '@masknet/theme'
import { FormattedCurrency, MiniNetworkSelector } from '@masknet/shared'
import { DashboardRoutes } from '@masknet/shared-base'
import { MaskColorVar } from '@masknet/theme'
import type { Web3Helper } from '@masknet/web3-helpers'
import { formatCurrency, getTokenUSDValue } from '@masknet/web3-shared-base'
import { Box, Button, buttonClasses, styled, Typography } from '@mui/material'
import { useDashboardI18N } from '../../../../locales/index.js'
import { useIsMatched } from '../../hooks/index.js'
import type { Web3Helper } from '@masknet/web3-helpers'
import { Context } from '../../hooks/useContext.js'

const BalanceContainer = styled('div')(
Expand Down
12 changes: 6 additions & 6 deletions packages/mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@
"use-subscription": "^1.8.0",
"uuid": "^9.0.0",
"wallet.ts": "^1.0.1",
"web3": "1.8.0",
"web3-core": "1.8.0",
"web3-core-helpers": "1.8.0",
"web3-eth-abi": "1.8.0",
"web3-eth-contract": "1.8.0",
"web3-utils": "1.8.0",
"web3": "1.10.0",
"web3-core": "1.10.0",
"web3-core-helpers": "1.10.0",
"web3-eth-abi": "1.10.0",
"web3-eth-contract": "1.10.0",
"web3-utils": "1.10.0",
"webextension-polyfill": "^0.10.0",
"zod": "^3.21.4"
},
Expand Down
52 changes: 26 additions & 26 deletions packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import AaveLendingPoolABI from '@masknet/web3-contracts/abis/AaveLendingPool.json'
import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json'
import ERC20ABI from '@masknet/web3-contracts/abis/ERC20.json'
import type { AaveLendingPool } from '@masknet/web3-contracts/types/AaveLendingPool.js'
import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider.js'
import type { ERC20 } from '@masknet/web3-contracts/types/ERC20.js'
import { BigNumber } from 'bignumber.js'
import { Contract } from '@masknet/web3-providers'
import { fetchJSON } from '@masknet/web3-providers/helpers'
import { ZERO, pow10, type FungibleToken } from '@masknet/web3-shared-base'
import {
TransactionEventType,
createContract,
getAaveConstant,
type ChainId,
type SchemaType,
type Web3,
} from '@masknet/web3-shared-evm'
import { BigNumber } from 'bignumber.js'
import type Web3 from 'web3'
import type { AbiItem } from 'web3-utils'
import { ProtocolType, type SavingsProtocol } from '../types.js'

export class AAVEProtocol implements SavingsProtocol {
Expand Down Expand Up @@ -132,8 +125,9 @@ export class AAVEProtocol implements SavingsProtocol {
body,
})

const aTokenId = response.data.reserves[0].aToken.id
const contract = createContract<ERC20>(web3, aTokenId, ERC20ABI as AbiItem[])
const contract = Contract.getERC20Contract(response.data.reserves[0].aToken.id, {
chainId,
})
return new BigNumber((await contract?.methods.balanceOf(account).call()) ?? '0')
} catch (error) {
console.error('AAVE BALANCE ERROR:', error)
Expand All @@ -156,16 +150,18 @@ export class AAVEProtocol implements SavingsProtocol {
}

private async createDepositTokenOperation(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) {
const aaveLPoolAddress = getAaveConstant(chainId, 'AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS')
const lPoolAddressProviderContract = createContract<AaveLendingPoolAddressProvider>(
web3,
aaveLPoolAddress,
AaveLendingPoolAddressProviderABI as AbiItem[],
const lPoolAddressProviderContract = Contract.getAAVELendingPoolAddressProviderContract(
getAaveConstant(chainId, 'AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS'),
{
chainId,
},
)

const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call()

const contract = createContract<AaveLendingPool>(web3, poolAddress, AaveLendingPoolABI as AbiItem[])
const contract = Contract.getAAVELendingPoolContract(poolAddress, {
chainId,
})
return contract?.methods.deposit(this.bareToken.address, new BigNumber(value).toFixed(), account, '0')
}

Expand All @@ -190,15 +186,16 @@ export class AAVEProtocol implements SavingsProtocol {

public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) {
try {
const lPoolAddressProviderContract = createContract<AaveLendingPoolAddressProvider>(
web3,
const lPoolAddressProviderContract = Contract.getAAVELendingPoolAddressProviderContract(
getAaveConstant(chainId, 'AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS'),
AaveLendingPoolAddressProviderABI as AbiItem[],
{ chainId },
)

const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call()

const contract = createContract<AaveLendingPool>(web3, poolAddress, AaveLendingPoolABI as AbiItem[])
const contract = Contract.getAAVELendingPoolContract(poolAddress, {
chainId,
})
const gasEstimate = await contract?.methods
.withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account)
.estimateGas({
Expand All @@ -211,16 +208,19 @@ export class AAVEProtocol implements SavingsProtocol {
}

public async withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) {
const lPoolAddressProviderContract = createContract<AaveLendingPoolAddressProvider>(
web3,
const lPoolAddressProviderContract = Contract.getAAVELendingPoolAddressProviderContract(
getAaveConstant(chainId, 'AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS'),
AaveLendingPoolAddressProviderABI as AbiItem[],
{ chainId },
)

const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call()

const contract = Contract.getAAVELendingPoolContract(poolAddress, {
chainId,
})

const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value)
const contract = createContract<AaveLendingPool>(web3, poolAddress, AaveLendingPoolABI as AbiItem[])

return new Promise<string>((resolve, reject) =>
contract?.methods
.withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account)
Expand Down
3 changes: 1 addition & 2 deletions packages/mask/src/plugins/Savings/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type Web3 from 'web3'
import type { BigNumber } from 'bignumber.js'
import type { ChainId, SchemaType } from '@masknet/web3-shared-evm'
import type { ChainId, SchemaType, Web3 } from '@masknet/web3-shared-evm'
import type { FungibleToken } from '@masknet/web3-shared-base'

export type TokenPair = [FungibleToken<ChainId, SchemaType>, FungibleToken<ChainId, SchemaType>]
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
"urlcat": "^3.1.0",
"use-subscription": "^1.8.0",
"wallet.ts": "^1.0.1",
"web3": "1.8.0",
"web3-core": "1.8.0",
"web3-core-helpers": "1.8.0",
"web3-utils": "1.8.0"
"web3": "1.10.0",
"web3-core": "1.10.0",
"web3-core-helpers": "1.10.0",
"web3-utils": "1.10.0"
}
}
8 changes: 4 additions & 4 deletions packages/plugins/Claim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"dependencies": {
"@masknet/icons": "workspace:^",
"@masknet/theme": "workspace:^",
"@masknet/web3-hooks-evm": "workspace:^",
"@masknet/web3-hooks-base": "workspace:^",
"@masknet/web3-shared-evm": "workspace:^",
"@masknet/shared-base-ui": "workspace:^",
"@masknet/plugin-infra": "workspace:^",
"@masknet/shared": "workspace:^",
"@masknet/shared-base": "workspace:^",
"@masknet/web3-hooks-evm": "workspace:^",
"@masknet/web3-hooks-base": "workspace:^",
"@masknet/web3-shared-evm": "workspace:^",
"@masknet/web3-contracts": "workspace:^",
"@masknet/web3-shared-base": "workspace:^",
"@masknet/web3-providers": "workspace:^",
"web3-utils": "1.8.0",
"web3-utils": "1.10.0",
"bignumber.js": "9.1.1",
"urlcat": "^3.1.0",
"date-fns": "2.29.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/Debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"date-fns": "^2.29.3",
"react-use": "^17.4.0",
"urlcat": "^3.1.0",
"web3-core-helpers": "1.8.0",
"web3-utils": "1.8.0"
"web3-core-helpers": "1.10.0",
"web3-utils": "1.10.0"
}
}
10 changes: 5 additions & 5 deletions packages/plugins/EVM/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"react-use": "^17.4.0",
"urlcat": "^3.1.0",
"wallet.ts": "^1.0.1",
"web3": "1.8.0",
"web3-core": "1.8.0",
"web3-core-helpers": "1.8.0",
"web3-eth-abi": "1.8.0",
"web3-utils": "1.8.0"
"web3": "1.10.0",
"web3-core": "1.10.0",
"web3-core-helpers": "1.10.0",
"web3-eth-abi": "1.10.0",
"web3-utils": "1.10.0"
},
"devDependencies": {
"@types/use-subscription": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Gitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"react-use": "^17.4.0",
"ts-results": "^3.3.0",
"urlcat": "^3.1.0",
"web3-utils": "1.8.0"
"web3-utils": "1.10.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { toNumber } from 'lodash-es'
import { useEffect } from 'react'
import { useAsync, useAsyncFn } from 'react-use'
import { InjectedDialog } from '@masknet/shared'
import { NetworkPluginID } from '@masknet/shared-base'
import { makeStyles } from '@masknet/theme'
Expand All @@ -7,9 +10,6 @@ import type { SecurityAPI } from '@masknet/web3-providers/types'
import { isSameAddress } from '@masknet/web3-shared-base'
import { ChainId, ZERO_ADDRESS } from '@masknet/web3-shared-evm'
import { Box, DialogActions, DialogContent, Stack } from '@mui/material'
import { toNumber } from 'lodash-es'
import { useEffect } from 'react'
import { useAsync, useAsyncFn } from 'react-use'
import { useI18N } from '../locales/index.js'
import { DefaultPlaceholder } from './components/DefaultPlaceholder.js'
import { Footer } from './components/Footer.js'
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/MaskBox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"ts-results": "^3.3.0",
"unstated-next": "^1.1.0",
"urlcat": "^3.1.0",
"web3-eth-abi": "1.8.0",
"web3-utils": "1.8.0"
"web3-eth-abi": "1.10.0",
"web3-utils": "1.10.0"
}
}
2 changes: 1 addition & 1 deletion packages/plugins/RSS3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"urlcat": "^3.1.0",
"use-subscription": "^1.8.0",
"uuid": "^9.0.0",
"web3-utils": "1.8.0"
"web3-utils": "1.10.0"
}
}
2 changes: 1 addition & 1 deletion packages/plugins/Wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"@masknet/web3-modals": "workspace:^",
"bignumber.js": "9.1.1",
"react-use": "^17.4.0",
"web3-core-helpers": "1.8.0"
"web3-core-helpers": "1.10.0"
}
}
2 changes: 1 addition & 1 deletion packages/plugins/Web3Profile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"react-use": "^17.4.0",
"urlcat": "^3.1.0",
"use-subscription": "^1.8.0",
"web3-utils": "1.8.0"
"web3-utils": "1.10.0"
}
}
2 changes: 1 addition & 1 deletion packages/shared-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"tiny-secp256k1": "^2.2.1",
"typeson": "^8.0.1",
"typeson-registry": "^5.0.0",
"web3-utils": "1.8.0"
"web3-utils": "1.10.0"
},
"devDependencies": {
"@types/use-subscription": "^1.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/web3-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"dependencies": {
"@typechain/web3-v1": "^6.0.2",
"typechain": "^8.1.1",
"web3-core": "1.8.0"
"web3-core": "1.10.0",
"web3-eth-contract": "1.10.0"
},
"devDependencies": {
"bn.js": "^4.12.0",
"promievent": "^0.1.5",
"web3-eth-contract": "1.8.0"
"promievent": "^0.1.5"
}
}
2 changes: 1 addition & 1 deletion packages/web3-hooks/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"react-use": "^17.4.0",
"unstated-next": "^1.1.0",
"use-subscription": "^1.8.0",
"web3": "1.8.0"
"web3": "1.10.0"
}
}
6 changes: 3 additions & 3 deletions packages/web3-hooks/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"react-use": "^17.4.0",
"unstated-next": "^1.1.0",
"wallet.ts": "^1.0.1",
"web3": "1.8.0",
"web3-core": "1.8.0",
"web3-utils": "1.8.0"
"web3": "1.10.0",
"web3-core": "1.10.0",
"web3-utils": "1.10.0"
}
}
10 changes: 5 additions & 5 deletions packages/web3-modals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"bignumber.js": "9.1.1",
"react-use": "^17.4.0",
"urlcat": "^3.1.0",
"web3": "1.8.0",
"web3-core": "1.8.0",
"web3-core-helpers": "1.8.0",
"web3-eth-abi": "1.8.0",
"web3-utils": "1.8.0"
"web3": "1.10.0",
"web3-core": "1.10.0",
"web3-core-helpers": "1.10.0",
"web3-eth-abi": "1.10.0",
"web3-utils": "1.10.0"
}
}
12 changes: 6 additions & 6 deletions packages/web3-providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
"use-subscription": "^1.8.0",
"uuid": "^9.0.0",
"wallet.ts": "^1.0.1",
"web3": "1.8.0",
"web3-core": "1.8.0",
"web3-core-helpers": "1.8.0",
"web3-eth": "1.8.0",
"web3-eth-abi": "1.8.0",
"web3-utils": "1.8.0"
"web3": "1.10.0",
"web3-core": "1.10.0",
"web3-core-helpers": "1.10.0",
"web3-eth": "1.10.0",
"web3-eth-abi": "1.10.0",
"web3-utils": "1.10.0"
},
"devDependencies": {
"@types/bn.js": "^4.11.6",
Expand Down
Loading