diff --git a/.env.example b/.env.example index b295163b..7a4076d6 100644 --- a/.env.example +++ b/.env.example @@ -19,7 +19,7 @@ NEXT_PUBLIC_GNOSIS_TEST_RPC=__URL__ NEXT_PUBLIC_POLYGON_TEST_RPC=__URL__ NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET= -# autonolas-registry-frontend +# registry NEXT_PUBLIC_REGISTRY_URL=__value__ NEXT_PUBLIC_AUTONOLAS_URL=__value__ NEXT_PUBLIC_GNOSIS_SAFE_API_MAINNET=__value__ @@ -30,8 +30,13 @@ NEXT_PUBLIC_ETHERSCAN_API_KEY=__value__ NEXT_PUBLIC_SOLANA_MAINNET_BETA_URL=__value__ NEXT_PUBLIC_SVM_PUBLIC_KEY=__value__ -# autonolas-tokenomics-frontend +# tokenomics NEXT_PUBLIC_GRAPH_ENDPOINT_MAINNET=__URL__ NEXT_PUBLIC_SHYFT_API_KEY=__KEY__ -NEXT_PUBLIC_IS_CONNECTED_TO_LOCAL=__TRUE_OR_FALSE__ +# bond +NEXT_PUBLIC_MAINNET_BALANCER_URL=__URL__ +NEXT_PUBLIC_OPTIMISM_BALANCER_URL=__URL__ +NEXT_PUBLIC_GNOSIS_BALANCER_URL=__URL__ +NEXT_PUBLIC_POLYGON_BALANCER_URL=__URL__ +NEXT_PUBLIC_ARBITRUM_BALANCER_URL=__URL__ diff --git a/.gitleaksignore b/.gitleaksignore index 1fcfc9aa..c47657ad 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -155,3 +155,4 @@ c286a015e94a4abfa474749e6d0d38d944b25e8b:apps/govern/common-util/Contracts/addre 19198deff3574e55dbb56fba98533722a641c6e7:apps/launcher/common-util/Contracts/addresses.tsx:generic-api-key:31 19198deff3574e55dbb56fba98533722a641c6e7:apps/launcher/common-util/Contracts/addresses.tsx:generic-api-key:29 c286a015e94a4abfa474749e6d0d38d944b25e8b:apps/govern/common-util/Contracts/addresses.tsx:generic-api-key:74 +6cf8d7df061c4bdb1e3ccbb8dbf3585b715ad874:apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx:generic-api-key:53 diff --git a/apps/bond/common-util/functions/frontend-library.js b/apps/bond/common-util/functions/frontend-library.js index 413b89f2..fd3485de 100644 --- a/apps/bond/common-util/functions/frontend-library.js +++ b/apps/bond/common-util/functions/frontend-library.js @@ -1,10 +1,10 @@ +import { notifyError } from 'libs/util-functions/src'; import { getProvider as getProviderFn, getChainId as getChainIdFn, getChainIdOrDefaultToMainnet as getChainIdOrDefaultToMainnetFn, - sendTransaction as sendTransactionFn, LOCAL_FORK_ID, - notifyError, + sendTransaction as sendTransactionFn, } from '@autonolas/frontend-library'; import { RPC_URLS } from 'common-util/constants/rpcs'; @@ -39,7 +39,4 @@ export const getChainId = (chainId) => { }; export const sendTransaction = (fn, account) => - sendTransactionFn(fn, account, { - supportedChains, - rpcUrls: RPC_URLS, - }); + sendTransactionFn(fn, account, { supportedChains, rpcUrls: RPC_URLS }); diff --git a/apps/bond/common-util/graphql/clients.js b/apps/bond/common-util/graphql/clients.js index 0d7a080d..873f7d64 100644 --- a/apps/bond/common-util/graphql/clients.js +++ b/apps/bond/common-util/graphql/clients.js @@ -1,4 +1,12 @@ import { GraphQLClient } from 'graphql-request'; +import { + arbitrum, + base, + gnosis, + mainnet, + optimism, + polygon, +} from 'viem/chains'; const requestConfig = { jsonSerializer: { @@ -16,32 +24,28 @@ export const AUTONOLAS_GRAPH_CLIENTS = { // https://docs.balancer.fi/reference/subgraph/ for future subgraph endpoints export const BALANCER_GRAPH_CLIENTS = { - 1: new GraphQLClient( - 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2', - requestConfig, - ), - 5: new GraphQLClient( - 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-goerli-v2', + [mainnet.id]: new GraphQLClient( + process.env.NEXT_PUBLIC_MAINNET_BALANCER_URL, requestConfig, ), - 10: new GraphQLClient( - 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-optimism-v2', + [optimism.id]: new GraphQLClient( + process.env.NEXT_PUBLIC_OPTIMISM_BALANCER_URL, requestConfig, ), - 100: new GraphQLClient( - 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-gnosis-chain-v2', + [gnosis.id]: new GraphQLClient( + process.env.NEXT_PUBLIC_GNOSIS_BALANCER_URL, requestConfig, ), - 137: new GraphQLClient( - 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2', + [polygon.id]: new GraphQLClient( + process.env.NEXT_PUBLIC_POLYGON_BALANCER_URL, requestConfig, ), - 8453: new GraphQLClient( + [base.id]: new GraphQLClient( 'https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest', requestConfig, ), - 42161: new GraphQLClient( - 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-arbitrum-v2', + [arbitrum.id]: new GraphQLClient( + process.env.NEXT_PUBLIC_ARBITRUM_BALANCER_URL, requestConfig, ), }; diff --git a/apps/bond/components/BondingProducts/Bonding/BondingList/BondingList.jsx b/apps/bond/components/BondingProducts/Bonding/BondingList/BondingList.jsx index 02565841..f10c4b9a 100644 --- a/apps/bond/components/BondingProducts/Bonding/BondingList/BondingList.jsx +++ b/apps/bond/components/BondingProducts/Bonding/BondingList/BondingList.jsx @@ -3,7 +3,7 @@ import { QuestionCircleOutlined, UnorderedListOutlined, } from '@ant-design/icons'; -import { Button, Empty, Popconfirm, Spin, Table, Tag, Tooltip, Typography } from 'antd'; +import { Button, Empty, Popconfirm, Skeleton, Spin, Table, Tag, Tooltip, Typography } from 'antd'; import { isNaN, remove, round } from 'lodash'; import Link from 'next/link'; import PropTypes from 'prop-types'; @@ -33,6 +33,10 @@ const Container = styled.div` } `; +const Loader = () => ; + +const isCurrentPriceLpZero = (currentPrice) => Number(currentPrice) === 0; + const getTitle = (title, tooltipDesc) => ( @@ -86,11 +90,17 @@ const getColumns = (onClick, isActive, acc, depositoryAddress, hideEmptyProducts dataIndex: 'fullCurrentPriceLp', key: 'fullCurrentPriceLp', width: 140, - render: (x, details) => ( - - {x} - - ), + render: (text, details) => { + if (isCurrentPriceLpZero(text)) { + return ; + } + + return ( + + {text} + + ); + }, }, { title: getTitle( @@ -223,8 +233,16 @@ const getColumns = (onClick, isActive, acc, depositoryAddress, hideEmptyProducts return columns; }; -const sortList = (list) => +const sortProducts = (list) => list.sort((a, b) => { + // if the current price of the LP token is zero, then move it to the end of the list + // NOTE: It can be zero because + // - the API returns zero (shouldn't happen) OR + // - has error OR + // - not fetched yet + const isSvm = a.lpChainId === VM_TYPE.SVM || b.lpChainId === VM_TYPE.SVM; + if (isSvm && isCurrentPriceLpZero(a.fullCurrentPriceLp)) return 1; + if (isNaN(a.projectedChange)) return 1; if (isNaN(b.projectedChange)) return -1; return b.projectedChange - a.projectedChange; @@ -282,7 +300,7 @@ export const BondingList = ({ bondingProgramType, hideEmptyProducts }) => { }, [handleProductDetails]); const getProductsDataSource = useCallback(() => { - const sortedList = sortList(filteredProducts); + const sortedList = sortProducts(filteredProducts); const processedList = hideEmptyProducts ? sortedList.filter((x) => x.supplyLeft > 0.00001) : sortedList; @@ -308,17 +326,19 @@ export const BondingList = ({ bondingProgramType, hideEmptyProducts }) => { pagination={false} scroll={{ x: 400 }} className="mb-16" + rowHoverable={false} /> {!!productDetails && ( diff --git a/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx b/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx index d5ed53d6..4ce0eb16 100644 --- a/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx +++ b/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx @@ -6,6 +6,7 @@ import { usePublicClient } from 'wagmi'; import { VM_TYPE, areAddressesEqual } from '@autonolas/frontend-library'; import { DEPOSITORY } from 'libs/util-contracts/src/lib/abiAndAddresses'; + import { ADDRESSES } from 'common-util/constants/addresses'; import { ADDRESS_ZERO, ONE_ETH } from 'common-util/constants/numbers'; import { DEX } from 'common-util/enums'; diff --git a/apps/bond/components/BondingProducts/Bonding/Deposit/Deposit.jsx b/apps/bond/components/BondingProducts/Bonding/Deposit/Deposit.jsx index 0bec9aed..e011886f 100644 --- a/apps/bond/components/BondingProducts/Bonding/Deposit/Deposit.jsx +++ b/apps/bond/components/BondingProducts/Bonding/Deposit/Deposit.jsx @@ -3,16 +3,14 @@ import BigNumber from 'bignumber.js'; import { ethers } from 'ethers'; import { isNil } from 'lodash'; import PropTypes from 'prop-types'; -import { useCallback, useEffect, useState } from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; -import { - COLOR, - getCommaSeparatedNumber, - notifyError, - notifySuccess, -} from '@autonolas/frontend-library'; +import { getCommaSeparatedNumber } from '@autonolas/frontend-library'; + +import { COLOR } from 'libs/ui-theme/src'; +import { notifyError, notifySuccess } from 'libs/util-functions/src'; -import { ONE_ETH_IN_STRING } from 'common-util/constants/numbers'; +import { ONE_ETH, ONE_ETH_IN_STRING } from 'common-util/constants/numbers'; import { notifyCustomErrors, parseToEth, @@ -30,7 +28,8 @@ const fullWidth = { width: '100%' }; export const Deposit = ({ productId, productToken, - productLpPriceInBg, + productLpTokenName, + productLpPriceAfterDiscount, productSupply, getProducts, closeModal, @@ -39,8 +38,7 @@ export const Deposit = ({ const [form] = Form.useForm(); const [isLoading, setIsLoading] = useState(false); const [isApproveModalVisible, setIsApproveModalVisible] = useState(false); - const [lpBalance, setLpBalance] = useState(0); - + const [lpBalance, setLpBalance] = useState(0n); const isSvmProduct = isSvmLpAddress(productToken); const { getLpBalanceRequest, depositRequest, approveRequest, hasSufficientTokenRequest } = @@ -82,7 +80,7 @@ export const Deposit = ({ notifySuccess('Deposited successfully!', `Transaction Hash: ${txHash}`); // fetch the products details again - getProducts(); + await getProducts(); // close the modal after successful deposit closeModal(); @@ -125,20 +123,19 @@ export const Deposit = ({ }); }; - const getRemainingLpSupplyInEth = () => { - const supplyInWei = new BigNumber(productSupply || '0'); - - const remainingSupply = supplyInWei - .multipliedBy(ONE_ETH_IN_STRING) - .dividedBy(productLpPriceInBg); - - const remainingSupplyInWei = remainingSupply.lt(lpBalance) ? remainingSupply : lpBalance; - return parseToEth(remainingSupplyInWei); - }; - - const remainingLpSupplyInEth = getRemainingLpSupplyInEth(); const tokenAmountInputValue = Form.useWatch('tokenAmount', form) || 0; - const getOlasPayout = () => { + + const remainingLpSupplyInEth = useMemo(() => { + const totalProductSupplyInWei = productSupply || 0n; + const lpBalanceInWei = BigInt(lpBalance); + const maxRedeemableSupply = + (totalProductSupplyInWei * ONE_ETH) / BigInt(productLpPriceAfterDiscount); + const remainingLPSupply = + maxRedeemableSupply < lpBalanceInWei ? maxRedeemableSupply : lpBalanceInWei; + return parseToEth(remainingLPSupply); + }, [lpBalance, productSupply, productLpPriceAfterDiscount]); + + const olasPayout = useMemo(() => { if (!tokenAmountInputValue || tokenAmountInputValue > remainingLpSupplyInEth) { return '--'; } @@ -147,14 +144,13 @@ export const Deposit = ({ ? tokenAmountInputValue : new BigNumber(parseToWei(tokenAmountInputValue)); - const payoutInBg = new BigNumber(productLpPriceInBg.toString()).multipliedBy(tokenAmountValue); - + const payoutInBg = new BigNumber(productLpPriceAfterDiscount).multipliedBy(tokenAmountValue); const payout = isSvmProduct ? payoutInBg.dividedBy(BigNumber(`1${'0'.repeat(28)}`)).toFixed(2) : Number(payoutInBg.dividedBy(ONE_ETH_IN_STRING).dividedBy(ONE_ETH_IN_STRING).toFixed(2)); return getCommaSeparatedNumber(payout, 4); - }; + }, [tokenAmountInputValue, remainingLpSupplyInEth, productLpPriceAfterDiscount, isSvmProduct]); return ( <> @@ -162,9 +158,7 @@ export const Deposit = ({ open title="Bond LP tokens for OLAS" okText="Bond" - okButtonProps={{ - disabled: !account || lpBalance === new BigNumber(0), - }} + okButtonProps={{ disabled: !account || lpBalance === 0n }} cancelText="Cancel" onCancel={closeModal} onOk={onCreate} @@ -178,8 +172,8 @@ export const Deposit = ({ autoComplete="off" className="mt-16" > - - {`Bonding Product ID: ${productId}`} + + {`Bonding Product ID: ${productId}`} Max @@ -230,7 +223,7 @@ export const Deposit = ({
- {`OLAS Payout: ${getOlasPayout()}`} + {`OLAS Payout: ${olasPayout}`}
@@ -238,12 +231,12 @@ export const Deposit = ({ {isApproveModalVisible && ( setIsApproveModalVisible(false)} > @@ -255,12 +248,12 @@ export const Deposit = ({ htmlType="submit" loading={isLoading} onClick={async () => { - try { - if (!account) { - notifyError('Please connect your wallet'); - return; - } + if (!account) { + notifyError('Please connect your wallet'); + return; + } + try { setIsLoading(true); await approveRequest({ token: productToken, @@ -291,8 +284,12 @@ export const Deposit = ({ Deposit.propTypes = { productId: PropTypes.string, productToken: PropTypes.string, - productSupply: PropTypes.string, - productLpPriceInBg: PropTypes.shape({}), + productLpTokenName: PropTypes.string, + productSupply: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(BigInt)]), + productLpPriceAfterDiscount: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.instanceOf(BigInt), + ]), closeModal: PropTypes.func, getProducts: PropTypes.func, }; @@ -300,7 +297,8 @@ Deposit.propTypes = { Deposit.defaultProps = { productId: undefined, productToken: null, - productLpPriceInBg: null, + productLpTokenName: null, + productLpPriceAfterDiscount: null, productSupply: null, closeModal: () => {}, getProducts: () => {}, diff --git a/apps/bond/components/BondingProducts/Bonding/Deposit/useDeposit.jsx b/apps/bond/components/BondingProducts/Bonding/Deposit/useDeposit.jsx index 8fdf5db0..c25b27e2 100644 --- a/apps/bond/components/BondingProducts/Bonding/Deposit/useDeposit.jsx +++ b/apps/bond/components/BondingProducts/Bonding/Deposit/useDeposit.jsx @@ -31,7 +31,7 @@ export const useDeposit = () => { async ({ token }) => { const contract = getUniswapV2PairContract(token); const response = await contract.methods.balanceOf(account).call(); - return response.toString(); + return response; }, [account], ); @@ -45,10 +45,7 @@ export const useDeposit = () => { const treasuryAddress = ADDRESSES[chainId].treasury; const fnApprove = contract.methods.approve(treasuryAddress, amountToApprove); const estimatedGas = await getEstimatedGasLimit(fnApprove, account); - const fn = await fnApprove.send({ - from: account, - gasLimit: estimatedGas, - }); + const fn = fnApprove.send({ from: account, gasLimit: estimatedGas }); const response = await sendTransaction(fn, account); return response; diff --git a/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWhirlpool.jsx b/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWhirlpool.jsx index 1939b877..5bae5b45 100644 --- a/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWhirlpool.jsx +++ b/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWhirlpool.jsx @@ -6,7 +6,7 @@ import { buildWhirlpoolClient, } from '@orca-so/whirlpools-sdk'; import { GraphQLClient, gql } from 'graphql-request'; -import { useCallback, useEffect, useState } from 'react'; +import { useCallback } from 'react'; import { VM_TYPE, areAddressesEqual } from '@autonolas/frontend-library'; @@ -74,20 +74,6 @@ const whirlpoolQuery = async () => { return filteredPositions; }; -const useWhirlpoolQuery = () => { - const [queryResult, setQueryResult] = useState(null); - - useEffect(() => { - const fetchData = async () => { - const result = await whirlpoolQuery(); - setQueryResult(result); - }; - fetchData(); - }, []); - - return queryResult; -}; - /** * Hook to get the data from the whirlpool */ @@ -110,13 +96,39 @@ export const useWhirlpool = () => { }; export const useWhirlPoolInformation = () => { - const positions = useWhirlpoolQuery(); const { getWhirlpoolData } = useWhirlpool(); return useCallback(async () => { + const positions = await whirlpoolQuery(); + if (!positions) return null; - const { whirlpoolData, whirlpoolTokenA } = await getWhirlpoolData(); + let whirlpoolData; + let whirlpoolTokenA; + + const fetchWhirlpoolDataWithRetry = async () => { + try { + const data = await getWhirlpoolData(); + + if (data) { + whirlpoolData = data.whirlpoolData; + whirlpoolTokenA = data.whirlpoolTokenA; + } + + if (!whirlpoolData || !whirlpoolTokenA) { + /* eslint-disable-next-line no-console */ + console.log('Invalid whirlpool data, retrying in 2 seconds'); + setTimeout(fetchWhirlpoolDataWithRetry, 2000); + } + } catch (error) { + /* eslint-disable-next-line no-console */ + console.warn('Error fetching whirlpool data, retrying in 2 seconds'); + setTimeout(fetchWhirlpoolDataWithRetry, 2000); + } + }; + + await fetchWhirlpoolDataWithRetry(); + let reserveToken0 = new BN(0); let reserveToken1 = new BN(0); let totalSupply = new BN(0); @@ -137,8 +149,12 @@ export const useWhirlPoolInformation = () => { const address1 = whirlpoolTokenA.mint.toString(); const address2 = ADDRESSES[VM_TYPE.SVM].olasAddress; - const reserveOlas = areAddressesEqual(address1, address2) ? reserveToken0 : reserveToken1; - return getSvmCalculatedPriceLp(reserveOlas.toString(), totalSupply.toString()); - }, [positions, getWhirlpoolData]); + const reserveOlas = areAddressesEqual(address1, address2) + ? reserveToken0.toString() + : reserveToken1.toString(); + + const svmPriceLp = getSvmCalculatedPriceLp(reserveOlas, totalSupply.toString()); + return svmPriceLp; + }, [getWhirlpoolData]); }; diff --git a/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx b/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx index 80729d8f..08c1fa00 100644 --- a/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx +++ b/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx @@ -11,9 +11,11 @@ import { import { useWallet } from '@solana/wallet-adapter-react'; import { SystemProgram, Transaction } from '@solana/web3.js'; import Decimal from 'decimal.js'; +import Link from 'next/link'; import { notifyError, notifySuccess } from '@autonolas/frontend-library'; +import { UNICODE_SYMBOLS } from 'libs/util-constants/src/lib/symbols'; import idl from 'libs/util-contracts/src/lib/abiAndAddresses/liquidityLockbox.json'; import { useSvmConnectivity } from 'common-util/hooks/useSvmConnectivity'; @@ -44,6 +46,19 @@ import { import { useGetOrCreateAssociatedTokenAccount } from './useGetOrCreateAssociatedTokenAccount'; import { useWhirlpool } from './useWhirlpool'; +const GetSomeOlas = () => ( + <> + OLAS Associated token account does not exist.  + + Get some OLAS first {UNICODE_SYMBOLS.EXTERNAL_LINK}. + + +); + const getOlasAmount = async (connection, walletPublicKey, tokenAddress) => { const tokenAccounts = await connection.getTokenAccountsByOwner(walletPublicKey, { programId: TOKEN_PROGRAM_ID, @@ -153,6 +168,7 @@ export const useWsolDeposit = () => { } const { whirlpoolTokenA, whirlpoolTokenB } = await getWhirlpoolData(); + const quote = await getDepositIncreaseLiquidityQuote({ sol, slippage }); const { solMax, olasMax } = await getDepositTransformedQuote(quote); @@ -164,7 +180,8 @@ export const useWsolDeposit = () => { const accountInfo = await connection.getAccountInfo(tokenOwnerAccountB); if (!accountInfo) { - notifyError('OLAS Associated token account does not exist'); + // If the user has no associated token account, they need to get some OLAS first + notifyError(); return null; } diff --git a/apps/bond/components/BondingProducts/BondingProducts.jsx b/apps/bond/components/BondingProducts/BondingProducts.jsx index 084d23d4..2505af98 100644 --- a/apps/bond/components/BondingProducts/BondingProducts.jsx +++ b/apps/bond/components/BondingProducts/BondingProducts.jsx @@ -14,11 +14,11 @@ const { Title } = Typography; const PageHeader = styled.div` align-items: center; margin-bottom: 12px; - display: ${(props) => (props.isMobile ? 'block' : 'flex')}; + display: ${(props) => (props.is_mobile === 'true' ? 'block' : 'flex')}; `; const StyledDivider = styled(Divider)` - margin: ${(props) => (props.isMobile ? '12px 0 ' : '0 12px')}; + margin: ${(props) => (props.is_mobile === 'true' ? '12px 0 ' : '0 12px')}; `; const SwitchContainer = styled.div` @@ -26,10 +26,16 @@ const SwitchContainer = styled.div` display: flex; `; +const manageSolanaLiquidityBtnCss = { + width: '160px', + whiteSpace: 'normal', + height: 'auto', +}; + const ResponsiveDivider = () => { const { isMobile } = useScreen(); - return ; + return ; }; export const BondingProducts = () => { @@ -50,9 +56,9 @@ export const BondingProducts = () => { return ( <> - + - + Bonding Products @@ -80,6 +86,7 @@ export const BondingProducts = () => { type="primary" ghost onClick={() => router.push('manage-solana-liquidity')} + style={isMobile ? manageSolanaLiquidityBtnCss : undefined} > Manage Solana Liquidity diff --git a/apps/bond/components/Layout/Footer.jsx b/apps/bond/components/Layout/Footer.jsx index 6c7290b1..a3bd9a93 100644 --- a/apps/bond/components/Layout/Footer.jsx +++ b/apps/bond/components/Layout/Footer.jsx @@ -1,19 +1,25 @@ -import { useRouter } from 'next/router'; import { Grid } from 'antd'; import Image from 'next/image'; -import { - Footer as CommonFooter, - getExplorerURL, -} from '@autonolas/frontend-library'; +import { useRouter } from 'next/router'; + +import { Footer as CommonFooter, getExplorerURL } from '@autonolas/frontend-library'; import { ADDRESSES } from 'common-util/constants/addresses'; import { useHelpers } from 'common-util/hooks/useHelpers'; -import { ContractsInfoContainer } from './styles'; import { OPERATOR_NAME } from 'util/meta'; +import { ContractsInfoContainer } from './styles'; + const { useBreakpoint } = Grid; -const PATHS_NOT_TO_SHOW = ['/docs', '/disclaimer', '/not-legal']; +const PATHS_NOT_TO_SHOW = [ + '/', + '/paths', + '/manage-solana-liquidity', + '/docs', + '/disclaimer', + '/not-legal', +]; const ContractInfo = () => { const { chainId } = useHelpers(); @@ -51,19 +57,13 @@ const ContractInfo = () => { ); - const { textOne, addressOne, textTwo, addressTwo } = - getCurrentPageAddresses(); + const { textOne, addressOne, textTwo, addressTwo } = getCurrentPageAddresses(); return ( {!PATHS_NOT_TO_SHOW.includes(pathname) && ( <> - Etherscan link + Etherscan link Contracts  •  {getContractInfo(textOne, addressOne)} diff --git a/apps/bond/components/Layout/styles.jsx b/apps/bond/components/Layout/styles.jsx index 1314e579..f5fb32f1 100644 --- a/apps/bond/components/Layout/styles.jsx +++ b/apps/bond/components/Layout/styles.jsx @@ -4,7 +4,6 @@ import styled from 'styled-components'; import { COLOR, MEDIA_QUERY } from 'libs/ui-theme/src'; export const CustomLayout = styled(Layout)` - background-color: ${COLOR.WHITE}; min-height: 100vh; /* layout */ @@ -61,6 +60,15 @@ export const CustomLayout = styled(Layout)` } } + .ant-table { + .ant-table-thead > tr > th.ant-table-cell { + background-color: ${COLOR.WHITE}; + } + .ant-table-tbody > tr > td { + padding: 10px; + } + } + ${MEDIA_QUERY.tablet} { .ant-layout-header { position: relative; diff --git a/apps/bond/components/MyBonds/MyBonds.jsx b/apps/bond/components/MyBonds/MyBonds.jsx index 7a2315b1..14a6ad6d 100644 --- a/apps/bond/components/MyBonds/MyBonds.jsx +++ b/apps/bond/components/MyBonds/MyBonds.jsx @@ -1,7 +1,7 @@ import { CheckOutlined, CloseOutlined } from '@ant-design/icons'; -import { Button, ConfigProvider, Empty, Radio, Table, Typography } from 'antd'; +import { Button, ConfigProvider, Empty, Radio, Table, Tooltip, Typography } from 'antd'; import { round } from 'lodash'; -import { useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { getFormattedDate, notifyError, notifySuccess } from '@autonolas/frontend-library'; @@ -20,7 +20,14 @@ const getBondsColumns = () => { title: 'Payout in OLAS', dataIndex: 'payout', key: 'payout', - render: (value) => `${round(parseToEth(value), 4)}`, + render: (value) => { + const parseValue = parseToEth(value); + return ( + + {round(parseValue, 4)} + + ); + }, }, { title: 'Matured?', @@ -57,7 +64,7 @@ export const MyBonds = () => { const [nonMaturedBondList, setNonMaturedBondList] = useState([]); const [selectedBondIds, setSelectedBondIds] = useState([]); - const getBondsListHelper = async () => { + const getBondsListHelper = useCallback(async () => { try { setIsLoading(true); @@ -71,7 +78,7 @@ export const MyBonds = () => { } finally { setIsLoading(false); } - }; + }, [account]); // on load, get the list of bonds & set the maturity type radio button useEffect(() => { @@ -103,7 +110,7 @@ export const MyBonds = () => { if (account && chainId) { getBondsListHelper(); } - }, [account, chainId, maturityType]); + }, [account, chainId, maturityType, getBondsListHelper]); const onRedeem = async () => { try { @@ -170,6 +177,7 @@ export const MyBonds = () => { } : undefined } + rowHoverable={false} /> diff --git a/apps/bond/pages/paths/[pathId].jsx b/apps/bond/pages/paths/[pathId].jsx index d9d3111a..7030c25d 100644 --- a/apps/bond/pages/paths/[pathId].jsx +++ b/apps/bond/pages/paths/[pathId].jsx @@ -1,7 +1,7 @@ import { Button, Card, Col, Collapse, Flex, Grid, Row, Typography } from 'antd'; import Head from 'next/head'; import Image from 'next/image'; -import { useRouter } from 'next/router'; +import Link from 'next/link'; import { PropTypes } from 'prop-types'; import styled from 'styled-components'; @@ -162,19 +162,18 @@ BridgeCollapseItem.propTypes = { isEthereumPath: PropTypes.bool.isRequired, }; -const BondCollapseItem = () => { - const router = useRouter(); +const BondCollapseItem = () => ( Bond LP Token into Olas Protocol - router.push('/bonding-products')}> - View available products - + + View available products + - ; -}; + +); BondCollapseItem.propTypes = { path: PropTypes.shape({ diff --git a/apps/tokenomics/components/Donate/index.jsx b/apps/tokenomics/components/Donate/index.jsx index c10c6982..74d416ff 100644 --- a/apps/tokenomics/components/Donate/index.jsx +++ b/apps/tokenomics/components/Donate/index.jsx @@ -1,4 +1,4 @@ -import { Alert, Button, Typography } from 'antd'; +import { Alert, Button, Skeleton, Typography } from 'antd'; import { ethers } from 'ethers'; import isNumber from 'lodash/isNumber'; import { useEffect, useState } from 'react'; @@ -194,7 +194,11 @@ export const DepositServiceDonation = () => { {epochStatusList.map((e, index) => ( {`${e.text}:`} - {e.value} + {isEpochDetailsLoading ? ( + + ) : ( + {e.value} + )} ))} diff --git a/apps/tokenomics/middleware.js b/apps/tokenomics/middleware.js deleted file mode 100644 index 48909f10..00000000 --- a/apps/tokenomics/middleware.js +++ /dev/null @@ -1,32 +0,0 @@ -import { NextResponse } from 'next/server'; -import prohibitedCountries from 'libs/util-prohibited-data/src/lib/prohibited-countries.json'; - - -const prohibitedCountriesCode = Object.values(prohibitedCountries); - -/** - * Middleware to validate the country - * - * @param {NextRequest} request - */ -export default function validateCountryMiddleware(request) { - const country = request.geo?.country; - const isProhibited = prohibitedCountriesCode.includes(country); - - // if already on the not-legal page, don't redirect - if (request.nextUrl.pathname === '/not-legal') { - if (isProhibited) { - return NextResponse.next(); - } - - // if not prohibited & trying to access not-legal page, redirect to home - return NextResponse.redirect(new URL('/', request.url)); - } - - // if country is prohibited, redirect to not-legal page - if (isProhibited) { - return NextResponse.redirect(new URL('/not-legal', request.url)); - } - - return NextResponse.next(); -} diff --git a/libs/common-middleware/src/lib/cspHeader.ts b/libs/common-middleware/src/lib/cspHeader.ts index 0b349f1f..f4bb376c 100644 --- a/libs/common-middleware/src/lib/cspHeader.ts +++ b/libs/common-middleware/src/lib/cspHeader.ts @@ -61,6 +61,7 @@ const ALLOWED_ORIGINS = [ 'https://forno.celo.org', 'https://alfajores-forno.celo-testnet.org', 'https://api.web3modal.com/', + 'https://rpc.ankr.com/', // tenderly 'https://virtual.mainnet.rpc.tenderly.co/', @@ -70,7 +71,10 @@ const ALLOWED_ORIGINS = [ // others 'https://api.thegraph.com/', + 'https://api.studio.thegraph.com/', 'https://sockjs-us3.pusher.com/', + 'https://programs.shyft.to/', + 'https://*.network.thegraph.com/', ...VERCEL_LINKS, ]; diff --git a/libs/ui-theme/src/lib/GlobalStyles.tsx b/libs/ui-theme/src/lib/GlobalStyles.tsx index 082a6b14..a9d46596 100644 --- a/libs/ui-theme/src/lib/GlobalStyles.tsx +++ b/libs/ui-theme/src/lib/GlobalStyles.tsx @@ -1,8 +1,6 @@ import { createGlobalStyle } from 'styled-components'; -import { COLOR, MEDIA_QUERY } from 'libs/ui-theme/src'; - -import { ANTD_COLOR } from './ui-theme'; +import { ANTD_COLOR, COLOR, MEDIA_QUERY } from './ui-theme'; export const GlobalStyles = createGlobalStyle` *, diff --git a/libs/ui-theme/src/lib/ui-theme.tsx b/libs/ui-theme/src/lib/ui-theme.tsx index aac5b991..da3f9acb 100644 --- a/libs/ui-theme/src/lib/ui-theme.tsx +++ b/libs/ui-theme/src/lib/ui-theme.tsx @@ -1,4 +1,3 @@ -// TODO: move to theme export const COLOR = { PRIMARY: '#7e22ce', SECONDARY: '#4d596a', @@ -32,7 +31,6 @@ export const COLOR = { YELLOW_SECONDARY: '#fefce8', // tailwind orange.50 }; -// TODO: move to theme export const BREAK_POINT = { xxs: '375px', xs: '480px', @@ -43,7 +41,6 @@ export const BREAK_POINT = { xxl: '1600px', }; -// TODO: move to theme export const MEDIA_QUERY = { mobileS: `@media only screen and (max-width: ${BREAK_POINT.xxs})`, mobileM: `@media only screen and (max-width: ${BREAK_POINT.xs})`, diff --git a/libs/util-contracts/src/lib/abiAndAddresses/dispenser.js b/libs/util-contracts/src/lib/abiAndAddresses/dispenser.js index a35b2fe2..6f3ea6f7 100644 --- a/libs/util-contracts/src/lib/abiAndAddresses/dispenser.js +++ b/libs/util-contracts/src/lib/abiAndAddresses/dispenser.js @@ -1,12 +1,16 @@ export const DISPENSER = { contractName: 'Dispenser', addresses: { - 1: '0xeED0000fE94d7cfeF4Dc0CA86a223f0F603A61B8', - 5: '0xeDd71796B90eaCc56B074C39BAC90ED2Ca6D93Ee', + 1: '0x5650300fCBab43A0D7D02F8Cb5d0f039402593f0', }, abi: [ { inputs: [ + { + internalType: 'address', + name: '_olas', + type: 'address', + }, { internalType: 'address', name: '_tokenomics', @@ -17,51 +21,39 @@ export const DISPENSER = { name: '_treasury', type: 'address', }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [], - name: 'AlreadyInitialized', - type: 'error', - }, - { - inputs: [ + { + internalType: 'address', + name: '_voteWeighting', + type: 'address', + }, + { + internalType: 'bytes32', + name: '_retainer', + type: 'bytes32', + }, { internalType: 'uint256', - name: 'bondId', + name: '_maxNumClaimingEpochs', type: 'uint256', }, - ], - name: 'BondNotRedeemable', - type: 'error', - }, - { - inputs: [ { - internalType: 'address', - name: 'account', - type: 'address', + internalType: 'uint256', + name: '_maxNumStakingTargets', + type: 'uint256', }, { internalType: 'uint256', - name: 'reward', + name: '_defaultMinStakingWeight', type: 'uint256', }, { internalType: 'uint256', - name: 'topUp', + name: '_defaultMaxStakingIncentive', type: 'uint256', }, ], - name: 'ClaimIncentivesFailed', - type: 'error', - }, - { - inputs: [], - name: 'DelegatecallOnly', - type: 'error', + stateMutability: 'nonpayable', + type: 'constructor', }, { inputs: [ @@ -70,40 +62,34 @@ export const DISPENSER = { name: 'account', type: 'address', }, - ], - name: 'DonatorBlacklisted', - type: 'error', - }, - { - inputs: [ { internalType: 'uint256', - name: 'provided', + name: 'reward', type: 'uint256', }, { internalType: 'uint256', - name: 'expected', + name: 'topUp', type: 'uint256', }, ], - name: 'InsufficientAllowance', + name: 'ClaimIncentivesFailed', type: 'error', }, { inputs: [ { - internalType: 'uint256', - name: 'provided', - type: 'uint256', + internalType: 'address', + name: 'sender', + type: 'address', }, { - internalType: 'uint256', - name: 'expected', - type: 'uint256', + internalType: 'address', + name: 'depositProcessor', + type: 'address', }, ], - name: 'LowerThan', + name: 'DepositProcessorOnly', type: 'error', }, { @@ -122,11 +108,6 @@ export const DISPENSER = { name: 'ManagerOnly', type: 'error', }, - { - inputs: [], - name: 'NonZeroValue', - type: 'error', - }, { inputs: [ { @@ -164,222 +145,250 @@ export const DISPENSER = { name: 'Paused', type: 'error', }, + { + inputs: [], + name: 'ReentrancyGuard', + type: 'error', + }, { inputs: [ { - internalType: 'uint256', - name: 'productId', - type: 'uint256', + internalType: 'bytes32', + name: 'account', + type: 'bytes32', }, ], - name: 'ProductClosed', + name: 'WrongAccount', type: 'error', }, { inputs: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'productId', - type: 'uint256', - }, { internalType: 'uint256', - name: 'deadline', + name: 'provided', type: 'uint256', }, { internalType: 'uint256', - name: 'curTime', + name: 'expected', type: 'uint256', }, ], - name: 'ProductExpired', + name: 'WrongAmount', type: 'error', }, { inputs: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, { internalType: 'uint256', - name: 'productId', + name: 'numValues1', type: 'uint256', }, { internalType: 'uint256', - name: 'requested', + name: 'numValues2', type: 'uint256', }, + ], + name: 'WrongArrayLength', + type: 'error', + }, + { + inputs: [ { internalType: 'uint256', - name: 'actual', + name: 'chainId', type: 'uint256', }, ], - name: 'ProductSupplyLow', + name: 'WrongChainId', type: 'error', }, { inputs: [], - name: 'ReentrancyGuard', + name: 'ZeroAddress', type: 'error', }, { inputs: [], - name: 'SameBlockNumberViolation', + name: 'ZeroValue', type: 'error', }, { + anonymous: false, inputs: [ { - internalType: 'uint256', - name: 'serviceId', - type: 'uint256', + indexed: true, + internalType: 'bytes32', + name: 'nomineeHash', + type: 'bytes32', }, ], - name: 'ServiceDoesNotExist', - type: 'error', + name: 'AddNomineeHash', + type: 'event', }, { + anonymous: false, inputs: [ { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: false, internalType: 'uint256', - name: 'serviceId', + name: 'reward', type: 'uint256', }, - ], - name: 'ServiceNeverDeployed', - type: 'error', - }, - { - inputs: [ { - internalType: 'address', - name: 'token', - type: 'address', + indexed: false, + internalType: 'uint256', + name: 'topUp', + type: 'uint256', }, { - internalType: 'address', - name: 'from', - type: 'address', + indexed: false, + internalType: 'uint256[]', + name: 'unitTypes', + type: 'uint256[]', }, { - internalType: 'address', - name: 'to', - type: 'address', + indexed: false, + internalType: 'uint256[]', + name: 'unitIds', + type: 'uint256[]', }, + ], + name: 'IncentivesClaimed', + type: 'event', + }, + { + anonymous: false, + inputs: [ { - internalType: 'uint256', - name: 'amount', - type: 'uint256', + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', }, ], - name: 'TransferFailed', - type: 'error', + name: 'OwnerUpdated', + type: 'event', }, { + anonymous: false, inputs: [ { - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', + indexed: false, + internalType: 'enum Dispenser.Pause', + name: 'pauseState', + type: 'uint8', }, ], - name: 'TreasuryRebalanceFailed', - type: 'error', + name: 'PauseDispenser', + type: 'event', }, { + anonymous: false, inputs: [ { - internalType: 'address', - name: 'tokenAddress', - type: 'address', + indexed: true, + internalType: 'bytes32', + name: 'nomineeHash', + type: 'bytes32', }, ], - name: 'UnauthorizedToken', - type: 'error', + name: 'RemoveNomineeHash', + type: 'event', }, { + anonymous: false, inputs: [ { - internalType: 'uint256', - name: 'provided', - type: 'uint256', + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', }, { + indexed: false, internalType: 'uint256', - name: 'expected', + name: 'returnAmount', type: 'uint256', }, ], - name: 'WrongAmount', - type: 'error', + name: 'Retained', + type: 'event', }, { + anonymous: false, inputs: [ { - internalType: 'uint256', - name: 'numValues1', - type: 'uint256', + indexed: false, + internalType: 'address[]', + name: 'depositProcessors', + type: 'address[]', }, { - internalType: 'uint256', - name: 'numValues2', - type: 'uint256', + indexed: false, + internalType: 'uint256[]', + name: 'chainIds', + type: 'uint256[]', }, ], - name: 'WrongArrayLength', - type: 'error', + name: 'SetDepositProcessorChainIds', + type: 'event', }, { + anonymous: false, inputs: [ { + indexed: true, internalType: 'address', - name: 'provided', + name: 'account', type: 'address', }, { - internalType: 'address', - name: 'expected', - type: 'address', + indexed: false, + internalType: 'uint256[]', + name: 'chainIds', + type: 'uint256[]', }, - ], - name: 'WrongTokenAddress', - type: 'error', - }, - { - inputs: [ { + indexed: false, + internalType: 'bytes32[][]', + name: 'stakingTargets', + type: 'bytes32[][]', + }, + { + indexed: false, + internalType: 'uint256[][]', + name: 'stakingIncentives', + type: 'uint256[][]', + }, + { + indexed: false, + internalType: 'uint256', + name: 'totalStakingIncentive', + type: 'uint256', + }, + { + indexed: false, internalType: 'uint256', - name: 'unitId', + name: 'totalTransferAmount', type: 'uint256', }, { + indexed: false, internalType: 'uint256', - name: 'unitType', + name: 'totalReturnAmount', type: 'uint256', }, ], - name: 'WrongUnitId', - type: 'error', - }, - { - inputs: [], - name: 'ZeroAddress', - type: 'error', - }, - { - inputs: [], - name: 'ZeroValue', - type: 'error', + name: 'StakingIncentivesBatchClaimed', + type: 'event', }, { anonymous: false, @@ -387,36 +396,60 @@ export const DISPENSER = { { indexed: true, internalType: 'address', - name: 'owner', + name: 'account', type: 'address', }, { indexed: false, internalType: 'uint256', - name: 'reward', + name: 'chainId', type: 'uint256', }, + { + indexed: false, + internalType: 'bytes32', + name: 'stakingTarget', + type: 'bytes32', + }, { indexed: false, internalType: 'uint256', - name: 'topUp', + name: 'stakingIncentive', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'transferAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'returnAmount', type: 'uint256', }, ], - name: 'IncentivesClaimed', + name: 'StakingIncentivesClaimed', type: 'event', }, { anonymous: false, inputs: [ { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, + indexed: false, + internalType: 'uint256', + name: 'maxNumClaimingEpochs', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'maxNumStakingTargets', + type: 'uint256', + }, ], - name: 'OwnerUpdated', + name: 'StakingParamsUpdated', type: 'event', }, { @@ -445,6 +478,125 @@ export const DISPENSER = { name: 'TreasuryUpdated', type: 'event', }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'voteWeighting', + type: 'address', + }, + ], + name: 'VoteWeightingUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'chainId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'updatedWithheldAmount', + type: 'uint256', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'batchHash', + type: 'bytes32', + }, + ], + name: 'WithheldAmountSynced', + type: 'event', + }, + { + inputs: [], + name: 'MAX_EVM_CHAIN_ID', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'nomineeHash', + type: 'bytes32', + }, + ], + name: 'addNominee', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'numClaimedEpochs', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'chainId', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'stakingTarget', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'bridgingDecimals', + type: 'uint256', + }, + ], + name: 'calculateStakingIncentives', + outputs: [ + { + internalType: 'uint256', + name: 'totalStakingIncentive', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'totalReturnAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'lastClaimedEpoch', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'nomineeHash', + type: 'bytes32', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [ { @@ -457,6 +609,11 @@ export const DISPENSER = { name: '_treasury', type: 'address', }, + { + internalType: 'address', + name: '_voteWeighting', + type: 'address', + }, ], name: 'changeManagers', outputs: [], @@ -476,6 +633,24 @@ export const DISPENSER = { stateMutability: 'nonpayable', type: 'function', }, + { + inputs: [ + { + internalType: 'uint256', + name: '_maxNumClaimingEpochs', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_maxNumStakingTargets', + type: 'uint256', + }, + ], + name: 'changeStakingParams', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [ { @@ -505,6 +680,227 @@ export const DISPENSER = { stateMutability: 'nonpayable', type: 'function', }, + { + inputs: [ + { + internalType: 'uint256', + name: 'numClaimedEpochs', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'chainId', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'stakingTarget', + type: 'bytes32', + }, + { + internalType: 'bytes', + name: 'bridgePayload', + type: 'bytes', + }, + ], + name: 'claimStakingIncentives', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'numClaimedEpochs', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'chainIds', + type: 'uint256[]', + }, + { + internalType: 'bytes32[][]', + name: 'stakingTargets', + type: 'bytes32[][]', + }, + { + internalType: 'bytes[]', + name: 'bridgePayloads', + type: 'bytes[]', + }, + { + internalType: 'uint256[]', + name: 'valueAmounts', + type: 'uint256[]', + }, + ], + name: 'claimStakingIncentivesBatch', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'defaultMaxStakingIncentive', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'defaultMinStakingWeight', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'mapChainIdDepositProcessors', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'mapChainIdWithheldAmounts', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + name: 'mapLastClaimedStakingEpochs', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + name: 'mapRemovedNomineeEpochs', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'mapZeroWeightEpochRefunded', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'maxNumClaimingEpochs', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'maxNumStakingTargets', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'olas', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, { inputs: [], name: 'owner', @@ -518,6 +914,142 @@ export const DISPENSER = { stateMutability: 'view', type: 'function', }, + { + inputs: [], + name: 'paused', + outputs: [ + { + internalType: 'enum Dispenser.Pause', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'nomineeHash', + type: 'bytes32', + }, + ], + name: 'removeNominee', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'retain', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'retainer', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'retainerHash', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address[]', + name: 'depositProcessors', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'chainIds', + type: 'uint256[]', + }, + ], + name: 'setDepositProcessorChainIds', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'enum Dispenser.Pause', + name: 'pauseState', + type: 'uint8', + }, + ], + name: 'setPauseState', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'chainId', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'batchHash', + type: 'bytes32', + }, + ], + name: 'syncWithheldAmount', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'chainId', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'batchHash', + type: 'bytes32', + }, + ], + name: 'syncWithheldAmountMaintenance', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [], name: 'tokenomics', @@ -544,5 +1076,18 @@ export const DISPENSER = { stateMutability: 'view', type: 'function', }, + { + inputs: [], + name: 'voteWeighting', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, ], }; diff --git a/libs/util-contracts/src/lib/abiAndAddresses/tokenomics.ts b/libs/util-contracts/src/lib/abiAndAddresses/tokenomics.ts index 704ae4f0..423ef314 100644 --- a/libs/util-contracts/src/lib/abiAndAddresses/tokenomics.ts +++ b/libs/util-contracts/src/lib/abiAndAddresses/tokenomics.ts @@ -15,38 +15,6 @@ export const TOKENOMICS = { name: 'AlreadyInitialized', type: 'error', }, - { - inputs: [ - { - internalType: 'uint256', - name: 'bondId', - type: 'uint256', - }, - ], - name: 'BondNotRedeemable', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - { - internalType: 'uint256', - name: 'reward', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'topUp', - type: 'uint256', - }, - ], - name: 'ClaimIncentivesFailed', - type: 'error', - }, { inputs: [], name: 'DelegatecallOnly', @@ -63,22 +31,6 @@ export const TOKENOMICS = { name: 'DonatorBlacklisted', type: 'error', }, - { - inputs: [ - { - internalType: 'uint256', - name: 'provided', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'expected', - type: 'uint256', - }, - ], - name: 'InsufficientAllowance', - type: 'error', - }, { inputs: [ { @@ -111,11 +63,6 @@ export const TOKENOMICS = { name: 'ManagerOnly', type: 'error', }, - { - inputs: [], - name: 'NonZeroValue', - type: 'error', - }, { inputs: [ { @@ -196,79 +143,6 @@ export const TOKENOMICS = { name: 'PRBMath_UD60x18_Convert_Overflow', type: 'error', }, - { - inputs: [], - name: 'Paused', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'productId', - type: 'uint256', - }, - ], - name: 'ProductClosed', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'productId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'curTime', - type: 'uint256', - }, - ], - name: 'ProductExpired', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'productId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'requested', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'actual', - type: 'uint256', - }, - ], - name: 'ProductSupplyLow', - type: 'error', - }, - { - inputs: [], - name: 'ReentrancyGuard', - type: 'error', - }, { inputs: [], name: 'SameBlockNumberViolation', @@ -296,32 +170,6 @@ export const TOKENOMICS = { name: 'ServiceNeverDeployed', type: 'error', }, - { - inputs: [ - { - internalType: 'address', - name: 'token', - type: 'address', - }, - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'TransferFailed', - type: 'error', - }, { inputs: [ { @@ -333,17 +181,6 @@ export const TOKENOMICS = { name: 'TreasuryRebalanceFailed', type: 'error', }, - { - inputs: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - ], - name: 'UnauthorizedToken', - type: 'error', - }, { inputs: [ { @@ -376,22 +213,6 @@ export const TOKENOMICS = { name: 'WrongArrayLength', type: 'error', }, - { - inputs: [ - { - internalType: 'address', - name: 'provided', - type: 'address', - }, - { - internalType: 'address', - name: 'expected', - type: 'address', - }, - ], - name: 'WrongTokenAddress', - type: 'error', - }, { inputs: [ { @@ -486,6 +307,12 @@ export const TOKENOMICS = { { anonymous: false, inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'epochNumber', + type: 'uint256', + }, { indexed: false, internalType: 'uint256', @@ -536,6 +363,24 @@ export const TOKENOMICS = { name: 'accountTopUps', type: 'uint256', }, + { + indexed: false, + internalType: 'uint256', + name: 'effectiveBond', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'returnedStakingIncentive', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'totalStakingIncentive', + type: 'uint256', + }, ], name: 'EpochSettled', type: 'event', @@ -592,6 +437,12 @@ export const TOKENOMICS = { name: 'topUpAgentFraction', type: 'uint256', }, + { + indexed: false, + internalType: 'uint256', + name: 'stakingFraction', + type: 'uint256', + }, ], name: 'IncentiveFractionsUpdateRequested', type: 'event', @@ -635,6 +486,63 @@ export const TOKENOMICS = { name: 'ServiceRegistryUpdated', type: 'event', }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'epochNumber', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'maxStakingIncentive', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'minStakingWeight', + type: 'uint256', + }, + ], + name: 'StakingParamsUpdateRequested', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'epochNumber', + type: 'uint256', + }, + ], + name: 'StakingParamsUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'epochNumber', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'StakingRefunded', + type: 'event', + }, { anonymous: false, inputs: [ @@ -717,6 +625,32 @@ export const TOKENOMICS = { name: 'TreasuryUpdated', type: 'event', }, + { + inputs: [], + name: 'MAX_EPOCH_LENGTH', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MAX_STAKING_WEIGHT', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, { inputs: [], name: 'MIN_EPOCH_LENGTH', @@ -869,6 +803,11 @@ export const TOKENOMICS = { name: '_topUpAgentFraction', type: 'uint256', }, + { + internalType: 'uint256', + name: '_stakingFraction', + type: 'uint256', + }, ], name: 'changeIncentiveFractions', outputs: [], @@ -934,6 +873,24 @@ export const TOKENOMICS = { stateMutability: 'nonpayable', type: 'function', }, + { + inputs: [ + { + internalType: 'uint256', + name: '_maxStakingIncentive', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_minStakingWeight', + type: 'uint256', + }, + ], + name: 'changeStakingParams', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [ { @@ -1144,11 +1101,11 @@ export const TOKENOMICS = { type: 'uint256', }, ], - name: 'getIDF', + name: 'getEpochEndTime', outputs: [ { internalType: 'uint256', - name: 'idf', + name: '', type: 'uint256', }, ], @@ -1174,26 +1131,13 @@ export const TOKENOMICS = { stateMutability: 'pure', type: 'function', }, - { - inputs: [], - name: 'getInflationPerEpoch', - outputs: [ - { - internalType: 'uint256', - name: 'inflationPerEpoch', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, { inputs: [], name: 'getLastIDF', outputs: [ { internalType: 'uint256', - name: 'idf', + name: '', type: 'uint256', }, ], @@ -1292,7 +1236,7 @@ export const TOKENOMICS = { }, ], internalType: 'struct UnitPoint', - name: 'up', + name: '', type: 'tuple', }, ], @@ -1383,6 +1327,40 @@ export const TOKENOMICS = { stateMutability: 'view', type: 'function', }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'mapEpochStakingPoints', + outputs: [ + { + internalType: 'uint96', + name: 'stakingIncentive', + type: 'uint96', + }, + { + internalType: 'uint96', + name: 'maxStakingIncentive', + type: 'uint96', + }, + { + internalType: 'uint16', + name: 'minStakingWeight', + type: 'uint16', + }, + { + internalType: 'uint8', + name: 'stakingFraction', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, { inputs: [ { @@ -1661,6 +1639,19 @@ export const TOKENOMICS = { stateMutability: 'nonpayable', type: 'function', }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'refundFromStaking', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [ {