Change final transfer location. Add wrap/unwrap functionality

This commit is contained in:
lomonoshka
2023-10-30 19:54:47 +04:00
parent b3ed38890c
commit cdc3a78eb9
7 changed files with 213 additions and 178 deletions

View File

@@ -0,0 +1,32 @@
import { SwapExecutor__factory } from "@orionprotocol/contracts/lib/ethers-v6/index.js"
import type { BigNumberish } from "ethers"
import { type CallParams, addCallParams } from "./utils.js"
import type { AddressLike } from "ethers"
export function generateWrapAndTransferCall(
target: AddressLike,
callParams?: CallParams
) {
const executorInterface = SwapExecutor__factory.createInterface()
const calldata = executorInterface.encodeFunctionData('wrapAndTransfer', [
target,
])
return addCallParams(calldata, callParams)
}
export function generateUnwrapAndTransferCall(
target: AddressLike,
amount: BigNumberish,
callParams?: CallParams
) {
const executorInterface = SwapExecutor__factory.createInterface()
const calldata = executorInterface.encodeFunctionData('unwrapAndTransfer', [
target,
amount
])
return addCallParams(calldata, callParams)
}