Open vivi365 opened 9 months ago
Set up
npx hardhat node
npx hardhat run --network localhost scripts/deploy.js
npx hardhat console --network localhost
How to interact:
We are using the ethers api
const Company = await ethers.getContractFactory('CONTRACT NAME')
const company = Company.attach('HEXADDRESS HERE');
var greeting = await company.register("hello");
company.retrieve()).toString()
Namespaces in ethers API
Example
import "./access-control/Auth.sol";
contract Hello {
Auth private _auth;
constructor() {
_auth = new Auth(msg.sender);
}
function hi() {
require(_auth.isAdministrator(msg.sender), "Unauthorized");}
}
Basics 😎