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
Is it possible to get the bytecode of an already deployed contract in Solidity?
mstore(o_code, size)
// actually retrieve the code, this needs assembly
extcodecopy(_addr, add(o_code, 0x20), 0, size)
}
}
Update:
Now, with the latest versions of Solidity …
11
votes
Accepted
How to convert bytes to uint in Solidity
You can use this function to convert bytes to uint:
pragma solidity ^0.4.23;
contract mycontract {
function bytesToUint(bytes b) public returns (uint256){
uint256 number;
for(uint … i=0;i<b.length;i++){
number = number + uint(b[i])*(2**(8*(b.length-(i+1))));
}
return number;
}
}
Updated function for solidity ^0.8.11
function bytesToUint(bytes memory …
1
vote
Looping over scheduling ETH transaction
The code below is shown in the help for recurrent transactions:
pragma solidity ^0.4.24;
// interface Aion
contract Aion {
uint256 public serviceFee;
function ScheduleCall(uint256 blocknumber, …
1
vote
Accepted
sha256 works with string memory but doesn't work with bytes32
The issue is the representation of the data. When you move to bytes32 the resulting data after abi.encodedPacked has 32 bytes, but the data used for the hash in your code SHA256(A) is not 32 bytes. So …
3
votes
Accepted
Unable to add transaction to blockchain (I'm invoking the setMessage(str) method but the str...
when you are calling setMessage function you should use send instead of call
$("#setMessageButton").click(function () {
var val = $("#userInput").val();
RemixContract.methods.setMessag …
2
votes
Accepted
how to get array that contain certain value
I test it on remix.
pragma solidity 0.5;
contract userID{
mapping (uint256 => bytes32[]) public users;
function sendReview(uint256 _uid, bytes32 _item) public{
users[_uid].push(_item);
}
function … getitem(uint256 _uid) public view returns(bytes32[] memory){
return(users[_uid]);
}
}
If you want to return structures then you can use this:
pragma experimental ABIEncoderV2;
pragma solidity …
4
votes
Trying to figure out this 2 ETH smart contract quiz
I think this is a good exercise to understand some details of how ethereum works.
The whole thing is a "scam". The two people who send the ether never had a chance.
The thing attracts attention becaus …
5
votes
Accepted
How can I create an array of objects of a specific smart contract in solidity?
The id is used to index the student
pragma solidity 0.5.1;
contract Management{
struct studentInfo {
string name;
string birthdate;
string department;
string location;
string email …
2
votes
Can a contract auto execute a transaction given certain conditions?
Smart contracts can not autoexecute, they should always be triggered by a transaction.
In your case you have a contract A and a contract B. When contract B balance is below a particular values you w …
1
vote
Accepted
Difference between Micropayment channel and ReceiverPays in Solidity docs
In the first case, Alice make several small payments that Bob can claim at any time. There is no need for expiration. This makes Bob topay for the transaction fees every time he claims one payment.
I …
0
votes
Accepted
A smart contract's storage problem , further ERC ?
It is not true that the limit is 1.46GB. A smart contract can theoretically store 2^256 words of 32 bytes. That is a ridiculously huge amount of data.
The amount of data used by a smart contract that …
3
votes
Accepted
Calling a smart-contract fallback function from another contract
The thing is that the transfer method allows for 2300 gas stipend. Because the fallback has a transfer again, 2300 won't be enough. You can use
addressB.call.value(msg.value)()
which will pass all …
0
votes
Accepted
How to get all the function names with their respective parameters from smart contract?
This can be done only for contracts for which you have the ABI. Etherscan allows people to verify the contracts and the ABI becomes available through Etherscan API. Then you just need to read the JSON …
2
votes
Accepted
Atomic Transactions
In the case that you present, there is no way that these function will fail. I assume your question is if in general there is a way to control the atomicity.
I assume your question is that you requir …
1
vote
Accepted
Smart contract method relayer
Yes, this can be done. Assuming that these two contracts are deployed indipendently:
First, deploy the first contract:
contract first{
function one(uint256 a, uint256 b) public pure returns(uin …