Questions tagged [solidity]

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.

Filter by
Sorted by
Tagged with
2
votes
1answer
28 views

Ethereum Blockchain Interoperability

I was reading through Vitalik's blockchain interoperability paper available here One thing he mentions is a company / project called EthereumLottery.io (currently not operating) which managed to ...
1
vote
1answer
49 views

Explicit type conversion not allowed from “bytes1” to “uint256”

Just tried to convert byte to uint using Solidity 0.5.x: uint length = uint(arr[i]); and got: MyCode.sol:88:29: TypeError: Explicit type conversion not allowed from "bytes1" to "uint256". ...
0
votes
1answer
22 views

error in ico token and ico contract

function () public payable { require(currentStage == Stages.icoStart); require(msg.value > 0); require(remainingTokens > 0); Blockquote fallback typos error ...
1
vote
3answers
117 views

comparing two addresses

I'am trying to create a modifier that allows certain accounts to execute functions. address[] authorized; function verify (address adrs) internal view returns (bool) { bool exist; ...
0
votes
1answer
66 views

'types/values length mismatch',

Hey guys I had a problem with my return function here's my smart contract : pragma solidity >=0.4.0 <0.7.0; contract NewHello{ address owner; address newOwner; constructor()public{ ...
0
votes
0answers
30 views

Trigger a function with transaction

Is it possible to trigger a solidity function by just sending a transaction to the smart contract without specifically interacting with the function in the transaction?
0
votes
1answer
45 views

totalSupply doesn't pass test

I'm starting programming. I wanted to do my first contract and I assigned totalSupply to 1000000. pragma solidity ^0.5.8; /** * The DappToken contract Constructor Set the total number of tokens ...
0
votes
0answers
37 views

Accept different tokens for one specific token within the contract

Assuming I want to accept different (let's say 3 or 4) tokens on exchange one specific token (MyToken). Let's call this X transfer. I'm thinking to write ERC223 contract which will accept different ...
0
votes
1answer
26 views

How can one user(Patient) can share information to other user in solidity

I am looking to Design Smart Contract using Ethereum Blockchain for storing and retrieving Medical Recoreds in Blockchain. As I am new to Ethereum I am little issue with below thing. anyone have any ...
-2
votes
1answer
32 views

ParserError: Expected '(' but got identifier function unlockMessage(string name ) public payable returns (bool) { ^-----------^ [closed]

I am trying to compile but i get this error message I can not figure out what is wrong with the unlock message ParserError: Expected '(' but got identifier function unlockMessage(string name ) ...
1
vote
1answer
34 views

How can I send ether [duplicate]

Hey guys I am a beginer on Solidity. I write a function and try to send ether on remix accounts and check balances this accounts. But I can't connect accounts I think because when I check balance of ...
0
votes
1answer
26 views

abigen error : Failed to generate ABI binding: unsupported arg type: tuple

Hello I 'am trying to generate Go ethereum binding for a smart contract in which I have a function that takes a struct as argument. It seems that abigen doesn'tsupport this argument. struct Device { ...
0
votes
1answer
24 views

CRUD storage pattern Infinite gas error when trying to implement in Remix

I'm trying to implement @robhitchens CRUD storage pattern in solidity, and I'm getting infinate gas costs when I import the library. Not sure where to go from here. one of them: Gas requirement of ...
1
vote
0answers
20 views

How to get the address of the code being executed from CALLCODE?

I want to write a library which can be callcalled by any contract. As part of this, I want to write a function which returns the contract address of the library to the contract which callcalled it. ...
0
votes
2answers
26 views

Solidity code sequence for owner

How can I make my code sequential, meaning I'd like functions to be performed in a certain order. Can I make a function not run able till another is run. An example would be great help.
0
votes
1answer
37 views

Staticcall on external function works only, when there is one function's argument

I'm trying to call external function in contract B from contract A using staticcall. Here is code for contract A: contract A { address public addr; bool public success; bytes public ...
0
votes
2answers
47 views

Unused function parameter. Remove or comment out the variable name to silence this warning

I have a smart contact which have 2 owner address and 3 functions. my set functions is set a users with msg.sender and my getUser functions is returns name,surname and age and I want to add a admin ...
1
vote
1answer
53 views

Function declared as view, but this expression (potentially) modifies the state requires payable

I'm trying to change the an address data variable to a one, which is selected via a function. Keep getting the below error. Function declared as view, but this expression (potentially) modifies the ...
0
votes
1answer
29 views

cannot verify the contract address because of compiler version 0.4.9 not available in etherscan verify contract

My compiler version is solidity 0.4.9, but i am not able to verify my contract address on etherscan verify contract, the reason is 0.4.9 is not in the list compilers...please tell me the solution to ...
3
votes
0answers
13 views

Any known implementations for on-chain merkle proofs of historical balances?

I know it is possible to verify historical ETH balances (for the last 256 blocks) using a merkle proof on-chain - are there any known implementations? NB - I'm looking for Solidity code (i.e. on-...
0
votes
0answers
50 views

Why would I use interfaces in this case?

I see suggestions here and there to import an interface instead of the whole contract to reduce contract's bytecode and deployment costs. Consider the following structures: contract Storage { ...
0
votes
0answers
49 views

“evm: execution reverted”

solidity version:0.4.25 web3 version:0.20.1 I write a contract using solidity,and I have finished the test on remix web and it work successfully.When I want to call the contract using web3,the geth ...
0
votes
0answers
58 views

Truffle Contract deployment >> Error: Returned values aren't valid, did it run Out of Gas?

I have a rpc enabled running private ethereum blockchain node with mining enabled. I have connected to it using metamask and have performed some contract interactions (deployment, calling functions,...
0
votes
1answer
32 views

Member “name” not found or not visible after argument-dependent lookup in string storage ref

I have code like this and I want to set my name, surname and age in my struct so I want to set them and get them using with my functions here's my code : pragma solidity >=0.4.0 <0.7.0; ...
0
votes
0answers
60 views

Withdraw functions implementation

I'm writing a smart contract where subscribers make a bid, post doing so owner selects one and sends him data as well as ends the contract. If data is valid, winner releases the funds so owner can ...
1
vote
1answer
47 views

Which is faster: loop inside contract or loop of transactions?

I have this contract: pragma solidity 0.5; pragma experimental ABIEncoderV2; contract TestStruct { struct User { string name; uint256 age; } mapping (bytes32 => ...
0
votes
3answers
88 views

ParserError: Expected ',' but got identifier

pragma solidity >=0.4.0 <0.7.0; contract NewHello{ struct kullanicilar{ string name; string surname; uint age; } event infoChanged( string name, ...
1
vote
1answer
41 views

How to pass struct params in remix ide?

I have this smart contract: pragma solidity 0.5; pragma experimental ABIEncoderV2; contract TestStruct { struct User { string name; uint256 age; } mapping (bytes32 =&...
0
votes
0answers
15 views

Finding methods executing a transfer

How can we find all the function which executes a .transfer to transfer ether even by parsing the contract or going through opcodes? One can also put their views related to it. Thanks!
0
votes
0answers
16 views

signature verification without solidity

Hello I want to verify a signature and the format should be VRS (Ethereum standard secp256k1 signature format) and I want to achieve it using only "Java". I found ways to do it using Web3j and ...
0
votes
2answers
29 views

How can I pack two int16 into a single byte32?

I have a contract that makes use of cartesian coordinates. My initial thought is to map a single location (x,y) to a value/struct. I would like to define any given pair of coordinates by a single ...
0
votes
1answer
21 views

What is the best way to store a hexadecimal value in an array in Solidity?

I am attempting to store a hash (web3.sha3) into an array in a smart contract. What is the best way to do that?
2
votes
2answers
54 views

Fallback function - why revert?

Just wrote and tested the following on http://remix.ethereum.org Same happens on Ropsten network. If I run without sending any value it works, but I can't deploy the Test contract if I put any ...
0
votes
0answers
45 views

Running Migrate in Truffle does not work

I have been using Remix for developing my dapp but decided I should use Truffle to make things a little more robust and professional. I have truffle and ganache installed. I run truffle migrate and ...
0
votes
1answer
21 views

Trying to set a new value to storage contract through another contract

I'm having a problem of setting a value to storage contract through another contract. Below is the code: StorageContract.sol pragma solidity ^0.5.8; contract StorageContract { constructor () ...
0
votes
0answers
27 views

compile_files gives errror for given path of the contract [duplicate]

pragma solidity ^0.5.1; import "./Owned.sol"; contract Greeter is Owned { bytes32 public greeting; event GreetingChange ( address indexed changer, bytes32 indexed _from, ...
0
votes
1answer
21 views

What does this mean: “It is not possible to enumerate storage from within a contract” (Solidity doc)?

In the Solidity docs section on memory, you find this paragraph (emphasis added): Each account has a data area called storage, which is persistent between function calls and transactions. Storage ...
0
votes
0answers
18 views

How to get the call graph of a mainchain transaction?

Simple question, but I couldn't find the answer. There are transactions like this one which involve many chained contracts. But as storage modify the functions being called and calldata doesn t ...
0
votes
0answers
13 views

how to write smart contract in django python?

I am trying to create a daap website in django. In django use apps to write views and urls to mvc pattern. I tried to create an app and wrote smartcontract there but i am not able to access it. I have ...
2
votes
1answer
47 views

Status of ABIEncoderV2 now

Do you know the current status of ABIEncoderV2? I want to know the current status of ABIEncoderV2 Live projects using ABIEncoderV2 right now Restriction on the normal encoder Risks of using ...
0
votes
0answers
13 views

Difference between UTXO based smart contract and Account based Smart contracts [duplicate]

I want to understand the difference between UTXO based smart contract(Bitcoin scripting and Komodo's CC) and account based smart contract (Ethereum). What are the different pro and cons for these two ...
0
votes
1answer
32 views

Multiple Inheritance at particular contract address

I'm attempting to have 4 different contracts sharing the same data fields. The reasoning behind having 4 instead of 1, is that the different functionality can be broken down so that it is cleaner, ...
0
votes
1answer
31 views

Hash functions in solidity

I'am trying to hash two bytes16 variables to produce bytes32 or bytes16 variable : bytes16 T=hash(bytes16 t1, bytes16 t2) I looked in documentation but I didn't find anything
1
vote
2answers
63 views

How to concatenate two bytes16 to bytes32

I'am trying to concatenate tow bytes16 to form a bytes32 func concat(bytes16 t1, bytes16 t2) public returns (bytes32) I'am not finding anything in solidity documentation! Is anyone have an idea ...
0
votes
1answer
27 views

Passing array in web3.js as a function parameter

I am trying to estimate gasLimit for function that transfers funds to multiple addresses: const gasLimit = await multiTransferContract.methods .transferToMany(targetAddresses, amounts, tokenAddress)...
0
votes
1answer
31 views

Expected ')' but got identifier if(string name != users[name]){ ^--^

pragma solidity >=0.4.0 <0.7.0; contract NewHello{ mapping(address => string) public users; // contains a name for every address function updateUser(string memory name) public { ...
1
vote
0answers
23 views

What's the equivalent of Vyper's create_forwarder_to in Solidity?

In Vyper, there's a built-in function called create_forwarder_to, which Duplicates a contract’s code and deploys it as a new instance, by means of a DELEGATECALL. If my understanding is correct, ...
0
votes
1answer
36 views

member not found or not visible after argument-dependent lookup in mapping

pragma solidity >=0.4.0 <0.7.0; contract New{ mapping(address => string) public users; string name; address[] public userAddress ; //string[] public userNames; ...
0
votes
1answer
32 views

Wrong estimation of gas while contract deployment

I have a smart contract: pragma solidity 0.5.3; import "./ERC20.sol"; contract Transfer { ERC20 private erc20iface; address private _owner; modifier validOwner() { require(msg.sender == ...
2
votes
2answers
49 views

Why is the recursion in the namehash algorithm?

The algorithm is described in eip-137.