mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-20 04:46:20 +00:00
b243025ca8
* Add tests for getStorageInfo and getEventNameTopics. * Lint solidity-mapper package code. * Add test for contract type. * Add test for fixed size byte arrays. * Add test for Enum types. * Add tests for variables packed together and using single slot. * Fix comments in test contracts. Co-authored-by: nikugogoi <95nikass@gmail.com>
23 lines
699 B
Solidity
23 lines
699 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.7.0;
|
|
|
|
contract TestStrings {
|
|
string string1;
|
|
|
|
// String type variable takes the next single slot.
|
|
// If data is 32 or more bytes, the main slot stores the value length * 2 + 1 and the data is stored in keccak256(slot).
|
|
// Else the main slot stores the data and value length * 2.
|
|
// https://docs.soliditylang.org/en/v0.7.4/internals/layout_in_storage.html#bytes-and-string
|
|
string string2;
|
|
|
|
// Set variable string1.
|
|
function setString1(string memory value) external {
|
|
string1 = value;
|
|
}
|
|
|
|
// Set variable string2.
|
|
function setString2(string memory value) external {
|
|
string2 = value;
|
|
}
|
|
}
|