From 39a0cf5f44b7c8481a4239978bc2179b8960ca95 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sat, 21 Jan 2023 15:18:57 -0800 Subject: [PATCH] adding hash and cleaning ui --- src/App.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/App.js b/src/App.js index a2c0c32..6c3b20a 100644 --- a/src/App.js +++ b/src/App.js @@ -35,7 +35,8 @@ function Contract() { winningAmount: 0, phraseSet: false, mintAmount: 1, - balance: 0 + balance: 0, + hash: '' }); function handleStateChange(obj) { setOptions(preState => ({...preState , ...obj})); @@ -49,6 +50,7 @@ function Contract() { {..._contract, functionName: 'winningAmount'}, {..._contract, functionName: 'phraseSet'}, {..._contract, functionName: 'balanceOf'}, + {..._contract, functionName: 'winningPhraseHash'}, ], watch: true, cacheTime: 8000, @@ -60,7 +62,8 @@ function Contract() { winners: Number(data[3]), winningAmount: Number(data[4]), phraseSet: Number(data[5]), - balance: Number(data[6]) + balance: Number(data[6]), + hash: data[7].toString() }); } }); @@ -68,11 +71,12 @@ function Contract() { if (isConnected) return ( <> +

Price: {ethers.utils.formatEther((options.price * options.mintAmount).toString())} ETH

- { + { if (v.target.value >= 0) handleStateChange({mintAmount: Number(v.target.value)})} }>
@@ -82,17 +86,16 @@ function Contract() {
-
- You'll have a ~{(options.balance + options.mintAmount) / options.max * 100}% chance to win 1 ETH -
- +

You'll have a ~{(options.balance + options.mintAmount) / options.max * 100}% chance to win 1 ETH

-

Connected to {address.slice(0,6) + '...' + address.slice(-4)}

-

You own {options.balance}

+

Connected to {address.slice(0,6) + '...' + address.slice(-4)} :: You own {options.balance} tokens

Minted {options.totalSupply} / {options.max}

+
+ The secret phrase containing the pre-determined winners is: {options.hash} +
) return @@ -108,7 +111,7 @@ function App() { A Few Of Us Are Going To Make It.

- An NFT Lottery. Mint a token for your chance to win 1 ETH. + An NFT Lottery. Mint a token for your chance to win 1 ETH. 10 tokens are pre-determined to win.