Search
Search

Transaction: 5qfgwaa...CJBX

Status
Succeeded
Transaction Fee
0.00132 
Deposit Value
0.00635 
Gas Used
13 Tgas
Attached Gas
300 Tgas
Created
November 09, 2023 at 9:11:02am
Hash
5qfgwaavV3ozNTKUBQ6khFj9ksbF2jWYtTuJ9kshCJBX

Actions

Called method: 'set' in contract: v1.social08.testnet
Arguments:
{ "data": { "manztech.testnet": { "widget": { "app.dummy-dao.components.NetworkSwitcher": { "": "import { Box, Button, Dialog, DialogContent, DialogTitle, Typography } from '@mui/material';\nimport React, { useEffect, useState } from 'react';\n\nexport function NetworkSwitcher() {\n const windowOverride = typeof window !== 'undefined' ? window : null;\n const [errorMessage, setErrorMessage] = useState(\"\");\n const [isEthereumAvailable, setIsEthereumAvailable] = useState(false);\n\n useEffect(() => {\n if (typeof window !== 'undefined' && 'ethereum' in window) {\n setIsEthereumAvailable(true);\n }\n }, [])\n\n const switchNetwork = async () => {\n try {\n // Prompt user to switch to Sepolia\n await windowOverride?.ethereum?.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: '0xaa36a7' }],\n });\n } catch (switchError) {\n setErrorMessage(switchError.message);\n }\n }\n\n if (isEthereumAvailable) {\n if (windowOverride?.ethereum?.networkVersion == \"11155111\") {\n // This component renders on all pages. If the network is Sepolia, render nothing\n return null;\n }\n } else {\n // If injected provider is not in use, do not render this modal by default\n return null;\n }\n\n return (\n <div>\n <Dialog open={true} aria-labelledby=\"network-switcher-title\">\n <DialogTitle className=\"center\" id=\"network-switcher-title\">\n Network Switcher\n </DialogTitle>\n <DialogContent>\n <Box display=\"flex\" flexDirection=\"column\" alignItems=\"center\" >\n <Typography variant=\"body1\">\n This dApp is deployed on Sepolia (Chain ID 11155111)\n </Typography>\n <Typography variant=\"body1\">\n You are currently connected to Chain ID {windowOverride?.ethereum?.networkVersion || \"N/A\"}\n </Typography>\n\n {switchNetwork && (\n <Box mt={2}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => switchNetwork()}\n >\n Switch to Sepolia\n </Button>\n </Box>\n )}\n <Box mt={2}>\n <Typography variant=\"body2\" color=\"error\">\n {errorMessage}\n </Typography>\n </Box>\n </Box>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n" }, "transactionMiddleware": { "": "const sender = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nif (!sender) return <Web3Connect connectLabel=\"Connect with Web3\" />;\nconst currentViewCounter = Storage.get(\"viewCounter\")\n\nconsole.log(currentViewCounter, 'storage')\n\nconst managerABI = [\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"txTarget\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256[]\",\n \"name\": \"campaignsTokenIds\",\n \"type\": \"uint256[]\"\n },\n {\n \"internalType\": \"uint256[]\",\n \"name\": \"campaignsViewedCounters\",\n \"type\": \"uint256[]\"\n },\n {\n \"internalType\": \"bytes\",\n \"name\": \"signature\",\n \"type\": \"bytes\"\n },\n {\n \"internalType\": \"bytes\",\n \"name\": \"functionData\",\n \"type\": \"bytes\"\n }\n ],\n \"name\": \"executionMiddleware\",\n \"outputs\": [\n {\n \"internalType\": \"bytes\",\n \"name\": \"\",\n \"type\": \"bytes\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n }\n]\n\n// Pass function call data thru props.calldata\n// pass contract call target address thru props.target\n// read ad view data\n// call executionMiddleware(\n// address txTarget,\n// address[] memory campaignsViewedAddresses,\n// uint256[] memory campaignsViewedCounters,\n// bytes memory signature,\n// bytes memory functionData\n// )\n// \nconst managerIface = new ethers.utils.Interface(managerABI);\n\nlet campaignIds = {}\nlet campaignCounts = {}\nif (currentViewCounter) {\n campaignIds = Object.keys(currentViewCounter).map(x => Number(x))\n campaignCounts = Object.values(currentViewCounter).map(x => Number(x))\n}\n\nconst execution = () => {\n console.log(props)\n try {\n const encoded = managerIface.encodeFunctionData(\"executionMiddleware\", [props.target, [campaignIds], [campaignCounts], (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32)), (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32))]);\n console.log('ADDRESSES', props.target, props.managerAddress, encoded)\n\n const managerContract = new ethers.Contract(\n props.managerAddress,\n managerABI,\n Ethers.provider().getSigner()\n );\n\n return managerContract.executionMiddleware(\n props.target,\n [campaignIds],\n [campaignCounts],\n (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32)),\n (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32)),\n {}\n ).then(returnData => {\n const decoded = managerIface.decodeFunctionResult(\n \"executionMiddleware\",\n returnData\n );\n console.log('RETURN VALUE FROM EXECUTE ROUTING:', decoded)\n return decoded[0];\n })\n } catch (error) {\n console.log(error)\n }\n};\n\n\n// Read from state the transaction data to send\n// Read from state the ad campaigns that have been shown and should have counts updated\n\n// Take the transaction data and make a signer call, passing in the ad campaign info saved in state.\n// The transactions must be routed through the manager contract\n// Upon tx success, set state.viewCounter: {}\n\n\nexecution()\n\n\nreturn (\n <>\n </>);" }, "app.dummy-dao.page": { "": "\"use client\"\n\nimport React, { useEffect, useState } from \"react\";\nimport { Container, Typography } from \"@mui/material\";\nimport { makeStyles } from \"@mui/styles\";\nimport Mint from \"./components/Mint\";\n// import History from \"./components/History\";\nimport { NetworkSwitcher } from \"./components/NetworkSwitcher\";\nimport { ethers } from \"ethers\";\nimport ConnectButton from \"./components/ConnectButton\";\nimport ErrorPopup from \"./components/ErrorPopup\";\nimport { Fade } from '@mui/material';\nimport dynamic from 'next/dynamic';\n\nconst Component = dynamic(() => import('../../components/vm-component'), { ssr: false });\n\n\nconst HomePage = () => {\n const windowOverride = typeof window !== 'undefined' ? window : null;\n const [connected, setConnected] = useState(null);\n const [errorMessage, setErrorMessage] = useState(\"\");\n const [newMintTx, setNewMintTx] = useState({});\n const classes = useStyles({ connected });\n\n useEffect(() => {\n // Initialize the injected provider event listeners to execute behaviors if account/chain/unlock changes in Metamask \n windowOverride?.ethereum?.on(\"chainChanged\", () => {\n if (typeof window !== 'undefined') {\n return window.location.reload();\n }\n });\n windowOverride?.ethereum?.on(\"accountsChanged\", () => {\n if (ethers.isAddress(windowOverride?.ethereum?.selectedAddress)) {\n setConnected(true);\n }\n });\n checkUnlock();\n }, [])\n\n const checkUnlock = async () => {\n const isUnlocked = await windowOverride?.ethereum?._metamask?.isUnlocked();\n setConnected(isUnlocked);\n }\n\n const readCampaignComponentSrc = \"manztech.testnet/widget/readCampaign\";\n const transactionMiddlewareComponentSrc = \"manztech.testnet/widget/transactionMiddleware\"\n\n\n return (\n <Fade in appear timeout={1500}>\n <div className={classes.root}>\n <NetworkSwitcher />\n <ErrorPopup errorMessage={errorMessage} errorMessageCallback={() => setErrorMessage(\"\")} />\n <div className={classes.buttonDiv}>\n <ConnectButton connected={connected} setErrorMessage={(msg) => setErrorMessage(msg)} />\n </div>\n <Container maxWidth=\"lg\" className={classes.contentContainer}>\n <Typography className={classes.pinkLotusHeader}>\n Welcome to the Pink Lotus DAO\n </Typography>\n\n <div className={classes.childContainer}>\n <Mint setErrorMessage={(msg) => setErrorMessage(msg)} setNewMintTx={(x) => setNewMintTx(x)} />\n <Component src={readCampaignComponentSrc} props={{ managerAddress: \"0x7A5C4E6c39dD8C594Aca1De08A0733fe3c07B8C2\" }} />\n {/* <History setErrorMessage={(msg) => setErrorMessage(msg)} newMintTx={newMintTx} clearNewMintTx={() => setNewMintTx({})} /> */}\n </div>\n </Container>\n </div>\n </Fade>\n );\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: \"100%\",\n height: \"100vh\",\n backgroundImage: \"url(/bg.png)\",\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center center\",\n },\n buttonDiv: {\n width: \"100%\",\n display: \"flex\",\n justifyContent: \"flex-end\",\n marginBottom: \"16px\"\n },\n contentContainer: {\n marginLeft: \"84px\",\n width: \"100%\",\n marginTop: \"32px\"\n },\n pinkLotusHeader: {\n fontFamily: '\"Roboto\", \"Helvetica\", \"Arial\", sans-serif',\n fontSize: \"42px\",\n },\n childContainer: {\n display: \"flex\",\n width: \"100%\",\n marginTop: \"120px\",\n justifyContent: \"space-between\",\n alignItems: \"flex-start\",\n },\n}));\n\nexport default HomePage;\n" }, "app.dummy-dao.components.Mint": { "": "import React, { useEffect, useMemo, useState } from 'react';\nimport { Button, CircularProgress, IconButton, InputAdornment, TextField, Tooltip } from '@mui/material';\nimport { makeStyles } from '@mui/styles';\nimport dynamic from 'next/dynamic';\n\nconst Component = dynamic(() => import('../../../components/vm-component'), { ssr: false });\n\nconst Mint = ({ setErrorMessage, setNewMintTx }) => {\n const transactionMiddlewareComponentSrc = \"manztech.testnet/widget/transactionMiddleware\"\n\n const windowOverride = typeof window !== 'undefined' ? window : null;\n const lotusDaoAddress = process.env.NEXT_PUBLIC_LOTUS_ADDRESS || \"\";\n\n const [totalSupply, setTotalSupply] = useState(0);\n const [lotusAmount, setLotusAmount] = useState('');\n const [buyInputError, setBuyInputError] = useState(false);\n const [buyInitialized, setBuyInitialized] = useState(false);\n // isEthereumAvailable helps prevent 'window' object errors while browser loads injected provider \n const [isEthereumAvailable, setIsEthereumAvailable] = useState(false);\n const classes = useStyles();\n\n useEffect(() => {\n fetchLotusTotalSupply();\n if (typeof window !== 'undefined' && 'ethereum' in window) {\n setIsEthereumAvailable(true);\n }\n }, [])\n\n useEffect(() => {\n // Buy flow starts with clearing input errors detected on last buy attempt\n if (buyInitialized) {\n setBuyInputError(false);\n handleBuy();\n }\n }, [buyInitialized])\n\n const price = useMemo(() => computeLotusPrice(totalSupply), [totalSupply]);\n // const provider = useMemo(() => {\n // return new ethers.BrowserProvider(windowOverride?.ethereum);\n // }, [windowOverride]);\n\n\n // const readPinkLotusContract = new ethers.Contract(lotusDaoAddress, abi, provider);\n\n const fetchLotusTotalSupply = async () => {\n // Get the LOTUS ERC20 total supply if provider is currently on Sepolia\n // try {\n // if (windowOverride?.ethereum?.networkVersion !== \"11155111\") {\n // return setTotalSupply(0);\n // }\n // const supply = await readPinkLotusContract.totalSupply();\n // return setTotalSupply(supply);\n // } catch (err) {\n // return setErrorMessage(err?.info?.error?.message ?? err?.message);\n // }\n }\n\n function computeLotusPrice(totalSupply) {\n // try {\n // if (totalSupply === 0) {\n // return \"0\";\n // }\n // // Construct the hash exactly how it would be in EVM\n // const hash = solidityPackedKeccak256(['uint256'], [totalSupply]);\n // const keccakNumerical = new BigNumber(formatUnits(hash, 'wei'));\n // // Get the .1 ETH factor\n // const etherFraction = new BigNumber('100000000000000000');\n // const modulusResult = keccakNumerical.mod(etherFraction);\n // const etherConvert = formatEther(BigInt(modulusResult));\n // return etherConvert;\n // } catch (err) {\n // setErrorMessage(err?.info?.error?.message ?? err?.message);\n // return \"0\";\n // }\n }\n\n const getMsgValueInEth = (price, lotusAmount) => {\n // try {\n // let msgValue = new BigNumber(price).multipliedBy(new BigNumber(lotusAmount)).toString();\n // if (msgValue.split('.')[1]?.length > 18) {\n // const int = msgValue.toString().split('.')[0];\n // const dec = msgValue.toString().split('.')[1].slice(0, 18);\n // msgValue = int + '.' + dec;\n // }\n // return msgValue;\n // } catch (err) {\n // setErrorMessage(err?.info?.error?.message ?? err?.message);\n // return \"0.0\";\n // }\n }\n\n const handleBuy = async () => {\n // The main Buy logic. Prepare the data to be passed in the buy() method and execute the call.\n // if (lotusAmount === \"0\" || !lotusAmount) {\n // setBuyInputError(true);\n // setBuyInitialized(false);\n // return;\n // }\n // try {\n // const msgValue = getMsgValueInEth(price, lotusAmount);\n // const options: { [x]: bigint } = { value: parseEther(msgValue) };\n\n // await provider.send(\"eth_requestAccounts\", []);\n // const signer = await provider.getSigner();\n // const writePinkLotusContract = new ethers.Contract(lotusDaoAddress, abi, signer);\n // if (!writePinkLotusContract) {\n // throw new Error(\"Could not Instantiate Contract at address \" + lotusDaoAddress);\n // }\n // const tx = await writePinkLotusContract.buy(parseEther(lotusAmount), options);\n // const txReceipt = await tx.wait();\n // // setNewMintTx passes this transaction to the history component to make a new entry in the transactions\n // setNewMintTx({ txHash: txReceipt.hash, lotusAmount, date: new Date() });\n // // Clear the amount state\n // setLotusAmount('');\n // } catch (err) {\n // setErrorMessage(\"Transaction Error: \" + err?.info?.error?.message ?? err?.message);\n // }\n // setBuyInitialized(false);\n };\n\n let lotusInput = (\n <TextField\n variant=\"outlined\"\n type=\"number\"\n placeholder=\"0.0\"\n className={classes.input}\n value={lotusAmount}\n onChange={(e) => {\n setBuyInputError(false)\n setLotusAmount(e.target.value)\n }}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <img src=\"icon.png\" width=\"56px\" height=\"56px\" />\n </InputAdornment>\n ),\n }} />);\n\n if ((!lotusAmount || lotusAmount === \"0\") && buyInputError === true) {\n // Add the 'Invalid' tooltip message when user attempts an invalid amount to purchase \n lotusInput = (\n <Tooltip\n title=\"Invalid Amount of LOTUS!\"\n open={true}\n classes={{ tooltip: classes.customTooltip }}\n placement=\"top-end\"\n >\n {lotusInput}\n </Tooltip>\n );\n }\n\n let button = <Button className={classes.buyButton} onClick={() => setBuyInitialized(true)}>Buy</Button>;\n if (buyInitialized) {\n button = (\n <Button className={classes.loadingButton} disabled>\n <CircularProgress size={24} className={classes.spinner} />\n </Button>\n );\n }\n\n let totalPurchaseInEth = null;\n if (lotusAmount) {\n totalPurchaseInEth = <div className={classes.purchaseContainer}>\n <span>Total Purchase</span>\n <span className={classes.valueInEth}>= {parseFloat(getMsgValueInEth(price, lotusAmount)).toFixed(5)} ETH</span>\n </div>;\n }\n\n if (!isEthereumAvailable) {\n return <></>;\n }\n\n return (\n <div className={classes.mint}>\n <span className=\"sectionHeader\">Amount of Lotus to Buy</span>\n {lotusInput}\n {button}\n <div className={classes.costSpan}>\n <span>Cost Per LOTUS ≈ 1 ETH</span>\n </div>\n {totalPurchaseInEth}\n {buyInitialized ? <Component src={transactionMiddlewareComponentSrc} props={{ managerAddress: \"0x7A5C4E6c39dD8C594Aca1De08A0733fe3c07B8C2\", target: \"0x7A5C4E6c39dD8C594Aca1De08A0733fe3c07B8C2\" }} /> : null}\n </div>\n );\n};\n\nconst useStyles = makeStyles(() => ({\n mint: {\n width: \"50%\",\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n },\n input: {\n borderRadius: '4px',\n marginBottom: '16px',\n width: '100%',\n '& .MuiOutlinedInput-adornment': {\n position: 'absolute',\n right: '0',\n },\n },\n buyButton: {\n border: '#FF69B4 2px solid',\n padding: \"4px 20px\",\n fontSize: \"16px\",\n borderRadius: '4px',\n backgroundColor: '#FFC1CC',\n color: 'black',\n marginBottom: '16px',\n alignSelf: 'stretch',\n \"&:disabled\": {\n cursor: \"none\"\n }\n },\n costSpan: {\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n },\n infoIcon: {\n marginLeft: \"8px\",\n color: 'black',\n },\n customTooltip: {\n fontSize: \"1.2rem\",\n backgroundColor: \"black\",\n padding: \"10px 15px\",\n },\n loadingButton: {\n padding: \"8px 20px\",\n fontSize: \"16px\",\n borderRadius: '4px',\n backgroundColor: 'black',\n color: 'white',\n marginBottom: '16px',\n alignSelf: 'stretch',\n \"&:disabled\": {\n cursor: \"not-allowed\",\n },\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n },\n spinner: {\n color: '#fff',\n },\n purchaseContainer: {\n display: 'flex',\n alignItems: 'center',\n fontWeight: \"bold\"\n },\n valueInEth: {\n marginLeft: \"10px\"\n }\n}));\n\nexport default Mint;" } } } } }

