Questions tagged [solidity]

Solidity is a high-level language whose syntax is similar to that of JavaScript and it is designed to compile to code for the Ethereum Virtual Machine. A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain.

Solidity is a high-level language whose syntax is similar to that of JavaScript and it is designed to compile to code for the Ethereum Virtual Machine.

2349 questions
10
votes
4 answers

TypeError: Data location must be "memory" for parameter in function, but none was given

I tried to compile my code, but I got the following error: TypeError: Data location must be "memory" for parameter in function, but none was given my code: pragma solidity ^0.5.0; contract memeRegistry { string url; string name; …
10
votes
1 answer

Unhandled rejection Error: Invalid JSON RPC response: ""

I am trying to call a method on my ERC20 token contract. I am connecting to 'https://rinkeby.infura.io/' httpProvider. I can call() constant methods but when i want to change the state of the contract by calling send() function i get this mentioned…
sam k
  • 911
  • 12
  • 21
10
votes
1 answer

Division in Ethereum Solidity

I am creating a contract that issues tokens. I would like a account that holds tokens to be able to check what percentage they own out of all the tokens issued. I know that Ethereum has not implemented floating point numbers yet. What should I do?
GK1
  • 277
  • 3
  • 10
10
votes
2 answers

Getting the address of a contract deployed by another contract

I am trying to deploy a contract from another factory contract and then return the address of the newly created contract. The address it returns however is the transaction hash not the contract address. I believe this is because the contract is not…
Joe
  • 251
  • 1
  • 2
  • 11
10
votes
1 answer

How do I initialize an array in a struct

I have a struct Purchase in which I'm putting an array of payments. However, when I try to add the new payments array in my makePayment method I get an error back from the solidity compiler: "Internal compiler error: Copying of type struct Payment…
unflores
  • 1,444
  • 14
  • 29
9
votes
3 answers

Data location must be "memory" for return parameter in function, but none was given

I tried solidity example like as above in remix, solidity version > 0.5.0 But I am getting this error now. What is the way to solve this error? contract MyContract { string value; function get() public view returns (string) { return…
venus12
  • 93
  • 1
  • 3
9
votes
2 answers

Composition over inheritance in Solidity - Gas efficiency

In OOP languages, composition over inheritance is a well-known best practice. Solidity is an OOP language too but there is also the gas efficiency issue. Question is, in Solidity, how do composition and inheritance compare to each other considering…
ferit
  • 4,937
  • 3
  • 27
  • 49
9
votes
1 answer

Data on Private Ethereum blockchain lost/disappears after couple of days

I am deploying a private ethereum blockchain (geth) on a virtual machine on Azure. Upon deploying my Solidity contracts on the blockchain and launching my NodeJS application to it, I am able to add data normally through web apis of the nodejs…
Ghassan Zein
  • 3,289
  • 2
  • 15
  • 27
9
votes
2 answers

Can't send transaction even if I use an example from official Ethereum webpage

I write Crowdsale using this example. But I can't send a transaction, my test fails with an error: Contract: Crowdsale should accept payments after start: AssertionError: expected promise to be fulfilled but it was rejected with 'Error: VM…
rel1x
  • 2,087
  • 1
  • 29
  • 48
9
votes
2 answers

Calling external contract in solidity dynamically

I am trying to make a contract have a function that is capable of calling functions of another contract. The key part of my goal is that the contract should not be able to be deployed without any import statements and will not know the name of the…
GK1
  • 277
  • 3
  • 10
8
votes
5 answers

Event triggering in solidity

I'm currently working on ethereum platform(node.js and solidity). My question is how do I trigger an event in solidity(contract) using node.js?
Yajnesh Rai
  • 206
  • 1
  • 2
  • 12
7
votes
1 answer

Warning: SPDX license identifier not provided in source file

I created a new solidity contract. The contract is up and running but giving me this warning. Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier:…
Gogle Gogle
  • 135
  • 1
  • 5
7
votes
1 answer

Error when writing remix unit tests: URL not parseable: remix_accounts.sol

I'm writing unit test in remix-ide and I want to call functions from different addresses within a single test. The remix-tests Github page says that you can use import "remix_accounts.sol";, but I get URL not parseable: remix_accounts.sol. How to…
Arterm
  • 71
  • 2
7
votes
3 answers

How to modelize smart contracts in UML?

I am looking for a way to modelize ethereum smart contracts interaction using a modeling language like UML. I have the following serivce Contract: contract ServiceContract { constructor (address _storeC, address _quizC, address _signC) { …
maroodb
  • 848
  • 9
  • 24
7
votes
1 answer

Why am I getting exceeds gas limit error when I specify the exact gas limit?

I am deploying a contract using truffle, and when I specify the gas limit as the gas I want to use for the transaction I always get the exceeds gas limit error. Why does this happen? edit What I am trying to do is deploy the crypto kitties…
yemista
  • 345
  • 3
  • 13