Search Results
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 |
Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.
2
votes
Accepted
Store decimal number in contract and then read it back
ufixed datatypes are not supported yet. See the warning notice in here.
But you can save the number insolidity multiplied by 10**decimals, where decimals is the number of decimal points you want to u …
1
vote
Accepted
Determining if a transfer to a contract is from another contract
balance)(address(this));
will execute the funding function in B including a transaction of ether from A with value address(this).balance
As for the reason of the gas limit you will read in the docs (solidity …
4
votes
How to store user specific data in ethereum private chain
Create a smart contract with a mapping variable, a setter, and a getter (the getter is not really necessary as solidity will create it for you). … pragma Solidity 0.4.23;
contract storeData{
address public admin;
mapping(uint256 => bytes32) public userData;
constructor(){
admin = msg.sender;
}
function saveData(uint256 …
0
votes
Call the function of another contract not on behalf of this contract
You call contract 2 from your wallet, there, msg.sender is your wallet. Contract 2 call contract 1 transfer function, there, msg.sender is the address of contract2.
2
votes
How others know my function is public?
You are right, if people do not know the ABI they will not know how to interface with your contract (maybe through the opcodes but let's keep it simple). However, they will get this from you, because …
1
vote
Accepted
Why Can't transferFrom be an onlyOwner function?
This is because before an address is able to execute transferFrom the owner of the tokens has approved that address to move the tokens, so no one but the users that have been approved can do the trans …
0
votes
Accepted
How to declare a fallback function?
Is easy.
function () payable public{
}
Hope it helps
2
votes
Accepted
Is it possible for a contract to steal funds using transferFrom function?
The intermediary contract can interact with your contract but can not extract funds if there is not a function for that. There is of course the issues with reentrancy and other patterns that can be av …
2
votes
Accepted
How Can I Use Javascript to Accept ERC20 Token Payments on My Site?
Asking the users to send tokens to your address could be a simple solution. You could also include code in your website to allow them to pay by just clicking a button. In the last case, you can use we …
2
votes
What is the purpose of mapping an object to another mapping?
This can be explained with an analogy. Mappings can be understood as file organizers. For instance, mapping(address => uint) can be seen as Folder => data, so the address gives the name of the folder …
1
vote
Accepted
Contract Interaction
As for the line PQ memory pq, this will throw an error in solidity, you should do PQ pq this defines an object that you can use to access PQ methods.
Hope this helps …
0
votes
Accepted
Solidity - ether transfer from contract to contract issue
This usually happens because there is a limitation in the amount of gas that the method transfer pass to the receiving contract. Transfer pass only 2300 gas which means that is the code in the fallbac …
2
votes
Accepted
What is the alternative to using the deprecated 'var' in this example code?
Instructor storage instructor = instructors[_address];
hope it helps.
0
votes
Accepted
Self-test assessment for Ethereum vulnerabilities
I know that one, was really instructive, made by Zeppelin, you can find it here:
https://ethernaut.zeppelin.solutions/level/0xdf51a9e8ce57e7787e4a27dd19880fd7106b9a5c
Hope this helps
1
vote
How to return the index value of transaction?
function setInstructor(address _address, uint _age, string _fName, string _lName) public returns(uint256){
var instructor = instructors[_address];
instructor.age = _age;
instructor.fName …