Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions src/routes/reservecoin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function ReserveCoin() {
).then((res) => setBuyValidity(res));
}
} catch (error) {
console.log("error", error);

}
};
getTradeData();
Expand Down Expand Up @@ -204,7 +204,6 @@ export default function ReserveCoin() {
).then((res) => setSellValidity(res));
}
} catch (error) {
console.log("error", error);
}
};
getTradeData();
Expand All @@ -221,48 +220,39 @@ export default function ReserveCoin() {
};

const buyRc = (total) => {
console.log("Attempting to buy RC for", total);
setTxStatus("pending");
// TODO: pass to buyRcTx a parameter to enforce gasLimit if we are using WSC
promiseTx(isWalletConnected, buyRcTx(djedContract, account, total), signer)
.then(({ hash }) => {
verifyTx(web3, hash).then((res) => {
if (res) {
console.log("Buy RC success!");
setTxStatus("success");
} else {
console.log("Buy RC reverted!");
setTxError("The transaction reverted.");
setTxStatus("rejected");
}
});
})
.catch((err) => {
console.error("Error:", err.message);
setTxStatus("rejected");
setTxError("MetaMask error. See developer console for details.");
});
};

const sellRc = (amount) => {
console.log("Attempting to sell RC in amount", amount);
setTxStatus("pending");
promiseTx(isWalletConnected, sellRcTx(djedContract, account, amount), signer)
.then(({ hash }) => {
verifyTx(web3, hash).then((res) => {
console.log(hash, "hash");
if (res) {
console.log("Sell RC success!", hash);
setTxStatus("success");
} else {
console.log("Sell RC reverted!");
setTxError("The transaction reverted.");
setTxStatus("rejected");
}
});
})
.catch((err) => {
console.error("Error:", err.message);
setTxStatus("rejected");
setTxError("MetaMask error. See developer console for details.");
});
Expand Down
10 changes: 0 additions & 10 deletions src/routes/stablecoin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export default function Stablecoin() {
});
}
} catch (error) {
console.log("error", error);
}
};
getTradeData();
Expand Down Expand Up @@ -182,7 +181,6 @@ export default function Stablecoin() {
);
}
} catch (error) {
console.log("error", error);
}
};
getTradeData();
Expand All @@ -198,46 +196,38 @@ export default function Stablecoin() {
};

const buySc = (total) => {
console.log("Attempting to buy SC for", total);
setTxStatus("pending");
promiseTx(isWalletConnected, buyScTx(djedContract, account, total), signer)
.then(({ hash }) => {
verifyTx(web3, hash).then((res) => {
if (res) {
console.log("Buy SC success!");
setTxStatus("success");
} else {
console.log("Buy SC reverted!");
setTxError("The transaction reverted.");
setTxStatus("rejected");
}
});
})
.catch((err) => {
console.error("Buy SC error:", err.message);
setTxStatus("rejected");
setTxError("MetaMask error. See developer console for details.");
});
};

const sellSc = (amount) => {
console.log("Attempting to sell SC in amount", amount);
setTxStatus("pending");
promiseTx(isWalletConnected, sellScTx(djedContract, account, amount), signer)
.then(({ hash }) => {
verifyTx(web3, hash).then((res) => {
if (res) {
console.log("Sell SC success!");
setTxStatus("success");
} else {
console.log("Sell SC reverted!");
setTxError("The transaction reverted.");
setTxStatus("rejected");
}
});
})
.catch((err) => {
console.error("Sell SC error:", err.message);
setTxStatus("rejected");
setTxError("MetaMask error. See developer console for details.");
});
Expand Down
6 changes: 0 additions & 6 deletions src/utils/ethereum.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ const getFees = async (djed) => {
fee
};
} catch (error) {
console.log("error", error);
}
};

Expand Down Expand Up @@ -363,7 +362,6 @@ export const tradeDataPriceBuyRc = async (djed, rcDecimals, amountScaled) => {
totalBCUnscaled
};
} catch (error) {
console.log("error", error);
}
};

Expand Down Expand Up @@ -391,7 +389,6 @@ export const tradeDataPriceSellRc = async (djed, rcDecimals, amountScaled) => {
totalBCUnscaled: totalBCAmount.toString()
};
} catch (error) {
console.log("error", error);
}
};

Expand Down Expand Up @@ -442,7 +439,6 @@ export const tradeDataPriceBuySc = async (djed, scDecimals, amountScaled) => {
totalBCUnscaled
};
} catch (error) {
console.log("error", error);
}
};

Expand Down Expand Up @@ -470,7 +466,6 @@ export const tradeDataPriceSellSc = async (djed, scDecimals, amountScaled) => {
totalBCScaled: decimalScaling(totalBCAmount.toString(), BC_DECIMALS)
};
} catch (error) {
console.log("error", error);
}
};

Expand Down Expand Up @@ -593,6 +588,5 @@ export const calculateFutureScPrice = async ({
: futurePrice.toString();
}
} catch (error) {
console.log("calculateFutureScPrice error ", error);
}
};