Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 19510
4 votes
Accepted

Is there a way to know the REAL msg.sender?

On a real blockchain, you can't send from whatever account you want. You can only send as an address for which you know the private key. So "the real msg.sender" is just msg.sender. It cannot be spo …
user19510's user avatar
  • 28.1k
1 vote

Check if contract exists in list

I'm a little unsure of what you want, but assuming _id is unrelated to an item's position in the list and you require a way to enumerate the Users in the system, you probably need both an array and a mapping … /User.sol"; contract Main is Ownable { User[] private _users; mapping(uint256 => bool) userExists; function createUser(uint256 _id) onlyOwner external { require(! …
user19510's user avatar
  • 28.1k
2 votes

ERC20 transfer function - Use "if, else" or "require"

So I'd say you should indeed use require, but don't include the _amount > 0 clause. …
user19510's user avatar
  • 28.1k
3 votes
Accepted

How to use require() with stings

There's no built-in equality test for strings (or other arrays), so a common technique is to compare the hashes of the strings instead: function feedData(string _result) public { // Compare hashes require
user19510's user avatar
  • 28.1k