I have built a smart contract method to which I pass some sensitive data that needs to be stored on the blockchain and alter the state of the contract. I, the creator of the contract don’t want to be the one paying for the fees of that transaction. I want the user on the browser to approve and pay for
Tag: solidity
Return address function from smart contract returns promise object instead of address in truffle test
Hi I have an address return function that works in remix but when I try to run it in a truffle test it gives me a promise object. If I could have the truffle test return an address like it does in the solidity code that would be ideal or if I can access the promise object to give me
TypeError: Cannot read properties of undefined (reading ‘equal’) [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 10 months ago. Improve this question
Decode constructor arguments in solidity
I playing Ethernaut Level 8. The goal is to get access to the private password state variable and unlock the contract. I know one could use await contract.unlock(await web3.eth.getStorageAt(contract.address, 1));, but I want to find the password decoding the input data of the contract creation. Here is the contract. I tried await contract.unlock(“f94b476063b6379a3c8b6c836efb8b3e10ede188”) but that didn’t work. Answer If the
Command ‘Solidity: Compile Contract’ resulted in an error (Cannot read properties of undefined(reading ‘uri’))
Good day everyone, I am working on a lottery smart contract. I am currently done with the remix VM tests and proceeded with the unit tests with JavaScript. The test.js file is shown below. The test file for now only checks if the contract deploys, pretty simple. However, I have not been able to proceed from here due to a
How to configure to handle CORS errors in web3 connecting to ganache
I have a react project I am running at http:\localhost:3000 which connects to ganache running at http:\localhost:7545. I deploy a small smart contract onto ganache which increments a counter and emits an event, like this… I want to listen to the Pinged and Ponged events from my contract. As this is just a helper project for something else I am
Making use of a nested Array with solidity
I need to create an online game using solidity. The games have games within them with each game having their respective players. it can be likened to a battle royale on a FPS game where there are various battle royales going on simultaneously within the game with their respective participants. I tried using an array within a struct to keep
Issue in calling a smart contract function with web3
I’m trying to call the createCustomer function provided in this smart contract https://ropsten.etherscan.io/address/0xD3B462CbF6244ed21CD3cF334Bf8CB44A28795A9#code and we basically have to provide three parameters like string memory _hashedEmail, string memory _name and string memory _phone. So I’ve written the following program to call the createCustomer function However it gives me this err which doesnt make any sense as i’ve already provided the three
Test an onlyOwner function in Javascript
I have this situation in my smart contract: I’m using truffle and his test suite and then I wrote this case, that fails maybe because I’m not using the only owner method in the right way: Can someone help me? Answer Assuming that you properly set the owner in the contract, write a getter for the owner in the contract:
Displaying the transaction value of a custom ERC20 function in MetaMask
I have created a new contract on Polygon based on ERC20 with a couple of extra public functions. And am having trouble with communicating what the user is doing to MetaMask. When I perform a normal ERC20 transfer() transaction, the signature popup correctly showing the value, in myNewToken, of the transaction plus MATIC gas. BUT if I use my new