-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(bond & tokenomics) feat: bond migration final #75
Changes from 19 commits
f20fd6c
3149f9c
e104e99
8165e72
eac13e4
f7da5b5
a1386c0
b3a13f0
af689c3
0097a42
43dae31
3afe314
aad7b57
6226a88
7db34fc
3ff28ac
6cf8d7d
b7ac697
5c33ca9
501e504
91701fc
04202e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = () => <Skeleton.Button size="small" className="full-width" active block />; | ||
|
||
const isCurrentPriceLpZero = (currentPrice) => Number(currentPrice) === 0; | ||
|
||
const getTitle = (title, tooltipDesc) => ( | ||
<Tooltip title={tooltipDesc}> | ||
<span> | ||
|
@@ -86,11 +90,17 @@ const getColumns = (onClick, isActive, acc, depositoryAddress, hideEmptyProducts | |
dataIndex: 'fullCurrentPriceLp', | ||
key: 'fullCurrentPriceLp', | ||
width: 140, | ||
render: (x, details) => ( | ||
<a href={details.currentPriceLpLink} rel="noopener noreferrer" target="_blank"> | ||
{x} | ||
</a> | ||
), | ||
render: (text, details) => { | ||
if (isCurrentPriceLpZero(text)) { | ||
return <Loader />; | ||
} | ||
|
||
return ( | ||
<a href={details.currentPriceLpLink} rel="noopener noreferrer" target="_blank"> | ||
{text} | ||
</a> | ||
); | ||
}, | ||
}, | ||
{ | ||
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 | ||
Comment on lines
+241
to
+242
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this our own API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value is |
||
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 && ( | ||
<Deposit | ||
productId={productDetails?.id} | ||
productToken={productDetails?.token} | ||
productLpPriceInBg={getLpTokenWithDiscount( | ||
productLpPriceAfterDiscount={getLpTokenWithDiscount( | ||
productDetails?.priceLp, | ||
productDetails?.discount, | ||
)} | ||
).toString()} | ||
productSupply={productDetails?.supply} | ||
productLpTokenName={productDetails?.lpTokenName} | ||
getProducts={refetch} | ||
closeModal={handleModalClose} | ||
/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not config for CELO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't support CELO in tokenomics, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CELO bonding in tokenomics at stage of preparing voting. yes, not supported atm.