I am trying to deploy my contract using geth.
Contract goes like this :
pragma solidity ^0.5.0;
contract hier {
uint i;
uint ur=0;
bytes15[2][20] public UserRole;
function user_role_assignment(bytes15[] memory a) public
{
for(i=0;i<10;i++)
{
if(i%2==0)
UserRole[ur][0]=a[i];
else{
UserRole[ur][1]=a[i];
ur=ur+1;
}
}
}
bytes15 public result;
function checkAccess( bytes15 username ) public {
for(i=0;i<10;i++)
{
if(UserRole[i][0]==username)
result = UserRole[i][1];
}
}
function RESULT() public view returns(bytes15)
{
return result;
}
}
When I pass array through function user_role_assignment, values are not stored. (Everything is working fine in Remix) Why is it happening?
Someone please help!
Not only this, even simple function which just store value in a variable is not working in geth but working fine when I run on remix.
Eg:
contract Example{
uint public i = 0;
function store() {
i = 100;
}
function check() public returns(uint){
returns i;
}
After running store and check functions in geth, i values didn't change... Please help! Thank you.
example.store.call()it will NOT modify the contract storage. You have to useexample.store()instead. See this question for the difference between a call and a transaction https://ethereum.stackexchange.com/questions/765/what-is-the-difference-between-a-transaction-and-a-call. – Ismael May 08 '19 at 05:32