Skip to content

Commit

Permalink
Merge pull request #126 from golemfactory/change-to-pol
Browse files Browse the repository at this point in the history
Migrate MATIC to POL
  • Loading branch information
SewerynKras committed Sep 20, 2024
2 parents e0e52ca + b62a609 commit 92e5427
Show file tree
Hide file tree
Showing 24 changed files with 11,135 additions and 8,056 deletions.
6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@heroicons/react": "2.0.13",
"@hotjar/browser": "^1.0.9",
"@metamask/detect-provider": "^2.0.0",
"@ramp-network/ramp-instant-sdk": "^4.0.4",
"@ramp-network/ramp-instant-sdk": "^4.0.5",
"@tanstack/react-query": "^5.26.3",
"@typechain/ethers-v6": "^0.5.0",
"@types/lodash": "^4.14.198",
Expand Down Expand Up @@ -53,8 +53,8 @@
"use-query-params": "^2.2.1",
"usehooks-ts": "^2.15.1",
"uuid": "^9.0.1",
"viem": "^2.9.3",
"wagmi": "^2.5.13",
"viem": "^2.21.10",
"wagmi": "^2.12.12",
"xstate": "^4.38.2"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const BudgetCard = ({
})}
<div className="flex flex-col">
<span className="text-h6 text-primary font-kanit">
{maticCost} MATIC
{maticCost} POL
</span>
<span className={`${style.caps10px} flex gap-2 z-40`}>
<Trans i18nKey="coversFees" ns="welcome.step" />{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const ExchangeRate = ({
}) => {
return (
<div className="text-body-small-light text-neutral-grey-300 mt-2">
{amountIn} MATIC{amountOut} GLM
{amountIn} POL{amountOut} GLM
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const WalletState = ({
<EthereumIcon className="h-6 inline" />
)}

{isMainnet ? 'ETH' : 'MATIC'}
{isMainnet ? 'ETH' : 'POL'}
</div>
<div className="text-h7">{formatBalance(balance.NATIVE)}</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const ManualTestGateway = () => {
account?.trim() !== `0x${storageTankJSON.address.trim()}`
)
if (
path !== BalanceCase.NO_GLM_NO_MATIC &&
path !== BalanceCase.NO_GLM_NO_POL &&
account?.toLocaleLowerCase() !==
`0x${storageTankJSON.address.toLocaleLowerCase()}`
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ import { BalanceCaseType, BalanceCase } from 'types/path'

type TestingSetupType = {
glmBalance: number
maticBalance: number
polBalance: number
label: string
}

export const testingSetup: Record<BalanceCaseType, TestingSetupType> = {
[BalanceCase.NO_GLM]: {
glmBalance: 0,
maticBalance: 15,
polBalance: 15,
label: 'No GLM',
},
[BalanceCase.NO_MATIC]: {
[BalanceCase.NO_POL]: {
glmBalance: 1000,
maticBalance: 0,
label: 'No MATIC',
polBalance: 0,
label: 'No POL',
},
[BalanceCase.BOTH]: {
glmBalance: 1000,
maticBalance: 15,
label: 'Both GLM and MATIC',
polBalance: 15,
label: 'Both GLM and POL',
},
[BalanceCase.NO_GLM_NO_MATIC]: {
[BalanceCase.NO_GLM_NO_POL]: {
glmBalance: 0,
maticBalance: 0,
label: 'No GLM and no MATIC',
polBalance: 0,
label: 'No GLM and no POL',
},
}

Expand All @@ -34,9 +34,9 @@ export const getExpectedBalances = ({
}: {
testingPath: BalanceCaseType
}) => {
const { glmBalance, maticBalance } = testingSetup[testingPath]
const { glmBalance, polBalance } = testingSetup[testingPath]
return {
glm: glmBalance,
native: maticBalance,
native: polBalance,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { formatEther } from 'utils/formatEther'
import { Chain } from 'types/wagmi'
import { AwaitTransaction } from 'components/molecules/awaitTransaction/AwaitTransaction'

//@ts-ignore

// const log = debug('onboarding:steps:onramp')

TooltipProvider.registerTooltip({
Expand Down Expand Up @@ -161,7 +159,6 @@ export const OnRamp = ({
setPlacement: (x: 'inside' | 'outside') => void
placement: 'inside' | 'outside'
}) => {
//@ts-ignore
const { address } = useAccount(true)
const widgetRef = useRef<RampInstantSDK | null>(null)
const { chain } = useNetwork(true)
Expand Down Expand Up @@ -212,15 +209,14 @@ export const OnRamp = ({
hostLogoUrl: `${extractBaseURL(window.location.href)}/logo.svg`,
hostApiKey: import.meta.env.VITE_RAMP_KEY,
url: import.meta.env.VITE_RAMP_API_URL,
swapAsset: 'MATIC_MATIC',
swapAsset: import.meta.env.DEV ? 'MATIC_MATIC' : 'MATIC_POL', // TODO: POL is not available on ramp testnet (as of 2024-09-20)
fiatValue: recommendedAmount.toString(),
fiatCurrency: 'USD',
userAddress: address,
defaultFlow: 'ONRAMP',
variant: 'embedded-desktop',
//well ramp is internally inconsistent...
//@ts-ignore
containerNode: document.getElementById('rampContainer'),
containerNode: document.getElementById('rampContainer')!,
})

//check if there is no widget rendered already
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const SwapTokensPresentational = ({
<Trans i18nKey="swapAmount" ns="swap.step" />
<IconInput
icon={MaticCoinIcon}
label="MATIC"
label="POL"
placeholder={`${amountIn}`}
isError={isError}
onChange={(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const TransferPresentational = ({
)}
<IconInput
icon={
nativeToken === 'MATIC'
nativeToken === 'POL'
? MaticCoinSolidIcon
: EthereumIcon
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ethereum/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const MAINNET: INetwork = {
blockExplorerUrls: ['https://polygonscan.com/'],
nativeCurrency: {
//@ts-ignore
symbol: 'MATIC',
symbol: 'POL',
decimals: 18,
},
isProduction: true,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/ethereum/networks/mumbai.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { INetwork, Network } from 'types/ethereum'

// TODO: Mumbai is dead, this can be removed?
export const MUMBAI: INetwork = {
chainId: Network.MUMBAI,
chainName: 'Mumbai Testnet',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ethereum/networks/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const POLYGON: INetwork = {
blockExplorerUrls: ['https://polygonscan.com/'],
nativeCurrency: {
//@ts-ignore
symbol: 'MATIC',
symbol: 'POL',
decimals: 18,
},
isProduction: true,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ethereum/tokens/matic/mumbai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Token, Network, INativeToken } from 'types/ethereum'

export const maticMumbai: INativeToken = {
isNative: true,
name: 'Matic',
name: 'Pol',
decimals: 18,
symbol: Token.MATIC_MUMBAI,
symbol: Token.POL_MUMBAI,
network: Network.MUMBAI,
}
2 changes: 1 addition & 1 deletion frontend/src/ethereum/tokens/matic/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const maticPolygon: INativeToken = {
isNative: true,
name: 'Matic',
decimals: 18,
symbol: Token.MATIC_POLYGON,
symbol: Token.POL_POLYGON,
network: Network.POLYGON,
}
Loading

0 comments on commit 92e5427

Please sign in to comment.