Skip to content

Commit

Permalink
token mint button & function
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostffcode committed Jul 12, 2022
1 parent 52a5502 commit 152af8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/react-app/src/views/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ const zero = ethers.BigNumber.from("0");
function Home({ tx, readContracts, address, writeContracts, mainnetProvider }) {
const [challengeAddresses, setChallengeAddresses] = useState([]);

console.log({ challengeAddresses });

const tokenBalance = ethers.utils.formatUnits(
useContractReader(readContracts, "Token", "balanceOf", [address]) || zero,
);
const tokenSymbol = useContractReader(readContracts, "Token", "symbol");
const stakes = useContractReader(readContracts, "Staking", "getStakeFor", [address]) || {};
const stakedBalance = ethers.utils.formatUnits(stakes.balance || zero);

const mintToken = async () => {
tx(writeContracts.Token.mintAmount(ethers.utils.parseUnits("100")));
};

const approve = async () => {
tx(writeContracts.Token.approve(readContracts.Staking.address, ethers.utils.parseUnits("10000000")));
};
Expand Down Expand Up @@ -66,6 +68,9 @@ function Home({ tx, readContracts, address, writeContracts, mainnetProvider }) {
<div style={{ marginTop: "20px" }}>
<Divider>Stake</Divider>
<div style={{ width: "100%" }}>
<Button style={{ marginRight: "10px" }} onClick={mintToken}>
Mint
</Button>
<Button style={{ marginRight: "10px" }} onClick={approve}>
Approve GTC
</Button>
Expand Down

0 comments on commit 152af8c

Please sign in to comment.