Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
201dc2ce
Unverified
Commit
201dc2ce
authored
Apr 24, 2023
by
Zach Pomerantz
Committed by
GitHub
Apr 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: keep constants insular (#6411)
parent
c36d9c3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
21 deletions
+13
-21
addresses.ts
src/constants/addresses.ts
+10
-2
chainInfo.ts
src/constants/chainInfo.ts
+1
-2
chains.test.ts
src/constants/chains.test.ts
+1
-2
governance.ts
src/constants/governance.ts
+1
-2
constructSameAddressMap.ts
src/utils/constructSameAddressMap.ts
+0
-13
No files found.
src/constants/addresses.ts
View file @
201dc2ce
import
{
FACTORY_ADDRESS
as
V2_FACTORY_ADDRESS
}
from
'
@uniswap/v2-sdk
'
import
{
FACTORY_ADDRESS
as
V2_FACTORY_ADDRESS
}
from
'
@uniswap/v2-sdk
'
import
{
FACTORY_ADDRESS
as
V3_FACTORY_ADDRESS
}
from
'
@uniswap/v3-sdk
'
import
{
FACTORY_ADDRESS
as
V3_FACTORY_ADDRESS
}
from
'
@uniswap/v3-sdk
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
constructSameAddressMap
}
from
'
../utils/constructSameAddressMap
'
import
{
SupportedChainId
}
from
'
./chains
'
type
AddressMap
=
{
[
chainId
:
number
]:
string
}
type
AddressMap
=
{
[
chainId
:
number
]:
string
}
const
DEFAULT_NETWORKS
=
[
SupportedChainId
.
MAINNET
,
SupportedChainId
.
GOERLI
]
function
constructSameAddressMap
(
address
:
string
,
additionalNetworks
:
SupportedChainId
[]
=
[]):
AddressMap
{
return
DEFAULT_NETWORKS
.
concat
(
additionalNetworks
).
reduce
<
AddressMap
>
((
memo
,
chainId
)
=>
{
memo
[
chainId
]
=
address
return
memo
},
{})
}
export
const
UNI_ADDRESS
:
AddressMap
=
constructSameAddressMap
(
'
0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
'
)
export
const
UNI_ADDRESS
:
AddressMap
=
constructSameAddressMap
(
'
0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
'
)
export
const
UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS
=
'
0x8B799381ac40b838BBA4131ffB26197C432AFe78
'
export
const
UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS
=
'
0x8B799381ac40b838BBA4131ffB26197C432AFe78
'
...
...
src/constants/chainInfo.ts
View file @
201dc2ce
...
@@ -11,11 +11,10 @@ import optimismSquareLogoUrl from 'assets/svg/optimism_square_logo.svg'
...
@@ -11,11 +11,10 @@ import optimismSquareLogoUrl from 'assets/svg/optimism_square_logo.svg'
import
optimismLogoUrl
from
'
assets/svg/optimistic_ethereum.svg
'
import
optimismLogoUrl
from
'
assets/svg/optimistic_ethereum.svg
'
import
polygonSquareLogoUrl
from
'
assets/svg/polygon_square_logo.svg
'
import
polygonSquareLogoUrl
from
'
assets/svg/polygon_square_logo.svg
'
import
polygonMaticLogo
from
'
assets/svg/polygon-matic-logo.svg
'
import
polygonMaticLogo
from
'
assets/svg/polygon-matic-logo.svg
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
ms
from
'
ms.macro
'
import
ms
from
'
ms.macro
'
import
{
darkTheme
}
from
'
theme/colors
'
import
{
darkTheme
}
from
'
theme/colors
'
import
{
SupportedL1ChainId
,
SupportedL2ChainId
}
from
'
./chains
'
import
{
Supported
ChainId
,
Supported
L1ChainId
,
SupportedL2ChainId
}
from
'
./chains
'
import
{
ARBITRUM_LIST
,
CELO_LIST
,
OPTIMISM_LIST
,
PLASMA_BNB_LIST
}
from
'
./lists
'
import
{
ARBITRUM_LIST
,
CELO_LIST
,
OPTIMISM_LIST
,
PLASMA_BNB_LIST
}
from
'
./lists
'
export
const
AVERAGE_L1_BLOCK_TIME
=
ms
`12s`
export
const
AVERAGE_L1_BLOCK_TIME
=
ms
`12s`
...
...
src/constants/chains.test.ts
View file @
201dc2ce
import
{
SupportedChainId
as
SdkSupportedChainId
}
from
'
@uniswap/sdk-core
'
import
{
SupportedChainId
as
SdkSupportedChainId
}
from
'
@uniswap/sdk-core
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
ALL_SUPPORTED_CHAIN_IDS
}
from
'
./chains
'
import
{
ALL_SUPPORTED_CHAIN_IDS
,
SupportedChainId
}
from
'
./chains
'
describe
(
'
ChainIds
'
,
()
=>
{
describe
(
'
ChainIds
'
,
()
=>
{
describe
(
'
SupportedChainId
'
,
()
=>
{
describe
(
'
SupportedChainId
'
,
()
=>
{
...
...
src/constants/governance.ts
View file @
201dc2ce
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
import
{
GOVERNANCE_ALPHA_V0_ADDRESSES
,
GOVERNANCE_ALPHA_V0_ADDRESSES
,
GOVERNANCE_ALPHA_V1_ADDRESSES
,
GOVERNANCE_ALPHA_V1_ADDRESSES
,
...
@@ -7,6 +5,7 @@ import {
...
@@ -7,6 +5,7 @@ import {
TIMELOCK_ADDRESS
,
TIMELOCK_ADDRESS
,
UNI_ADDRESS
,
UNI_ADDRESS
,
}
from
'
./addresses
'
}
from
'
./addresses
'
import
{
SupportedChainId
}
from
'
./chains
'
export
const
COMMON_CONTRACT_NAMES
:
Record
<
number
,
{
[
address
:
string
]:
string
}
>
=
{
export
const
COMMON_CONTRACT_NAMES
:
Record
<
number
,
{
[
address
:
string
]:
string
}
>
=
{
[
SupportedChainId
.
MAINNET
]:
{
[
SupportedChainId
.
MAINNET
]:
{
...
...
src/utils/constructSameAddressMap.ts
deleted
100644 → 0
View file @
c36d9c3d
import
{
SupportedChainId
}
from
'
constants/chains
'
const
DEFAULT_NETWORKS
=
[
SupportedChainId
.
MAINNET
,
SupportedChainId
.
GOERLI
]
export
function
constructSameAddressMap
<
T
extends
string
>
(
address
:
T
,
additionalNetworks
:
SupportedChainId
[]
=
[]
):
{
[
chainId
:
number
]:
T
}
{
return
DEFAULT_NETWORKS
.
concat
(
additionalNetworks
).
reduce
<
{
[
chainId
:
number
]:
T
}
>
((
memo
,
chainId
)
=>
{
memo
[
chainId
]
=
address
return
memo
},
{})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment