0

I am new to Solidity, I completed a tutorial from medium (3 parts) and I wanted to start my own project.

In this project I want to create a BaseClient contract, but I got confused about how the data is manipulated inside the contract. Considering the ClientBase contract references a bank client in the real world, how can I proceed in order to make a right contract?

I made these samples to illustrate my confusion: where is the client Data supposed to be?

contract ClientBase is Ownership,Account {



    struct ClientBase {
        uint  cin;
        Account[]  accounts;
        address ClientAddress;

    }

    function ClientBase() {

    }
}

or

contract ClientBase is Ownership,Account {

     uint  cin;
     Account[]  accounts;
     address ClientAddress;

     function ClientBase() {

     }
}
0

where is the client Data supposed to be?

If we are talking about some data which is meant to be in multiple instances (e.g. multiple bank accounts), then it is always better to use structs. Because later it will be easier to organize this structs into arrays or mappings, meaning it will be more intuitive to access data.


And if you will have multiple uint variables in your struct you can use smaller uint types (e.g. uint128, uint64 etc.) which will make storing data in your structs more gas efficient.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.