Skip to content

Commit

Permalink
fix: added config for flashloan actionbox platform fee
Browse files Browse the repository at this point in the history
  • Loading branch information
k0beLeenders committed Oct 21, 2024
1 parent 985032a commit 7769557
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
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
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 @@ -53,7 +53,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 @@ -120,7 +124,8 @@ export function useRepayCollatSimulation({
amount,
slippageBps,
marginfiClient.provider.connection,
0 //priorityFee
0, //priorityFee,
platformFeeBps
);

if (repayObject && "repayTxn" in repayObject) {
Expand Down Expand Up @@ -154,6 +159,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

0 comments on commit 7769557

Please sign in to comment.