-
Build the Solidity contracts using forge b.
-
Copy the generated Solidity JSON from the out folder to the src\contracts directory.
-
Run TypeChain to import contracts and target ethers v5 using either PowerShell or cmd
- & 'K:\Development\Ethereum\UniswapHook Donations UI\node_modules.bin\typechain.ps1' --target ethers-v5 --out-dir src/contracts './src/json/*.json'
- node_modules.bin\typechain.cmd --target=ethers-v5 --out-dir src\contracts src\json*.json
-
Deploy the contracts using "forge.exe script AfterSwapHookDonationDeployScript --rpc-url $env:DEPLOY_URL --private-key $env:FOUNDRY_PRIVATE_KEY --broadcast --gas-price 10000000000000000000 -vvv --slow" in PowerShell.
-
Update the various constants in src\Constants.tsx from the output generated while deploying the contract.
-
Run "npm run build" to build the UI.
How to read various values from the Solidity contract on-chain.
let donationEnabledProperty = donationHookContract['donationEnabled()'];
let donationEnabled = await donationEnabledProperty();
let donationPercentProperty = donationHookContract['donationPercent()'];
const donationPercent = await donationPercentProperty();
let donationRecipientProperty = donationHookContract['donationRecipient()'];
const donationRecipient = await donationRecipientProperty();
let contractOwner = await donationHookContract.owner();