File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
crates/test-utils/contracts/src Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: MIT
2+ pragma solidity ^ 0.8.0 ;
3+
4+ contract AccessList {
5+ uint256 public x;
6+
7+ uint128 public a;
8+ uint128 public b;
9+
10+ mapping (uint256 => uint256 ) public numbers;
11+
12+ event LogNumber (uint256 x );
13+
14+ function setX (uint256 _x ) public {
15+ x = _x;
16+ }
17+
18+ function incrementX () public {
19+ x++ ;
20+ }
21+
22+ function getAB () public returns (uint256 , uint256 ) {
23+ return (a, b);
24+ }
25+
26+ function setAB (uint256 _a , uint256 _b ) public {
27+ a = _a;
28+ b = _b;
29+ }
30+
31+ function writeManyNumbers (
32+ uint256 [] memory _keys ,
33+ uint256 [] memory _values
34+ ) public {
35+ require (
36+ _keys.length == _values.length ,
37+ "Arrays must be of the same length "
38+ );
39+ for (uint256 i = 0 ; i < _keys.length ; i++ ) {
40+ numbers[_keys[i]] = _values[i];
41+ }
42+ }
43+
44+ function loadManyNumbers (uint256 [] memory _keys ) public {
45+ for (uint256 i = 0 ; i < _keys.length ; i++ ) {
46+ emit LogNumber (numbers[_keys[i]]);
47+ }
48+ }
49+ }
You can’t perform that action at this time.
0 commit comments