Skip to content

Commit

Permalink
fix: problem on delegatee
Browse files Browse the repository at this point in the history
  • Loading branch information
trmaphi committed Jun 14, 2024
1 parent 41a7631 commit 8ec304f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/backend/BrownFi.mo
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ shared(msg) actor class BrownFi(owner_ : Principal, bfId: Principal, capId_: Pri
var realUser: Principal = msg.caller;
switch (await getDelegatee(msg.caller)) {
case (?delegatee) { realUser := delegatee; };
case (_) { return #err("Delegatee not found")};
case (_) { realUser := realUser; };
};
if (tokens.balanceOf(qtid, realUser) < (pAmount)) return #err("Insufficient balance: " # qtid);
if (tokens.zeroFeeTransfer(qtid, realUser, Principal.fromActor(this), pAmount) == false)
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/components/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function Swap() {
args: [
Principal.fromText((tokens.INPUT as TokenDetails).address),
Principal.fromText((tokens.OUTPUT as TokenDetails).address),
BigInt(tokenAmounts[Field.INPUT]) * (BigInt(10) ** BigInt((tokens.INPUT as TokenDetails).decimals)),
BigInt(tokenAmounts[Field.INPUT]),
BigInt("1741447837000000000")
]
});
Expand All @@ -123,7 +123,7 @@ function Swap() {
console.error(error)
setStatus("fail")
})

setStatus("loading")
};

Expand All @@ -138,7 +138,7 @@ function Swap() {
<div className="flex w-full flex-col items-center gap-2">
<div className="flex flex-col items-start gap-5 self-stretch bg-[#131216] p-4 self-stretch">
<div className="flex justify-between items-center self-stretch">
{tokens.INPUT && (<span className="text-base font-medium">{tokens.INPUT.symbol}</span>)}
{tokens.INPUT && (<span className="text-base font-medium">{tokens.INPUT.symbol}</span>)}
<span className="text-lg font-normal text-white font-['Russo_One']">You Pay</span>
<div className="flex items-center gap-1 text-base font-normal">
<span>Balance:</span>
Expand Down Expand Up @@ -175,7 +175,7 @@ function Swap() {
/>
<div className="flex flex-col items-start gap-5 self-stretch bg-[#131216] p-4">
<div className="flex justify-between items-center self-stretch">
{tokens.OUTPUT && (<span className="text-base font-medium">{tokens.OUTPUT.symbol}</span>)}
{tokens.OUTPUT && (<span className="text-base font-medium">{tokens.OUTPUT.symbol}</span>)}
<span className="text-lg font-normal text-white font-['Russo_One']">Your Receive</span>
<div className="flex items-center gap-1 text-base font-normal">
<span>Balance:</span>
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/hooks/usePositions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { useAuth } from "@ic-reactor/react";
import { useEffect } from "react";
import { useCoreQueryCall } from "./coreActor";
import { PositionDetails } from "../model/pools";
import { Principal } from "@dfinity/principal";

export function usePositions() {
const { authenticated, identity } = useAuth();

const { call, data, error, loading } = useCoreQueryCall({
functionName: "getPairListByCreator",
args: [identity?.getPrincipal()],
args: [Principal.fromText("medlw-2c5pb-n4eht-4f3js-vtrp7-2juyk-smdl5-xitl6-x7ezi-dm5wx-cae")],
refetchInterval: 100_000,
refetchOnMount: true,
})
Expand Down

0 comments on commit 8ec304f

Please sign in to comment.