Skip to content

Commit

Permalink
feat: modifyi lib version, modify modified lib function usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Polybius93 committed Nov 21, 2024
1 parent fd97e61 commit 87df90c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"concurrently": "^8.2.2",
"d3": "^7.9.0",
"decimal.js": "^10.4.3",
"dlc-btc-lib": "2.4.12",
"dlc-btc-lib": "2.4.17",
"dotenv": "^16.3.1",
"ethers": "5.7.2",
"formik": "^2.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HStack, Text, VStack } from '@chakra-ui/react';
import { Vault } from '@models/vault';
import Decimal from 'decimal.js';
import { getFeeAmount } from 'dlc-btc-lib/bitcoin-functions';
import { shiftValue, unshiftValue } from 'dlc-btc-lib/utilities';

interface TransactionFormProtocolFeeStackProps {
flow: 'mint' | 'burn';
Expand Down Expand Up @@ -37,8 +38,9 @@ export function TransactionFormProtocolFeeStack({

const amount =
flow === 'burn' && currentStep === 1
? new Decimal(vault.valueLocked).minus(vault.valueMinted).toNumber()
: assetAmount;
? shiftValue(new Decimal(vault.valueLocked).minus(vault.valueMinted).toNumber())
: shiftValue(assetAmount!);

return (
<VStack
alignItems={'end'}
Expand All @@ -53,15 +55,15 @@ export function TransactionFormProtocolFeeStack({
Protocol Fee
</Text>
<Text color={'white.01'} fontSize={'xs'} fontWeight={800}>
{`${amount && protocolFeeBasisPoints ? getFeeAmount(amount, protocolFeeBasisPoints) : 0}
{`${amount && protocolFeeBasisPoints ? unshiftValue(getFeeAmount(amount, protocolFeeBasisPoints)) : 0}
BTC`}
</Text>{' '}
</HStack>
<Text color={'white.02'} fontSize={'xs'}>
{`~
${
assetAmount && bitcoinPrice && protocolFeeBasisPoints
? calculateProtocolFeeInUSD(assetAmount, bitcoinPrice, protocolFeeBasisPoints)
? calculateProtocolFeeInUSD(amount, bitcoinPrice, protocolFeeBasisPoints)
: 0
}
$`}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5195,10 +5195,10 @@ dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

[email protected].12:
version "2.4.12"
resolved "https://registry.yarnpkg.com/dlc-btc-lib/-/dlc-btc-lib-2.4.12.tgz#ee206d2ebfa3fe73b9c51cc565d1f5c102b99f22"
integrity sha512-HE6xYFfKRnRp16jRcDhDCmIgcOGfjKWoiQmY2//E8G6Z+VYsJaXsojZmD5M+uMOSQ7B3pwR+MpyURwNNrzKQgQ==
[email protected].17:
version "2.4.17"
resolved "https://registry.yarnpkg.com/dlc-btc-lib/-/dlc-btc-lib-2.4.17.tgz#44ff9dab788562cfa08ad299f65b275f7f7f5ff4"
integrity sha512-8gzJ40MttJHHtO8i0+qMoEtltVCwQ6U7y76w93lI/7jvVs4fBu+HlQvFtmfboNBJF1uAsoO1Hic5W6OzVlIrgQ==
dependencies:
"@gemwallet/api" "3.8.0"
"@ledgerhq/hw-app-btc" "10.4.1"
Expand Down

0 comments on commit 87df90c

Please sign in to comment.