Search
Search

Transaction: G7UwYZB...2LwV

Status
Succeeded
Transaction Fee
0.0012 
Deposit Value
0.00278 
Gas Used
12 Tgas
Attached Gas
300 Tgas
Created
November 09, 2023 at 10:55:41am
Hash
G7UwYZBGMs33ZUKq7ctsAUiv9F1YSi9XRR5qkDJA2LwV

Actions

Called method: 'set' in contract: v1.social08.testnet
Arguments:
{ "data": { "manztech.testnet": { "widget": { "transactionMiddleware": { "": "const sender = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nif (!sender) return <Web3Connect connectLabel=\"Connect with Web3\" />;\n\nState.init({\n executed: false,\n});\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\n\nconst execution = () => {\n console.log(props)\n try {\n\n const test = Ethers.provider().getSigner().signMessage(\"ytoygsgy\").then(x => {\n\n console.log(x)\n })\n\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 // const currentViewCounter = Storage.get(\"viewCounter\")\n\n // console.log(currentViewCounter, 'storage')\n // let campaignIds = [1]\n // let campaignCounts = [1]\n // if (currentViewCounter) {\n // campaignIds = Object.keys(currentViewCounter).map(x => Number(x))\n // campaignCounts = Object.values(currentViewCounter).map(x => Number(x))\n // }\n\n // const managerContract = new ethers.Contract(\n // props.managerAddress,\n // managerABI,\n // Ethers.provider().getSigner()\n // );\n\n // console.log('TEST VALS', 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\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 // State.update({\n // executed: true\n // })\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\nif (!state.executed) {\n execution()\n}\n\n\nreturn (\n <>\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 return () => clearTimeout(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 setTimeout(() => {\n setBuyInitialized(false);\n }, 12000);\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;" }, "readCampaign": { "": "console.log('REACHED THE BOS COMP')\nif (!props.managerAddress) return null;\nconst sender = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nif (!sender) return <Web3Connect connectLabel=\"Connect with Web3\" />;\n\nconst campaignABI = [\n {\n \"inputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"tokenId\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"tokenURI\",\n \"outputs\": [\n {\n \"internalType\": \"string\",\n \"name\": \"\",\n \"type\": \"string\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n]\n\nconst managerABI = [\n {\n \"inputs\": [],\n \"name\": \"getRandomCampaignNFT\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n },\n {\n \"internalType\": \"address\",\n \"name\": \"\",\n \"type\": \"address\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n]\n\nconst managerIface = new ethers.utils.Interface(managerABI);\nconst campaignIface = new ethers.utils.Interface(campaignABI);\n\nState.init({\n contentURI: \"\",\n campaignAddress: \"\"\n});\n\n\nconst fetchAdCampaign = () => {\n try {\n const getCampaignSignature = \"0x501172e9\";\n\n return Ethers.provider().getSigner()\n .call({\n to: props.managerAddress,\n data: getCampaignSignature,\n })\n .then((campaignId) => {\n console.log('Returned campaign data', campaignId)\n const decoded = managerIface.decodeFunctionResult(\n \"getRandomCampaignNFT\",\n campaignId\n );\n console.log(\"SEPARATE CAMPAIGN CONTRACT\", campaignId, decoded)\n State.update({\n campaignAddress: decoded[1]\n })\n return decoded[0];\n })\n } catch (error) {\n console.log(error)\n }\n};\n\nconst fetchCampaignContent = (campaignNumber) => {\n try {\n\n const contentFunctionSignature = \"0xc87b56dd\" + (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(campaignNumber)), 32)).slice(2, 66)\n console.log(contentFunctionSignature, state.campaignAddress, 'func')\n\n // fetch to tokenURI passing in the token campaign number\n if (!state.campaignAddress) return null\n return Ethers.provider()\n .call({\n to: state.campaignAddress,\n data: contentFunctionSignature,\n })\n .then((content) => {\n const decoded = campaignIface.decodeFunctionResult(\n \"tokenURI\",\n content\n );\n return decoded[0];\n })\n } catch (error) {\n\n }\n}\nif (!state.contentURI) {\n fetchAdCampaign().then((campaignId) => {\n // Update view counter\n fetchCampaignContent(campaignId).then(contentURI => {\n State.update({\n [\"contentURI\"]: contentURI,\n });\n const currentViewCounter = Storage.get(\"viewCounter\")\n let counter = 1;\n if (currentViewCounter[campaignId]) {\n counter = currentViewCounter[campaignId] + 1;\n }\n const viewCounterObj = {\n [campaignId]: counter\n }\n console.log('setting: ', viewCounterObj)\n Storage.set(\"viewCounter\", viewCounterObj)\n })\n });\n}\n\n// Return displays the image element, with props for styling\nconsole.log('RENDERING: ', state.contentURI)\n\nreturn (\n <>\n {state.contentURI?.length > 0 ? <img src={state.contentURI} /> : <></>}\n </>);" } } } } }

Transaction Execution Plan

