Update Exchange.js
This commit is contained in:
10
packages/react-app/src/components/Exchange.js
vendored
10
packages/react-app/src/components/Exchange.js
vendored
@@ -14,6 +14,16 @@ import styles from "../styles";
|
|||||||
|
|
||||||
const Exchange = ({ pools }) => {
|
const Exchange = ({ pools }) => {
|
||||||
const { account } = useEthers();
|
const { account } = useEthers();
|
||||||
|
const [fromValue, setFromValue] = useState("0");
|
||||||
|
const [fromToken, setFromToken] = useState(pools[0].token0Address);
|
||||||
|
const [toToken, setToToken] = useState("");
|
||||||
|
const [resetState, setResetState] = useState(false)
|
||||||
|
|
||||||
|
const fromValueBigNumber = parseUnits(fromValue || "0");
|
||||||
|
const availableTokens = getAvailableTokens(pools); //What tokens can we swap from?
|
||||||
|
const counterpartTokens = getCounterpartTokens(pools, fromToken); //What tokens can we swap to?
|
||||||
|
const pairAddress = findPoolByTokens(pools, fromToken, toToken)?.address ?? ""; //find a pair address ot that liquidity pair
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const isApproving = isOperationPending(swapApproveState);
|
const isApproving = isOperationPending(swapApproveState);
|
||||||
|
|||||||
Reference in New Issue
Block a user