Skip to content

Commit

Permalink
Merge pull request #63 from studydefi/swap-collateral-enhance
Browse files Browse the repository at this point in the history
Swap collateral 100%
  • Loading branch information
adrianmcli authored Apr 8, 2020
2 parents d5c2b3f + 456578b commit 4be7b45
Show file tree
Hide file tree
Showing 57 changed files with 60,041 additions and 60,369 deletions.
10 changes: 0 additions & 10 deletions packages/frontend/features/swap-tokens/SwapConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ const SwapConfirm = ({
<Icon name="Launch" color={outline ? "primary" : "white"} ml="2" />
</Flex>
</MyButton>
{thingToSwap === "collateral" && (
<>
<Text fontSize="0" color="#999" fontWeight="bold" mt="2">
Due to nature of slippages:
</Text>
<Text fontSize="0" color="#999">
MAX: 95% (90% recommended)
</Text>
</>
)}

<Modal isOpen={isOpen}>
<Card width={"640px"} p={0}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CompoundPositions from "../../containers/CompoundPositions";
const useIsAmountAvailable = (
amount: string,
tokenStr: string,
thingToSwap: string,
thingToSwap: string
) => {
const { compoundPositions } = CompoundPositions.useContainer();

Expand All @@ -17,7 +17,7 @@ const useIsAmountAvailable = (
const canSwapAmount =
thingToSwap === "debt"
? parseFloat(tokenBalance.borrow)
: 0.95 * parseFloat(tokenBalance.supply);
: parseFloat(tokenBalance.supply);

const result = parseFloat(amount) <= canSwapAmount;

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/features/swap-tokens/useSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const useSwap = (thingToSwap, fromTokenStr, toTokenStr, amountToSwap) => {
let tx = null;

try {
await swapDebt(
tx = await swapDebt(
ADDRESS_MAP[fromTokenStr],
ADDRESS_MAP[toTokenStr],
amount
Expand Down
Loading

1 comment on commit 4be7b45

@vercel
Copy link

@vercel vercel bot commented on 4be7b45 Apr 8, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.