Skip to content

Commit

Permalink
Merge branch 'develop' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Oct 23, 2024
2 parents 082d117 + 8a33694 commit 000f277
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/explorer-backend/src/Db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ class Db {
await this.db.query(
'CREATE INDEX IF NOT EXISTS idx_transfers_reorged_null ON transfers ((1)) WHERE reorged IS NULL;'
)

await this.db.query(
'CREATE INDEX IF NOT EXISTS idx_transfers_bond_transaction_hash ON transfers (bond_transaction_hash);'
)
}

async getPrices () {
Expand Down Expand Up @@ -590,7 +594,7 @@ class Db {
}

if (transferId) {
whereClauses.push(`(transfer_id = $${i} OR transaction_hash = $${i})`)
whereClauses.push(`(transfer_id = $${i} OR transaction_hash = $${i} OR bond_transaction_hash = $${i})`)
queryParams.push(transferId)
i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function PoolRow (props: Props) {
<Typography variant="body2" color="secondary" title="Tokens in pool">
{isPoolDeprecated ? <DeprecatedBadge badgeContent="Deprecated" color="warning" title="This pool is deprecated and only withdrawals are allowed.">{poolSubtitle}</DeprecatedBadge> : (

poolSubtitle?.includes('Pol ') ? <RebrandedBadge badgeContent="prev. MATIC" color="info" title="The token symbol has been rebranded">{poolSubtitle}</RebrandedBadge> : poolSubtitle
poolSubtitle?.includes('POL ') ? <RebrandedBadge badgeContent="prev. MATIC" color="info" title="The token symbol has been rebranded">{poolSubtitle}</RebrandedBadge> : poolSubtitle

)}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function usePools () {
const tokenImage = getTokenImage(tokenModel.symbol)
let tokenSymbolDisplay = token
if (tokenSymbolDisplay === TokenSymbol.MATIC && chainModel.slug === ChainSlug.Polygon) {
tokenSymbolDisplay = 'Pol'
tokenSymbolDisplay = 'POL'
}
const poolName = `${tokenSymbolDisplay} ${chainModel.name} Pool`
const poolSubtitle = `${tokenSymbolDisplay} - h${token}`
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hop-protocol/sdk",
"version": "0.0.39",
"version": "0.0.41",
"description": "The v1 Hop Protocol TypeScript SDK",
"author": "Authereum Labs, Inc.",
"license": "MIT",
Expand Down
12 changes: 9 additions & 3 deletions packages/sdk/src/HopBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ export class HopBridge extends Base {
estimatedReceived = BigNumber.from(0)
}

const availableLiquidity = await this.#getAvailableLiquidityCctp(sourceChain)
const availableLiquidity = await this.#getAvailableLiquidityCctp(sourceChain, destinationChain)
const isLiquidityAvailable = availableLiquidity.gte(amountIn)
const lpFeeBps = BigNumber.from(0)
const requiredLiquidity = amountIn
Expand Down Expand Up @@ -1655,13 +1655,19 @@ export class HopBridge extends Base {
}

async #getAvailableLiquidityCctp (
sourceChain: TChain
sourceChain: TChain,
destinationChain: TChain
): Promise<BigNumber> {
const isEnabled = await this.getIsCctpEnabled()
if (!isEnabled) {
return BigNumber.from(0)
}

destinationChain = this.toChainModel(destinationChain)
if (ChainSlug.Polygon === destinationChain.slug) {
return BigNumber.from(0)
}

sourceChain = this.toChainModel(sourceChain)

const sourceChainProvider = this.getChainProvider(sourceChain)
Expand Down Expand Up @@ -1692,7 +1698,7 @@ export class HopBridge extends Base {
}

if (this.getShouldUseCctpBridge({isHTokenSend})) {
return this.#getAvailableLiquidityCctp(sourceChain)
return this.#getAvailableLiquidityCctp(sourceChain, destinationChain)
}

sourceChain = this.toChainModel(sourceChain)
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/src/priceFeed/PriceFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class PriceFeed {
WETH: 'ETH',
WMATIC: 'MATIC',
WXDAI: 'DAI',
XDAI: 'DAI'
XDAI: 'DAI',
WPOL: 'MATIC'
}

constructor (apiKeysMap: PriceFeedApiKeys = {}) {
Expand Down
1 change: 1 addition & 0 deletions packages/stats-worker/src/YieldStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class YieldStats {
for (const chain in (this.bridges as any)[token]) {
const shouldSkip = this.shouldSkipYields(this.bridges, chain, token)
if (shouldSkip) {
console.log(`skipping ${chain}.${token}`)
continue
}

Expand Down

0 comments on commit 000f277

Please sign in to comment.