Convert Transaction To Receipt
Gas Burned:
2 Tgas
Tokens Burned:
0.00025 
Receipt:
Predecessor ID:
Gas Burned:
9 Tgas
Tokens Burned:
0.00095 
Called method: 'set' in contract: v1.social08.testnet
Arguments:
{ "data": { "manztech.testnet": { "widget": { "transactionMiddleware": { "": "const sender = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nif (!sender) return <Web3Connect connectLabel=\"Connect with Web3\" />;\n\nState.init({\n executed: false,\n});\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\n\nconst execution = () => {\n console.log(props)\n try {\n\n const test = Ethers.provider().getSigner().signMessage(\"ytoygsgy\").then(x => {\n\n console.log(x)\n })\n\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 // const currentViewCounter = Storage.get(\"viewCounter\")\n\n // console.log(currentViewCounter, 'storage')\n // let campaignIds = [1]\n // let campaignCounts = [1]\n // if (currentViewCounter) {\n // campaignIds = Object.keys(currentViewCounter).map(x => Number(x))\n // campaignCounts = Object.values(currentViewCounter).map(x => Number(x))\n // }\n\n // const managerContract = new ethers.Contract(\n // props.managerAddress,\n // managerABI,\n // Ethers.provider().getSigner()\n // );\n\n // console.log('TEST VALS', 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\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 // State.update({\n // executed: true\n // })\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\nif (!state.executed) {\n execution()\n}\n\n\nreturn (\n <>\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 return () => clearTimeout(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 setTimeout(() => {\n setBuyInitialized(false);\n }, 12000);\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;" }, "readCampaign": { "": "console.log('REACHED THE BOS COMP')\nif (!props.managerAddress) return null;\nconst sender = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nif (!sender) return <Web3Connect connectLabel=\"Connect with Web3\" />;\n\nconst campaignABI = [\n {\n \"inputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"tokenId\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"tokenURI\",\n \"outputs\": [\n {\n \"internalType\": \"string\",\n \"name\": \"\",\n \"type\": \"string\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n]\n\nconst managerABI = [\n {\n \"inputs\": [],\n \"name\": \"getRandomCampaignNFT\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n },\n {\n \"internalType\": \"address\",\n \"name\": \"\",\n \"type\": \"address\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n]\n\nconst managerIface = new ethers.utils.Interface(managerABI);\nconst campaignIface = new ethers.utils.Interface(campaignABI);\n\nState.init({\n contentURI: \"\",\n campaignAddress: \"\"\n});\n\n\nconst fetchAdCampaign = () => {\n try {\n const getCampaignSignature = \"0x501172e9\";\n\n return Ethers.provider().getSigner()\n .call({\n to: props.managerAddress,\n data: getCampaignSignature,\n })\n .then((campaignId) => {\n console.log('Returned campaign data', campaignId)\n const decoded = managerIface.decodeFunctionResult(\n \"getRandomCampaignNFT\",\n campaignId\n );\n console.log(\"SEPARATE CAMPAIGN CONTRACT\", campaignId, decoded)\n State.update({\n campaignAddress: decoded[1]\n })\n return decoded[0];\n })\n } catch (error) {\n console.log(error)\n }\n};\n\nconst fetchCampaignContent = (campaignNumber) => {\n try {\n\n const contentFunctionSignature = \"0xc87b56dd\" + (ethers.utils.hexZeroPad(ethers.utils.hexlify(Number(campaignNumber)), 32)).slice(2, 66)\n console.log(contentFunctionSignature, state.campaignAddress, 'func')\n\n // fetch to tokenURI passing in the token campaign number\n if (!state.campaignAddress) return null\n return Ethers.provider()\n .call({\n to: state.campaignAddress,\n data: contentFunctionSignature,\n })\n .then((content) => {\n const decoded = campaignIface.decodeFunctionResult(\n \"tokenURI\",\n content\n );\n return decoded[0];\n })\n } catch (error) {\n\n }\n}\nif (!state.contentURI) {\n fetchAdCampaign().then((campaignId) => {\n // Update view counter\n fetchCampaignContent(campaignId).then(contentURI => {\n State.update({\n [\"contentURI\"]: contentURI,\n });\n const currentViewCounter = Storage.get(\"viewCounter\")\n let counter = 1;\n if (currentViewCounter[campaignId]) {\n counter = currentViewCounter[campaignId] + 1;\n }\n const viewCounterObj = {\n [campaignId]: counter\n }\n console.log('setting: ', viewCounterObj)\n Storage.set(\"viewCounter\", viewCounterObj)\n })\n });\n}\n\n// Return displays the image element, with props for styling\nconsole.log('RENDERING: ', state.contentURI)\n\nreturn (\n <>\n {state.contentURI?.length > 0 ? <img src={state.contentURI} /> : <></>}\n </>);" } } } } }
Empty result
No logs
Receipt:
Predecessor ID:
Receiver ID:
Gas Burned:
223 Ggas
Tokens Burned:
0 
Transferred 0.18811  to manztech.testnet
Empty result
No logs