Questions tagged [modifiers]

The tag has no usage guidance.

12 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
232 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 = ...
1
vote
0answers
179 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
164 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
1answer
219 views

Calling onlyowner functions using owner's private key

I need to call a function with onlyOwner modifier in my smart contract via web3.js. I want a user of my site to be able to send their information to a white list, but it sends the transaction from ...
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
549 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
27 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
72 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
1answer
214 views

Read access control solidity smart contract

Let's say that we have a contract that not anyone can access to view function : contract AccessControl { mapping (address => bool) authorized; function getSomething () public view returns ...
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
281 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
38 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 ...