1

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.

  • How do you call the contract functions from geth? – Ismael May 6 at 4:36
  • In the 2nd contract named Example : example.store.call( ) , example is the variable in which bin of the contract is stored. – Shirisha Kollapuram May 8 at 4:59
  • If you use example.store.call() it will NOT modify the contract storage. You have to use example.store() instead. See this question for the difference between a call and a transaction ethereum.stackexchange.com/questions/765/…. – Ismael May 8 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.