I’m receiving this console error: Cannot destructure property ‘interface’ of ‘require(…)’ as it is undefined. Can somebody spot what is wrong? Inbox.test.js file: inbox.sol file: pragma solidity ^0.4.17; compile.js file: Answer I would suggest you verify your project structure. Your compile.js must be in a parent folder of Inbox.test.js.
Tag: solidity
Error when attempting to call smart contract with javascript
I am trying to write a piece of javascript that calls a smart contract. The smart contract has been deployed to a local test net with truffle and ganache and the javascript is producing the following error: Javascript code: Solidity code: I am not sure if the issue is coming from me not handling the async request properly, the JSON
Uncaught (in promise) Error: invalid address
how to fix this error when i call a smart contract function? it’s my code: Answer The Problem The error shows that you didn’t set the address property correctly, it’s may be the issue with your solidity implementation and it’s not related to javascript snippet, as mentioned in the comments, you can ask about it on related sites, but there
Error: invalid string value (arg=”_name”, coderType=”string”, value=null)
I am trying to parse a persons information from a UI to a smart contract, the problem I seem to be having is the example I followed parses int’s and I’m not sure what to change in order to parse strings across? This code is just trying to get the player name and birthday. Here is my smart contract code:
Supply ETH to Aave through solidity
I’m trying deposit into Aave V2 Contract Aave’s Code Examples I have code which consumes this like so: When attempting to supply, Metamask displays an error: ALERT: Transaction Error. Exception thrown in contract code. And just a simple button to call it in html: I’m running ganache ganache-cli –fork https://mainnet.infura.io/v3/{{MyProjectId}} The only error I see in the console is: Transaction:
Importing ethers via Hardhat fails despite official testing documentation
According to the official testing documentation for Hardhat, ethers should be available implicitly within the global scope; however, it can optionally be required explicitly, like so: This fails for my local project. My package manifest seems to include the correct dependencies: My unit tests file seems to match the worked example in the Hardhat documentation also: Despite this, running the
Unable to deploy Solidity contract to Rinkeby network (Invalid asm.js: Invalid member of stdlib)
I’ve been learning Solidity using this course by Stephen Grider and it’s been going well until now, where I am trying to deploy my code to the Rinkeby test network. For reference, I am using Node version 11.15.0 with npm version 6.7.0 with these dependencies: I have spent hours switching between versions of Node.js, npm, and all sorts of combinations
Call Function From Solidity With Web3
I am having trouble calling a simple function from my solidity contract. Here’s how the code is structured so far: In my web3Api.js file I have: Then in my projectApi.js file I have: Note: When I call the global variable throughout this file it successfully returns all my contract’s functions So this next part is where I’m running into trouble.
Solidity Function Modifying Value Failing
Using Truffle Development framework (web3, react, and solidity) to test a simple smart contract. I have a basic function I am testing when I press a button on the UI, but it doesn’t seem to be working the way I’d expect it. I expect the contract to increment the value and return true. Note, that the value is later being