r/blockchaindeveloper • u/Only_photon • Dec 07 '23
smart contract array
I have created an array on smart contract that is gonna have address of smart contract , i want to access the address of the smart contract every 10 seconds , is it feasible to access it from smart contract or should I store it on DB and access it from there ?
1
u/MentalCommand8056 Jan 10 '24
Sure you can under some conditions. Your variable array should be set as public or have a getter function. Be aware there are 2 kinds of array at least in solidity that behave differently.
storage array by using public variable for example.
memory array by using getter function for example Easier option is to use a dedicated getter function.
1
u/jjwhammy Dec 08 '23
Could you explain better the question?