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(mfi-v2-trading): added config for flashloan actionbox platform fee #923

Merged
merged 2 commits into from
Oct 24, 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
1 change: 0 additions & 1 deletion apps/marginfi-v2-trading/src/utils/tradingActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export async function executeLeverageAction({
}
}

console.log("loopingObject", loopingObject);
try {
if (loopingObject.loopingTxn) {
let txnSig: string[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export function useLoopSimulation({
setIsLoading,
setMaxLeverage,
}: LoopSimulationProps) {
const [slippageBps, priorityFee] = useActionBoxStore((state) => [state.slippageBps, state.priorityFee]);
const [slippageBps, priorityFee, platformFeeBps] = useActionBoxStore((state) => [
state.slippageBps,
state.priorityFee,
state.platformFeeBps,
]);

const prevDebouncedAmount = usePrevious(debouncedAmount);
const prevDebouncedLeverage = usePrevious(debouncedLeverage);
Expand Down Expand Up @@ -142,7 +146,8 @@ export function useLoopSimulation({
amount,
slippageBps,
marginfiClient.provider.connection,
0 //priorityFee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why no priority fee here? Arent you importing that from the actionboxstore too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priority fee isn't used anymore, we only use bundletip

0,
platformFeeBps
);

if (loopingObject && "loopingTxn" in loopingObject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export async function calculateLooping(
amount: number,
slippageBps: number,
connection: Connection,
priorityFee: number
priorityFee: number,
platformFeeBps: number
): Promise<LoopingObject | ActionMethod> {
// TODO setup logging again
// capture("looper", {
Expand All @@ -84,6 +85,7 @@ export async function calculateLooping(
slippageBps,
connection,
priorityFee,
platformFeeBps,
});

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ export function useRepayCollatSimulation({
setIsLoading,
setMaxAmountCollateral,
}: RepayCollatSimulationProps) {
const [slippageBps, priorityFee] = useActionBoxStore((state) => [state.slippageBps, state.priorityFee]);
const [slippageBps, priorityFee, platformFeeBps] = useActionBoxStore((state) => [
state.slippageBps,
state.priorityFee,
state.platformFeeBps,
]);

const prevDebouncedAmount = usePrevious(debouncedAmount);
const prevSelectedSecondaryBank = usePrevious(selectedSecondaryBank);
Expand Down Expand Up @@ -119,7 +123,8 @@ export function useRepayCollatSimulation({
amount,
slippageBps,
marginfiClient.provider.connection,
0 //priorityFee
0, //priorityFee,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

platformFeeBps
);

if (repayObject && "repayTxn" in repayObject) {
Expand Down Expand Up @@ -153,6 +158,7 @@ export function useRepayCollatSimulation({
setActionTxns,
setSimulationResult,
slippageBps,
platformFeeBps,
setRepayAmount,
setErrorMessage,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export async function calculateRepayCollateral(
amount: number,
slippageBps: number,
connection: Connection,
priorityFee: number
priorityFee: number,
platformFeeBps: number
): Promise<
| {
repayTxn: VersionedTransaction;
Expand All @@ -89,7 +90,8 @@ export async function calculateRepayCollateral(
amount,
slippageBps,
connection,
priorityFee
priorityFee,
platformFeeBps
);

return result;
Expand Down
Loading