-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[goreleaser] Updated explorer indexer for migration #1685
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,19 @@ | |
return nil, fmt.Errorf("could not get pool token data: %w", err) | ||
} | ||
decimals := uint8(usdcDecimals) | ||
// Hotfix | ||
if chainID == 8453 &&(cctpEvent.Token == "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93" || cctpEvent.Token == "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb") { | ||
decimals = 18 | ||
} | ||
cctpEvent.TokenSymbol = tokenData.TokenID() | ||
if (cctpEvent.Token == "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1") { | ||
decimals = 18 | ||
cctpEvent.TokenSymbol = "DAI" | ||
} | ||
if chainID == 10 && (cctpEvent.Token == "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9") { | ||
decimals = 18 | ||
cctpEvent.TokenSymbol = "sUSD" | ||
} | ||
Comment on lines
+117
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
cctpEvent.TokenDecimal = &decimals | ||
c.applyPriceData(ctx, cctpEvent, usdcCoinGeckoID) | ||
|
||
|
@@ -156,13 +168,13 @@ | |
} | ||
|
||
if cctpEvent.Amount != nil { | ||
amountUSD := GetAmountUSD(cctpEvent.Amount, usdcDecimals, tokenPrice) | ||
amountUSD := GetAmountUSD(cctpEvent.Amount, *cctpEvent.TokenDecimal, tokenPrice) | ||
if amountUSD != nil { | ||
cctpEvent.AmountUSD = *amountUSD | ||
} | ||
} | ||
if cctpEvent.Fee != nil { | ||
cctpEvent.FeeUSD = GetAmountUSD(cctpEvent.Fee, usdcDecimals, tokenPrice) | ||
cctpEvent.FeeUSD = GetAmountUSD(cctpEvent.Fee, *cctpEvent.TokenDecimal, tokenPrice) | ||
Comment on lines
+171
to
+177
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,38 @@ | |
|
||
// GetTokenData attempts to get token data from the cache otherwise it is fetched from the bridge config. | ||
func (t *tokenDataServiceImpl) GetTokenData(ctx context.Context, chainID uint32, token common.Address) (ImmutableTokenData, error) { | ||
// Hotfix for tokens not on bridge config. | ||
// Handle CRVUSDC | ||
if chainID == 8453 && token.String() == "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93" { | ||
return immutableTokenImpl{ | ||
tokenID: "crvUSD", | ||
decimals: 18, | ||
tokenAddress: "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93", | ||
}, nil | ||
} | ||
|
||
// Handle USDbC | ||
if chainID == 8453 && token.String() == "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" { | ||
return immutableTokenImpl{ | ||
tokenID: "USDbC", | ||
decimals: 6, | ||
tokenAddress: "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", | ||
}, nil | ||
} | ||
if chainID == 8453 && token.String() == "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb" { | ||
return immutableTokenImpl{ | ||
tokenID: "DAI", | ||
decimals: 18, | ||
tokenAddress: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", | ||
}, nil | ||
} | ||
if chainID == 10 && token.String() == "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9" { | ||
return immutableTokenImpl{ | ||
tokenID: "sUSD", | ||
decimals: 18, | ||
tokenAddress: "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9", | ||
}, nil | ||
} | ||
Comment on lines
+60
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
key := fmt.Sprintf("token_%d_%s", chainID, token.Hex()) | ||
if data, ok := t.tokenCache.Get(key); ok { | ||
return data, nil | ||
|
@@ -74,6 +106,31 @@ | |
|
||
// GetPoolTokenData attempts to get pool token data from the cache otherwise it is fetched from the erc20 interface for that token. | ||
func (t *tokenDataServiceImpl) GetPoolTokenData(ctx context.Context, chainID uint32, token common.Address, swapService fetcher.SwapService) (ImmutableTokenData, error) { | ||
// Hotfix for tokens not on bridge config. | ||
// Handle CRVUSDC | ||
if chainID == 8453 && token.String() == "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93" { | ||
return immutableTokenImpl{ | ||
tokenID: "crvUSD", | ||
decimals: 18, | ||
tokenAddress: "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93", | ||
}, nil | ||
} | ||
|
||
// Handle USDbC | ||
if chainID == 8453 && token.String() == "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" { | ||
return immutableTokenImpl{ | ||
tokenID: "USDbC", | ||
decimals: 6, | ||
tokenAddress: "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", | ||
}, nil | ||
} | ||
if chainID == 8453 && token.String() == "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb" { | ||
return immutableTokenImpl{ | ||
tokenID: "DAI", | ||
decimals: 18, | ||
tokenAddress: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", | ||
}, nil | ||
} | ||
key := fmt.Sprintf("token_%d_%s", chainID, token.Hex()) | ||
if data, ok := t.tokenCache.Get(key); ok { | ||
return data, nil | ||
|
@@ -91,6 +148,31 @@ | |
|
||
// GetCCTPTokenData attempts to get cctp token data from the cache otherwise it is fetched using the cctp ref. | ||
func (t *tokenDataServiceImpl) GetCCTPTokenData(ctx context.Context, chainID uint32, token common.Address, cctpService fetcher.CCTPService) (ImmutableTokenData, error) { | ||
// Hotfix for tokens not on bridge config. | ||
// Handle CRVUSDC | ||
if chainID == 8453 && token.String() == "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93" { | ||
return immutableTokenImpl{ | ||
tokenID: "crvUSD", | ||
decimals: 18, | ||
tokenAddress: "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93", | ||
}, nil | ||
} | ||
|
||
// Handle USDbC | ||
if chainID == 8453 && token.String() == "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" { | ||
return immutableTokenImpl{ | ||
tokenID: "USDbC", | ||
decimals: 6, | ||
tokenAddress: "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", | ||
}, nil | ||
} | ||
if chainID == 8453 && token.String() == "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb" { | ||
return immutableTokenImpl{ | ||
tokenID: "DAI", | ||
decimals: 18, | ||
tokenAddress: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", | ||
}, nil | ||
} | ||
key := fmt.Sprintf("token_%d_%s", chainID, token.Hex()) | ||
if data, ok := t.tokenCache.Get(key); ok { | ||
return data, nil | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ PLS: 'plutusdao' | |
NOTE: 'note' | ||
PEPE: 'pepe' | ||
UNIDX: 'unidex' | ||
USDbC: 'usd-coin' | ||
crvUSD: 'usd-coin' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ nusd: 'usd-coin' | |
m.usdc: 'usd-coin' | ||
pepe: 'pepe' | ||
unidx: 'unidex' | ||
usdbc: 'usd-coin' | ||
crvusd: 'usd-coin' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,5 @@ dai.e: 'DAI' | |
note: 'NOTE' | ||
pepe: 'PEPE' | ||
unidx: 'UNIDX' | ||
usdbc: 'usd-coin' | ||
crvusd: 'usd-coin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the
RPCURL
check in theIsValid
method of theChainConfig
type implies thatRPCURL
is no longer required for a chain configuration to be considered valid. Ensure that this change is intentional and that all dependent services can handle a missingRPCURL
without issues.