Skip to content

Commit

Permalink
Update ALL dependencies (#182)
Browse files Browse the repository at this point in the history
* updates all deps that needed it

* 5 to 6 to much of a jump

* remove path that used sunset exchange contracts

* updated firebase functions

* use lower version of firebase as new versions give "Component auth has not been registered yet
  • Loading branch information
aaronmgdr authored Jul 24, 2024
1 parent 48c05e0 commit c900063
Show file tree
Hide file tree
Showing 12 changed files with 3,843 additions and 3,054 deletions.
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
36 changes: 18 additions & 18 deletions apps/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,35 @@
"build:rules": "firebase-bolt database-rules.bolt"
},
"dependencies": {
"@celo/connect": "5.1.1",
"@celo/contractkit": "6.0.0",
"@celo/utils": "5.0.6",
"@firebase/app": "^0.9.6",
"@google-cloud/logging": "^11.0.0",
"@mento-protocol/mento-sdk": "^0.1.4",
"bignumber.js": "^9.1.1",
"debug": "^4.3.4",
"@celo/connect": "5.3.0",
"@celo/contractkit": "8.0.0",
"@celo/utils": "6.0.1",
"@firebase/app": "^0.10.7",
"@google-cloud/logging": "^11.1.0",
"@mento-protocol/mento-sdk": "^0.1.5",
"bignumber.js": "^9.1.2",
"debug": "^4.3.5",
"ethers": "^5.7.2",
"firebase": "^10.7.0",
"firebase-admin": "^12.0.0",
"firebase-functions": "^4.6.0",
"firebase-tools": "^13.0.2",
"web3": "1.10.0"
"web3": "1.10.4"
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/node": "^20.14.10",
"@types/node": "^20.14.11",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"cross-env": "7.0.3",
"eslint": "^8.37.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^48.0.2",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.7.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-unicorn": "^46.0.0",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-unicorn": "^46.0.1",
"firebase-bolt": "^0.8.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.3",
Expand Down
65 changes: 22 additions & 43 deletions apps/firebase/src/celo-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { providers, Signer, Wallet } from 'ethers'
import Web3 from 'web3'

export class CeloAdapter {
public readonly defaultAddress: string
public readonly defaultAddress: `0x${string}`
public readonly kit: ContractKit
private readonly etherProvider: providers.JsonRpcProvider
private readonly signer: Signer
Expand Down Expand Up @@ -61,7 +61,7 @@ export class CeloAdapter {
*
*/
async convertExtraStablesToCelo(amount: string) {
const mento = this.mento
const mento = this.mento!
if (!mento && this.useMento) {
throw new Error('Must call init() first')
}
Expand All @@ -79,49 +79,28 @@ export class CeloAdapter {
}
console.log('converting', info.symbol)

if (mento) {
const allowanceTxObj = await mento.increaseTradingAllowance(
stableToken.address,
amount,
)

const allowanceTx = await this.signer.sendTransaction(allowanceTxObj)
await allowanceTx.wait()

const quoteAmountOut = await mento.getAmountOut(
stableToken.address,
celoContractAddress,
amount,
)
const expectedAmountOut = quoteAmountOut.mul(99).div(100) // allow 1% slippage from quote
const swapTxObj = await mento.swapIn(
stableToken.address,
celoContractAddress,
amount,
expectedAmountOut,
)
const swapTx = await this.signer.sendTransaction(swapTxObj)
return swapTx.wait()
} else {
// Remove block once Broker contract issues are sorted out
console.info('Using exchange contract for extra stables conversion')
const exchangeContract = await this.kit.contracts.getContract(
info.exchangeContract,
)
const allowanceTxObj = await mento.increaseTradingAllowance(
stableToken.address,
amount,
)

const [quote] = await Promise.all([
exchangeContract.quoteStableSell(amount),
stableToken
.increaseAllowance(exchangeContract.address, amount)
.sendAndWaitForReceipt(),
])
const allowanceTx = await this.signer.sendTransaction(allowanceTxObj)
await allowanceTx.wait()

const tx = exchangeContract.sellStable(
amount,
quote.multipliedBy(0.99).integerValue(BigNumber.ROUND_UP),
)
return tx.sendAndWaitForReceipt()
}
const quoteAmountOut = await mento.getAmountOut(
stableToken.address,
celoContractAddress,
amount,
)
const expectedAmountOut = quoteAmountOut.mul(99).div(100) // allow 1% slippage from quote
const swapTxObj = await mento.swapIn(
stableToken.address,
celoContractAddress,
amount,
expectedAmountOut,
)
const swapTx = await this.signer.sendTransaction(swapTxObj)
return swapTx.wait()
} catch (e) {
console.info('caught', info.symbol, e)
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/faucet-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC, useCallback, useEffect, useState } from 'react'
import { inter } from 'components/request-form'
import styles from 'styles/Form.module.css'
import { Network, RequestRecord, RequestStatus } from 'types'
import { subscribeRequest } from 'utils/firebase-client'
import { subscribeRequest } from 'utils/firebase.client'

interface StatusProps {
faucetRequestKey: string | null
Expand Down
16 changes: 8 additions & 8 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
"dependencies": {
"@firebase/app-types": "^0.9.0",
"@metamask/detect-provider": "^2.0.0",
"@vercel/analytics": "^1.0.0",
"@vercel/analytics": "^1.3.1",
"firebase": "^10.7.0",
"next": "14.1.1",
"next-auth": "^4.20.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "14.2.5",
"next-auth": "^4.24.7",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-google-recaptcha-v3": "^1.10.1",
"react-use-async-callback": "^2.1.2"
},
"devDependencies": {
"@types/node": "20.14.10",
"@types/node": "20.14.11",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint": "8.54.0",
"eslint-config-next": "13.2.4",
"eslint": "8.57.0",
"eslint-config-next": "13.5.6",
"typescript": "5.5.3"
},
"engines": {
Expand Down
10 changes: 2 additions & 8 deletions apps/web/pages/api/faucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ import type { NextApiRequest, NextApiResponse } from 'next'
import { getServerSession } from 'next-auth/next'
import { authOptions } from './auth/[...nextauth]'
import { captchaVerify } from 'utils/captcha-verify'
import {
FaucetAPIResponse,
RequestStatus,
AuthLevel,
Network,
networks,
} from 'types'
import { sendRequest } from 'utils/firebase-serverside'
import { FaucetAPIResponse, RequestStatus, AuthLevel, networks } from 'types'
import { sendRequest } from 'utils/firebase.serverside'

export default async function handler(
req: NextApiRequest,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import 'firebase/compat/database'
import {
Address,
AuthLevel,
Network,
RequestedTokenSet,
RequestRecord,
RequestStatus,
RequestType,
Network,
} from 'types'
import { config } from './firebase-config'

Expand All @@ -26,6 +26,7 @@ async function getFirebase() {
throw new Error('Login username or password is empty')
}
try {
debugger
// Source: https://firebase.google.com/docs/auth
await firebase
.auth()
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@
"prettify": "yarn prettier --write \"apps/**/*.{ts,tsx}\" --ignore-path=./.gitignore"
},
"devDependencies": {
"eslint": "^8.37.0",
"husky": "^8.0.3",
"eslint": "^8.57.0",
"husky": "9.0.11",
"prettier": "^3.3.3"
},
"resolutions": {
"vm2": "^3.9.17"
},
"engines": {
"node": "20"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.3.1"
}
Loading

0 comments on commit c900063

Please sign in to comment.