Questions tagged [modifiers]

The tag has no usage guidance.

15 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
238 views

error: invalid opcode using modifier

Im getting the following error when trying to run my js test file using truffle: Error: VM Exception while executing eth_call: invalid opcode The js test file is the following: var DebitService = ...
2
votes
0answers
83 views

UnhandledPromiseRejectionWarning: Error: nonce generation function failed or private key is invalid in Ganache

In Go I am using go-ethereum to read data from the ethereum smart contract. My smart contract is maintained with truffle. I am trying to fetch candidate information based on candidate id. I have a ...
1
vote
0answers
287 views

Modifier to only allow access via staticcall

I'm trying to create a modifier that only allows a function to be called using staticcall. Using the view declaration in Solidity 0.5.0 guarantees that a function won't change state, but it still ...
1
vote
0answers
188 views

Modifiers: can I pass an array or specify that not all of them have to pass, but one is enough (OR functionality instead of AND)

Say I want to restrict a function to only authors and editors. And later on, I want to restrict another function to authors and contributors only. So ideally, I would add a modifier like this: ...
1
vote
0answers
22 views

Can't check if time is over using NOW

I'm coding a smart contract for an ICO and I have a problem. I have a modifier wich checks if NOW > timestamp, but it's not working for some reason. Here is the function: function DeleteModerator(...
1
vote
2answers
642 views

function () public payable modifier can trigger actions when sending tokens or only works when sending ether?

Modifier payable triggers an action when an address sends ether to a contract. For example: function () public payable { require(msg.data.length == 0); DoSomething(); } Is this ...
0
votes
0answers
11 views

TypeError: Member “checkAirlineRegistered” not found or not visible after argument-dependent lookup

So I made database and app logic smart contracts. App logic smart contracts will call functions in database smart contract. One of the functions acts as a way to check the data that has been put in ...
0
votes
1answer
10 views

How to restrict function to only callable from one external contract?

I have a Reputation contract which has a function foo() that sets some point. In another contract called Market I want to use the foo() function. But I don't want any one to be able to call foo() ...
0
votes
0answers
16 views

In Solidity, Modifiers & Mapping variable are stored where - storage or memory?

In Solidity, Modifiers & Mapping variable are stored where - storage or memory ?
0
votes
0answers
54 views

truffle solidity unit test modifiers: How do you test modifiers dependent on the sender account?

QUESTION: How do you write unit test code that would test that a non-owner can't execute a function modified by a requirement that they be the owner using in solidity and truffle? I am trying to write ...
0
votes
0answers
37 views

Accessing modifier of another smart contract - Role Based Access Control

I am trying to create a simple role based access control system for the contracts I have created. I have two smart contracts, one named Users that stores all of the users details as well as the type ...
0
votes
1answer
189 views

Function modifier effect on return value

Having the following code pragma solidity ^0.6.4; contract TestModifier { mapping (address => bool) public authorities; mapping (address => address) public authorized; modifier ...
0
votes
0answers
108 views

Using modifier on view function works locally, but fails on Ropsten

Hey I'm trying to make it inconvenient to view stored data in a contract, but it seems that the function is returning null values when I add a modifier. The modifier makes sure someone is approved ...
0
votes
1answer
288 views

Modifiers misunderstanding

pragma solidity ^0.4.0; contract test { bool test_bool1 = false; bool test_bool2 = true; modifier test_modifier(bool _test_bool){ if (_test_bool == false) throw; _; } ...
0
votes
1answer
44 views

onlyOwner modifier works in truffle test but not in console

In the following code, the console.log returns an empty string, but the truffle test works fine! const certificate = contract(Certificate); certificate.setProvider(web3.currentProvider); var ...