-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close position UI, fix for NotEnoughAllowance (#57)
* Adjust allowance to be at least $1 and 150% * Wait a bit * Fetch fresh debt when closing position to get accurate allowance * No need to wait * Bump timeouts * Dont auto-close transaction errors * Record test videos * Lint harder
- Loading branch information
Showing
14 changed files
with
84 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
liquidity/ui/src/components/ClosePosition/fetchPriceUpdateTxn.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { EvmPriceServiceConnection } from '@pythnetwork/pyth-evm-js'; | ||
import { ethers } from 'ethers'; | ||
import { offchainMainnetEndpoint } from '@snx-v3/constants'; | ||
|
||
export async function fetchPriceUpdateTxn({ | ||
PythVerfier, | ||
pythFeeds, | ||
}: { | ||
PythVerfier: { address: string; abi: string[] }; | ||
pythFeeds: string[]; | ||
}) { | ||
const PythVerifierInterface = new ethers.utils.Interface(PythVerfier.abi); | ||
const priceService = new EvmPriceServiceConnection(offchainMainnetEndpoint); | ||
const signedOffchainData = await priceService.getPriceFeedsUpdateData(pythFeeds); | ||
const priceUpdateTxn = { | ||
target: PythVerfier.address, | ||
callData: PythVerifierInterface.encodeFunctionData('updatePriceFeeds', [signedOffchainData]), | ||
value: ethers.BigNumber.from(pythFeeds.length), | ||
requireSuccess: false, | ||
}; | ||
return priceUpdateTxn; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters