Chuyển đổi

This commit is contained in:
huuhadz2k 2018-04-13 12:30:56 +07:00
parent d69cfcc84e
commit 654475de02
5 changed files with 26 additions and 26 deletions

View file

@ -47,9 +47,9 @@ type ContractCaller interface {
// CodeAt returns the code of the given account. This is needed to differentiate // CodeAt returns the code of the given account. This is needed to differentiate
// between contract internal errors and the local chain being out of sync. // between contract internal errors and the local chain being out of sync.
CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
// ContractCall executes an Ethereum contract call with the specified data as the // ContractCall executes an EtherFact contract call with the specified data as the
// input. // input.
CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) CallContract(ctx context.Context, call etherfact.CallMsg, blockNumber *big.Int) ([]byte, error)
} }
// PendingContractCaller defines methods to perform contract calls on the pending state. // PendingContractCaller defines methods to perform contract calls on the pending state.
@ -58,8 +58,8 @@ type ContractCaller interface {
type PendingContractCaller interface { type PendingContractCaller interface {
// PendingCodeAt returns the code of the given account in the pending state. // PendingCodeAt returns the code of the given account in the pending state.
PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error) PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)
// PendingCallContract executes an Ethereum contract call against the pending state. // PendingCallContract executes an EtherFact contract call against the pending state.
PendingCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error) PendingCallContract(ctx context.Context, call etherfact.CallMsg) ([]byte, error)
} }
// ContractTransactor defines the methods needed to allow operating with contract // ContractTransactor defines the methods needed to allow operating with contract
@ -79,7 +79,7 @@ type ContractTransactor interface {
// There is no guarantee that this is the true gas limit requirement as other // There is no guarantee that this is the true gas limit requirement as other
// transactions may be added or removed by miners, but it should provide a basis // transactions may be added or removed by miners, but it should provide a basis
// for setting a reasonable default. // for setting a reasonable default.
EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error) EstimateGas(ctx context.Context, call etherfact.CallMsg) (gas uint64, err error)
// SendTransaction injects the transaction into the pending pool for execution. // SendTransaction injects the transaction into the pending pool for execution.
SendTransaction(ctx context.Context, tx *types.Transaction) error SendTransaction(ctx context.Context, tx *types.Transaction) error
} }
@ -91,11 +91,11 @@ type ContractFilterer interface {
// returning all the results in one batch. // returning all the results in one batch.
// //
// TODO(karalabe): Deprecate when the subscription one can return past data too. // TODO(karalabe): Deprecate when the subscription one can return past data too.
FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error) FilterLogs(ctx context.Context, query etherfact.FilterQuery) ([]types.Log, error)
// SubscribeFilterLogs creates a background log filtering operation, returning // SubscribeFilterLogs creates a background log filtering operation, returning
// a subscription immediately, which can be used to stream the found events. // a subscription immediately, which can be used to stream the found events.
SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) SubscribeFilterLogs(ctx context.Context, query etherfact.FilterQuery, ch chan<- types.Log) (etherfact.Subscription, error)
} }
// DeployBackend wraps the operations needed by WaitMined and WaitDeployed. // DeployBackend wraps the operations needed by WaitMined and WaitDeployed.

View file

