From 428a9a3f9500bf72e14abf5fcc499b69a2edd4cc Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 8 Oct 2024 14:21:04 +0200 Subject: [PATCH 01/22] Fix/usdt donation on mainnet --- src/artifacts/usdtMainnetABI.json | 731 ++++++++++++++++++++++++++++++ src/lib/helpers.ts | 421 ++++++++++++++++- 2 files changed, 1149 insertions(+), 3 deletions(-) create mode 100644 src/artifacts/usdtMainnetABI.json diff --git a/src/artifacts/usdtMainnetABI.json b/src/artifacts/usdtMainnetABI.json new file mode 100644 index 0000000000..1fdc3bcce6 --- /dev/null +++ b/src/artifacts/usdtMainnetABI.json @@ -0,0 +1,731 @@ +[ + { + "constant":true, + "inputs":[ + + ], + "name":"name", + "outputs":[ + { + "name":"", + "type":"string" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_upgradedAddress", + "type":"address" + } + ], + "name":"deprecate", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_spender", + "type":"address" + }, + { + "name":"_value", + "type":"uint256" + } + ], + "name":"approve", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"deprecated", + "outputs":[ + { + "name":"", + "type":"bool" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_evilUser", + "type":"address" + } + ], + "name":"addBlackList", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"totalSupply", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_from", + "type":"address" + }, + { + "name":"_to", + "type":"address" + }, + { + "name":"_value", + "type":"uint256" + } + ], + "name":"transferFrom", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"upgradedAddress", + "outputs":[ + { + "name":"", + "type":"address" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + { + "name":"", + "type":"address" + } + ], + "name":"balances", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"decimals", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"maximumFee", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"_totalSupply", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + + ], + "name":"unpause", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + { + "name":"_maker", + "type":"address" + } + ], + "name":"getBlackListStatus", + "outputs":[ + { + "name":"", + "type":"bool" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + { + "name":"", + "type":"address" + }, + { + "name":"", + "type":"address" + } + ], + "name":"allowed", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"paused", + "outputs":[ + { + "name":"", + "type":"bool" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + { + "name":"who", + "type":"address" + } + ], + "name":"balanceOf", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + + ], + "name":"pause", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"getOwner", + "outputs":[ + { + "name":"", + "type":"address" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"owner", + "outputs":[ + { + "name":"", + "type":"address" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"symbol", + "outputs":[ + { + "name":"", + "type":"string" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_to", + "type":"address" + }, + { + "name":"_value", + "type":"uint256" + } + ], + "name":"transfer", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"newBasisPoints", + "type":"uint256" + }, + { + "name":"newMaxFee", + "type":"uint256" + } + ], + "name":"setParams", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"amount", + "type":"uint256" + } + ], + "name":"issue", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"amount", + "type":"uint256" + } + ], + "name":"redeem", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + { + "name":"_owner", + "type":"address" + }, + { + "name":"_spender", + "type":"address" + } + ], + "name":"allowance", + "outputs":[ + { + "name":"remaining", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"basisPointsRate", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":true, + "inputs":[ + { + "name":"", + "type":"address" + } + ], + "name":"isBlackListed", + "outputs":[ + { + "name":"", + "type":"bool" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_clearedUser", + "type":"address" + } + ], + "name":"removeBlackList", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":true, + "inputs":[ + + ], + "name":"MAX_UINT", + "outputs":[ + { + "name":"", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"view", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"newOwner", + "type":"address" + } + ], + "name":"transferOwnership", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "constant":false, + "inputs":[ + { + "name":"_blackListedUser", + "type":"address" + } + ], + "name":"destroyBlackFunds", + "outputs":[ + + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"function" + }, + { + "inputs":[ + { + "name":"_initialSupply", + "type":"uint256" + }, + { + "name":"_name", + "type":"string" + }, + { + "name":"_symbol", + "type":"string" + }, + { + "name":"_decimals", + "type":"uint256" + } + ], + "payable":false, + "stateMutability":"nonpayable", + "type":"constructor" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"amount", + "type":"uint256" + } + ], + "name":"Issue", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"amount", + "type":"uint256" + } + ], + "name":"Redeem", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"newAddress", + "type":"address" + } + ], + "name":"Deprecate", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"feeBasisPoints", + "type":"uint256" + }, + { + "indexed":false, + "name":"maxFee", + "type":"uint256" + } + ], + "name":"Params", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"_blackListedUser", + "type":"address" + }, + { + "indexed":false, + "name":"_balance", + "type":"uint256" + } + ], + "name":"DestroyedBlackFunds", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"_user", + "type":"address" + } + ], + "name":"AddedBlackList", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":false, + "name":"_user", + "type":"address" + } + ], + "name":"RemovedBlackList", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":true, + "name":"owner", + "type":"address" + }, + { + "indexed":true, + "name":"spender", + "type":"address" + }, + { + "indexed":false, + "name":"value", + "type":"uint256" + } + ], + "name":"Approval", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + { + "indexed":true, + "name":"from", + "type":"address" + }, + { + "indexed":true, + "name":"to", + "type":"address" + }, + { + "indexed":false, + "name":"value", + "type":"uint256" + } + ], + "name":"Transfer", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + + ], + "name":"Pause", + "type":"event" + }, + { + "anonymous":false, + "inputs":[ + + ], + "name":"Unpause", + "type":"event" + } +] diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index 5e2aa5922a..cda01084b3 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -19,6 +19,7 @@ import config, { isProduction } from '@/configuration'; import { AddressZero } from './constants/constants'; import { ChainType, NonEVMChain } from '@/types/config'; import { wagmiConfig } from '@/wagmiConfigs'; +import usdtMainnetABI from '@/artifacts/usdtMainnetABI.json'; declare let window: any; interface TransactionParams { @@ -375,15 +376,28 @@ async function handleErc20Transfer( params: TransactionParams, contractAddress: Address, ): Promise
{ + // 'viem' ABI contract for USDT donation fails on mainnet + // so we use the USDT mainnet ABI instead and put inside usdtMainnetABI.json file + // update for 'viem' package to fix this issue doesn't work + const ABItoUse = + contractAddress === '0xdac17f958d2ee523a2206206994597c13d831ec7' + ? usdtMainnetABI + : erc20Abi; + const baseProps = { address: contractAddress, - abi: erc20Abi, + abi: ABItoUse, }; - const decimals = await readContract(wagmiConfig, { + let decimals = await readContract(wagmiConfig, { ...baseProps, functionName: 'decimals', }); - const value = parseUnits(params.value, decimals); + + if (typeof decimals === 'bigint') { + decimals = Number(decimals.toString()); + } + + const value = parseUnits(params.value, decimals as number); const hash = await writeContract(wagmiConfig, { ...baseProps, functionName: 'transfer', @@ -687,3 +701,404 @@ export function generateRandomNonce(): number { return nonce; } + +export const contractAbiTEST = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '_upgradedAddress', type: 'address' }], + name: 'deprecate', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'approve', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'deprecated', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '_evilUser', type: 'address' }], + name: 'addBlackList', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_from', type: 'address' }, + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'upgradedAddress', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '', type: 'address' }], + name: 'balances', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'maximumFee', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: '_totalSupply', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'unpause', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_maker', type: 'address' }], + name: 'getBlackListStatus', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '', type: 'address' }, + { name: '', type: 'address' }, + ], + name: 'allowed', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'paused', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: 'who', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'pause', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getOwner', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'owner', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transfer', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: 'newBasisPoints', type: 'uint256' }, + { name: 'newMaxFee', type: 'uint256' }, + ], + name: 'setParams', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [{ name: 'amount', type: 'uint256' }], + name: 'issue', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [{ name: 'amount', type: 'uint256' }], + name: 'redeem', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '_owner', type: 'address' }, + { name: '_spender', type: 'address' }, + ], + name: 'allowance', + outputs: [{ name: 'remaining', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'basisPointsRate', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '', type: 'address' }], + name: 'isBlackListed', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '_clearedUser', type: 'address' }], + name: 'removeBlackList', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'MAX_UINT', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: 'newOwner', type: 'address' }], + name: 'transferOwnership', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '_blackListedUser', type: 'address' }], + name: 'destroyBlackFunds', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { name: '_initialSupply', type: 'uint256' }, + { name: '_name', type: 'string' }, + { name: '_symbol', type: 'string' }, + { name: '_decimals', type: 'uint256' }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], + name: 'Issue', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], + name: 'Redeem', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'newAddress', type: 'address' }], + name: 'Deprecate', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, name: 'feeBasisPoints', type: 'uint256' }, + { indexed: false, name: 'maxFee', type: 'uint256' }, + ], + name: 'Params', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, name: '_blackListedUser', type: 'address' }, + { indexed: false, name: '_balance', type: 'uint256' }, + ], + name: 'DestroyedBlackFunds', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: '_user', type: 'address' }], + name: 'AddedBlackList', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: '_user', type: 'address' }], + name: 'RemovedBlackList', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'owner', type: 'address' }, + { indexed: true, name: 'spender', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'from', type: 'address' }, + { indexed: true, name: 'to', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'Pause', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'Unpause', + type: 'event', + }, +] as const; From f565e1da971aea27e137aacebfe51ff81775d7f6 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 8 Oct 2024 15:06:52 +0200 Subject: [PATCH 02/22] rebuild --- src/lib/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index cda01084b3..59fe04094f 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -376,7 +376,7 @@ async function handleErc20Transfer( params: TransactionParams, contractAddress: Address, ): Promise
{ - // 'viem' ABI contract for USDT donation fails on mainnet + // 'viem' ABI contract for USDT donation fails on mainnet // so we use the USDT mainnet ABI instead and put inside usdtMainnetABI.json file // update for 'viem' package to fix this issue doesn't work const ABItoUse = From d5192faf940e95896f36a3a89f21e134dc9e55ca Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 8 Oct 2024 15:07:02 +0200 Subject: [PATCH 03/22] rebuild --- src/lib/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index 59fe04094f..cda01084b3 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -376,7 +376,7 @@ async function handleErc20Transfer( params: TransactionParams, contractAddress: Address, ): Promise
{ - // 'viem' ABI contract for USDT donation fails on mainnet + // 'viem' ABI contract for USDT donation fails on mainnet // so we use the USDT mainnet ABI instead and put inside usdtMainnetABI.json file // update for 'viem' package to fix this issue doesn't work const ABItoUse = From 078993e3b5c11bf37a1a129f02f8389086c3a8dd Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 8 Oct 2024 15:09:11 +0200 Subject: [PATCH 04/22] removed temp variable --- src/lib/helpers.ts | 401 --------------------------------------------- 1 file changed, 401 deletions(-) diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index cda01084b3..93a7b53083 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -701,404 +701,3 @@ export function generateRandomNonce(): number { return nonce; } - -export const contractAbiTEST = [ - { - constant: true, - inputs: [], - name: 'name', - outputs: [{ name: '', type: 'string' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [{ name: '_upgradedAddress', type: 'address' }], - name: 'deprecate', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: '_spender', type: 'address' }, - { name: '_value', type: 'uint256' }, - ], - name: 'approve', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'deprecated', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [{ name: '_evilUser', type: 'address' }], - name: 'addBlackList', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: '_from', type: 'address' }, - { name: '_to', type: 'address' }, - { name: '_value', type: 'uint256' }, - ], - name: 'transferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'upgradedAddress', - outputs: [{ name: '', type: 'address' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [{ name: '', type: 'address' }], - name: 'balances', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'maximumFee', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: '_totalSupply', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [], - name: 'unpause', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [{ name: '_maker', type: 'address' }], - name: 'getBlackListStatus', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { name: '', type: 'address' }, - { name: '', type: 'address' }, - ], - name: 'allowed', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'paused', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [{ name: 'who', type: 'address' }], - name: 'balanceOf', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [], - name: 'pause', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getOwner', - outputs: [{ name: '', type: 'address' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'owner', - outputs: [{ name: '', type: 'address' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [{ name: '', type: 'string' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: '_to', type: 'address' }, - { name: '_value', type: 'uint256' }, - ], - name: 'transfer', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { name: 'newBasisPoints', type: 'uint256' }, - { name: 'newMaxFee', type: 'uint256' }, - ], - name: 'setParams', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [{ name: 'amount', type: 'uint256' }], - name: 'issue', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [{ name: 'amount', type: 'uint256' }], - name: 'redeem', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { name: '_owner', type: 'address' }, - { name: '_spender', type: 'address' }, - ], - name: 'allowance', - outputs: [{ name: 'remaining', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'basisPointsRate', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [{ name: '', type: 'address' }], - name: 'isBlackListed', - outputs: [{ name: '', type: 'bool' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [{ name: '_clearedUser', type: 'address' }], - name: 'removeBlackList', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'MAX_UINT', - outputs: [{ name: '', type: 'uint256' }], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [{ name: 'newOwner', type: 'address' }], - name: 'transferOwnership', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [{ name: '_blackListedUser', type: 'address' }], - name: 'destroyBlackFunds', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { name: '_initialSupply', type: 'uint256' }, - { name: '_name', type: 'string' }, - { name: '_symbol', type: 'string' }, - { name: '_decimals', type: 'uint256' }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], - name: 'Issue', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], - name: 'Redeem', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, name: 'newAddress', type: 'address' }], - name: 'Deprecate', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: false, name: 'feeBasisPoints', type: 'uint256' }, - { indexed: false, name: 'maxFee', type: 'uint256' }, - ], - name: 'Params', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: false, name: '_blackListedUser', type: 'address' }, - { indexed: false, name: '_balance', type: 'uint256' }, - ], - name: 'DestroyedBlackFunds', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, name: '_user', type: 'address' }], - name: 'AddedBlackList', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, name: '_user', type: 'address' }], - name: 'RemovedBlackList', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: true, name: 'owner', type: 'address' }, - { indexed: true, name: 'spender', type: 'address' }, - { indexed: false, name: 'value', type: 'uint256' }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: true, name: 'from', type: 'address' }, - { indexed: true, name: 'to', type: 'address' }, - { indexed: false, name: 'value', type: 'uint256' }, - ], - name: 'Transfer', - type: 'event', - }, - { - anonymous: false, - inputs: [], - name: 'Pause', - type: 'event', - }, - { - anonymous: false, - inputs: [], - name: 'Unpause', - type: 'event', - }, -] as const; From de08251390c43012729a7b22a5fe50b48ea94010 Mon Sep 17 00:00:00 2001 From: Kilter Date: Tue, 8 Oct 2024 09:41:06 -0500 Subject: [PATCH 05/22] updating viem and wagmi --- package.json | 4 +- yarn.lock | 209 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 191 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index d155dec6e3..74ad14e007 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,8 @@ "styled-components": "^6.1.12", "swiper": "^11.1.3", "unsplash-js": "^7.0.19", - "viem": "^2.21.16", - "wagmi": "^2.12.16" + "viem": "^2.21.19", + "wagmi": "^2.12.17" }, "devDependencies": { "@babel/preset-typescript": "^7.23.3", diff --git a/yarn.lock b/yarn.lock index 1aebaaa546..be8aa535bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,11 @@ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== +"@adraffy/ens-normalize@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz#42cc67c5baa407ac25059fcd7d405cc5ecdb0c33" + integrity sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg== + "@ampproject/remapping@^2.2.0": version "2.3.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" @@ -2301,7 +2306,7 @@ dependencies: "@noble/hashes" "1.4.0" -"@noble/curves@^1.1.0", "@noble/curves@^1.4.0", "@noble/curves@^1.4.2": +"@noble/curves@1.6.0", "@noble/curves@^1.1.0", "@noble/curves@^1.4.0", "@noble/curves@^1.4.2", "@noble/curves@~1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ== @@ -2854,7 +2859,7 @@ resolved "https://registry.yarnpkg.com/@safe-global/safe-modules-deployments/-/safe-modules-deployments-2.2.1.tgz#a8b88f2afc6ec04fed09968fe1e4990ed975c86e" integrity sha512-H0XpusyXVcsTuRsQSq0FoBKqRfhZH87/1DrFEmXXPXmI3fJkvxq3KpTaTTqzcqoIe/J+erwVZQUYNfL68EcvAQ== -"@scure/base@^1.1.3", "@scure/base@~1.1.0", "@scure/base@~1.1.6", "@scure/base@~1.1.8": +"@scure/base@^1.1.3", "@scure/base@~1.1.0", "@scure/base@~1.1.6", "@scure/base@~1.1.7", "@scure/base@~1.1.8": version "1.1.9" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== @@ -2877,6 +2882,15 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" +"@scure/bip32@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.5.0.tgz#dd4a2e1b8a9da60e012e776d954c4186db6328e6" + integrity sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw== + dependencies: + "@noble/curves" "~1.6.0" + "@noble/hashes" "~1.5.0" + "@scure/base" "~1.1.7" + "@scure/bip39@1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5" @@ -5229,17 +5243,17 @@ resolved "https://registry.yarnpkg.com/@vercel/speed-insights/-/speed-insights-1.0.12.tgz#71c2edffdedae98d34e306d7b0a573e6816898b4" integrity sha512-ZGQ+a7bcfWJD2VYEp2R1LHvRAMyyaFBYytZXsfnbOMkeOvzGNVxUL7aVUvisIrTZjXTSsxG45DKX7yiw6nq2Jw== -"@wagmi/connectors@5.1.14": - version "5.1.14" - resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.1.14.tgz#392f187298ea0a68c5443ffe93d714187c01c83b" - integrity sha512-3faf6gXFI1nX/kud5e2s+8fMjnuWp14XwqHVNCOfl7nVXQlEFAvjQxI1GrGyHckfHm7e6oXdm2eJwJGgPWi0QQ== +"@wagmi/connectors@5.1.15": + version "5.1.15" + resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.1.15.tgz#39ff0fe0f1729ce9d0dce24806d40a82fe5a48fb" + integrity sha512-Bz5EBpn8hAYFuxCWoXviwABk2VlLRuQTpJ7Yd/hu4HuuXnTdCN27cfvT+Fy2sWbwpLnr1e29LJGAUCIyYkHz7g== dependencies: "@coinbase/wallet-sdk" "4.0.4" "@metamask/sdk" "0.28.4" "@safe-global/safe-apps-provider" "0.18.3" "@safe-global/safe-apps-sdk" "9.1.0" - "@walletconnect/ethereum-provider" "2.16.1" - "@walletconnect/modal" "2.6.2" + "@walletconnect/ethereum-provider" "2.17.0" + "@walletconnect/modal" "2.7.0" cbw-sdk "npm:@coinbase/wallet-sdk@3.9.3" "@wagmi/core@2.13.8": @@ -5342,6 +5356,28 @@ lodash.isequal "4.5.0" uint8arrays "3.1.0" +"@walletconnect/core@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.17.0.tgz#bf490e85a4702eff0f7cf81ba0d3c1016dffff33" + integrity sha512-On+uSaCfWdsMIQsECwWHZBmUXfrnqmv6B8SXRRuTJgd8tUpEvBkLQH4X7XkSm3zW6ozEkQTCagZ2ox2YPn3kbw== + dependencies: + "@walletconnect/heartbeat" "1.2.2" + "@walletconnect/jsonrpc-provider" "1.0.14" + "@walletconnect/jsonrpc-types" "1.0.4" + "@walletconnect/jsonrpc-utils" "1.0.8" + "@walletconnect/jsonrpc-ws-connection" "1.0.14" + "@walletconnect/keyvaluestorage" "1.1.1" + "@walletconnect/logger" "2.1.2" + "@walletconnect/relay-api" "1.0.11" + "@walletconnect/relay-auth" "1.0.4" + "@walletconnect/safe-json" "1.0.2" + "@walletconnect/time" "1.0.2" + "@walletconnect/types" "2.17.0" + "@walletconnect/utils" "2.17.0" + events "3.3.0" + lodash.isequal "4.5.0" + uint8arrays "3.1.0" + "@walletconnect/environment@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@walletconnect/environment/-/environment-1.0.1.tgz#1d7f82f0009ab821a2ba5ad5e5a7b8ae3b214cd7" @@ -5365,6 +5401,22 @@ "@walletconnect/utils" "2.16.1" events "3.3.0" +"@walletconnect/ethereum-provider@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@walletconnect/ethereum-provider/-/ethereum-provider-2.17.0.tgz#d74feaaed6180a6799e96760d7ee867ff3a083d2" + integrity sha512-b+KTAXOb6JjoxkwpgYQQKPUcTwENGmdEdZoIDLeRicUmZTn/IQKfkMoC2frClB4YxkyoVMtj1oMV2JAax+yu9A== + dependencies: + "@walletconnect/jsonrpc-http-connection" "1.0.8" + "@walletconnect/jsonrpc-provider" "1.0.14" + "@walletconnect/jsonrpc-types" "1.0.4" + "@walletconnect/jsonrpc-utils" "1.0.8" + "@walletconnect/modal" "2.7.0" + "@walletconnect/sign-client" "2.17.0" + "@walletconnect/types" "2.17.0" + "@walletconnect/universal-provider" "2.17.0" + "@walletconnect/utils" "2.17.0" + events "3.3.0" + "@walletconnect/events@1.0.1", "@walletconnect/events@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@walletconnect/events/-/events-1.0.1.tgz#2b5f9c7202019e229d7ccae1369a9e86bda7816c" @@ -5457,6 +5509,13 @@ dependencies: valtio "1.11.2" +"@walletconnect/modal-core@2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@walletconnect/modal-core/-/modal-core-2.7.0.tgz#73c13c3b7b0abf9ccdbac9b242254a86327ce0a4" + integrity sha512-oyMIfdlNdpyKF2kTJowTixZSo0PGlCJRdssUN/EZdA6H6v03hZnf09JnwpljZNfir2M65Dvjm/15nGrDQnlxSA== + dependencies: + valtio "1.11.2" + "@walletconnect/modal-ui@2.6.2": version "2.6.2" resolved "https://registry.yarnpkg.com/@walletconnect/modal-ui/-/modal-ui-2.6.2.tgz#fa57c087c57b7f76aaae93deab0f84bb68b59cf9" @@ -5467,6 +5526,16 @@ motion "10.16.2" qrcode "1.5.3" +"@walletconnect/modal-ui@2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@walletconnect/modal-ui/-/modal-ui-2.7.0.tgz#dbbb7ee46a5a25f7d39db622706f2d197b268cbb" + integrity sha512-gERYvU7D7K1ANCN/8vUgsE0d2hnRemfAFZ2novm9aZBg7TEd/4EgB+AqbJ+1dc7GhOL6dazckVq78TgccHb7mQ== + dependencies: + "@walletconnect/modal-core" "2.7.0" + lit "2.8.0" + motion "10.16.2" + qrcode "1.5.3" + "@walletconnect/modal@2.6.2": version "2.6.2" resolved "https://registry.yarnpkg.com/@walletconnect/modal/-/modal-2.6.2.tgz#4b534a836f5039eeb3268b80be7217a94dd12651" @@ -5475,6 +5544,14 @@ "@walletconnect/modal-core" "2.6.2" "@walletconnect/modal-ui" "2.6.2" +"@walletconnect/modal@2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@walletconnect/modal/-/modal-2.7.0.tgz#55f969796d104cce1205f5f844d8f8438b79723a" + integrity sha512-RQVt58oJ+rwqnPcIvRFeMGKuXb9qkgSmwz4noF8JZGUym3gUAzVs+uW2NQ1Owm9XOJAV+sANrtJ+VoVq1ftElw== + dependencies: + "@walletconnect/modal-core" "2.7.0" + "@walletconnect/modal-ui" "2.7.0" + "@walletconnect/qrcode-modal@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@walletconnect/qrcode-modal/-/qrcode-modal-1.8.0.tgz#ddd6f5c9b7ee52c16adf9aacec2a3eac4994caea" @@ -5533,6 +5610,21 @@ "@walletconnect/utils" "2.16.1" events "3.3.0" +"@walletconnect/sign-client@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.17.0.tgz#efe811b1bb10082d964e2f0378aaa1b40f424503" + integrity sha512-sErYwvSSHQolNXni47L3Bm10ptJc1s1YoJvJd34s5E9h9+d3rj7PrhbiW9X82deN+Dm5oA8X9tC4xty1yIBrVg== + dependencies: + "@walletconnect/core" "2.17.0" + "@walletconnect/events" "1.0.1" + "@walletconnect/heartbeat" "1.2.2" + "@walletconnect/jsonrpc-utils" "1.0.8" + "@walletconnect/logger" "2.1.2" + "@walletconnect/time" "1.0.2" + "@walletconnect/types" "2.17.0" + "@walletconnect/utils" "2.17.0" + events "3.3.0" + "@walletconnect/sign-client@^2.7.2": version "2.16.3" resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.16.3.tgz#abf686e54408802a626a105b096aa9cc3c8a2d14" @@ -5579,6 +5671,18 @@ "@walletconnect/logger" "2.1.2" events "3.3.0" +"@walletconnect/types@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.17.0.tgz#20eda5791e3172f8ab9146caa3f317701d4b3232" + integrity sha512-i1pn9URpvt9bcjRDkabuAmpA9K7mzyKoLJlbsAujRVX7pfaG7wur7u9Jz0bk1HxvuABL5LHNncTnVKSXKQ5jZA== + dependencies: + "@walletconnect/events" "1.0.1" + "@walletconnect/heartbeat" "1.2.2" + "@walletconnect/jsonrpc-types" "1.0.4" + "@walletconnect/keyvaluestorage" "1.1.1" + "@walletconnect/logger" "2.1.2" + events "3.3.0" + "@walletconnect/types@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-1.8.0.tgz#3f5e85b2d6b149337f727ab8a71b8471d8d9a195" @@ -5599,6 +5703,21 @@ "@walletconnect/utils" "2.16.1" events "3.3.0" +"@walletconnect/universal-provider@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@walletconnect/universal-provider/-/universal-provider-2.17.0.tgz#c9d4bbd9b8f0e41b500b2488ccbc207dc5f7a170" + integrity sha512-d3V5Be7AqLrvzcdMZSBS8DmGDRdqnyLk1DWmRKAGgR6ieUWykhhUKlvfeoZtvJrIXrY7rUGYpH1X41UtFkW5Pw== + dependencies: + "@walletconnect/jsonrpc-http-connection" "1.0.8" + "@walletconnect/jsonrpc-provider" "1.0.14" + "@walletconnect/jsonrpc-types" "1.0.4" + "@walletconnect/jsonrpc-utils" "1.0.8" + "@walletconnect/logger" "2.1.2" + "@walletconnect/sign-client" "2.17.0" + "@walletconnect/types" "2.17.0" + "@walletconnect/utils" "2.17.0" + events "3.3.0" + "@walletconnect/utils@2.16.1": version "2.16.1" resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.16.1.tgz#2099cc2bd16b0edc32022f64aa2c2c323b45d1d4" @@ -5643,6 +5762,28 @@ query-string "7.1.3" uint8arrays "3.1.0" +"@walletconnect/utils@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.17.0.tgz#02b3af0b80d0c1a994d692d829d066271b04d071" + integrity sha512-1aeQvjwsXy4Yh9G6g2eGmXrEl+BzkNjHRdCrGdMYqFTFa8ROEJfTGsSH3pLsNDlOY94CoBUvJvM55q/PMoN/FQ== + dependencies: + "@stablelib/chacha20poly1305" "1.0.1" + "@stablelib/hkdf" "1.0.1" + "@stablelib/random" "1.0.2" + "@stablelib/sha256" "1.0.1" + "@stablelib/x25519" "1.0.3" + "@walletconnect/relay-api" "1.0.11" + "@walletconnect/relay-auth" "1.0.4" + "@walletconnect/safe-json" "1.0.2" + "@walletconnect/time" "1.0.2" + "@walletconnect/types" "2.17.0" + "@walletconnect/window-getters" "1.0.1" + "@walletconnect/window-metadata" "1.0.1" + detect-browser "5.3.0" + elliptic "^6.5.7" + query-string "7.1.3" + uint8arrays "3.1.0" + "@walletconnect/window-getters@1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@walletconnect/window-getters/-/window-getters-1.0.0.tgz#1053224f77e725dfd611c83931b5f6c98c32bfc8" @@ -5844,7 +5985,7 @@ abitype@1.0.5: resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.5.tgz#29d0daa3eea867ca90f7e4123144c1d1270774b6" integrity sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw== -abitype@^1.0.2: +abitype@1.0.6, abitype@^1.0.2: version "1.0.6" resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.6.tgz#76410903e1d88e34f1362746e2d407513c38565b" integrity sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A== @@ -11105,6 +11246,11 @@ isows@1.0.4: resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061" integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ== +isows@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.6.tgz#0da29d706fa51551c663c627ace42769850f86e7" + integrity sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw== + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -16457,7 +16603,7 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -viem@^2.1.1, viem@^2.21.16: +viem@^2.1.1: version "2.21.16" resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.16.tgz#cf32200bbd1696bd6e86de7e1c12fcdfd77b63c1" integrity sha512-SvhaPzTj3a+zR/5OmtJ0acjA6oGDrgPg4vtO8KboXtvbjksXEkz+oFaNjZDgxpkqbps2SLi8oPCjdpRm6WgDmw== @@ -16472,6 +16618,21 @@ viem@^2.1.1, viem@^2.21.16: webauthn-p256 "0.0.5" ws "8.17.1" +viem@^2.21.19: + version "2.21.19" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.19.tgz#5e1a7efc45903d83306416ffa2e3a11ed23cd924" + integrity sha512-FdlkN+UI1IU5sYOmzvygkxsUNjDRD5YHht3gZFu2X9xFv6Z3h9pXq9ycrYQ3F17lNfb41O2Ot4/aqbUkwOv9dA== + dependencies: + "@adraffy/ens-normalize" "1.11.0" + "@noble/curves" "1.6.0" + "@noble/hashes" "1.5.0" + "@scure/bip32" "1.5.0" + "@scure/bip39" "1.4.0" + abitype "1.0.6" + isows "1.0.6" + webauthn-p256 "0.0.10" + ws "8.18.0" + vm-browserify@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" @@ -16484,12 +16645,12 @@ w3c-xmlserializer@^4.0.0: dependencies: xml-name-validator "^4.0.0" -wagmi@^2.12.16: - version "2.12.16" - resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.12.16.tgz#4ce84b67957ba24c6d440603c747a3e97114e23f" - integrity sha512-FBw8sEuo1uJkmGyl/DDxy9LSR/3t76CKFF8SxLi6nuPIaDr1hH5KOsBbpa0a8or7cY/tSLAhpTA/YBpDfDwL0Q== +wagmi@^2.12.17: + version "2.12.17" + resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.12.17.tgz#b3fad0dc38a67a35a2506db3dc8df90164f1ee87" + integrity sha512-WkofyvOX6XGOXrs8W0NvnzbLGIb9Di8ECqpMDW32nqwTKRxfolfN4GI/AlAMs9fjx4h3k8LGTfqa6UGLb063yg== dependencies: - "@wagmi/connectors" "5.1.14" + "@wagmi/connectors" "5.1.15" "@wagmi/core" "2.13.8" use-sync-external-store "1.2.0" @@ -16755,6 +16916,14 @@ web3@1.10.0: web3-shh "1.10.0" web3-utils "1.10.0" +webauthn-p256@0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/webauthn-p256/-/webauthn-p256-0.0.10.tgz#877e75abe8348d3e14485932968edf3325fd2fdd" + integrity sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA== + dependencies: + "@noble/curves" "^1.4.0" + "@noble/hashes" "^1.4.0" + webauthn-p256@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/webauthn-p256/-/webauthn-p256-0.0.5.tgz#0baebd2ba8a414b21cc09c0d40f9dd0be96a06bd" @@ -17047,6 +17216,11 @@ ws@8.17.1, ws@~8.17.1: resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== +ws@8.18.0, ws@^8.11.0, ws@^8.18.0, ws@^8.5.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + ws@^3.0.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" @@ -17061,11 +17235,6 @@ ws@^7.2.0, ws@^7.3.1, ws@^7.4.6, ws@^7.5.1, ws@^7.5.10: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== -ws@^8.11.0, ws@^8.18.0, ws@^8.5.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== - xhr-request-promise@^0.1.2: version "0.1.3" resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" From b48c07afe64a0efcd08c07463fdedd120f4ef9ac Mon Sep 17 00:00:00 2001 From: Kilter Date: Tue, 8 Oct 2024 10:02:02 -0500 Subject: [PATCH 06/22] Update SelectTokenModal.tsx --- .../donate/OneTime/SelectTokenModal/SelectTokenModal.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/views/donate/OneTime/SelectTokenModal/SelectTokenModal.tsx b/src/components/views/donate/OneTime/SelectTokenModal/SelectTokenModal.tsx index f5dbe4f97e..a776a03470 100644 --- a/src/components/views/donate/OneTime/SelectTokenModal/SelectTokenModal.tsx +++ b/src/components/views/donate/OneTime/SelectTokenModal/SelectTokenModal.tsx @@ -148,14 +148,13 @@ const SelectTokenInnerModal: FC = ({ } } else { setCustomToken(undefined); + const sQuery: string = searchQuery; const filtered = tokens.filter( token => token.symbol .toLowerCase() - .includes(searchQuery.toLowerCase()) || - token.name - .toLowerCase() - .includes(searchQuery.toLowerCase()), + .includes(sQuery.toLowerCase()) || + token.name.toLowerCase().includes(sQuery.toLowerCase()), ); setFilteredTokens(filtered); } From 919b27b2da5fa14690b5cf8bc6379f1bd5f12214 Mon Sep 17 00:00:00 2001 From: Kilter Date: Tue, 8 Oct 2024 10:09:13 -0500 Subject: [PATCH 07/22] Update useCreateEvmDonation.tsx --- src/hooks/useCreateEvmDonation.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useCreateEvmDonation.tsx b/src/hooks/useCreateEvmDonation.tsx index aac52f512b..23a89f0d0d 100644 --- a/src/hooks/useCreateEvmDonation.tsx +++ b/src/hooks/useCreateEvmDonation.tsx @@ -18,7 +18,7 @@ import { client } from '@/apollo/apolloClient'; import { CREATE_DRAFT_DONATION } from '@/apollo/gql/gqlDonations'; export const useCreateEvmDonation = () => { - const [txHash, setTxHash] = useState<`0x${string}` | undefined>(); + const [txHash, setTxHash] = useState<`0x${string}` | Address | undefined>(); const [donationSaved, setDonationSaved] = useState(false); const [donationMinted, setDonationMinted] = useState(false); const [donationId, setDonationId] = useState(0); @@ -30,7 +30,7 @@ export const useCreateEvmDonation = () => { const isSafeEnv = useIsSafeEnvironment(); const { status } = useWaitForTransactionReceipt({ - hash: txHash, + hash: txHash as `0x${string}`, onReplaced(data) { console.log('Transaction Updated', data); setTxHash(data.transaction.hash); From 71c56a1f01c6bbb52fd489c817c6c31d10373203 Mon Sep 17 00:00:00 2001 From: Kilter Date: Tue, 8 Oct 2024 10:21:24 -0500 Subject: [PATCH 08/22] Update usePassport.ts --- src/hooks/usePassport.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/usePassport.ts b/src/hooks/usePassport.ts index 3044bc7f4c..4cfd425eee 100644 --- a/src/hooks/usePassport.ts +++ b/src/hooks/usePassport.ts @@ -235,7 +235,9 @@ export const usePassport = () => { }); try { - const userAddressScore = await scoreUserAddress(address); + const userAddressScore = await scoreUserAddress( + address as `0x${string}`, + ); await updateState(userAddressScore); dispatch(setUserMBDScore(userAddressScore?.activeQFMBDScore)); } catch (error) { From 24ca887cd33594710b78ca16d9959fffd759823d Mon Sep 17 00:00:00 2001 From: Kilter Date: Tue, 8 Oct 2024 10:30:05 -0500 Subject: [PATCH 09/22] Update transaction.ts --- src/lib/transaction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/transaction.ts b/src/lib/transaction.ts index 54bda2b6fe..9cd8e1542c 100644 --- a/src/lib/transaction.ts +++ b/src/lib/transaction.ts @@ -57,7 +57,7 @@ export const retryFetchEVMTransaction = async ( ) => { for (let i = 0; i < retries; i++) { const transaction = await getTransaction(wagmiConfig, { - hash: txHash, + hash: txHash as `0x${string}`, }).catch(error => { console.error( 'Attempt', From df2545d76ad076c1f01404705f7dd4ea19203a5f Mon Sep 17 00:00:00 2001 From: Kilter Date: Tue, 8 Oct 2024 11:44:59 -0500 Subject: [PATCH 10/22] Update wagmiConfigs.ts --- src/wagmiConfigs.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wagmiConfigs.ts b/src/wagmiConfigs.ts index 03c50ba47a..e33ec15218 100644 --- a/src/wagmiConfigs.ts +++ b/src/wagmiConfigs.ts @@ -2,6 +2,7 @@ import { cookieStorage, createConfig, createStorage } from 'wagmi'; import { walletConnect, coinbaseWallet, safe } from '@wagmi/connectors'; import { createClient, http } from 'viem'; +import { mainnet } from 'viem/chains'; import configuration from './configuration'; // Get projectId at https://cloud.walletconnect.com @@ -37,6 +38,16 @@ export const wagmiConfig = createConfig({ storage: cookieStorage, }), client({ chain }) { - return createClient({ chain, transport: http() }); + // TODO: we must manage this for all chains in a better way + // basically to stop using viem's public transport + // leaving this as a hotfix to keep it quick + const infuraKey = process.env.NEXT_PUBLIC_INFURA_API_KEY; + + const customHttp = + chain.id === mainnet.id && infuraKey + ? http(`https://mainnet.infura.io/v3/${infuraKey}`) + : http(); + + return createClient({ chain, transport: customHttp }); }, }); From 9f67e61077cefeed013a4ed624521287ecda52b3 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Wed, 23 Oct 2024 22:04:58 +0200 Subject: [PATCH 11/22] removed stake together --- src/components/views/givfarm/GIVfarmBottom.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/components/views/givfarm/GIVfarmBottom.tsx b/src/components/views/givfarm/GIVfarmBottom.tsx index 50dce7f30f..b2432c8251 100644 --- a/src/components/views/givfarm/GIVfarmBottom.tsx +++ b/src/components/views/givfarm/GIVfarmBottom.tsx @@ -32,7 +32,6 @@ import StakingPoolCard from '@/components/cards/StakingCards/BaseStakingCard/Bas import { RegenStreamSection } from '@/components/givfarm/RegenStreamSection'; import ToggleSwitch from '@/components/ToggleSwitch'; import { getNetworkConfig } from '@/helpers/givpower'; -import { StakeTogetherCard } from '@/components/cards/StakingCards/BaseStakingCard/StakeTogetherCard'; const renderPool = (pool: SimplePoolStakingConfig, id: number) => ( @@ -189,17 +188,7 @@ export const GIVfarmBottom = () => { toggleOnOff={setShowArchivedPools} /> - - {renderPools(chainId, showArchivedPools)} - - - - + {renderPools(chainId, showArchivedPools)} From e4698ad4a3108428a36c882a39fa8f2e9cd08355 Mon Sep 17 00:00:00 2001 From: Lovel George <36924734+lovelgeorge99@users.noreply.github.com> Date: Sat, 26 Oct 2024 04:37:21 +0530 Subject: [PATCH 12/22] added footer links to qacc --- lang/ca.json | 2 ++ lang/en.json | 2 ++ lang/es.json | 2 ++ next-env.d.ts | 2 +- src/components/Footer/Footer.tsx | 18 +++++++++++++++++- src/lib/constants/links.ts | 2 ++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index 7008153fa8..985cfd381e 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -98,6 +98,8 @@ "component.title.user_guides": "Guies d'Usuari", "component.title.we_hiring": "Estem contractant!", "component.title.what_is_giveth": "Què és Giveth?", + "component.title.qacc": "Q/acc", + "component.title.qacc_news": "Q/acc News", "component.title.with_your_donation": "amb la teva donació", "component.tooltip.donate_anonymously": "En marcar això, no considerarem la informació del teu perfil com a donant per a aquesta donació i no la mostrarem a les pàgines públiques.", "component.tooltip.donate_privately": "Si marques això, amagarem el teu nom i l'enllaç de la transacció de donació de la pàgina del projecte, i no mostrarem aquesta donació a la teva pàgina de perfil públic.", diff --git a/lang/en.json b/lang/en.json index eb8ac421ea..2ddfd1f966 100644 --- a/lang/en.json +++ b/lang/en.json @@ -97,6 +97,8 @@ "component.title.tos": "Terms of Use", "component.title.user_guides": "User Guides", "component.title.we_hiring": "We're Hiring!", + "component.title.qacc": "Q/acc", + "component.title.qacc_news": "Q/acc News", "component.title.what_is_giveth": "What is Giveth?", "component.title.with_your_donation": "with your Donation", "component.tooltip.donate_anonymously": "By checking this, we won't consider your profile information as a donor for this donation and won't show it on public pages.", diff --git a/lang/es.json b/lang/es.json index 9b6c0c3095..abb0ae51a7 100644 --- a/lang/es.json +++ b/lang/es.json @@ -706,6 +706,8 @@ "label.on": "en", "label.onboarding_guide": "Guía de incorporación", "label.one_million_giv": "1 Millón de GIV", + "component.title.qacc": "Q/acc", + "component.title.qacc_news": "Q/acc News", "label.one_round": "1 Ronda", "label.one_time_donation": "Donación Única", "label.on_gnosis_and": "en el red de Gnosis Chain y además, ¡el 80% de las tarifas de registro van al 'Matching Pool' de Giveth!", diff --git a/next-env.d.ts b/next-env.d.ts index a4a7b3f5cf..4f11a03dc6 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 7cbe06a31c..7da33574dd 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -142,6 +142,22 @@ const Footer = () => { + + + + {formatMessage({ + id: 'component.title.qacc', + })} + + + + + {formatMessage({ + id: 'component.title.qacc_news', + })} + + + @@ -225,7 +241,7 @@ const LeftContainer = styled(Flex)` gap: 0; ${mediaQueries.laptopL} { - gap: 0 72px; + gap: 0 0px; } `; diff --git a/src/lib/constants/links.ts b/src/lib/constants/links.ts index 03e55171ee..f1c6413628 100644 --- a/src/lib/constants/links.ts +++ b/src/lib/constants/links.ts @@ -56,6 +56,8 @@ const links = { SWAG: 'https://swag.giveth.io/', COMMONS_STACK: 'https://commonsstack.org/', RECRUITEE: 'https://giveth.recruitee.com/', + QACC: 'https://qacc.giveth.io/', + QACC_NEWS: 'https://qacc.giveth.io/news', JOINGIVFRENS: TYPEFORM + 'regenfarms', DISCORD_SUPPORT: 'https://discord.gg/TeWHtAjNQT', CALENDAR: From cf32f76232e24b90a99955c8c5207e5cfbcad522 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Mon, 11 Nov 2024 19:02:44 +0100 Subject: [PATCH 13/22] Disable USDC on recurring donation --- next-env.d.ts | 2 +- src/config/production.tsx | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03dc6..a4a7b3f5cf 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. diff --git a/src/config/production.tsx b/src/config/production.tsx index 27c51ceb91..d394f547a6 100644 --- a/src/config/production.tsx +++ b/src/config/production.tsx @@ -522,21 +522,21 @@ const config: EnvConfig = { isSuperToken: true, coingeckoId: 'dai', }, - { - underlyingToken: { - decimals: 6, - id: '0x7f5c764cbc14f9669b88837ca1490cca17c31607', - name: 'USD Coin', - symbol: 'USDC', - coingeckoId: 'usd-coin', - }, - decimals: 18, - id: '0x8430f084b939208e2eded1584889c9a66b90562f', - name: 'Super USD Coin', - symbol: 'USDCx', - isSuperToken: true, - coingeckoId: 'usd-coin', - }, + // { + // underlyingToken: { + // decimals: 6, + // id: '0x7f5c764cbc14f9669b88837ca1490cca17c31607', + // name: 'USD Coin', + // symbol: 'USDC', + // coingeckoId: 'usd-coin', + // }, + // decimals: 18, + // id: '0x8430f084b939208e2eded1584889c9a66b90562f', + // name: 'Super USD Coin', + // symbol: 'USDCx', + // isSuperToken: true, + // coingeckoId: 'usd-coin', + // }, { underlyingToken: { decimals: 18, From de3da5f1c224da62101739dc7604cf31d81e5a06 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 26 Nov 2024 21:31:04 +0100 Subject: [PATCH 14/22] Fix/Recurring donation for USDC --- .../Recurring/RecurringDonationCard.tsx | 13 +++- .../Recurring/RecurringDonationModal/Item.tsx | 8 ++- .../RecurringDonationModal.tsx | 31 +++++++-- .../SelectTokenModal/SelectTokenModal.tsx | 67 ++++++++++--------- src/config/production.tsx | 45 ++++++++----- 5 files changed, 111 insertions(+), 53 deletions(-) diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index d40b596581..23d373f345 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -142,12 +142,20 @@ export const RecurringDonationCard = () => { if (selectedRecurringToken.token.isSuperToken) { setAmount(balance.value || 0n); } + if (selectedRecurringToken.token.decimals === 6) { + setAmount(0n); + setPerMonthAmount(0n); + } }, [selectedRecurringToken, balance]); const underlyingToken = selectedRecurringToken?.token.underlyingToken; + // Introduce a scaling factor to handle tokens with different decimals + const scaleFactor = + selectedRecurringToken?.token.decimals === 6 ? 10000n : 1n; + // total means project + giveth - const totalPerSec = perMonthAmount / ONE_MONTH_SECONDS; + const totalPerSec = perMonthAmount / (ONE_MONTH_SECONDS / scaleFactor); const projectPerMonth = (perMonthAmount * BigInt(100 - donationToGiveth)) / 100n; const givethPerMonth = perMonthAmount - projectPerMonth; @@ -168,7 +176,8 @@ export const RecurringDonationCard = () => { 0n, ) || 0n; const totalStreamPerSec = totalPerSec + otherStreamsPerSec; - const totalStreamPerMonth = totalStreamPerSec * ONE_MONTH_SECONDS; + const totalStreamPerMonth = + totalStreamPerSec * (ONE_MONTH_SECONDS / scaleFactor); const streamRunOutInMonth = totalStreamPerSec > 0 ? amount / totalStreamPerMonth : 0n; const isTotalStreamExceed = diff --git a/src/components/views/donate/Recurring/RecurringDonationModal/Item.tsx b/src/components/views/donate/Recurring/RecurringDonationModal/Item.tsx index 2366a6de13..10f5225c3d 100644 --- a/src/components/views/donate/Recurring/RecurringDonationModal/Item.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationModal/Item.tsx @@ -31,7 +31,9 @@ export const Item: FC = ({ {limitFraction( formatUnits( amount, - token.underlyingToken?.decimals || 18, + token.underlyingToken?.decimals || + token.decimals || + 18, ), )}  {token.symbol} @@ -47,7 +49,9 @@ export const Item: FC = ({ .multipliedBy(amount.toString()) .toFixed(0), ), - token.underlyingToken?.decimals || 18, + token.underlyingToken?.decimals || + token.decimals || + 18, ), 2, )} diff --git a/src/components/views/donate/Recurring/RecurringDonationModal/RecurringDonationModal.tsx b/src/components/views/donate/Recurring/RecurringDonationModal/RecurringDonationModal.tsx index 76021e47e1..89863d004f 100644 --- a/src/components/views/donate/Recurring/RecurringDonationModal/RecurringDonationModal.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationModal/RecurringDonationModal.tsx @@ -10,6 +10,7 @@ import { Framework, type Operation } from '@superfluid-finance/sdk-core'; import { useAccount } from 'wagmi'; import { useIntl } from 'react-intl'; import { formatUnits } from 'viem'; +import { ethers } from 'ethers'; import { Modal } from '@/components/modals/Modal'; import { useModalAnimation } from '@/hooks/useModalAnimation'; import { IModal } from '@/types/common'; @@ -227,10 +228,32 @@ const RecurringDonationInnerModal: FC = ({ const operations: Operation[] = []; + let newAmount = amount; + let newPerMonthAmount = perMonthAmount; + + // This is a special case with tokens that have 6 decimals + // We need to convert the amount to 18 decimals for the upgrade operation + // And also for the flow rate calculation + if (selectedRecurringToken.token.decimals === 6) { + const divisor = BigInt( + 10 ** selectedRecurringToken.token.decimals, + ); + const currentAmount = Number(amount) / Number(divisor); + newAmount = ethers.utils + .parseUnits(currentAmount.toString(), 18) + .toBigInt(); + + const currentPerMonth = + Number(perMonthAmount) / Number(divisor); + newPerMonthAmount = ethers.utils + .parseUnits(currentPerMonth.toString(), 18) + .toBigInt(); + } + // Upgrade the token to super token if (!isUpdating && !selectedRecurringToken.token.isSuperToken) { const upgradeOperation = await superToken.upgrade({ - amount: amount.toString(), + amount: newAmount.toString(), }); //Upgrading ETHx is a special case and can't be batched @@ -245,8 +268,8 @@ const RecurringDonationInnerModal: FC = ({ throw new Error('Project wallet address not found'); } - const _flowRate = - (perMonthAmount * BigInt(100 - donationToGiveth)) / + let _flowRate = + (newPerMonthAmount * BigInt(100 - donationToGiveth)) / 100n / ONE_MONTH_SECONDS; @@ -279,7 +302,7 @@ const RecurringDonationInnerModal: FC = ({ } const _newFlowRate = - (perMonthAmount * BigInt(donationToGiveth)) / + (newPerMonthAmount * BigInt(donationToGiveth)) / 100n / ONE_MONTH_SECONDS; diff --git a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx index b6aa89e915..806ad772ca 100644 --- a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx +++ b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx @@ -51,6 +51,7 @@ const SelectTokenInnerModal: FC = ({ setShowModal, }) => { const [tokens, setTokens] = useState([]); + const [underlyingTokens, setUnderlyingTokens] = useState([]); const [balances, setBalances] = useState({}); const { formatMessage } = useIntl(); @@ -84,11 +85,12 @@ const SelectTokenInnerModal: FC = ({ return acc; }, {} as IBalances); - const filteredTokens = superTokens.filter( - token => !(newBalances[token.symbol] > 0n), - ); + const filteredTokens = superTokens.filter(token => { + return !(newBalances[token.underlyingToken.symbol] > 0n); + }); setTokens(filteredTokens); + setUnderlyingTokens(superTokens); // Update the state with the new balances setBalances(newBalances); @@ -185,33 +187,38 @@ const SelectTokenInnerModal: FC = ({ id: 'label.superfluid_eligible_tokens_description', })} - {tokens.length > 0 ? ( - tokens.map(token => ( - { - setSelectedRecurringToken({ - token: token.underlyingToken, - balance: - balances[ - token.underlyingToken.symbol - ], - }); - setShowModal(false); - }} - /> + {underlyingTokens.length > 0 ? ( + underlyingTokens.map(token => ( + <> + { + setSelectedRecurringToken({ + token: token.underlyingToken, + balance: + balances[ + token.underlyingToken + .symbol + ], + }); + setShowModal(false); + }} + /> + )) ) : ( diff --git a/src/config/production.tsx b/src/config/production.tsx index d394f547a6..40c9d9d710 100644 --- a/src/config/production.tsx +++ b/src/config/production.tsx @@ -522,21 +522,36 @@ const config: EnvConfig = { isSuperToken: true, coingeckoId: 'dai', }, - // { - // underlyingToken: { - // decimals: 6, - // id: '0x7f5c764cbc14f9669b88837ca1490cca17c31607', - // name: 'USD Coin', - // symbol: 'USDC', - // coingeckoId: 'usd-coin', - // }, - // decimals: 18, - // id: '0x8430f084b939208e2eded1584889c9a66b90562f', - // name: 'Super USD Coin', - // symbol: 'USDCx', - // isSuperToken: true, - // coingeckoId: 'usd-coin', - // }, + { + underlyingToken: { + decimals: 6, + id: '0x7f5c764cbc14f9669b88837ca1490cca17c31607', + name: 'USD Coin', + symbol: 'USDC.e', + coingeckoId: 'usd-coin', + }, + decimals: 18, + id: '0x8430f084b939208e2eded1584889c9a66b90562f', + name: 'Super USD Coin', + symbol: 'USDC.ex', + isSuperToken: true, + coingeckoId: 'usd-coin', + }, + { + underlyingToken: { + decimals: 6, + id: '0x0b2c639c533813f4aa9d7837caf62653d097ff85', + name: 'USD Coin', + symbol: 'USDC', + coingeckoId: 'usd-coin', + }, + decimals: 18, + id: '0x35Adeb0638EB192755B6E52544650603Fe65A006', + name: 'Super USD Coin', + symbol: 'USDCx', + isSuperToken: true, + coingeckoId: 'usd-coin', + }, { underlyingToken: { decimals: 18, From 16294c3e4a0779088b8b3a538178ad2ecc3b8613 Mon Sep 17 00:00:00 2001 From: Mitch Oz Date: Wed, 27 Nov 2024 15:18:04 -0600 Subject: [PATCH 15/22] add cbBTC token images --- public/images/tokens/cbBTC.png | Bin 0 -> 640 bytes public/images/tokens/cbBTC.svg | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 public/images/tokens/cbBTC.png create mode 100644 public/images/tokens/cbBTC.svg diff --git a/public/images/tokens/cbBTC.png b/public/images/tokens/cbBTC.png new file mode 100644 index 0000000000000000000000000000000000000000..d05eab7e5d3378a02a420be3bb299b6532df6de2 GIT binary patch literal 640 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEdf3uuI>ds3_<@G$6r{;1fwQf{9Ai>q&odj2oX z;SXnC`ru7&%#?(6?YR>D=Y^l>Y>-)2{HL>Cb=RXe{U5#5Uw_~3R&#bo#e5e{gY=-uYg5&%mBPg?bO2uP`|Vl4b(6U=XPy2$x5|K39ijKvDJXOA01T>3O!I`Fux zulb5K>P|HW7wbfKU-{vaHBzRFR(OkbQC0@$|@pyOxG6+FJTk zqq(%b>E!XSo;1FygDsOD2X%Dcq+U-z`uMX^)={(87({=Hux*UkHHe#Fc@WuJLN R7BC7KJYD@<);T3K0RZFsKCb`( literal 0 HcmV?d00001 diff --git a/public/images/tokens/cbBTC.svg b/public/images/tokens/cbBTC.svg new file mode 100644 index 0000000000..2f3494630c --- /dev/null +++ b/public/images/tokens/cbBTC.svg @@ -0,0 +1,9 @@ + + + + + + + + + From 2b943cf1afee527c25f7bcf7428f18fe9e54ee78 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 28 Nov 2024 20:05:47 +0100 Subject: [PATCH 16/22] started diagnostic --- .../views/donate/Recurring/RecurringDonationCard.tsx | 3 +++ src/helpers/donate.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index 23d373f345..bd359cff9d 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -162,6 +162,8 @@ export const RecurringDonationCard = () => { const tokenBalance = balance?.value; const tokenStream = tokenStreams[selectedRecurringToken?.token.id || '']; + console.log({ tokenStreams }); + const anchorContractAddress = useMemo( () => findAnchorContractAddress(project.anchorContracts), [project.anchorContracts], @@ -533,6 +535,7 @@ export const RecurringDonationCard = () => { )} + AAAA {tokenStream?.length > 0 && ( <> diff --git a/src/helpers/donate.ts b/src/helpers/donate.ts index e45dc72ed4..e5615353a2 100644 --- a/src/helpers/donate.ts +++ b/src/helpers/donate.ts @@ -35,6 +35,7 @@ export const findUserActiveStreamOnSelectedToken = ( }; export const countActiveStreams = (tokenStreams: ISuperfluidStream[]) => { + console.log('tokenStreams', tokenStreams); return ( tokenStreams.filter(stream => stream.currentFlowRate !== '0').length || 0 From 7b1534aa6f78f58789060ed85e5c2bb571be002b Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 28 Nov 2024 21:28:59 +0100 Subject: [PATCH 17/22] fixing missing streams --- .../views/donate/Recurring/RecurringDonationCard.tsx | 3 --- .../Recurring/SelectTokenModal/SelectTokenModal.tsx | 8 ++++++-- src/helpers/donate.ts | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index bd359cff9d..23d373f345 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -162,8 +162,6 @@ export const RecurringDonationCard = () => { const tokenBalance = balance?.value; const tokenStream = tokenStreams[selectedRecurringToken?.token.id || '']; - console.log({ tokenStreams }); - const anchorContractAddress = useMemo( () => findAnchorContractAddress(project.anchorContracts), [project.anchorContracts], @@ -535,7 +533,6 @@ export const RecurringDonationCard = () => { )} - AAAA {tokenStream?.length > 0 && ( <> diff --git a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx index 806ad772ca..203710aab5 100644 --- a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx +++ b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx @@ -128,8 +128,12 @@ const SelectTokenInnerModal: FC = ({ })} {Object.keys(tokenStreams).map(tokenId => { + console.log(new Date()); + console.log(tokenId); const token = superTokens.find( - token => token.id === tokenId, + token => + token.id.toLowerCase() === + tokenId.toLowerCase(), ) as IToken; return token ? ( = ({ ) : null; })} {superTokens.map(token => - tokenStreams[token.id] || + tokenStreams[token.id.toLowerCase()] || balances[token.symbol] === 0n ? null : ( { - console.log('tokenStreams', tokenStreams); return ( tokenStreams.filter(stream => stream.currentFlowRate !== '0').length || 0 From 0ce1b94a06d38a06975d82877fe7946c2548f050 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 28 Nov 2024 21:30:10 +0100 Subject: [PATCH 18/22] removing console logs --- .../donate/Recurring/SelectTokenModal/SelectTokenModal.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx index 203710aab5..a6d05cc392 100644 --- a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx +++ b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx @@ -128,8 +128,6 @@ const SelectTokenInnerModal: FC = ({ })} {Object.keys(tokenStreams).map(tokenId => { - console.log(new Date()); - console.log(tokenId); const token = superTokens.find( token => token.id.toLowerCase() === From 664c79ac9de2c22245d43c67f53bcb035181fb5f Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 28 Nov 2024 21:42:34 +0100 Subject: [PATCH 19/22] fixing modify stream balance --- .../views/donate/Recurring/RecurringDonationCard.tsx | 7 +++++-- .../donate/Recurring/SelectTokenModal/SelectTokenModal.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index 23d373f345..8ad2737caf 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -160,7 +160,8 @@ export const RecurringDonationCard = () => { (perMonthAmount * BigInt(100 - donationToGiveth)) / 100n; const givethPerMonth = perMonthAmount - projectPerMonth; const tokenBalance = balance?.value; - const tokenStream = tokenStreams[selectedRecurringToken?.token.id || '']; + const tokenStream = + tokenStreams[selectedRecurringToken?.token.id.toLowerCase() || '']; const anchorContractAddress = useMemo( () => findAnchorContractAddress(project.anchorContracts), @@ -776,7 +777,9 @@ export const RecurringDonationCard = () => { {showTopUpModal && selectedRecurringToken && ( = ({ return token ? ( Date: Thu, 28 Nov 2024 17:04:55 -0600 Subject: [PATCH 20/22] fix token decimals and symbols on withdraw and summary views --- .../ModifySuperToken/WithDrawSuperToken.tsx | 2 +- .../Recurring/RecurringDonationModal/Item.tsx | 13 +++-------- .../donationsTab/recurringTab/StreamRow.tsx | 22 ++++++++++++++----- src/config/production.tsx | 10 ++++----- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/components/views/donate/Recurring/ModifySuperToken/WithDrawSuperToken.tsx b/src/components/views/donate/Recurring/ModifySuperToken/WithDrawSuperToken.tsx index 4c9e2dbe3d..f0f1e5cd9e 100644 --- a/src/components/views/donate/Recurring/ModifySuperToken/WithDrawSuperToken.tsx +++ b/src/components/views/donate/Recurring/ModifySuperToken/WithDrawSuperToken.tsx @@ -187,7 +187,7 @@ export const WithDrawSuperToken: FC = ({ title='Withdraw from this stream balance' amount={amount} price={tokenPrice} - token={token!} + token={superToken!} /> = ({ {limitFraction( - formatUnits( - amount, - token.underlyingToken?.decimals || - token.decimals || - 18, - ), + formatUnits(amount, token.decimals || 18), )} -  {token.symbol} +  {token.underlyingToken?.symbol || token.symbol} {subtext} @@ -49,9 +44,7 @@ export const Item: FC = ({ .multipliedBy(amount.toString()) .toFixed(0), ), - token.underlyingToken?.decimals || - token.decimals || - 18, + token.decimals || 18, ), 2, )} diff --git a/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx b/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx index 353678be1c..abd937afe3 100644 --- a/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx +++ b/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx @@ -1,4 +1,4 @@ -import { useState, type FC } from 'react'; +import { useState, useMemo, type FC } from 'react'; import styled from 'styled-components'; import { P, brandColors, semanticColors } from '@giveth/ui-design-system'; import { formatUnits } from 'viem'; @@ -8,7 +8,7 @@ import { TokenIcon } from '@/components/views/donate/TokenIcon/TokenIcon'; import { TableCell } from './ActiveStreamsSection'; import { ISuperfluidStream } from '@/types/superFluid'; import { ONE_MONTH_SECONDS } from '@/lib/constants/constants'; -import { limitFraction } from '@/helpers/number'; +import { limitFraction, formatDonation } from '@/helpers/number'; import config from '@/configuration'; import { countActiveStreams } from '@/helpers/donate'; import { findTokenByAddress } from '@/helpers/superfluid'; @@ -19,6 +19,16 @@ interface IStreamRowProps { } export const StreamRow: FC = ({ tokenStream }) => { + const superToken = useMemo( + () => + config.OPTIMISM_CONFIG.SUPER_FLUID_TOKENS.find( + s => s.id === tokenStream[0].token.id, + ), + [tokenStream], + ); + console.log('tokenStream', tokenStream); + console.log('config', config.OPTIMISM_CONFIG.SUPER_FLUID_TOKENS); + // console.log('superToken', superToken); const [showModifyModal, setShowModifyModal] = useState(false); const { address, chain } = useAccount(); const { switchChain } = useSwitchChain(); @@ -39,7 +49,7 @@ export const StreamRow: FC = ({ tokenStream }) => { 0n, ); const monthlyFlowRate = totalFlowRate * ONE_MONTH_SECONDS; - const { symbol, decimals } = tokenStream[0].token; + // const { symbol } = tokenStream[0].token; const runOutMonth = monthlyFlowRate > 0 && balance?.value ? balance?.value / monthlyFlowRate @@ -57,12 +67,12 @@ export const StreamRow: FC = ({ tokenStream }) => { ) : '0'}

-

{symbol}

+

{superToken?.symbol}

- {limitFraction( - formatUnits(monthlyFlowRate || 0n, decimals), + {formatDonation( + limitFraction(formatUnits(BigInt(monthlyFlowRate), 18)), )}   {underlyingSymbol} diff --git a/src/config/production.tsx b/src/config/production.tsx index 40c9d9d710..3396524042 100644 --- a/src/config/production.tsx +++ b/src/config/production.tsx @@ -526,13 +526,13 @@ const config: EnvConfig = { underlyingToken: { decimals: 6, id: '0x7f5c764cbc14f9669b88837ca1490cca17c31607', - name: 'USD Coin', + name: 'Bridged USD Coin', symbol: 'USDC.e', coingeckoId: 'usd-coin', }, decimals: 18, id: '0x8430f084b939208e2eded1584889c9a66b90562f', - name: 'Super USD Coin', + name: 'Super Bridged USD Coin', symbol: 'USDC.ex', isSuperToken: true, coingeckoId: 'usd-coin', @@ -546,7 +546,7 @@ const config: EnvConfig = { coingeckoId: 'usd-coin', }, decimals: 18, - id: '0x35Adeb0638EB192755B6E52544650603Fe65A006', + id: '0x35adeb0638eb192755b6e52544650603fe65a006', name: 'Super USD Coin', symbol: 'USDCx', isSuperToken: true, @@ -555,13 +555,13 @@ const config: EnvConfig = { { underlyingToken: { decimals: 18, - id: '0x4F604735c1cF31399C6E711D5962b2B3E0225AD3', + id: '0x4f604735c1cf31399c6e711d5962b2b3e0225ad3', name: 'Glo Dollar', symbol: 'USDGLO', coingeckoId: 'glo-dollar', }, decimals: 18, - id: '0x9F41d0AA24E599fd8D0c180Ee3C0F609dc41c622', + id: '0x9f41d0aa24e599fd8d0c180ee3c0f609dc41c622', name: 'Super Glo Dollar', symbol: 'USDGLOx', isSuperToken: true, From 058091c321c4c25a46b11fa05c0f71f7c8d0f09c Mon Sep 17 00:00:00 2001 From: Mitch Oz Date: Sun, 1 Dec 2024 20:44:52 -0600 Subject: [PATCH 21/22] fix usdc & usdc.e deposit decimals logic on upgrade --- .../ModifySuperToken/DepositSuperToken.tsx | 15 ++++++++++++--- .../ModifySuperToken/ModifySuperTokenModal.tsx | 2 +- .../donationsTab/recurringTab/StreamRow.tsx | 7 ++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx b/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx index 7396e7cb30..fb79d0c5e0 100644 --- a/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx +++ b/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx @@ -2,6 +2,7 @@ import { useState, type FC, useEffect } from 'react'; import { Button, Flex } from '@giveth/ui-design-system'; import { useAccount, useBalance } from 'wagmi'; import { useIntl } from 'react-intl'; +import { ethers } from 'ethers'; import { Framework } from '@superfluid-finance/sdk-core'; import { ISuperToken, IToken } from '@/types/superFluid'; import { AddressZero } from '@/lib/constants/constants'; @@ -125,6 +126,7 @@ export const DepositSuperToken: FC = ({ // EThx is not a Wrapper Super Token and should load separately let superTokenAsset; + let newAmount = amount; if (superToken.symbol === 'ETHx') { superTokenAsset = await sf.loadNativeAssetSuperToken( superToken.id, @@ -132,10 +134,18 @@ export const DepositSuperToken: FC = ({ } else { superTokenAsset = await sf.loadWrapperSuperToken(superToken.id); } + if (token && token.decimals === 6) { + const divisor = BigInt(10 ** token.decimals); + const currentAmount = Number(amount) / Number(divisor); + newAmount = ethers.utils + .parseUnits(currentAmount.toString(), 18) + .toBigInt(); + } + console.log('token', token); + console.log('supertoken', superToken); const upgradeOperation = await superTokenAsset.upgrade({ - amount: amount.toString(), + amount: newAmount.toString(), }); - const tx = await upgradeOperation.exec(signer); const res = await tx.wait(); if (!res.status) { @@ -165,7 +175,6 @@ export const DepositSuperToken: FC = ({ closeModal(); } }; - return ( {step === EModifySuperTokenSteps.MODIFY ? ( diff --git a/src/components/views/donate/Recurring/ModifySuperToken/ModifySuperTokenModal.tsx b/src/components/views/donate/Recurring/ModifySuperToken/ModifySuperTokenModal.tsx index a5a02b3812..39bc665f41 100644 --- a/src/components/views/donate/Recurring/ModifySuperToken/ModifySuperTokenModal.tsx +++ b/src/components/views/donate/Recurring/ModifySuperToken/ModifySuperTokenModal.tsx @@ -13,7 +13,7 @@ import { EModifySuperTokenSteps } from './common'; import config from '@/configuration'; interface IModifySuperTokenModalProps extends IModal { - selectedToken: IToken; + selectedToken: ISuperToken | IToken; tokenStreams: ISuperfluidStream[]; refreshBalance: () => void; } diff --git a/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx b/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx index abd937afe3..7df4fbd631 100644 --- a/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx +++ b/src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx @@ -26,9 +26,6 @@ export const StreamRow: FC = ({ tokenStream }) => { ), [tokenStream], ); - console.log('tokenStream', tokenStream); - console.log('config', config.OPTIMISM_CONFIG.SUPER_FLUID_TOKENS); - // console.log('superToken', superToken); const [showModifyModal, setShowModifyModal] = useState(false); const { address, chain } = useAccount(); const { switchChain } = useSwitchChain(); @@ -119,11 +116,11 @@ export const StreamRow: FC = ({ tokenStream }) => { Deposit/Withdraw - {showModifyModal && ( + {showModifyModal && superToken && ( )} From 7eafe7ac4d8fae9827c14de643717ca211274383 Mon Sep 17 00:00:00 2001 From: Mitch Oz Date: Mon, 2 Dec 2024 15:36:53 -0600 Subject: [PATCH 22/22] fix some decimal handling and incorrect USDC.e symbol on drop down menu --- .../donate/Recurring/RecurringDonationCard.tsx | 17 ++++++++++------- .../SelectTokenModal/SelectTokenModal.tsx | 3 +-- .../Recurring/SelectTokenModal/StreamInfo.tsx | 12 ++++++------ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index 8ad2737caf..85c64d0b94 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -44,7 +44,7 @@ import { showToastError, truncateToDecimalPlaces } from '@/lib/helpers'; import config from '@/configuration'; import { WrongNetworkLayer } from '../WrongNetworkLayer'; import { ModifySuperTokenModal } from './ModifySuperToken/ModifySuperTokenModal'; -import { limitFraction } from '@/helpers/number'; +import { limitFraction, formatDonation } from '@/helpers/number'; import AlloProtocolFirstDonationModal from './AlloProtocolFirstDonationModal'; import links from '@/lib/constants/links'; import Routes from '@/lib/constants/Routes'; @@ -570,12 +570,15 @@ export const RecurringDonationCard = () => { id: 'label.you_will_donate_total', })}{' '} - {limitFraction( - formatUnits( - totalStreamPerSec * - ONE_MONTH_SECONDS, - selectedRecurringToken - ?.token.decimals || 18, + {formatDonation( + limitFraction( + formatUnits( + totalStreamPerSec * + ONE_MONTH_SECONDS, + selectedRecurringToken + ?.token.decimals || + 18, + ), ), )}{' '} { diff --git a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx index a841587642..cf5fb3c854 100644 --- a/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx +++ b/src/components/views/donate/Recurring/SelectTokenModal/SelectTokenModal.tsx @@ -113,7 +113,6 @@ const SelectTokenInnerModal: FC = ({ return balances[symbol] !== undefined && balances[symbol] > 0n; }, ); - return ( <> @@ -137,6 +136,7 @@ const SelectTokenInnerModal: FC = ({ = ({ )} )} - {!isUserHasBalanceForAllSuperTokens && ( <> diff --git a/src/components/views/donate/Recurring/SelectTokenModal/StreamInfo.tsx b/src/components/views/donate/Recurring/SelectTokenModal/StreamInfo.tsx index e426975e33..2adac94dea 100644 --- a/src/components/views/donate/Recurring/SelectTokenModal/StreamInfo.tsx +++ b/src/components/views/donate/Recurring/SelectTokenModal/StreamInfo.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components'; import { type FC } from 'react'; import { formatUnits } from 'viem'; import { useIntl } from 'react-intl'; -import { ISuperfluidStream } from '@/types/superFluid'; +import { ISuperfluidStream, IToken } from '@/types/superFluid'; import { limitFraction } from '@/helpers/number'; import { countActiveStreams } from '@/helpers/donate'; import { findTokenByAddress } from '@/helpers/superfluid'; @@ -11,6 +11,7 @@ import { TokenIconWithGIVBack } from '../../TokenIcon/TokenIconWithGIVBack'; interface IStreamInfoProps { stream: ISuperfluidStream[]; + superToken: IToken; balance: bigint; disable: boolean; onClick: () => void; @@ -20,12 +21,12 @@ interface IStreamInfoProps { export const StreamInfo: FC<IStreamInfoProps> = ({ stream, balance, + superToken, disable, onClick, isSuperToken, }) => { const { formatMessage } = useIntl(); - const totalFlowRate = stream.reduce( (acc, curr) => acc + BigInt(curr.currentFlowRate), 0n, @@ -38,7 +39,6 @@ export const StreamInfo: FC<IStreamInfoProps> = ({ const token = findTokenByAddress(stream[0].token.id); const underlyingToken = token?.underlyingToken; const activeStreamCount = countActiveStreams(stream); - return ( <Wrapper gap='16px' @@ -62,8 +62,8 @@ export const StreamInfo: FC<IStreamInfoProps> = ({ > <Row $justifyContent='space-between'> <Symbol> - <Caption $medium>{stream[0].token.symbol}</Caption> - <GrayCaption>{stream[0].token.name}</GrayCaption> + <Caption $medium>{superToken.symbol}</Caption> + <GrayCaption>{superToken.name}</GrayCaption> </Symbol> <Balance gap='4px'> <GrayCaption>Stream Balance</GrayCaption> @@ -78,7 +78,7 @@ export const StreamInfo: FC<IStreamInfoProps> = ({ ) : '--'} </Caption> - <Caption $medium>{stream[0].token.symbol}</Caption> + <Caption $medium>{superToken.symbol}</Caption> </Balance> </Row> {totalFlowRate !== undefined && (