Skip to content

Commit

Permalink
Merge pull request #304 from EdgeApp/matthew/usdce
Browse files Browse the repository at this point in the history
Update Polygon USDC/USDC.e handling
  • Loading branch information
peachbits authored Nov 9, 2023
2 parents 67f018a + 8a28950 commit 5401a91
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
11 changes: 10 additions & 1 deletion src/swap/changehero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {

import {
checkInvalidCodes,
CurrencyCodeTranscriptionMap,
getCodesWithTranscription,
getMaxSwappable,
InvalidCurrencyCodes,
Expand Down Expand Up @@ -70,6 +71,10 @@ const MAINNET_CODE_TRANSCRIPTION: StringMap = {
zcash: 'zcash'
}

const CURRENCY_CODE_TRANSCRIPTION: CurrencyCodeTranscriptionMap = {
polygon: { 'USDC.e': 'USDCE' }
}

// See https://changehero.io/currencies for list of supported currencies
const INVALID_CURRENCY_CODES: InvalidCurrencyCodes = {
from: {
Expand Down Expand Up @@ -172,7 +177,11 @@ export function makeChangeHeroPlugin(
toCurrencyCode,
fromMainnetCode,
toMainnetCode
} = getCodesWithTranscription(request, MAINNET_CODE_TRANSCRIPTION)
} = getCodesWithTranscription(
request,
MAINNET_CODE_TRANSCRIPTION,
CURRENCY_CODE_TRANSCRIPTION
)

const quoteAmount =
request.quoteFor === 'from'
Expand Down
4 changes: 3 additions & 1 deletion src/swap/changenow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ const uri = 'https://api.changenow.io/v2/'

const INVALID_CURRENCY_CODES: InvalidCurrencyCodes = {
from: {
optimism: ['VELO']
optimism: ['VELO'],
polygon: ['USDC', 'USDC.e']
},
to: {
polygon: ['USDC', 'USDC.e'],
zcash: ['ZEC']
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/swap/godex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ const INVALID_CURRENCY_CODES: InvalidCurrencyCodes = {
celo: 'allTokens',
ethereum: ['MATIC'],
fantom: 'allTokens',
polygon: 'allCodes'
polygon: 'allCodes',
zcash: ['ZEC'] // ChangeHero doesn't support sending to unified addresses
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/swap/letsexchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ const asInfoReply = asObject({
const INVALID_CURRENCY_CODES: InvalidCurrencyCodes = {
from: {
ethereum: ['MATH'],
optimism: ['VELO']
optimism: ['VELO'],
polygon: ['USDC.e']
},
to: {
ethereum: ['MATH'],
polygon: ['USDC.e'],
zcash: ['ZEC']
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/swap/sideshift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ const MAINNET_CODE_TRANSCRIPTION = {

const INVALID_CURRENCY_CODES: InvalidCurrencyCodes = {
from: {
optimism: ['VELO']
optimism: ['VELO'],
polygon: ['USDC', 'USDC.e']
},
to: {}
to: {
polygon: ['USDC', 'USDC.e']
}
}

const SIDESHIFT_BASE_URL = 'https://sideshift.ai/api/v2'
Expand Down
4 changes: 3 additions & 1 deletion src/swap/swapuz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ const uri = 'https://api.swapuz.com/api/home/v1/'
const INVALID_CURRENCY_CODES: InvalidCurrencyCodes = {
from: {
ethereum: ['MATH'],
optimism: ['VELO']
optimism: ['VELO'],
polygon: ['USDC', 'USDC.e']
},
to: {
ethereum: ['MATH'],
polygon: ['USDC', 'USDC.e'],
zcash: ['ZEC'],
zksync: 'allCodes'
}
Expand Down

0 comments on commit 5401a91

Please sign in to comment.