@ -51,7 +51,7 @@ var errGasEstimationFailed = errors.New("gas required exceeds allowance or alway
// the background. Its main purpose is to allow easily testing contract bindings. // the background. Its main purpose is to allow easily testing contract bindings.
type SimulatedBackend struct { type SimulatedBackend struct {
database ethdb.Database // In memory database to store our testing data database ethdb.Database // In memory database to store our testing data
blockchain *core.BlockChain // Ethereum blockchain to handle the consensus blockchain *core.BlockChain // EtherFact blockchain to handle the consensus
mu sync.Mutex mu sync.Mutex
pendingBlock *types.Block // Currently pending block that will be imported on request pendingBlock *types.Block // Currently pending block that will be imported on request

View file

@ -43,9 +43,9 @@ type CallOpts struct {
} }
// TransactOpts is the collection of authorization data required to create a // TransactOpts is the collection of authorization data required to create a
// valid Ethereum transaction. // valid EtherFact transaction.
type TransactOpts struct { type TransactOpts struct {
From common.Address // Ethereum account to send the transaction from From common.Address // EtherFact account to send the transaction from
Nonce *big.Int // Nonce to use for the transaction execution (nil = use pending state) Nonce *big.Int // Nonce to use for the transaction execution (nil = use pending state)
Signer SignerFn // Method to use for signing the transaction (mandatory) Signer SignerFn // Method to use for signing the transaction (mandatory)
@ -73,11 +73,11 @@ type WatchOpts struct {
} }
// BoundContract is the base wrapper object that reflects a contract on the // BoundContract is the base wrapper object that reflects a contract on the
// Ethereum network. It contains a collection of methods that are used by the // EtherFact network. It contains a collection of methods that are used by the
// higher level contract bindings to operate. // higher level contract bindings to operate.
type BoundContract struct { type BoundContract struct {
address common.Address // Deployment address of the contract on the Ethereum blockchain address common.Address // Deployment address of the contract on the EtherFact blockchain
abi abi.ABI // Reflect based ABI to access the correct Ethereum methods abi abi.ABI // Reflect based ABI to access the correct EtherFact methods
caller ContractCaller // Read interface to interact with the blockchain caller ContractCaller // Read interface to interact with the blockchain
transactor ContractTransactor // Write interface to interact with the blockchain transactor ContractTransactor // Write interface to interact with the blockchain
filterer ContractFilterer // Event filtering to interact with the blockchain filterer ContractFilterer // Event filtering to interact with the blockchain
@ -95,7 +95,7 @@ func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller
} }
} }
// DeployContract deploys a contract onto the Ethereum blockchain and binds the // DeployContract deploys a contract onto the EtherFact blockchain and binds the
// deployment address with a Go wrapper. // deployment address with a Go wrapper.
func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error) { func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error) {
// Otherwise try to deploy the contract // Otherwise try to deploy the contract

View file

@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-etherfact library. If not, see <http://www.gnu.org/licenses/>. // along with the go-etherfact library. If not, see <http://www.gnu.org/licenses/>.
// Package bind generates Ethereum contract Go bindings. // Package bind generates EtherFact contract Go bindings.
// //
// Detailed usage document and tutorial available on the go-etherfact Wiki page: // Detailed usage document and tutorial available on the go-etherfact Wiki page:
// https://github.com/EtherFact-Project/go-etherfact/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts // https://github.com/EtherFact-Project/go-etherfact/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts

View file

@ -72,7 +72,7 @@ package {{.Package}}
// {{.Type}}Bin is the compiled bytecode used for deploying new contracts. // {{.Type}}Bin is the compiled bytecode used for deploying new contracts.
const {{.Type}}Bin = ` + "`" + `{{.InputBin}}` + "`" + ` const {{.Type}}Bin = ` + "`" + `{{.InputBin}}` + "`" + `
// Deploy{{.Type}} deploys a new Ethereum contract, binding an instance of {{.Type}} to it. // Deploy{{.Type}} deploys a new EtherFact contract, binding an instance of {{.Type}} to it.
func Deploy{{.Type}}(auth *bind.TransactOpts, backend bind.ContractBackend {{range .Constructor.Inputs}}, {{.Name}} {{bindtype .Type}}{{end}}) (common.Address, *types.Transaction, *{{.Type}}, error) { func Deploy{{.Type}}(auth *bind.TransactOpts, backend bind.ContractBackend {{range .Constructor.Inputs}}, {{.Name}} {{bindtype .Type}}{{end}}) (common.Address, *types.Transaction, *{{.Type}}, error) {
parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI)) parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI))
if err != nil { if err != nil {
@ -86,29 +86,29 @@ package {{.Package}}
} }
{{end}} {{end}}
// {{.Type}} is an auto generated Go binding around an Ethereum contract. // {{.Type}} is an auto generated Go binding around an EtherFact contract.
type {{.Type}} struct { type {{.Type}} struct {
{{.Type}}Caller // Read-only binding to the contract {{.Type}}Caller // Read-only binding to the contract
{{.Type}}Transactor // Write-only binding to the contract {{.Type}}Transactor // Write-only binding to the contract
{{.Type}}Filterer // Log filterer for contract events {{.Type}}Filterer // Log filterer for contract events
} }
// {{.Type}}Caller is an auto generated read-only Go binding around an Ethereum contract. // {{.Type}}Caller is an auto generated read-only Go binding around an EtherFact contract.
type {{.Type}}Caller struct { type {{.Type}}Caller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls contract *bind.BoundContract // Generic contract wrapper for the low level calls
} }
// {{.Type}}Transactor is an auto generated write-only Go binding around an Ethereum contract. // {{.Type}}Transactor is an auto generated write-only Go binding around an EtherFact contract.
type {{.Type}}Transactor struct { type {{.Type}}Transactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls contract *bind.BoundContract // Generic contract wrapper for the low level calls
} }
// {{.Type}}Filterer is an auto generated log filtering Go binding around an Ethereum contract events. // {{.Type}}Filterer is an auto generated log filtering Go binding around an EtherFact contract events.
type {{.Type}}Filterer struct { type {{.Type}}Filterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls contract *bind.BoundContract // Generic contract wrapper for the low level calls
} }
// {{.Type}}Session is an auto generated Go binding around an Ethereum contract, // {{.Type}}Session is an auto generated Go binding around an EtherFact contract,
// with pre-set call and transact options. // with pre-set call and transact options.
type {{.Type}}Session struct { type {{.Type}}Session struct {
Contract *{{.Type}} // Generic contract binding to set the session for Contract *{{.Type}} // Generic contract binding to set the session for
@ -116,31 +116,31 @@ package {{.Package}}
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
} }
// {{.Type}}CallerSession is an auto generated read-only Go binding around an Ethereum contract, // {{.Type}}CallerSession is an auto generated read-only Go binding around an EtherFact contract,
// with pre-set call options. // with pre-set call options.
type {{.Type}}CallerSession struct { type {{.Type}}CallerSession struct {
Contract *{{.Type}}Caller // Generic contract caller binding to set the session for Contract *{{.Type}}Caller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session CallOpts bind.CallOpts // Call options to use throughout this session
} }
// {{.Type}}TransactorSession is an auto generated write-only Go binding around an Ethereum contract, // {{.Type}}TransactorSession is an auto generated write-only Go binding around an EtherFact contract,
// with pre-set transact options. // with pre-set transact options.
type {{.Type}}TransactorSession struct { type {{.Type}}TransactorSession struct {
Contract *{{.Type}}Transactor // Generic contract transactor binding to set the session for Contract *{{.Type}}Transactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
} }
// {{.Type}}Raw is an auto generated low-level Go binding around an Ethereum contract. // {{.Type}}Raw is an auto generated low-level Go binding around an EtherFact contract.
type {{.Type}}Raw struct { type {{.Type}}Raw struct {
Contract *{{.Type}} // Generic contract binding to access the raw methods on Contract *{{.Type}} // Generic contract binding to access the raw methods on
} }
// {{.Type}}CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. // {{.Type}}CallerRaw is an auto generated low-level read-only Go binding around an EtherFact contract.
type {{.Type}}CallerRaw struct { type {{.Type}}CallerRaw struct {
Contract *{{.Type}}Caller // Generic read-only contract binding to access the raw methods on Contract *{{.Type}}Caller // Generic read-only contract binding to access the raw methods on
} }
// {{.Type}}TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. // {{.Type}}TransactorRaw is an auto generated low-level write-only Go binding around an EtherFact contract.
type {{.Type}}TransactorRaw struct { type {{.Type}}TransactorRaw struct {
Contract *{{.Type}}Transactor // Generic write-only contract binding to access the raw methods on Contract *{{.Type}}Transactor // Generic write-only contract binding to access the raw methods on
} }