Skip to content

Commit

Permalink
init storage in constructor for mock sol contract
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Jul 3, 2024
1 parent e7697e0 commit 7005c90
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ethereum/src/Mock/MockStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ pragma solidity ^0.8.0;
contract MockStorage {
uint256 public value;
mapping(uint256 => address) public mapValues;
address[] public arrValues;
uint[] public arrValues;

constructor() {
value = 99;
mapValues[99] = msg.sender;
arrValues.push(1);
arrValues.push(2);
arrValues.push(3);
arrValues.push(4);
arrValues.push(5);
}

function setValue(uint256 _value) public {
value = _value;
Expand All @@ -22,11 +32,11 @@ contract MockStorage {
return mapValues[_value];
}

function setArrValues(address _value) public {
function setArrValues(uint _value) public {
arrValues.push(_value);
}

function getArrValues(uint256 i) public view returns (address) {
function getArrValues(uint256 i) public view returns (uint) {
return arrValues[i];
}
}

0 comments on commit 7005c90

Please sign in to comment.