Skip to content

Commit

Permalink
Merge pull request #59 from AstraProtocol/feat/update-official-contra…
Browse files Browse the repository at this point in the history
…cts-mainnet

feat: update official contracts mainnet
  • Loading branch information
ruitran authored Jul 26, 2023
2 parents b36bd54 + ac09d37 commit 24a1d69
Show file tree
Hide file tree
Showing 24 changed files with 206 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .env-prod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ NEXT_PUBLIC_FEE=100
NEXT_PUBLIC_TITLE=SolarSwap
NEXT_PUBLIC_WALLET_CONNECT_RELAY=wc-relay.astranaut.io
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=af3dd8c81db591806b87e9dbdd42d470
NEXT_PUBLIC_DEFAULT_OUTPUT_CURRENCY=0xa0161089652A33eeA83168dCd74287E58b390910
NEXT_PUBLIC_DEFAULT_OUTPUT_CURRENCY=0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d
NEXT_PUBLIC_GN_INFO_CLIENT=https://graph-node.astranaut.io/subgraphs/name/solarswap/exchange-v1
NEXT_PUBLIC_GN_BLOCK_CLIENT=https://graph-node.astranaut.io/subgraphs/name/solarswap/blocks-v1
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
NEXT_PUBLIC_WALLET_CONNECT_RELAY=wc-relay.astranaut.io
NEXT_PUBLIC_SENTRY_DSN=https://3440367258bb4aa39f6798ce548c98c8@sentry.astranet.live/5
NEXT_PUBLIC_SENTRY_ENVIRONMENT=mainnet
NEXT_PUBLIC_DEFAULT_OUTPUT_CURRENCY=0x2039A56173fDac411975Bce6F756059Ac33d0d79
NEXT_PUBLIC_DEFAULT_OUTPUT_CURRENCY=0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d
NEXT_PUBLIC_GN_INFO_CLIENT=https://graph-node.astranaut.io/subgraphs/name/solarswap/exchange-v1
NEXT_PUBLIC_GN_BLOCK_CLIENT=https://graph-node.astranaut.io/subgraphs/name/solarswap/blocks-v1
4 changes: 2 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export default defineConfig({
...process.env,
WASA:
CHAIN_ID === ChainId.MAINNET.toString()
? '0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf'
? '0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670'
: '0xA625BF1c3565775B1859B579DF980Fef324E7315',
USDT:
CHAIN_ID === ChainId.MAINNET.toString()
? '0xa0161089652A33eeA83168dCd74287E58b390910'
? '0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d'
: '0x2039A56173fDac411975Bce6F756059Ac33d0d79',
TNT:
CHAIN_ID === ChainId.MAINNET.toString()
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/farms/farms.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
describe('Farms Page', () => {
const HOST = 'http://localhost:3000'
it('loads live farms', () => {
cy.visit(`${HOST}/farms`)
cy.get('#farms-table').should('be.visible')
})
// const HOST = 'http://localhost:3000'
// it('loads live farms', () => {
// cy.visit(`${HOST}/farms`)
// cy.get('#farms-table').should('be.visible')
// })

// it('loads finished farms', () => {
// cy.visit('http://localhost/farms/history')
Expand Down
18 changes: 9 additions & 9 deletions cypress/integration/farms/farms.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
describe('Farms Page', () => {
it('loads live farms', () => {
cy.visit('/farms')
cy.get('#farms-table').should('be.visible')
})
// it('loads live farms', () => {
// cy.visit('/farms')
// cy.get('#farms-table').should('be.visible')
// })

it('loads finished farms', () => {
cy.visit('/farms/history')
cy.get('#staked-only-farms').click({ force: true })
cy.get('#farms-table').should('be.visible')
})
// it('loads finished farms', () => {
// cy.visit('/farms/history')
// cy.get('#staked-only-farms').click({ force: true })
// cy.get('#farms-table').should('be.visible')
// })
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@next/bundle-analyzer": "^13.4.7",
"@reduxjs/toolkit": "^1.5.0",
"@sentry/nextjs": "^7.56.0",
"@solarswap/sdk": "1.0.11",
"@solarswap/sdk": "1.0.12",
"@uniswap/token-lists": "^1.0.0-beta.19",
"@walletconnect/sign-client": "^2.1.4",
"@web3-onboard/common": "^2.2.3",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 138 additions & 0 deletions public/images/tokens/0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1604,5 +1604,7 @@
"Added by user": "Added by user",
"Approved": "Approved",
"Infinity": "Infinity",
"Your approve current is not enough": "Your approve current is not enough"
"Your approve current is not enough": "Your approve current is not enough",
"Error importing list": "Error importing list",
"Enter valid list location": "Enter valid list location"
}
4 changes: 3 additions & 1 deletion public/locales/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1604,5 +1604,7 @@
"Added by user": "Thêm bởi bạn",
"Approved": "Đã duyệt",
"Infinity": "Vô tận",
"Your approve current is not enough": "Hiện tại phê duyệt của bạn không đủ"
"Your approve current is not enough": "Hiện tại phê duyệt của bạn không đủ",
"Error importing list": "Lỗi khi nhập danh sách",
"Enter valid list location": "Nhập địa chỉ danh sách không hợp lệ"
}
6 changes: 3 additions & 3 deletions src/__tests__/utils/getLpAddress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import getLpAddress from 'utils/getLpAddress'
import { CHAIN_ID } from 'config/constants/networks'

const chainId = CHAIN_ID === ChainId.MAINNET.toString() ? ChainId.MAINNET : ChainId.TESTNET
const WASA_AS_STRING = chainId === ChainId.MAINNET ? '0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf' : '0xA625BF1c3565775B1859B579DF980Fef324E7315'
const USDT_AS_STRING = chainId === ChainId.MAINNET ? '0xa0161089652A33eeA83168dCd74287E58b390910' : '0x2039A56173fDac411975Bce6F756059Ac33d0d79'
const WASA_AS_STRING = chainId === ChainId.MAINNET ? '0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670' : '0xA625BF1c3565775B1859B579DF980Fef324E7315'
const USDT_AS_STRING = chainId === ChainId.MAINNET ? '0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d' : '0x2039A56173fDac411975Bce6F756059Ac33d0d79'
const WASA_AS_TOKEN = new Token(chainId, WASA_AS_STRING, 18)
const USDT_AS_TOKEN = new Token(chainId, USDT_AS_STRING, 18)
const WASA_USDT_LP = chainId === ChainId.MAINNET ? '0x654272F07Aa573ca5775F7aaDB28388754619Ba9' : '0xEcd38FcDA1e283d6344BF6A5970979C68dA5064F'
const WASA_USDT_LP = chainId === ChainId.MAINNET ? '0x09194e6605443d56fD3Cc2f95919af68adde5e66' : '0xEcd38FcDA1e283d6344BF6A5970979C68dA5064F'

describe('getLpAddress', () => {
it('returns correct LP address, both tokens are strings', () => {
Expand Down
15 changes: 7 additions & 8 deletions src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,13 @@ export default function Navbar() {
link: '/liquidity',
submenus: [],
},

{
id: '3',
type: 'static',
label: t('Farm'),
link: '/farms',
submenus: [],
},
// {
// id: '3',
// type: 'static',
// label: t('Farm'),
// link: '/farms',
// submenus: [],
// },
{
id: '4',
type: 'static',
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/CurrencySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function CurrencySearch({
fixedListRef={fixedList}
showImportView={showImportView}
setImportToken={setImportToken}
style={{ gap: 8 }}
style={{ gap: 10 }}
/>
</div>
) : (
Expand Down
27 changes: 11 additions & 16 deletions src/components/SearchModal/ManageLists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,23 @@ const ListRow = memo(function ListRow({ listUrl }: { listUrl: string }) {

return (
<div className={styles.rowWrapper} key={listUrl} id={listUrlRowHTMLId(listUrl)}>
{tooltipVisible && tooltip}
{/* {tooltipVisible && tooltip} */}

{list.logoURI ? (
<ListLogo
size="40px"
size={'40'}
style={{ marginRight: '1rem' }}
logoURI={list.logoURI}
alt={`${list.name} list logo`}
/>
) : (
<div style={{ width: '24px', height: '24px', marginRight: '1rem' }} />
)}
<div className="flex flex-1">
<Row>
<span className="text text-bold">{list.name}</span>
</Row>
<Row style={{ marginTop: 4 }}>
<span className="text text-sm text-lowercase">
{list.tokens.length} {t('Tokens')}
</span>
<span ref={targetRef}>{/* <CogIcon color="text" width="12px" /> */}</span>
</Row>
<div className="col margin-left-md">
<span className="text text-bold">{list.name}</span>
<span className="text text-sm text-lowercase">
{list.tokens.length} {t('Tokens')}
</span>
</div>
<Toggle
checked={isActive}
Expand Down Expand Up @@ -193,23 +188,23 @@ function ManageLists({
async function fetchTempList() {
fetchList(listUrlInput, false)
.then(list => setTempList(list))
.catch(() => setAddError('Error importing list'))
.catch(() => setAddError(t('Error importing list')))
}
// if valid url, fetch details for card
if (validUrl) {
fetchTempList()
} else {
setTempList(undefined)
if (listUrlInput !== '') {
setAddError('Enter valid list location')
setAddError(t('Enter valid list location'))
}
}

// reset error
if (listUrlInput === '') {
setAddError(undefined)
}
}, [fetchList, listUrlInput, validUrl])
}, [fetchList, listUrlInput, validUrl, t])

// check if list is already imported
const isImported = Object.keys(lists).includes(listUrlInput)
Expand Down Expand Up @@ -267,7 +262,7 @@ function ManageLists({
</div>
)}
<div>
<div className="flex col">
<div className="flex col" style={{ gap: 12 }}>
{sortedLists.map(listUrl => (
<ListRow key={listUrl} listUrl={listUrl} />
))}
Expand Down
2 changes: 2 additions & 0 deletions src/components/SearchModal/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
align-items: center;
padding: 1rem;
border-radius: 20px;
display: flex;
flex-direction: row;
}

.textDot {
Expand Down
2 changes: 1 addition & 1 deletion src/config/constants/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
11115: '0x5790c3534F30437641541a0FA04C992799602998',
},
multiCall: {
11110: '0x15b2dFb902c055fff4c8CADcd5f2a3978E33E94c',
11110: '0xc4B93331ee8cdb3d33fd2d744bc6d67F412B5318',
11115: '0xbD58b441b03D9807d1429662e9ed2F6C1a7af5DD',
},

Expand Down
4 changes: 2 additions & 2 deletions src/config/constants/farms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const farms: SerializedFarmConfig[] = [
// lpSymbol: 'WASA',
// lpAddresses: {
// 11115: '0xA625BF1c3565775B1859B579DF980Fef324E7315',
// 11110: '0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf',
// 11110: '0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670',
// },
// token: serializedTokens.wasa,
// quoteToken: serializedTokens.wasa,
Expand All @@ -23,7 +23,7 @@ const farms: SerializedFarmConfig[] = [
lpSymbol: 'USDT-ASA LP',
lpAddresses: {
11115: '0xecd38fcda1e283d6344bf6a5970979c68da5064f',
11110: '0x654272f07aa573ca5775f7aadb28388754619ba9',
11110: '0x09194e6605443d56fD3Cc2f95919af68adde5e66',
},
token: serializedTokens.usdt,
quoteToken: serializedTokens.wasa,
Expand Down
6 changes: 3 additions & 3 deletions src/config/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { BigNumber } from '@ethersproject/bignumber'
import { mainnetTokens, testnetTokens } from './tokens'

export const ROUTER_ADDRESS = {
[ChainId.MAINNET]: '0xf2ff88daA4B210408F2412AFf188a656fe51429A',
[ChainId.MAINNET]: '0x7Dad3d655EA4BE30e1FD95adDbDeEdDcDAe0C2C6',
[ChainId.TESTNET]: '0xfc9ecc743695f9BFfC8c33e5DB6e51356032Ef59',
}

export const ZAP_ADDRESS = {
[ChainId.MAINNET]: '0xe380876d88464dFcA487a68461A965eE3A566274',
[ChainId.MAINNET]: '0xece9Ca24493c582E2F3a41912282C5ad16393F8c',
[ChainId.TESTNET]: '0xE32e8e00Ba3D1A1D1dE0442d9879DFB636a98A87',
}

export const WASA_ADDRESS = {
[ChainId.MAINNET]: '0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf',
[ChainId.MAINNET]: '0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670',
[ChainId.TESTNET]: '0xA625BF1c3565775B1859B579DF980Fef324E7315',
}

Expand Down
8 changes: 4 additions & 4 deletions src/config/constants/tokenLists/solar-default.tokenlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
{
"name": "WASA Token",
"symbol": "WASA",
"address": "0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf",
"address": "0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670",
"chainId": 11110,
"decimals": 18,
"logoURI": "https://tokens.solarswap.io/images/0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf.png"
"logoURI": "https://tokens.solarswap.io/images/0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670.png"
},
{
"name": "Tether USD",
"symbol": "USDT",
"address": "0xa0161089652A33eeA83168dCd74287E58b390910",
"address": "0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d",
"chainId": 11110,
"decimals": 18,
"logoURI": "https://tokens.solarswap.io/images/0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d.png"
Expand All @@ -31,7 +31,7 @@
"address": "0xA625BF1c3565775B1859B579DF980Fef324E7315",
"chainId": 11115,
"decimals": 18,
"logoURI": "https://tokens.solarswap.io/images/0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf.png"
"logoURI": "https://tokens.solarswap.io/images/0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670.png"
},
{
"name": "Tether USD",
Expand Down
4 changes: 2 additions & 2 deletions src/config/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ const defineTokens = <T extends TokenList>(t: T) => t
export const mainnetTokens = defineTokens({
wasa: new Token(
MAINNET,
'0xEAd8b0094072CAAa333DD2Ca72E5856f808e83Cf',
'0x6637D8275DC58983Cb3A2fa64b705EC11f6EC670',
18,
'WASA',
'Wrapped ASA',
'https://www.astranaut.io/',
),
usdt: new Token(
MAINNET,
'0xa0161089652A33eeA83168dCd74287E58b390910',
'0x5fC4435AcA131f1F541D2fc67DC3A6a20d10a99d',
18,
'USDT',
'Tether USD',
Expand Down
4 changes: 3 additions & 1 deletion src/config/localization/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1604,5 +1604,7 @@
"Added by user": "Thêm bởi bạn",
"Approved": "Đã duyệt",
"Infinity": "Vô tận",
"Your approve current is not enough": "Hiện tại phê duyệt của bạn không đủ"
"Your approve current is not enough": "Hiện tại phê duyệt của bạn không đủ",
"Error importing list": "Lỗi khi nhập danh sách",
"Enter valid list location": "Nhập địa chỉ danh sách không hợp lệ"
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2306,10 +2306,10 @@
rpc-websockets "^7.5.1"
superstruct "^0.14.2"

"@solarswap/sdk@1.0.11":
version "1.0.11"
resolved "https://registry.yarnpkg.com/@solarswap/sdk/-/sdk-1.0.11.tgz#3136698554fbf0566b9a281107bad6f5d4e545d3"
integrity sha512-FcN9hyPERTq47KZne2s9LcZexkCr9i9hPwfaXh27aw+vT0DAX5jHy40yTHLunLbpidH5U/joHjsXPg3JT1t3Iw==
"@solarswap/sdk@1.0.12":
version "1.0.12"
resolved "https://registry.yarnpkg.com/@solarswap/sdk/-/sdk-1.0.12.tgz#3b84dbd6b9e938b363d8c7f4198b7a23f5e29517"
integrity sha512-lyf+rG5tztBWnwJFkwCLwT/wqSL5Fb0MbvqyHRvYiJ+xQHlkzfuiyn9ButyVaGJE+iQr0yamRyLX7/DQ2Y5teg==
dependencies:
big.js "^5.2.2"
decimal.js-light "^2.5.0"
Expand Down

0 comments on commit 24a1d69

Please sign in to comment.