Transaction Execution Plan

Convert Transaction To Receipt
Gas Burned:
2 Tgas
Tokens Burned:
0.00025 
Receipt:
Predecessor ID:
Gas Burned:
10 Tgas
Tokens Burned:
0.00107 
Called method: 'set' in contract: v1.social08.testnet
Arguments:
{ "data": { "manztech.testnet": { "widget": { "app.dummy-dao.components.NetworkSwitcher": { "": "import { Box, Button, Dialog, DialogContent, DialogTitle, Typography } from '@mui/material';\nimport React, { useEffect, useState } from 'react';\n\nexport function NetworkSwitcher() {\n const windowOverride = typeof window !== 'undefined' ? window : null;\n const [errorMessage, setErrorMessage] = useState(\"\");\n const [isEthereumAvailable, setIsEthereumAvailable] = useState(false);\n\n useEffect(() => {\n if (typeof window !== 'undefined' && 'ethereum' in window) {\n setIsEthereumAvailable(true);\n }\n }, [])\n\n const switchNetwork = async () => {\n try {\n // Prompt user to switch to Sepolia\n await windowOverride?.ethereum?.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: '0xaa36a7' }],\n });\n } catch (switchError) {\n setErrorMessage(switchError.message);\n }\n }\n\n if (isEthereumAvailable) {\n if (windowOverride?.ethereum?.networkVersion == \"11155111\") {\n // This component renders on all pages. If the network is Sepolia, render nothing\n return null;\n }\n } else {\n // If injected provider is not in use, do not render this modal by default\n return null;\n }\n\n return (\n <div>\n <Dialog open={true} aria-labelledby=\"network-switcher-title\">\n <DialogTitle className=\"center\" id=\"network-switcher-title\">\n Network Switcher\n </DialogTitle>\n <DialogContent>\n <Box display=\"flex\" flexDirection=\"column\" alignItems=\"center\" >\n <Typography variant=\"body1\">\n This dApp is deployed on Sepolia (Chain ID 11155111)\n </Typography>\n <Typography variant=\"body1\">\n You are currently connected to Chain ID {windowOverride?.ethereum?.networkVersion || \"N/A\"}\n </Typography>\n\n {switchNetwork && (\n <Box mt={2}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => switchNetwork()}\n >\n Switch to Sepolia\n </Button>\n </Box>\n )}\n <Box mt={2}>\n <Typography variant=\"body2\" color=\"error\">\n {errorMessage}\n </Typography>\n </Box>\n </Box>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n" }, "transactionMiddleware": { "": "const sender = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nif (!sender) return <Web3Connect connectLabel=\"Connect with Web3\" />;\nconst currentViewCounter = Storage.get(\"viewCounter\")\n\nconsole.log(currentViewCounter, 'storage')\n\nconst managerABI = [\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"txTarget\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256[]\",\n \"name\": \"campaignsTokenIds\",\n \"type\": \"uint256[]\"\n },\n {\n \"internalType\": \"uint256[]\",\n \"name\": \"campaignsViewedCounters\",\n \"type\": \"uint256[]\"\n },\n {\n \"internalType\": \"bytes\",\n \"name\": \"signature\",\n \"type\": \"bytes\"\n },\n {\n \"internalType\": \"bytes\",\n \"name\": \"functionData\",\n \"type\": \"bytes\"\n }\n ],\n \"name\": \"executionMiddleware\",\n \"outputs\": [\n {\n \"internalType\": \"bytes\",\n \"name\": \"\",\n \"type\": \"bytes\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n }\n]\n\n// Pass function call data thru props.calldata\n// pass contract call target address thru props.target\n// read ad view data\n// call executionMiddleware(\n// address txTarget,\n// address[] memory campaignsViewedAddresses,\n// uint256[] memory campaignsViewedCounters,\n// bytes memory signature,\n// bytes memory functionData\n// )\n// \nconst managerIface = new ethers.utils.Interface(managerABI);\n\nlet campaignIds = {}\nlet campaignCounts = {}\nif (currentViewCounter) {\n campaignIds = Object.keys(currentViewCounter).map(x => Number(x))\n campaignCounts = Object.values(currentViewCounter).map(x => Number(x))\n}\n\nconst execution = () => {\n console.log(props)\n try {\n const encoded = managerIface.encodeFunctionData(\"executionMiddleware\", [props.target, [campaignIds], [campaignCounts], (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32)), (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32))]);\n console.log('ADDRESSES', props.target, props.managerAddress, encoded)\n\n const managerContract = new ethers.Contract(\n props.managerAddress,\n managerABI,\n Ethers.provider().getSigner()\n );\n\n return managerContract.executionMiddleware(\n props.target,\n [campaignIds],\n [campaignCounts],\n (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32)),\n (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(0)), 32)),\n {}\n ).then(returnData => {\n const decoded = managerIface.decodeFunctionResult(\n \"executionMiddleware\",\n returnData\n );\n console.log('RETURN VALUE FROM EXECUTE ROUTING:', decoded)\n return decoded[0];\n })\n } catch (error) {\n console.log(error)\n }\n};\n\n\n// Read from state the transaction data to send\n// Read from state the ad campaigns that have been shown and should have counts updated\n\n// Take the transaction data and make a signer call, passing in the ad campaign info saved in state.\n// The transactions must be routed through the manager contract\n// Upon tx success, set state.viewCounter: {}\n\n\nexecution()\n\n\nreturn (\n <>\n </>);" }, "app.dummy-dao.page": { "": "\"use client\"\n\nimport React, { useEffect, useState } from \"react\";\nimport { Container, Typography } from \"@mui/material\";\nimport { makeStyles } from \"@mui/styles\";\nimport Mint from \"./components/Mint\";\n// import History from \"./components/History\";\nimport { NetworkSwitcher } from \"./components/NetworkSwitcher\";\nimport { ethers } from \"ethers\";\nimport ConnectButton from \"./components/ConnectButton\";\nimport ErrorPopup from \"./components/ErrorPopup\";\nimport { Fade } from '@mui/material';\nimport dynamic from 'next/dynamic';\n\nconst Component = dynamic(() => import('../../components/vm-component'), { ssr: false });\n\n\nconst HomePage = () => {\n const windowOverride = typeof window !== 'undefined' ? window : null;\n const [connected, setConnected] = useState(null);\n const [errorMessage, setErrorMessage] = useState(\"\");\n const [newMintTx, setNewMintTx] = useState({});\n const classes = useStyles({ connected });\n\n useEffect(() => {\n // Initialize the injected provider event listeners to execute behaviors if account/chain/unlock changes in Metamask \n windowOverride?.ethereum?.on(\"chainChanged\", () => {\n if (typeof window !== 'undefined') {\n return window.location.reload();\n }\n });\n windowOverride?.ethereum?.on(\"accountsChanged\", () => {\n if (ethers.isAddress(windowOverride?.ethereum?.selectedAddress)) {\n setConnected(true);\n }\n });\n checkUnlock();\n }, [])\n\n const checkUnlock = async () => {\n const isUnlocked = await windowOverride?.ethereum?._metamask?.isUnlocked();\n setConnected(isUnlocked);\n }\n\n const readCampaignComponentSrc = \"manztech.testnet/widget/readCampaign\";\n const transactionMiddlewareComponentSrc = \"manztech.testnet/widget/transactionMiddleware\"\n\n\n return (\n <Fade in appear timeout={1500}>\n <div className={classes.root}>\n <NetworkSwitcher />\n <ErrorPopup errorMessage={errorMessage} errorMessageCallback={() => setErrorMessage(\"\")} />\n <div className={classes.buttonDiv}>\n <ConnectButton connected={connected} setErrorMessage={(msg) => setErrorMessage(msg)} />\n </div>\n <Container maxWidth=\"lg\" className={classes.contentContainer}>\n <Typography className={classes.pinkLotusHeader}>\n Welcome to the Pink Lotus DAO\n </Typography>\n\n <div className={classes.childContainer}>\n <Mint setErrorMessage={(msg) => setErrorMessage(msg)} setNewMintTx={(x) => setNewMintTx(x)} />\n <Component src={readCampaignComponentSrc} props={{ managerAddress: \"0x7A5C4E6c39dD8C594Aca1De08A0733fe3c07B8C2\" }} />\n {/* <History setErrorMessage={(msg) => setErrorMessage(msg)} newMintTx={newMintTx} clearNewMintTx={() => setNewMintTx({})} /> */}\n </div>\n </Container>\n </div>\n </Fade>\n );\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: \"100%\",\n height: \"100vh\",\n backgroundImage: \"url(/bg.png)\",\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center center\",\n },\n buttonDiv: {\n width: \"100%\",\n display: \"flex\",\n justifyContent: \"flex-end\",\n marginBottom: \"16px\"\n },\n contentContainer: {\n marginLeft: \"84px\",\n width: \"100%\",\n marginTop: \"32px\"\n },\n pinkLotusHeader: {\n fontFamily: '\"Roboto\", \"Helvetica\", \"Arial\", sans-serif',\n fontSize: \"42px\",\n },\n childContainer: {\n display: \"flex\",\n width: \"100%\",\n marginTop: \"120px\",\n justifyContent: \"space-between\",\n alignItems: \"flex-start\",\n },\n}));\n\nexport default HomePage;\n" }, "app.dummy-dao.components.Mint": { "": "import React, { useEffect, useMemo, useState } from 'react';\nimport { Button, CircularProgress, IconButton, InputAdornment, TextField, Tooltip } from '@mui/material';\nimport { makeStyles } from '@mui/styles';\nimport dynamic from 'next/dynamic';\n\nconst Component = dynamic(() => import('../../../components/vm-component'), { ssr: false });\n\nconst Mint = ({ setErrorMessage, setNewMintTx }) => {\n const transactionMiddlewareComponentSrc = \"manztech.testnet/widget/transactionMiddleware\"\n\n const windowOverride = typeof window !== 'undefined' ? window : null;\n const lotusDaoAddress = process.env.NEXT_PUBLIC_LOTUS_ADDRESS || \"\";\n\n const [totalSupply, setTotalSupply] = useState(0);\n const [lotusAmount, setLotusAmount] = useState('');\n const [buyInputError, setBuyInputError] = useState(false);\n const [buyInitialized, setBuyInitialized] = useState(false);\n // isEthereumAvailable helps prevent 'window' object errors while browser loads injected provider \n const [isEthereumAvailable, setIsEthereumAvailable] = useState(false);\n const classes = useStyles();\n\n useEffect(() => {\n fetchLotusTotalSupply();\n if (typeof window !== 'undefined' && 'ethereum' in window) {\n setIsEthereumAvailable(true);\n }\n }, [])\n\n useEffect(() => {\n // Buy flow starts with clearing input errors detected on last buy attempt\n if (buyInitialized) {\n setBuyInputError(false);\n handleBuy();\n }\n }, [buyInitialized])\n\n const price = useMemo(() => computeLotusPrice(totalSupply), [totalSupply]);\n // const provider = useMemo(() => {\n // return new ethers.BrowserProvider(windowOverride?.ethereum);\n // }, [windowOverride]);\n\n\n // const readPinkLotusContract = new ethers.Contract(lotusDaoAddress, abi, provider);\n\n const fetchLotusTotalSupply = async () => {\n // Get the LOTUS ERC20 total supply if provider is currently on Sepolia\n // try {\n // if (windowOverride?.ethereum?.networkVersion !== \"11155111\") {\n // return setTotalSupply(0);\n // }\n // const supply = await readPinkLotusContract.totalSupply();\n // return setTotalSupply(supply);\n // } catch (err) {\n // return setErrorMessage(err?.info?.error?.message ?? err?.message);\n // }\n }\n\n function computeLotusPrice(totalSupply) {\n // try {\n // if (totalSupply === 0) {\n // return \"0\";\n // }\n // // Construct the hash exactly how it would be in EVM\n // const hash = solidityPackedKeccak256(['uint256'], [totalSupply]);\n // const keccakNumerical = new BigNumber(formatUnits(hash, 'wei'));\n // // Get the .1 ETH factor\n // const etherFraction = new BigNumber('100000000000000000');\n // const modulusResult = keccakNumerical.mod(etherFraction);\n // const etherConvert = formatEther(BigInt(modulusResult));\n // return etherConvert;\n // } catch (err) {\n // setErrorMessage(err?.info?.error?.message ?? err?.message);\n // return \"0\";\n // }\n }\n\n const getMsgValueInEth = (price, lotusAmount) => {\n // try {\n // let msgValue = new BigNumber(price).multipliedBy(new BigNumber(lotusAmount)).toString();\n // if (msgValue.split('.')[1]?.length > 18) {\n // const int = msgValue.toString().split('.')[0];\n // const dec = msgValue.toString().split('.')[1].slice(0, 18);\n // msgValue = int + '.' + dec;\n // }\n // return msgValue;\n // } catch (err) {\n // setErrorMessage(err?.info?.error?.message ?? err?.message);\n // return \"0.0\";\n // }\n }\n\n const handleBuy = async () => {\n // The main Buy logic. Prepare the data to be passed in the buy() method and execute the call.\n // if (lotusAmount === \"0\" || !lotusAmount) {\n // setBuyInputError(true);\n // setBuyInitialized(false);\n // return;\n // }\n // try {\n // const msgValue = getMsgValueInEth(price, lotusAmount);\n // const options: { [x]: bigint } = { value: parseEther(msgValue) };\n\n // await provider.send(\"eth_requestAccounts\", []);\n // const signer = await provider.getSigner();\n // const writePinkLotusContract = new ethers.Contract(lotusDaoAddress, abi, signer);\n // if (!writePinkLotusContract) {\n // throw new Error(\"Could not Instantiate Contract at address \" + lotusDaoAddress);\n // }\n // const tx = await writePinkLotusContract.buy(parseEther(lotusAmount), options);\n // const txReceipt = await tx.wait();\n // // setNewMintTx passes this transaction to the history component to make a new entry in the transactions\n // setNewMintTx({ txHash: txReceipt.hash, lotusAmount, date: new Date() });\n // // Clear the amount state\n // setLotusAmount('');\n // } catch (err) {\n // setErrorMessage(\"Transaction Error: \" + err?.info?.error?.message ?? err?.message);\n // }\n // setBuyInitialized(false);\n };\n\n let lotusInput = (\n <TextField\n variant=\"outlined\"\n type=\"number\"\n placeholder=\"0.0\"\n className={classes.input}\n value={lotusAmount}\n onChange={(e) => {\n setBuyInputError(false)\n setLotusAmount(e.target.value)\n }}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <img src=\"icon.png\" width=\"56px\" height=\"56px\" />\n </InputAdornment>\n ),\n }} />);\n\n if ((!lotusAmount || lotusAmount === \"0\") && buyInputError === true) {\n // Add the 'Invalid' tooltip message when user attempts an invalid amount to purchase \n lotusInput = (\n <Tooltip\n title=\"Invalid Amount of LOTUS!\"\n open={true}\n classes={{ tooltip: classes.customTooltip }}\n placement=\"top-end\"\n >\n {lotusInput}\n </Tooltip>\n );\n }\n\n let button = <Button className={classes.buyButton} onClick={() => setBuyInitialized(true)}>Buy</Button>;\n if (buyInitialized) {\n button = (\n <Button className={classes.loadingButton} disabled>\n <CircularProgress size={24} className={classes.spinner} />\n </Button>\n );\n }\n\n let totalPurchaseInEth = null;\n if (lotusAmount) {\n totalPurchaseInEth = <div className={classes.purchaseContainer}>\n <span>Total Purchase</span>\n <span className={classes.valueInEth}>= {parseFloat(getMsgValueInEth(price, lotusAmount)).toFixed(5)} ETH</span>\n </div>;\n }\n\n if (!isEthereumAvailable) {\n return <></>;\n }\n\n return (\n <div className={classes.mint}>\n <span className=\"sectionHeader\">Amount of Lotus to Buy</span>\n {lotusInput}\n {button}\n <div className={classes.costSpan}>\n <span>Cost Per LOTUS ≈ 1 ETH</span>\n </div>\n {totalPurchaseInEth}\n {buyInitialized ? <Component src={transactionMiddlewareComponentSrc} props={{ managerAddress: \"0x7A5C4E6c39dD8C594Aca1De08A0733fe3c07B8C2\", target: \"0x7A5C4E6c39dD8C594Aca1De08A0733fe3c07B8C2\" }} /> : null}\n </div>\n );\n};\n\nconst useStyles = makeStyles(() => ({\n mint: {\n width: \"50%\",\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n },\n input: {\n borderRadius: '4px',\n marginBottom: '16px',\n width: '100%',\n '& .MuiOutlinedInput-adornment': {\n position: 'absolute',\n right: '0',\n },\n },\n buyButton: {\n border: '#FF69B4 2px solid',\n padding: \"4px 20px\",\n fontSize: \"16px\",\n borderRadius: '4px',\n backgroundColor: '#FFC1CC',\n color: 'black',\n marginBottom: '16px',\n alignSelf: 'stretch',\n \"&:disabled\": {\n cursor: \"none\"\n }\n },\n costSpan: {\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n },\n infoIcon: {\n marginLeft: \"8px\",\n color: 'black',\n },\n customTooltip: {\n fontSize: \"1.2rem\",\n backgroundColor: \"black\",\n padding: \"10px 15px\",\n },\n loadingButton: {\n padding: \"8px 20px\",\n fontSize: \"16px\",\n borderRadius: '4px',\n backgroundColor: 'black',\n color: 'white',\n marginBottom: '16px',\n alignSelf: 'stretch',\n \"&:disabled\": {\n cursor: \"not-allowed\",\n },\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n },\n spinner: {\n color: '#fff',\n },\n purchaseContainer: {\n display: 'flex',\n alignItems: 'center',\n fontWeight: \"bold\"\n },\n valueInEth: {\n marginLeft: \"10px\"\n }\n}));\n\nexport default Mint;" } } } } }
Empty result
No logs
Receipt:
Predecessor ID:
Receiver ID:
Gas Burned:
223 Ggas
Tokens Burned:
0 
Transferred 0.18799  to manztech.testnet
Empty result
No logs