Questions tagged [solidity-0.5.0]

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
0answers
8 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-...
-2
votes
0answers
16 views

can anyone upgrade this code to new solidity version o.5.14 [closed]

pragma solidity >=0.4.12; contract HealthRecords{ struct Contact { string symptoms; string medications; string allergies; uint weight; uint height; } mapping (uint => ...
-1
votes
1answer
9 views

parse error: expected type name [closed]

pragma solidity >=0.4.0 < 0.7.0; contract Doctor { mapping (address => doctor) internal doctors; mapping (address => mapping(address => uint)) internal doctorToPatient; ...
0
votes
1answer
20 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
35 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
17 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
34 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 ...
0
votes
1answer
36 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
20 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
27 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
25 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
54 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
39 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
25 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
72 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
26 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
28 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
29 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
38 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
20 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
19 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
16 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
15 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
32 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
62 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
34 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
21 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
52 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
18 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
90 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
17 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
46 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
18 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
26 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
12 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". ...
1
vote
1answer
41 views

What is the unit for the tx.gasprice?

Is it a wei, kwei, mwei, gwei, ... Something else? The API doesn't say much.
0
votes
0answers
29 views

Simple functions and constructors not working [duplicate]

I am working with a private blockchain, and am having a problem where simple functions and constructors simply fail to work. For instance: constructor(address admin) public{ owner = msg....
0
votes
4answers
103 views

How do I get an address with a correct checksum, from an address with an incorrect checksum, using Solidity?

Example of an address with the wrong checksum: 0xa54D3c09E34aC96807c1CC397404bF2B98DC4eFb Example of an address with the right checksum: 0xa54d3c09E34aC96807c1CC397404bF2B98DC4eFb -Difference ...
0
votes
1answer
29 views

Combine BytesX and BytesY to create BytesZ?

I am working on a Solidity Smart Contract (^0.5.10) where I want to return an array of Ratings elements. struct Ratings { address restaurant uint8 score }; Since returning Rating[], string[]...
1
vote
1answer
15 views

ganache test returns characters instead of numbers

mapping(uint256 => uint256) public amount; function saveAmount(uint256 _id, uint256 _amount) public { amount[_id] = _amount; } I have a function that saves amount in mapping. When I test ...
0
votes
1answer
19 views

How does the named return variables in solidity work

I have below solidity contract from Truffle quick start guide. pragma solidity >=0.4.0 <0.6.0; contract TaskMaster { mapping (address=>uint) public balances; ...
0
votes
1answer
30 views

openzeppelin mint sequence

// openzeppelin v5 contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata { constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) { // solhint-...
0
votes
1answer
65 views

address payable type error

Just upgraded truffle to version 5 and having a problem with this new address payable type. contract Test { ERC721Full public tokenAddress; constructor(address _address) public { ...
0
votes
3answers
99 views

transferFrom function not working in ICO Smart contract

I am facing issues with the transferFrom function of smart contract address 0x6560a9b6436e129cf835ab9da96201207facd4f8: I copied the smart contract code from etherscan.io and deployed on ropsten ...
0
votes
1answer
43 views

Solidity group addresses with a name. Eg: Whats app groups

I want to create a squad(group) which consists of a group addresses. Like Squad XYZ consists of Addr1 with name 'A',Addr2 with Name 'B', Addr3 with name 'C'. pragma solidity ^0.5.9; contract Squads{ ...
2
votes
0answers
26 views

How Can You Map a Struct Twice With Different Keys?

I have a struct mapped with an address as the key. I want to iterate through all values of that mapping with another key value, in this case a nonce that I generate in the contract. Is this possible? ...
3
votes
1answer
46 views

Why solidity's keccak returns different value from online generators?

I try to implement my own little modifited commit&reveal voting. I have problem with revael phase. Reveal metod signature look like: function reveal(bytes32[] memory _reveals, bytes32[] memory ...
2
votes
2answers
46 views

Geographic location in Solidity

Does solidity have a way of fetching a persons geographic location(using something like msg.sender)? Im building a dApp for national elections, and would need to verify the geographic location before ...
0
votes
1answer
47 views

Deposit event is not call while contract get token

My contract pragma solidity ^0.5.0; contract Transfereventaction { event Deposit( address indexed _from, bytes32 indexed _id, uint _value ); function deposit(...
0
votes
1answer
30 views

uint[] to address with correct checksum

Lets say we have something like this as a given: bytes20 b = bytes20(someAddress); uint8[] memory array = new uint8[](b.length); for (uint256 n = 0; n < b.length; n++) { array[n] = uint8(uint160(...