Questions tagged [require]

The tag has no usage guidance.

13 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
54 views

Require not working on geth private node

I have created this contract to manage a votation: pragma solidity ^0.5.7; contract Votacion{ mapping(uint => address[]) private votosCandidatos; uint[] listaCandidatos; bool abierta; address ...
1
vote
1answer
415 views

Handling require/assert failure errors correctly from a Node.JS app?

I have a getter function in my smart contract that returns one of the string values in statically defined string array. Upon entry to the function, it does a bounds check on the incoming index using ...
1
vote
0answers
202 views

cannot get return variable(s) in javascript when using require in solidity

I have a function in solidity that returns a few bytes32 variables. I cannot for the life of me access those variables. Can someone please help? function getData() public returns (bytes32, bytes32, ...
1
vote
0answers
279 views

Catch a "require()" in frontend

I was trying to validate a transaction with some conditions on contract level and was wondering if it was possible in any way to give user feedback in the frontend if a require() fails - aka if it ...
0
votes
1answer
18 views

web3.js:3 Uncaught ReferenceError: require is not defined

I've been confused by the web3.js all day. I created the web.js for setting and initialize Web3, and it appears the following message: And I install web3 by npm install web3, the version of web3 is 1....
0
votes
0answers
9 views

Solidity: Difference between require and if, need to use address when calling function on a smart contract

I have a question if the two functions below differ as I have written approach 2 but no 1 was the solution. Earlier in the contract Dangerous d; is defined which refers to a different smart contract. ...
0
votes
1answer
13 views

Why check for zero-account?

I see require(account != address(0x0)); as somewhat of a boilerplate check for some functions. Is the purpose just to add a check that prevents the creation of a new contract?
0
votes
1answer
127 views

Require a specific amount of Ether inside the payable function

I have a payble function that has some logic. I want that logic to be triggered only if the received amount is equal to the amount specified when the contract was created. Solidity v0.7.6 receive() ...
0
votes
0answers
7 views

array of struct inside struct - require

Given two structures, struct travel { string name; uint USN; } struct class { uint classID; string ProfessorName; student[] students; } mapping(uint => class) selectedClass; A ...
0
votes
0answers
10 views

Require messages on Remix or a similar tool

Our team is using Remix for a long time for the first exploratory tests or to call administrative methods (that we do not have specific UI). I remember that some time ago I saw the messages that we ...
0
votes
2answers
132 views

how to set a require for a string to not be null

I want to write a require condition for string that string variable could not be null. How to write because string is not taking the != operator function createOrder(address _seller, string memory ...
0
votes
0answers
360 views

Error message shown as [object Object] when use require, how to get actual error message string in Remix IDE Console?

I have used require function as: require(owner == msg.sender, "Sender must be owner"); But in the remix console I got, transact to Contract.setAdmin errored: [object Object] What should I ...
0
votes
1answer
152 views

Geth Node doesn't revert a transaction not satisfying a require

i'm testing my smart contract on remix with local ganache cli, when i try to test case that doesn't satisfy a require on the SC i correctly receive message "transact to Contract.function errored: VM ...