Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [uint256]

The tag has no usage guidance.

0
votes
1answer
18 views

variable declared as uint but accepting negative values instead of throwing errors

pragma solidity ^0.4.24; contract setget{ uint x; function setnumber(uint _x) public { x=_x; } function getnumber() public view returns(uint){ return x; } }
0
votes
2answers
14 views

Create token exchange by defining decimal values

I just learnt a lot about solidity and decided to put it into practice. Something I truly don't understand is how I can bypass the limitations of this programming language. Assume the following ...
3
votes
2answers
47 views

Passing '-1' to a solidity function which takes a 'uint256' argument as input

Suppose I have: function func(uint256 x) external { ... } I would like to test this function via web3.js, with the maximum possible value of x. In a Truffle test, I have noticed that I can ...
0
votes
1answer
41 views

converting uint256 to string

Any idea for the simplest way to add "degrees" variable into the string like below? Looking for getString to return "today is 40 degrees outside". pragma solidity ^0.5.3; uint public ...
0
votes
2answers
45 views

Set and Get of a large amount of data

I created a contract that insert one number (uint) in blockchain with set function but how can i retrieve all numbers inserted? This is my html, i put 1 number in a blockchain and i will see just the ...
0
votes
1answer
24 views

Store different numbers in Blockchain

pragma solidity ^0.4.24; contract Count { uint256 storeddata; function set(uint256 x) public { storeddata = x; } function get() public view returns(uint256) { return ...
0
votes
1answer
55 views

Ethers.js invalid number value while deploying contract

I'm deploying a contract usign ethers.js I do it as follows: const tokenWeiPrice = (answers.priceEur / ethEur) * Math.pow(10, 18); const contract = await factory.deploy( answers.maxSupply, ...
0
votes
1answer
35 views

Contract returns incorrect uint when it should fail

I have a simple contract that saves how many people payed, and, if you pay, you can see how many people payed. A simple idea to learn smart contracts. The problem is that the return value doesn't ...
0
votes
2answers
192 views

bytes32/uint256 conversion

I am looking to take in a uint256 (in hex notation) and convert it to bytes32. For some reason I am not getting the same value after converting. function test(uint256 genes1) public returns (bytes32) ...