Skip to content

Commit

Permalink
feat: Mainnet close position (#60)
Browse files Browse the repository at this point in the history
* feat: mainnet close position

* Remove optionality

---------

Co-authored-by: peiman666 <[email protected]>
Co-authored-by: Noisekit <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent 0b49a23 commit a6a8736
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions liquidity/lib/contracts/importers/importClosePosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ const abi = [
export async function importClosePosition(chainId, preset) {
const deployment = `${Number(chainId).toFixed(0)}-${preset}`;
switch (deployment) {
case '1-main': {
// https://etherscan.io/address/0x800b12d24ebb639bce7280861b05149f0d60f99e#code
return { address: '0x800b12d24ebb639bce7280861b05149f0d60f99e', abi };
}
case '11155111-main': {
// https://sepolia.etherscan.io/address/0xcc998ef6d1923f206be1fed700eb1afebd69fbce#code
return { address: '0xcc998ef6d1923f206be1fed700eb1afebd69fbce', abi };
}
case '42161-main': {
// https://arbiscan.io/address/0x28551921507790D91260d8eD08E3D688d525A752#code
return { address: '0x28551921507790D91260d8eD08E3D688d525A752', abi };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export function ClosePositionOneStep({

return (
<Flex flexDirection="column" data-cy="close position multistep">
<Text color="gray.50" fontSize="sm" fontWeight="700">
<Text color="gray.50" fontSize="20px" fontWeight={700}>
<ArrowBackIcon cursor="pointer" onClick={onBack} mr={2} />
Close Position
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export const ClosePositionTransactions: FC<{

return (
<Flex flexDirection="column" data-cy="close position multistep">
<Text color="gray.50" fontSize="sm" fontWeight="700">
<Text color="gray.50" fontSize="20px" fontWeight={700}>
<ArrowBackIcon cursor="pointer" onClick={onBack} mr={2} />
Close Position
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ export async function fetchPriceUpdateTxn({
PythVerfier: { address: string; abi: string[] };
pythFeeds: string[];
}) {
if (!pythFeeds.length) {
return {
target: PythVerfier.address,
callData: ethers.constants.HashZero,
value: ethers.BigNumber.from(0),
requireSuccess: false,
};
}
const PythVerifierInterface = new ethers.utils.Interface(PythVerfier.abi);
const priceService = new EvmPriceServiceConnection(offchainMainnetEndpoint);
const signedOffchainData = await priceService.getPriceFeedsUpdateData(pythFeeds);
Expand Down

0 comments on commit a6a8736

Please sign in to comment.