watcher-ts/packages/solidity-mapper/test/contracts/TestUnsignedIntegers.sol
Ashwin Phatak a7ec3d8da8
Add APGL license and copyright notices (#212)
* Add license & copyright declarations for add-watcher.

* Add copyright declarations for cache.

* Add copyright declarations for erc20-watcher.

* Add copyright declarations for ipld-eth-client.

* Add copyright declarations for tracing-client.

* Add copyright declarations for uni-watcher.

* Add copyright declarations for solidity-mapper.

* Add copyright declarations for uni-info-watcher.

* Add copyright declarations for util.

* Add copyright declarations for lighthouse-watcher.

* Change license identifier in .sol files.

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2021-08-12 15:28:13 +05:30

35 lines
925 B
Solidity

// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.7.0;
contract TestUnsignedIntegers {
// Following unsigned integer variables are packed together in a single slot since the combined size is less than 32 bytes.
uint8 uint1;
uint16 uint2;
// Unsigned integer variable is stored in the next slot as it needs 32 bytes of storage.
uint256 uint3;
// Unsigned integer variable is stored in the next slot as there is not enough space for it in the previous slot.
uint32 uint4;
// Set variable uint1.
function setUint1(uint8 value) external {
uint1 = value;
}
// Set variable uint2.
function setUint2(uint16 value) external {
uint2 = value;
}
// Set variable uint3.
function setUint3(uint256 value) external {
uint3 = value;
}
// Set variable uint4.
function setUint4(uint32 value) external {
uint4 = value;
}
}