-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷♂️✨ sdeUSD lev data switch to odos & slippage update (#525)
* sdeUSD lev data switch to odos & slippage update * update sdeUSD delev swapper
- Loading branch information
1 parent
4396af1
commit c8b9d10
Showing
7 changed files
with
168 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
export default [ | ||
{ inputs: [], stateMutability: "nonpayable", type: "constructor" }, | ||
{ inputs: [], name: "ErrSwapFailed", type: "error" }, | ||
{ | ||
inputs: [], | ||
name: "BALANCER_QUERY", | ||
outputs: [ | ||
{ internalType: "contract IBalancerQuery", name: "", type: "address" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "BALANCER_SWAPS", | ||
outputs: [ | ||
{ internalType: "contract IBalancerSwaps", name: "", type: "address" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "BALANCER_VAULT", | ||
outputs: [{ internalType: "address", name: "", type: "address" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "BOX", | ||
outputs: [ | ||
{ internalType: "contract IBentoBoxLite", name: "", type: "address" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "DEUSD", | ||
outputs: [{ internalType: "address", name: "", type: "address" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "MIM", | ||
outputs: [{ internalType: "address", name: "", type: "address" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "POOL_ID", | ||
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "SDEUSD", | ||
outputs: [{ internalType: "address", name: "", type: "address" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "SWAP_KIND", | ||
outputs: [{ internalType: "enum SwapKind", name: "", type: "uint8" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [ | ||
{ internalType: "uint256", name: "amountSDEUSD", type: "uint256" }, | ||
], | ||
name: "previewSDEUSDOut", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [ | ||
{ internalType: "address", name: "", type: "address" }, | ||
{ internalType: "address", name: "", type: "address" }, | ||
{ internalType: "address", name: "recipient", type: "address" }, | ||
{ internalType: "uint256", name: "shareToMin", type: "uint256" }, | ||
{ internalType: "uint256", name: "shareFrom", type: "uint256" }, | ||
{ internalType: "bytes", name: "data", type: "bytes" }, | ||
], | ||
name: "swap", | ||
outputs: [ | ||
{ internalType: "uint256", name: "extraShare", type: "uint256" }, | ||
{ internalType: "uint256", name: "shareReturned", type: "uint256" }, | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
]; |
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
37 changes: 37 additions & 0 deletions
37
src/helpers/cauldron/cook/0xSwapData/leverage/fetchLevSdeusdSwapData.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,37 @@ | ||
import { utils } from "ethers"; | ||
import { swapOdosRequest } from "@/helpers/odos"; | ||
|
||
import type { CauldronInfo } from "@/helpers/cauldron/types"; | ||
import type { BigNumber } from "ethers"; | ||
import type { Address } from "viem"; | ||
|
||
const deUSDAddress = "0x15700B564Ca08D9439C58cA5053166E8317aa138"; | ||
|
||
const fetchLevSdeusdSwapData = async ( | ||
cauldronObject: CauldronInfo, | ||
collateralAmount: BigNumber, | ||
slipage: number | ||
) => { | ||
// @ts-ignore | ||
const { mim, leverageSwapper } = cauldronObject.contracts; | ||
|
||
const buyToken = deUSDAddress; | ||
|
||
const swapResponse = await swapOdosRequest( | ||
cauldronObject.config.chainId, | ||
buyToken, | ||
mim.address as Address, | ||
slipage, | ||
// @ts-ignore | ||
collateralAmount, | ||
leverageSwapper!.address as Address | ||
); | ||
|
||
return utils.defaultAbiCoder.encode( | ||
["address", "bytes"], | ||
// @ts-ignore | ||
[swapResponse.to, swapResponse.data] | ||
); | ||
}; | ||
|
||
export default fetchLevSdeusdSwapData; |
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