From b33c6c97c5c87ea84426e76a7849a9307133bc7c Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Sat, 8 Mar 2025 10:19:25 +0100 Subject: [PATCH] accounts/abi/bind/v2: add package-level documentation summarizing the utilties. Better documentation indicating the intended use of DefaultDeployer and the deployment options available. --- accounts/abi/bind/v2/lib.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/accounts/abi/bind/v2/lib.go b/accounts/abi/bind/v2/lib.go index a5052d94ec..1196276261 100644 --- a/accounts/abi/bind/v2/lib.go +++ b/accounts/abi/bind/v2/lib.go @@ -14,6 +14,16 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . +// Package bind implements utilities for interacting with Solidity contracts +// via their Go bindings generated from the abigen command. It includes +// methods for calling/transacting, filtering chain history for +// specific custom Solidity event types, creating event subscriptions to +// monitor the chain for event occurrences. +// +// Two methods for contract deployment are provided: +// - DeployContract is intended to be used for deployment of a single contract. +// - LinkAndDeploy is intended to be used for the deployment of multiple +// contracts, potentially with library dependencies. package bind import ( @@ -199,6 +209,9 @@ func DeployContract(opts *TransactOpts, bytecode []byte, backend ContractBackend // DefaultDeployer returns a DeployFn that signs and submits creation transactions // using the given signer. +// +// The DeployFn returned by DefaultDeployer should be used by LinkAndDeploy in +// almost all cases, unless a custom DeployFn implementation is needed. func DefaultDeployer(opts *TransactOpts, backend ContractBackend) DeployFn { return func(input []byte, deployer []byte) (common.Address, *types.Transaction, error) { addr, tx, err := DeployContract(opts, deployer, backend, input)