Questions tagged [solidity-0.5.x]

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. Solidity version 0.5.0 is a specific version that includes a number of changes to the language and introduce new features.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

Is it true that we can't make multiple Transfer() to the same address within a single transaction now?

The code below is for illustrative purposes only. Not the actual production code. function payCommission(address[] payee) public payable { for (uint i = 0; i < payee.length; i++) payee[...
0
votes
2answers
20 views

Couldn't understand the logic behind code for mulitdeed payout contract

While searching on the web I came across this page the user has created multiple examples of solidity smart contract On multiple payout deed smart contract I can't understand this line duePayouts = ...
0
votes
0answers
25 views

Polymorphism in Solidity

I understand that Solidity supports contract polymorphism, but what pattern would one use to create abstract data types for use in derived contracts? Motivating example: Say I have an abstract Storage ...
1
vote
1answer
18 views

Compilation Eror: One contract accessing the variable of another contract

I am trying to compile two contracts. I am getting 'balance' variable error in "HoneyPotCollect.sol" contract. Is balance not a global contract variable? Somebody please guide me how to ...
0
votes
0answers
27 views

Truffle + Infura Mainnet deploy. Transactions never get mined, timing out after 750 seconds

The contract deploys on Rinkeby without a hitch, but when it comes to mainnet it is erroring out strangely. Infura's HTTP endpoint was giving me Invalid JSON RPC RESPONSE "", so I decided to ...
0
votes
1answer
31 views

Why solidity doesn't use “ Null ” and “undefined”?

Like Python or any other language why does Solidity avoid having the Null and undefined properties?
1
vote
1answer
23 views

Why does Solidity not use the years keyword?

Solidity has keywords like seconds, minutes, hours, days and weeks that are used to specify units of time. Why do they not have years?
0
votes
0answers
15 views

How to make my contract balance as private in Ethereum?

Suppose there are two contracts, A and B. Obviously, balance of A is public and B can read it with address_of_A.balance. Is there a way to make balance of A as a private data and B can't read it with ...
0
votes
1answer
36 views

Data location can only be specified for array, struct or mapping types, but “memory” was given

I am new to solidity. I was trying to compile the following code in chrome browser with Remix. I am getting the following error "Data location can only be specified for array, struct or mapping types, ...
0
votes
1answer
37 views

Problem: Payment between smart contracts without reducing the balance of the sender contract

I work on Truffle. I have two smart contracts A and B. Codes of them are same. A should transfer some ether to B and store some information about this payment. I funded A with METAMASK. But, whenever ...
0
votes
1answer
32 views

delegatecall method - calling context is not being set

We have an issue with delegatecall method. We want to call contract C2 from C1 (which is supposed to be a pass through contract for the user wallet). When we are calling C2 via C1 even using ...
1
vote
1answer
35 views

Receiving error while getting state variable value after using selfdestruct method “Error: Returned values aren't valid, did it run Out of Gas?”

I am using selfdestruct method and passing the payable address to it but receiving the following error when trying to get the value of a state variable : "Error: Returned values aren't valid, did it ...
0
votes
0answers
34 views

Transaction halted with a RUNTIME ERROR

while debugging I encountered this error: There was no revert message. This may be due to an in intentional halting expression, such as assert(), revert(), or require(), or could be due to an ...
0
votes
1answer
24 views

When i call a function: Error: Returned error: VM Exception while processing transaction: invalid opcode

I work on Truffle. My contract is A and its function is infoRep(). infoRep() returns some data. Whenever i call the function in Truffle console the below error occurs: Error: Returned error: VM ...
0
votes
1answer
23 views

Delete mapping within a mapping

I have a mapping with the following structure: mapping(uint256 => mapping(address => SOME_STRUCT)) public submissions; delete submissions[uint256] is not allowed(compiler error). delete ...
1
vote
1answer
31 views

Explicit declaration, the “var” keyword is not allowed syntax error

While trying to compile this contract I'm getting a syntax error complaining about the "var" keyword being disallowed. How do I fix this? pragma solidity ^0.5.0; contract Courses { struct ...
0
votes
1answer
72 views

Openzeppelin Crowdsale

Ok so Ive found Openzeppelin a slightly easier Code to use, it explains better than Solidity does. But now my problem is the Math bit. Im no mathematician neither and cannot get my head around how it ...
0
votes
1answer
26 views

Contract inheritance to share same storage in Proxy pattern for upgradeability

Please bear with me here, I have been trying to figure it out myself but couldn't. I am trying to learn upgradeability with a Proxy pattern .https://blog.gnosis.pm/solidity-delegateproxy-contracts-...
0
votes
1answer
67 views

Factory contract to clone existing contracts

I am researching about Factory contract to clone existing contracts, First is the implementation present at https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol. I don't ...
0
votes
0answers
46 views

Deploy ERC725 Identity with ERC735 Claims

I am using ERC725v1 and ERC735 Interfaces to add a contract which can deploy an ERC725 based Identity contract that can hold an Identity key and further Add Claims from that Identity for the ...
1
vote
1answer
38 views

TypeError: Member “editor” not found or not visible after argument-dependent lookup in struct PrivateSmartContract.BuildingRental storage ref

I want to store user's wallet address array as editor's address so i created struct with array like following pragma solidity >=0.4.0 <0.7.0; pragma experimental ABIEncoderV2; contract ...
2
votes
1answer
77 views

How to get access to the storage mapping through the solidity assembler?

referencing the question How to get access to the storage array through the solidity assembler? I have been trying to figure out how to access the mapping (or variable y from the question). The ...
1
vote
1answer
158 views

Error: Cannot find module 'bignumber.js'

I'm trying to test this smart contract but I can't seem to get the beyond this error, I'm using the latest truffle suite v5.1.16, and web3 v1.2.6. KTokenSale.test.js const BigNumber = web3.BigNumber;...
1
vote
1answer
30 views

How to use solidity library with truffle

I'm using truffle V5.1.13 and when I run truffle test the res variable contains a transaction receipt rather than the expected 2. I notice if I remove everything that has to do with the library things ...
0
votes
0answers
30 views

Version Compatibility Issues Solidity v0.4 to 0.5 | Identity Contracts ERC 725 | abi.encodePacked not working

This is in reference to ERC 725 Identity Contracts. I am updating the contract to version 0.5. The issue arise in a specific function where it requires a single argument to the call method which I ...
1
vote
1answer
37 views

Transaction working in remix but not errored from dapp

I have a master contract which deploys instances of other contracts. pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; contract DataEntityContract { DataEntity DE; constructor(...
1
vote
1answer
161 views

Explicit type conversion not allowed from “bytes32” to “address”

I am using solidity 0.5.0 when i compile code i am throwing exception as Explicit type conversion not allowed from "bytes32" to "address". code is working fine in remix IDE and my code is as ...
1
vote
1answer
71 views

How to get web3 to interact with smart contract to input string info

Just cannot get what seems like a simple input from html page to interact with a very simple contract to input data. Started off trying to make this tutorial work: Interacting with a Smart Contract ...
0
votes
1answer
40 views

Calculate most frequent value in a array in solidity

I have an array something like [0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2]. I want to find the most frequent value. If two are more are having highest frequency, the first occurance should be the result. ...
6
votes
1answer
97 views

Public variable getter shows as transaction in Remix

As of Solidity 0.6.0+ compiler, my remix shows getter functions, built by public variables, as transactions and, therefore, do not return the value. I searched the solidity 0.6.0 breaking changes but ...
1
vote
2answers
41 views

How can I find out the sender's gas limit?

Is there a way to check Sender's Gas Limit? If the sender sets too low, I will just accept whatever gas amount that he had set and return immediately without hitting the limit. I am trying to ...
1
vote
0answers
36 views

transfer(amount) failed even when it is not a contract

address payable receiver; receiver.transfer(amount); The receiver is NOT an contract, and the amount is only 0.4 ether, the contract is holding sufficient ether in its balance. I understood that ...
0
votes
1answer
40 views

“Migrations” exceeded the block limit

I didn't have any problem using solc 0.5.0 (geth 1.9.3), but facing this problem after upgraded to 0.5.12 (geth 1.9.9). After doing some research, I believe it is because of the changes to the ...
0
votes
1answer
42 views

Contract Data Retrival

Whenever I do modification in a contract and deploy the contract again, the data in the existing contract is completely lost as the new contract is deployed in a new address. For instance, I have a ...
0
votes
1answer
45 views

what is declaration error in remix ide and how to solve it

What is declaration error here! I can't figure it out and the error is shown as an unidentified declaration error. Please help me out
0
votes
0answers
25 views

TypeError: “send” and “transfer” are only available for objects of type “address payable”, not “address”. owner.transfer(msg.value); ^------------^ [duplicate]

pragma solidity ^0.5.0; /** * The Hotel contract does this and that... */ contract Hotel { struct Room { uint id; string name; string hotel_name; uint price; ...
0
votes
1answer
27 views

How to retrieve elements from a mapping to an array of structs

I have recently started playing around with SmartContracts and I have run into a problem which I can not find a solution to. I have the following struct and mapping in my Smart Contract: struct ...
1
vote
1answer
23 views

Different behavior of the same contract between JavaScript and Solidity tests with Truffle

I have a simple contract that functions as a ratekeeper - it is constructed with a capacity and time_frame (in blocks) parameters and makes sure we never add more than $capacity payments in any given ...
0
votes
1answer
38 views

Incorrect bytes32 to string conversion

My solidity function is returning a bytes32[] which I am looping in Javascript and converting to string using web3.toAscii(). Printing this in console shows extra � characters at the end as shown ...
-1
votes
1answer
115 views

How and when should I use a Ethereum smart contract in document verification process?

First, a student applies for a certificate in his/her University . The University creates his degree certificate . Now , how do I write a smart contract in Solidity so that anyone in blockchain can ...
0
votes
0answers
38 views

Comparison of 2 child-contract-values in factory-contract

in my solidity code I create a tracking-contract and auction-contracts out of a factory-contract. The last function 'a4_Payment' of the auction-contract should be triggered out of the master-contract ...
0
votes
0answers
23 views

Can a factory-contract access/read/modify variables in generated child-contracts?

at the moment I am experimenting with the factory/child-logic in solidity. With my factory contract I am able to create child contracts in which an auction is executed. Now I want to return a variable ...
0
votes
1answer
92 views

Solidity - Creating child contract

Recent code: pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; contract Master { address Pi_C_Owner; address payable public NewAuctionPayable; //Hilfsvariable um ...
0
votes
1answer
23 views

how to put struct “s1” values in another variable

how to put struct "s1" values in another variable. pragma solidity ^0.5.1; contract MyContract{ struct student{ int RollNo; string Name; } student public s1=student({...
1
vote
1answer
178 views

what is 'UnimplementedFeatureError: Not yet implemented - FixedPointType' error?

what is 'UnimplementedFeatureError: Not yet implemented - FixedPointType' error in solidity while compiling through truffle ? How to fix it ? Using solidity compiler version - 0.5.9
0
votes
0answers
19 views

Auction Contract with “Right to Bid”

I build a basic reverse auction you see here using Solidity and the ethereum remix IDE. In addition to the functionalities already implemented I would like to add a "SafetyLimit" amounting to half the ...
1
vote
1answer
68 views

Invalid opcode when trying to pass address as parameter to contract

When I try to pass address as parameter to this addEmployee function it gives me this error: invalid opcode The execution might have thrown. Debug to get more information. modifier onlyOwner(...
1
vote
1answer
30 views

Direct and separate funds into two different payable functions

Basically I have this code where I'm trying to divide a specific amount of ether into two different function calls within the contract. function singleTransaction(arg1) payable { require(msg.value ...
0
votes
1answer
42 views

Unable to interface the contract while running test.js and how to get the abi while compiling using solc?

Solidity Contract: index.sol pragma solidity ^0.5.0; contract Inbox{ string public message; constructor(string memory IntialMessage) public{ message = IntialMessage; } function setMessage(...
1
vote
1answer
23 views

How to type cast fixed size byte arrays in solc 0.5.x?

In solc 0.4.28 I was able to do: uint foo = 42; bytes28 bar = bytes28(foo); but in 0.5.9 I'm getting the error: TypeError: Explicit type conversion not allowed from "uint256" to "bytes28". ...