Skip to content
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

FIX: Discard ERC20 Synths for EVM aprovals #1078

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/chilled-hotels-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@xchainjs/xchain-mayachain-amm': minor
'@xchainjs/xchain-thorchain-amm': minor
---

Add validation that allows synthetics to be discarded from EVM approvals
2 changes: 1 addition & 1 deletion packages/xchain-mayachain-amm/src/mayachain-amm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export class MayachainAMM {
private isERC20Asset(asset: Asset): boolean {
// Check if the asset's chain is an EVM chain and if the symbol matches AssetETH.symbol
return this.isEVMChain(asset.chain)
? [AssetETH].findIndex((nativeEVMAsset) => eqAsset(nativeEVMAsset, asset)) === -1
? [AssetETH].findIndex((nativeEVMAsset) => eqAsset(nativeEVMAsset, asset)) === -1 && !asset.synth
: false
}

Expand Down
3 changes: 2 additions & 1 deletion packages/xchain-thorchain-amm/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const isProtocolEVMChain = (chain: Chain): boolean => {
*/
export const isProtocolERC20Asset = (asset: Asset): boolean => {
return isProtocolEVMChain(asset.chain)
? [AssetETH, AssetAVAX, AssetBSC].findIndex((nativeEVMAsset) => eqAsset(nativeEVMAsset, asset)) === -1
? [AssetETH, AssetAVAX, AssetBSC].findIndex((nativeEVMAsset) => eqAsset(nativeEVMAsset, asset)) === -1 &&
!asset.synth
: false
}

Expand Down
Loading