Solidity-Baby Steps...
The best path for earning Solidity is to approach examples.
Here are baby examples. Typing one-by-one is recommended.
References:
MyBlog explanation for using EnglishAuction and testing.
Example-1
updateBalance & getBalance
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract MyLedger {
mapping(address => uint) public balances;
function updateBalance(uint newBal) public {
balances[msg.sender] = newBal;
}
function getBalance() public view returns(uint) {
return balances[msg.sender];
}
}
Example-2
Inherited from Square
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/utils/Strings.sol";
contract Shape {
uint height;
uint width;
constructor(uint _height, uint _width) {
height = _height;
width = _width;
}
}
contract Square is Shape {
constructor(uint h, uint w) Shape(h, w) {}
function
…