adding filter for valid deposits

This commit is contained in:
Bruno
2022-12-16 01:19:08 -03:00
parent a1c27c3da6
commit c4b74309cc
5 changed files with 76 additions and 32 deletions

View File

@@ -9,7 +9,7 @@ import blockchain from "../utils/blockchain";
// Store reference
const etherStore = useEtherStore();
const { walletAddress, depositsAddedList } = storeToRefs(etherStore);
const { walletAddress, depositsValidList } = storeToRefs(etherStore);
// Reactive state
const tokenValue = ref(0);
@@ -59,14 +59,13 @@ const verifyLiquidity = () => {
selectedDeposit.value = null;
if (!walletAddress.value || tokenValue.value <= 0) return;
depositsAddedList.value.find((element) => {
const p2pixTokenValue = Number(
blockchain.formatBigNumber(element.args.amount)
);
depositsValidList.value.find((element) => {
const remaining = element.remaining;
if (
tokenValue.value!! <= p2pixTokenValue &&
element.valid == true &&
tokenValue.value!! <= remaining &&
tokenValue.value!! != 0 &&
element.args.seller !== walletAddress.value
element.seller !== walletAddress.value
) {
enableSelectButton.value = true;
hasLiquidity.value = true;

View File

@@ -24,9 +24,9 @@ const formatWalletAddress = (): string => {
return `${initialText}...${finalText}`;
};
const formatWalletBalance = (): string => {
const fixed = balance.value.substring(0, 8);
return fixed;
const formatWalletBalance = (): String => {
const fixed = Number(balance.value);
return fixed.toFixed(2);
};
</script>