Skip to content

Commit 3bea301

Browse files
authored
Merge pull request #5235 from swaponline/phpx_chain
Add phpX blockchain
2 parents 0bcfe5f + a1ec1fd commit 3bea301

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+221
-2
lines changed

src/common/erc20Like/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,10 @@ export default {
223223
defaultParams: DEFAULT_CURRENCY_PARAMETERS.evmLikeToken,
224224
web3: new Web3(providers.fkw_provider),
225225
}),
226+
phpx20: new erc20LikeHelper({
227+
standard: 'phpx20',
228+
currency: 'phpx',
229+
defaultParams: DEFAULT_CURRENCY_PARAMETERS.evmLikeToken,
230+
web3: new Web3(providers.phpx_provider),
231+
}),
226232
}

src/common/helpers/constants/ADDRESSES.ts

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export const WrapperCurrency = {
2929
421611: '',
3030
1666700000: '',
3131
1313161556: '',
32+
33+
52767: '0x87a6417F03E106A05698F18829bB3a40CBC54f61', // PHPx Mainnet Wrapped
34+
3235
}
3336

3437
export default {

src/common/helpers/constants/COINS_WITH_DYNAMIC_FEE.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export default [
2020
'ghost',
2121
'next',
2222
'fkw',
23+
'phpx',
2324
]

src/common/helpers/constants/DEFAULT_CURRENCY_PARAMETERS.ts

+12
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ export default {
7575
fast: 2000,
7676
},
7777
},
78+
phpx: {
79+
limit: {
80+
send: 21 * 1e3,
81+
contractInteract: 200 * 1e3,
82+
swap: 70 * 1e3,
83+
},
84+
price: {
85+
slow: 100,
86+
normal: 1000,
87+
fast: 2000,
88+
},
89+
},
7890
evmLike: {
7991
limit: {
8092
send: 21 * 1e3,

src/common/helpers/constants/MIN_AMOUNT.ts

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default {
1212
phi_v1: 0.001,
1313
phi: 0.001,
1414
fkw: 0.001,
15+
phpx: 0.001,
1516
ame: 0.001,
1617
btc: 0.00015,
1718
ghost: 0.00015,

src/common/helpers/constants/MIN_AMOUNT_OFFER.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
aureth: 0.0006,
77
xdai: 0.0006,
88
ftm: 0.0006,
9+
phpx: 0.0006,
910
avax: 0.0006,
1011
movr: 0.0006,
1112
one: 0.0006,

src/common/helpers/ethLikeHelper.ts

+5
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,9 @@ export default {
141141
defaultParams: DEFAULT_CURRENCY_PARAMETERS.fkw,
142142
web3: new Web3(config.web3.fkw_provider),
143143
}),
144+
phpx: new ethLikeHelper({
145+
currency: 'PHPX',
146+
defaultParams: DEFAULT_CURRENCY_PARAMETERS.phpx,
147+
web3: new Web3(config.web3.phpx_provider),
148+
}),
144149
}

src/core/swap.app/constants/COINS.ts

+14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const COIN_TYPE = Object.freeze({
1313
PHI_V1_TOKEN: 'PHI_V1_TOKEN',
1414
PHI_TOKEN: 'PHI_TOKEN',
1515
FKW_TOKEN: 'FKW_TOKEN',
16+
PHPX_TOKEN: 'PHPX_TOKEN',
1617
})
1718

1819
export const TOKEN_STANDARD = Object.freeze({
@@ -29,6 +30,7 @@ export const TOKEN_STANDARD = Object.freeze({
2930
PHI20_V1: 'PHI20_V1',
3031
PHI20: 'PHI20',
3132
FKW20: 'FKW20',
33+
PHPX20: 'PHPX20',
3234
})
3335

3436
export const BLOCKCHAIN = Object.freeze({
@@ -49,6 +51,7 @@ export const BLOCKCHAIN = Object.freeze({
4951
PHI_V1: 'PHI_V1',
5052
PHI: 'PHI',
5153
FKW: 'FKW',
54+
PHPX: 'PHPX',
5255
})
5356

5457
export const BASE_TOKEN_CURRENCY = Object.freeze({
@@ -65,6 +68,7 @@ export const BASE_TOKEN_CURRENCY = Object.freeze({
6568
PHI_V1: 'PHI_V1',
6669
PHI: 'PHI',
6770
FKW: 'FKW',
71+
PHPX: 'PHPX',
6872
})
6973

7074
export const COIN_MODEL = Object.freeze({
@@ -196,6 +200,15 @@ export const COIN_DATA = {
196200
model: COIN_MODEL.AB,
197201
precision: 18,
198202
},
203+
PHPX: {
204+
ticker: 'PHPX',
205+
name: 'PHPX',
206+
type: COIN_TYPE.PHPX_TOKEN,
207+
blockchain: BLOCKCHAIN.PHPX,
208+
standard: TOKEN_STANDARD.PHPX20,
209+
model: COIN_MODEL.AB,
210+
precision: 18,
211+
},
199212
USDT: {
200213
ticker: 'USDT',
201214
name: 'Tether',
@@ -278,6 +291,7 @@ export const NATIVE = {
278291
phi_v1: 'PHI_V1',
279292
phi: 'PHI',
280293
fkw: 'FKW',
294+
phpx: 'PHPX',
281295
ghost: 'GHOST',
282296
next: 'NEXT',
283297
}

src/core/swap.app/util/tokenRegistrar.ts

+8
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,12 @@ export default {
155155
isCoinAddress: typeforce.isCoinAddress.FKW,
156156
isPublicKey: typeforce.isPublicKey.FKW,
157157
}),
158+
phpx20: new TokenRegistrar({
159+
blockchainType: BLOCKCHAIN_TYPE.PHPX,
160+
tokenStandard: TOKEN_STANDARD.PHPX20,
161+
coinType: COIN_TYPE.PHPX_TOKEN,
162+
blockchainModel: COIN_DATA.PHPX.model,
163+
isCoinAddress: typeforce.isCoinAddress.PHPX,
164+
isPublicKey: typeforce.isPublicKey.PHPX,
165+
}),
158166
}

src/core/swap.app/util/typeforce.ts

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const isCoinAddress = { // TODO: move to front helpers
3838
[constants.COINS.phi_v1]: isEvmAddress,
3939
[constants.COINS.phi]: isEvmAddress,
4040
[constants.COINS.fkw]: isEvmAddress,
41+
[constants.COINS.phpx]: isEvmAddress,
4142
[constants.COINS.btc]: (value) => typeof value === 'string' && /^[A-Za-z0-9]{26,35}$/.test(value),
4243
[constants.COINS.ghost]: (value) => typeof value === 'string' && /^[A-Za-z0-9]{26,35}$/.test(value),
4344
[constants.COINS.next]: (value) => typeof value === 'string' && /^[A-Za-z0-9]{26,35}$/.test(value),
@@ -59,6 +60,7 @@ const isPublicKey = {
5960
[constants.COINS.phi_v1]: '?String',
6061
[constants.COINS.phi]: '?String',
6162
[constants.COINS.fkw]: '?String',
63+
[constants.COINS.phpx]: '?String',
6264
[constants.COINS.btc]: (value) => typeof value === 'string' && /^[A-Za-z0-9]{66}$/.test(value),
6365
[constants.COINS.ghost]: (value) => typeof value === 'string' && /^[A-Za-z0-9]{66}$/.test(value),
6466
[constants.COINS.next]: (value) => typeof value === 'string' && /^[A-Za-z0-9]{66}$/.test(value),

src/front/config/mainnet/api.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ export default {
4646
noxon: 'https://noxon.wpmix.net',
4747
phiscan: 'https://phiscan.com/api',
4848
fkwscan: 'https://explorer.fokawa.com/api',
49+
phpxscan: 'https://explorer.phpx.network/api',
4950
WalletConnectProjectId: 'a23677c4af3139b4eccb52981f76ad94',
5051
}

src/front/config/mainnet/evmNetworkVersions.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export default [
1313
4181, // PHI v1
1414
144, // PHI v2
1515
40821, // FKW (Fokawa)
16+
52767, // PHPX
1617
]

src/front/config/mainnet/evmNetworks.js

+9
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,13 @@ export default {
128128
blockExplorerUrls: [link.fkw_Explorer],
129129
hasWalletConnect: false,
130130
},
131+
PHPX: {
132+
currency: 'PHPX',
133+
chainId: '0xCE1F',
134+
networkVersion: 52767,
135+
chainName: 'PHPX Network',
136+
rpcUrls: [web3.phpx_provider],
137+
blockExplorerUrls: [link.phpx_Explorer],
138+
hasWalletConnect: false,
139+
},
131140
}

src/front/config/mainnet/hiddenCoins.js

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default [
6666
'PHI_V1',
6767
'PHI',
6868
'FKW',
69+
'PHPX',
6970
'{ETH}SWAP',
7071
'{ETH}HDP',
7172
'{ETH}USDT',

src/front/config/mainnet/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import bep20 from './bep20'
1414
import phi20_v1 from './phi20'
1515
import phi20 from './phi20'
1616
import fkw20 from './fkw20'
17+
import phpx20 from './phpx20'
1718
import api from './api'
1819
import swapContract from './swapContract'
1920
import feeRates from './feeRates'
@@ -34,6 +35,7 @@ export default {
3435
phi20_v1,
3536
phi20,
3637
fkw20,
38+
phpx20,
3739
erc20matic,
3840
erc20xdai,
3941
erc20ftm,

src/front/config/mainnet/link.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ export default {
1717
phi_v1Explorer: 'https://explorer.phi.network',
1818
phi_Explorer: 'https://phiscan.com',
1919
fkw_Explorer: 'https://explorer.fokawa.com',
20+
phpx_Explorer: 'https://explorer.phpx.network',
2021
}

src/front/config/mainnet/phpx20.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {}

src/front/config/mainnet/swapContract.js

+3
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ export default {
3737
fkwFactory: '0xcE72A00dfe506Bff0398CBA51BE8853D8Cb5F099',
3838
fkwRouter: '0x663A8a85FaB794f95F8C098A0806bdc1D9D33d76',
3939

40+
phpxFactory: '0x48d7ac38530697aDB91061B6D141C8c763edE565',
41+
phpxRouter: '0x83048f0Bf34FEeD8CEd419455a4320A735a92e9d',
42+
4043
affiliateAddress: '0x873351e707257C28eC6fAB1ADbc850480f6e0633',
4144
}

src/front/config/mainnet/web3.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export default {
1313
phi_v1_provider: 'https://rpc1.phi.network',
1414
phi_provider: 'https://connect.phi.network',
1515
fkw_provider: 'https://mainnet-rpc.fokawa.com',
16+
phpx_provider: 'https://rpc.phpx.network',
1617
}

src/front/config/testnet/evmNetworkVersions.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export default [
1010
1666700000, // ONE Testnet
1111
181, // AME testnet
1212
1313161556, // AURETH Aurora Betanet
13+
52767, // PHPX
1314
]

src/front/config/testnet/evmNetworks.js

+9
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,13 @@ export default {
114114
rpcUrls: [web3.fwk_provider],
115115
blockExplorerUrls: [link.fkw_Explorer],
116116
},
117+
PHPX: {
118+
currency: 'PHPX',
119+
chainId: '0xCE1F',
120+
networkVersion: 52767,
121+
chainName: 'PHPX Network',
122+
rpcUrls: [web3.phpx_provider],
123+
blockExplorerUrls: [link.phpx_Explorer],
124+
hasWalletConnect: false,
125+
},
117126
}

src/front/config/testnet/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import erc20aurora from './erc20aurora'
1414
import phi20_v1 from './phi20'
1515
import phi20 from './phi20_v2'
1616
import fkw20 from './fkw20'
17+
import phpx20 from './phpx20'
1718
import api from './api'
1819
import swapContract from './swapContract'
1920
import feeRates from './feeRates'
@@ -42,6 +43,7 @@ export default {
4243
phi20_v1,
4344
phi20,
4445
fkw20,
46+
phpx20,
4547
swapContract,
4648
feeRates,
4749
hiddenCoins,

src/front/config/testnet/phpx20.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {}

src/front/config/testnet/web3.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export default {
1313
phi_v1_provider: '',
1414
phi_provider: '',
1515
fkw_provider: '',
16+
phpx_provider: 'https://rpc.phpx.network',
1617
}

src/front/externalConfigs/mainnet-localhost.js

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ window.buildOptions = {
116116
phi_v1: true,
117117
phi: true,
118118
fkw: true,
119+
phpx: true,
119120
},
120121
blockchainSwapEnabled: {
121122
btc: true,
@@ -135,6 +136,7 @@ window.buildOptions = {
135136
phi_v1: false,
136137
phi: false,
137138
fkw: false,
139+
phpx: false,
138140
},
139141
defaultExchangePair: {
140142
buy: '{eth}wbtc',

src/front/externalConfigs/swaponline.github.io.js

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ window.buildOptions = {
6565
phi_v1: true,
6666
phi: true,
6767
fkw: true,
68+
phpx: true,
6869
},
6970
blockchainSwapEnabled: {
7071
btc: true,
@@ -84,6 +85,7 @@ window.buildOptions = {
8485
phi_v1: false,
8586
phi: false,
8687
fkw: false,
88+
phpx: false,
8789
},
8890
defaultExchangePair: {
8991
buy: '{eth}wbtc',

src/front/shared/components/Coin/Coin.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const defaultCurrencyColors = {
2020
'phi_v1': '#1C0237',
2121
'phi': '#1C0237',
2222
'fkw': '#f2f9f6',
23+
'phpx': '#000000',
2324
'usdt': '#33a681',
2425
'ghost': 'black',
2526
'next': 'white',
@@ -57,6 +58,7 @@ const Coin = function (props: CoinProps) {
5758
|| config?.phi20_v1[lowerName]?.icon
5859
|| config?.phi20[lowerName]?.icon
5960
|| config?.fkw20[lowerName]?.icon
61+
|| config?.phpx20[lowerName]?.icon
6062
) {
6163
isIconConfigExist = true
6264
}
@@ -121,6 +123,10 @@ const Coin = function (props: CoinProps) {
121123
if (config?.fkw20[lowerName]?.iconBgColor) {
122124
style.backgroundColor = config.fkw20[lowerName].iconBgColor
123125
}
126+
127+
if (config?.phpx20[lowerName]?.iconBgColor) {
128+
style.backgroundColor = config.phpx20[lowerName].iconBgColor
129+
}
124130

125131
// *************************************
126132

src/front/shared/components/SaveKeys/SaveKeys.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type SaveKeysProps = {
2929
phi_v1Data,
3030
phiData,
3131
fkwData,
32+
phpxData,
3233
ameData,
3334
btcData,
3435
ghostData,
@@ -49,6 +50,7 @@ type SaveKeysProps = {
4950
phi_v1Data,
5051
phiData,
5152
fkwData,
53+
phpxData,
5254
ameData,
5355
ethData,
5456
ghostData,

src/front/shared/components/modals/WithdrawModal/WithdrawModal.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type WithdrawModalState = {
122122
phi_v1Data,
123123
phiData,
124124
fkwData,
125+
phpxData,
125126
ameData,
126127
btcData,
127128
ghostData,
@@ -146,6 +147,7 @@ type WithdrawModalState = {
146147
phi_v1Data,
147148
phiData,
148149
fkwData,
150+
phpxData,
149151
ameData,
150152
btcData,
151153
ghostData,

src/front/shared/components/ui/CurrencyIcon/images/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import next from './next.svg'
3232
import phi_v1 from './phi.png'
3333
import phi from './phi_v2.png'
3434
import fkw from './fkw.png'
35+
import phpx from './phpx.png'
3536

3637

3738

@@ -73,4 +74,5 @@ export default {
7374
phi_v1,
7475
phi,
7576
fkw,
77+
phpx,
7678
}
Loading

src/front/shared/helpers/constants/TOKEN_DECIMALS.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const decimals = {
1717
phi_v1: 18,
1818
phi: 18,
1919
fkw: 18,
20+
phpx: 18,
2021
ghost: 8,
2122
next: 8,
2223
}

0 commit comments

Comments
 (0)