As previous example shows, we have deployed a simple smart contract and got a contract address. Now, we will connect to this contract.
Creating a new instance of a Contract connects to an existing contract by specifying its address on the blockchain, its abi (used to populate the class' methods) and a providerOrSigner.
If a Provider is given, the contract has only read-only access, allows:
- Any constant function
- Querying Filters
- Populating Unsigned Transactions for non-constant methods
- Estimating Gas for non-constant (as an anonymous sender)
- Static Calling non-constant methods (as anonymous sender)
While a Signer(wallet) offers access to state manipulating methods.
- Everything from Read-Only (except as Signer, not anonymous)
- Sending transactions for non-constant functions