Day-05: Solidity Insights (02) #100DaysOfCode #MyLearnings

Day-05: Solidity Insights (02) #100DaysOfCode #MyLearnings

·

2 min read

Intro

You begin with something & challenges come on the way, the most challenging thing is to maintain consistency, and in my case, it is to maintain with my work... My y perspective is to keep things moving, if not at most then at least... That's what I did today, did at least I could do along with the workload. Overall day was productive but not in a learning sense...still am happy.

Overall learning was less, but am moving ahead...experimenting with the concepts & code in Solidity, some of the insights are listed below,

Concepts Covered

Deploying Contracts from the contracts themselves i.e. from the code itself:

The ability of contracts to seamlessly interact with each other is known as Composability.

import "contracts/SimpleStorage.sol";

contract StorageFactory{
SimpleStorage public simpleStorage;
function createSimpleStorageInstance() public{
simpleStorage = new SimpleStorage();
}
}

Interacting with contracts form code:

Interacting with other contracts needs two things, the address of the contract & ABI(Application Binary Interface)

To access the functionalities of other contracts, first, we need to access that particular

contract for which we need either address or ABI(Application Binary Interface)

Opinion:

To me, an ABI is a contract instance & assigning it to a particular variable would initialize with that particular instance & not create the new one, as done below.

SimpleStorage simpleStorage = simpleStorageArray[index];

simpleStorage.addPeople(name, favNumber);

Another way could be to use the address to initialize the particular contract by parsing it to

the constructor, which will assign the instance at that particular address to a variable.

SimpleStorage simpleStorageWithAddress = SimpleStorage(simpleStorageArray[index]);

simpleStorageWithAddress.addPeople(name, favNumber);

Outro

So far these are some of the learnings that I can share with you all, I've tried to put everything as per my understanding & there's a chance that I might've mistaken somewhere, so, feel free to correct me on anything in the comments.

Wrapping up my Day-05 of #100DaysOfCode, will catch up again tomorrow, till then, it's a farewell.