created a #SmartContract in Solidity language for a Advance storage, and successfully deployed on XinFin XDC Network under the injected web 3 environment.
Check the code:
pragma solidity >=0.5.0;
contract AdvancedContracts {
uint[] ids;
function add(uint id) public {
ids.push(id);
}
function get(uint position) public view returns(uint) {
return ids[position];
}
function getall() public view returns(uint[] memory) {
return ids;
}
function length() public view returns(uint) {
return ids.length;
}
}
Top comments (0)