Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Klaytn -> Kaia in local variables, strings #2155

Merged
merged 27 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions accounts/abi/bind/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"errors"
"math/big"

"github.com/klaytn/klaytn"
kaia "github.com/klaytn/klaytn"
"github.com/klaytn/klaytn/blockchain/types"
"github.com/klaytn/klaytn/common"
)
Expand Down Expand Up @@ -53,7 +53,7 @@ type ContractCaller interface {
CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
// ContractCall executes a Kaia contract call with the specified data as the
// input.
CallContract(ctx context.Context, call klaytn.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract(ctx context.Context, call kaia.CallMsg, blockNumber *big.Int) ([]byte, error)
}

// PendingContractCaller defines methods to perform contract calls on the pending state.
Expand All @@ -63,7 +63,7 @@ type PendingContractCaller interface {
// PendingCodeAt returns the code of the given account in the pending state.
PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)
// PendingCallContract executes a Kaia contract call against the pending state.
PendingCallContract(ctx context.Context, call klaytn.CallMsg) ([]byte, error)
PendingCallContract(ctx context.Context, call kaia.CallMsg) ([]byte, error)
}

// ContractTransactor defines the methods needed to allow operating with contract
Expand All @@ -83,7 +83,7 @@ type ContractTransactor interface {
// 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
// for setting a reasonable default.
EstimateGas(ctx context.Context, call klaytn.CallMsg) (gas uint64, err error)
EstimateGas(ctx context.Context, call kaia.CallMsg) (gas uint64, err error)
// SendTransaction injects the transaction into the pending pool for execution.
SendTransaction(ctx context.Context, tx *types.Transaction) error
// ChainID can return the chain ID of the chain.
Expand All @@ -97,11 +97,11 @@ type ContractFilterer interface {
// returning all the results in one batch.
//
// TODO(karalabe): Deprecate when the subscription one can return past data too.
FilterLogs(ctx context.Context, query klaytn.FilterQuery) ([]types.Log, error)
FilterLogs(ctx context.Context, query kaia.FilterQuery) ([]types.Log, error)

// SubscribeFilterLogs creates a background log filtering operation, returning
// a subscription immediately, which can be used to stream the found events.
SubscribeFilterLogs(ctx context.Context, query klaytn.FilterQuery, ch chan<- types.Log) (klaytn.Subscription, error)
SubscribeFilterLogs(ctx context.Context, query kaia.FilterQuery, ch chan<- types.Log) (kaia.Subscription, error)
}

// DeployBackend wraps the operations needed by WaitMined and WaitDeployed.
Expand Down
12 changes: 6 additions & 6 deletions accounts/abi/bind/backends/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"errors"
"math/big"

"github.com/klaytn/klaytn"
kaia "github.com/klaytn/klaytn"
"github.com/klaytn/klaytn/accounts/abi/bind"
"github.com/klaytn/klaytn/blockchain"
"github.com/klaytn/klaytn/blockchain/state"
Expand Down Expand Up @@ -106,7 +106,7 @@ func (b *BlockchainContractBackend) CodeAt(ctx context.Context, account common.A
// - VM revert error
// - VM other errors (e.g. NotProgramAccount, OutOfGas)
// - Error outside VM
func (b *BlockchainContractBackend) CallContract(ctx context.Context, call klaytn.CallMsg, blockNumber *big.Int) ([]byte, error) {
func (b *BlockchainContractBackend) CallContract(ctx context.Context, call kaia.CallMsg, blockNumber *big.Int) ([]byte, error) {
block, state, err := b.getBlockAndState(blockNumber)
if err != nil {
return nil, err
Expand All @@ -122,7 +122,7 @@ func (b *BlockchainContractBackend) CallContract(ctx context.Context, call klayt
return res.Return(), res.Unwrap()
}

func (b *BlockchainContractBackend) callContract(call klaytn.CallMsg, block *types.Block, state *state.StateDB) (*blockchain.ExecutionResult, error) {
func (b *BlockchainContractBackend) callContract(call kaia.CallMsg, block *types.Block, state *state.StateDB) (*blockchain.ExecutionResult, error) {
if call.Gas == 0 {
call.Gas = uint64(3e8) // enough gas for ordinary contract calls
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func (b *BlockchainContractBackend) SuggestGasPrice(ctx context.Context) (*big.I
}
}

func (b *BlockchainContractBackend) EstimateGas(ctx context.Context, call klaytn.CallMsg) (uint64, error) {
func (b *BlockchainContractBackend) EstimateGas(ctx context.Context, call kaia.CallMsg) (uint64, error) {
state, err := b.bc.State()
if err != nil {
return 0, err
Expand Down Expand Up @@ -247,7 +247,7 @@ func (b *BlockchainContractBackend) ChainID(ctx context.Context) (*big.Int, erro

// bind.ContractFilterer defined methods

func (b *BlockchainContractBackend) FilterLogs(ctx context.Context, query klaytn.FilterQuery) ([]types.Log, error) {
func (b *BlockchainContractBackend) FilterLogs(ctx context.Context, query kaia.FilterQuery) ([]types.Log, error) {
// Convert the current block numbers into internal representations
if query.FromBlock == nil {
query.FromBlock = big.NewInt(b.bc.CurrentBlock().Number().Int64())
Expand Down Expand Up @@ -279,7 +279,7 @@ func (b *BlockchainContractBackend) FilterLogs(ctx context.Context, query klaytn
return res, nil
}

func (b *BlockchainContractBackend) SubscribeFilterLogs(ctx context.Context, query klaytn.FilterQuery, ch chan<- types.Log) (klaytn.Subscription, error) {
func (b *BlockchainContractBackend) SubscribeFilterLogs(ctx context.Context, query kaia.FilterQuery, ch chan<- types.Log) (kaia.Subscription, error) {
// Subscribe to contract events
sink := make(chan []*types.Log)

Expand Down
28 changes: 14 additions & 14 deletions accounts/abi/bind/backends/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"time"

"github.com/golang/mock/gomock"
"github.com/klaytn/klaytn"
kaia "github.com/klaytn/klaytn"
"github.com/klaytn/klaytn/accounts/abi"
"github.com/klaytn/klaytn/blockchain"
"github.com/klaytn/klaytn/blockchain/types"
Expand Down Expand Up @@ -122,7 +122,7 @@ func TestBlockchainCallContract(t *testing.T) {
data_revertNoString, _ := parsedAbi2.Pack("revertNoString")

// Normal case
ret, err := c.CallContract(context.Background(), klaytn.CallMsg{
ret, err := c.CallContract(context.Background(), kaia.CallMsg{
From: testAddr,
To: &code1Addr,
Gas: 1000000,
Expand All @@ -132,7 +132,7 @@ func TestBlockchainCallContract(t *testing.T) {
assert.Equal(t, expectedReturn, ret)

// Error outside VM - Intrinsic Gas
ret, err = c.CallContract(context.Background(), klaytn.CallMsg{
ret, err = c.CallContract(context.Background(), kaia.CallMsg{
From: testAddr,
To: &code1Addr,
Gas: 20000,
Expand All @@ -141,7 +141,7 @@ func TestBlockchainCallContract(t *testing.T) {
assert.True(t, errors.Is(err, blockchain.ErrIntrinsicGas))

// VM revert error - empty reason
ret, err = c.CallContract(context.Background(), klaytn.CallMsg{
ret, err = c.CallContract(context.Background(), kaia.CallMsg{
From: testAddr,
To: &code2Addr,
Gas: 100000,
Expand All @@ -150,7 +150,7 @@ func TestBlockchainCallContract(t *testing.T) {
assert.Equal(t, "execution reverted: ", err.Error())

// VM revert error - string reason
ret, err = c.CallContract(context.Background(), klaytn.CallMsg{
ret, err = c.CallContract(context.Background(), kaia.CallMsg{
From: testAddr,
To: &code2Addr,
Gas: 100000,
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestBlockChainEstimateGas(t *testing.T) {
c := NewBlockchainContractBackend(bc, nil, nil)

// Normal case
gas, err := c.EstimateGas(context.Background(), klaytn.CallMsg{
gas, err := c.EstimateGas(context.Background(), kaia.CallMsg{
From: testAddr,
To: &testAddr,
Value: big.NewInt(1000),
Expand All @@ -217,7 +217,7 @@ func TestBlockChainEstimateGas(t *testing.T) {
assert.Equal(t, uint64(params.TxGas), gas)

// Error case - simple transfer with insufficient funds with zero gasPrice
gas, err = c.EstimateGas(context.Background(), klaytn.CallMsg{
gas, err = c.EstimateGas(context.Background(), kaia.CallMsg{
From: code1Addr,
To: &code1Addr,
Value: big.NewInt(1),
Expand Down Expand Up @@ -317,16 +317,16 @@ func initBackendForFiltererTests(t *testing.T, bc *blockchain.BlockChain) *Block
txPoolConfig := blockchain.DefaultTxPoolConfig
txPoolConfig.Journal = "/dev/null" // disable journaling to file
txPool := blockchain.NewTxPool(txPoolConfig, bc.Config(), bc)
subscribeNewTxsEvent := func(ch chan<- blockchain.NewTxsEvent) klaytn.Subscription {
subscribeNewTxsEvent := func(ch chan<- blockchain.NewTxsEvent) kaia.Subscription {
return txPool.SubscribeNewTxsEvent(ch)
}
subscribeLogsEvent := func(ch chan<- []*types.Log) klaytn.Subscription {
subscribeLogsEvent := func(ch chan<- []*types.Log) kaia.Subscription {
return bc.SubscribeLogsEvent(ch)
}
subscribeRemovedLogsEvent := func(ch chan<- blockchain.RemovedLogsEvent) klaytn.Subscription {
subscribeRemovedLogsEvent := func(ch chan<- blockchain.RemovedLogsEvent) kaia.Subscription {
return bc.SubscribeRemovedLogsEvent(ch)
}
subscribeChainEvent := func(ch chan<- blockchain.ChainEvent) klaytn.Subscription {
subscribeChainEvent := func(ch chan<- blockchain.ChainEvent) kaia.Subscription {
return bc.SubscribeChainEvent(ch)
}
mockBackend.EXPECT().SubscribeNewTxsEvent(any).DoAndReturn(subscribeNewTxsEvent).AnyTimes()
Expand All @@ -345,7 +345,7 @@ func TestBlockChainFilterLogs(t *testing.T) {
c := initBackendForFiltererTests(t, bc)

// Normal case
logs, err := c.FilterLogs(context.Background(), klaytn.FilterQuery{
logs, err := c.FilterLogs(context.Background(), kaia.FilterQuery{
FromBlock: big.NewInt(10),
ToBlock: big.NewInt(11),
Addresses: []common.Address{code1Addr},
Expand All @@ -354,7 +354,7 @@ func TestBlockChainFilterLogs(t *testing.T) {
assert.Equal(t, 2, len(logs))

// No logs exist for code2Addr
logs, err = c.FilterLogs(context.Background(), klaytn.FilterQuery{
logs, err = c.FilterLogs(context.Background(), kaia.FilterQuery{
FromBlock: big.NewInt(0),
ToBlock: big.NewInt(11),
Addresses: []common.Address{code2Addr},
Expand All @@ -368,7 +368,7 @@ func TestBlockChainSubscribeFilterLogs(t *testing.T) {
c := initBackendForFiltererTests(t, bc)

logs := make(chan types.Log)
sub, err := c.SubscribeFilterLogs(context.Background(), klaytn.FilterQuery{
sub, err := c.SubscribeFilterLogs(context.Background(), kaia.FilterQuery{
FromBlock: big.NewInt(0),
ToBlock: big.NewInt(20),
Addresses: []common.Address{code1Addr},
Expand Down
18 changes: 9 additions & 9 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"sync"
"time"

"github.com/klaytn/klaytn"
kaia "github.com/klaytn/klaytn"
"github.com/klaytn/klaytn/accounts/abi/bind"
"github.com/klaytn/klaytn/blockchain"
"github.com/klaytn/klaytn/blockchain/bloombits"
Expand Down Expand Up @@ -227,7 +227,7 @@ func (b *SimulatedBackend) TransactionByHash(ctx context.Context, txHash common.
if tx != nil {
return tx, false, nil
}
return nil, false, klaytn.NotFound
return nil, false, kaia.NotFound
}

// BlockByHash retrieves a block based on the block hash.
Expand Down Expand Up @@ -354,7 +354,7 @@ func (b *SimulatedBackend) PendingCodeAt(_ context.Context, contract common.Addr
}

// CallContract executes a contract call.
func (b *SimulatedBackend) CallContract(ctx context.Context, call klaytn.CallMsg, blockNumber *big.Int) ([]byte, error) {
func (b *SimulatedBackend) CallContract(ctx context.Context, call kaia.CallMsg, blockNumber *big.Int) ([]byte, error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand All @@ -377,7 +377,7 @@ func (b *SimulatedBackend) CallContract(ctx context.Context, call klaytn.CallMsg
}

// PendingCallContract executes a contract call on the pending state.
func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call klaytn.CallMsg) ([]byte, error) {
func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call kaia.CallMsg) ([]byte, error) {
b.mu.Lock()
defer b.mu.Unlock()
defer b.pendingState.RevertToSnapshot(b.pendingState.Snapshot())
Expand Down Expand Up @@ -410,7 +410,7 @@ func (b *SimulatedBackend) SuggestGasPrice(_ context.Context) (*big.Int, error)

// EstimateGas executes the requested code against the latest block/state and
// returns the used amount of gas.
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call klaytn.CallMsg) (uint64, error) {
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call kaia.CallMsg) (uint64, error) {
b.mu.Lock()
defer b.mu.Unlock()

Expand Down Expand Up @@ -444,7 +444,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call klaytn.CallMsg)

// callContract implements common code between normal and pending contract calls.
// state is modified during execution, make sure to copy it if necessary.
func (b *SimulatedBackend) callContract(_ context.Context, call klaytn.CallMsg, block *types.Block, stateDB *state.StateDB) (*blockchain.ExecutionResult, error) {
func (b *SimulatedBackend) callContract(_ context.Context, call kaia.CallMsg, block *types.Block, stateDB *state.StateDB) (*blockchain.ExecutionResult, error) {
// Ensure message is initialized properly.
if call.GasPrice == nil {
call.GasPrice = big.NewInt(1)
Expand Down Expand Up @@ -513,7 +513,7 @@ func (b *SimulatedBackend) SendTransaction(_ context.Context, tx *types.Transact
// returning all the results in one batch.
//
// TODO(karalabe): Deprecate when the subscription one can return past data too.
func (b *SimulatedBackend) FilterLogs(ctx context.Context, query klaytn.FilterQuery) ([]types.Log, error) {
func (b *SimulatedBackend) FilterLogs(ctx context.Context, query kaia.FilterQuery) ([]types.Log, error) {
// Initialize unset filter boundaries to run from genesis to chain head
from := int64(0)
if query.FromBlock != nil {
Expand Down Expand Up @@ -545,7 +545,7 @@ func (b *SimulatedBackend) ChainID(ctx context.Context) (*big.Int, error) {

// SubscribeFilterLogs creates a background log filtering operation, returning a
// subscription immediately, which can be used to stream the found events.
func (b *SimulatedBackend) SubscribeFilterLogs(_ context.Context, query klaytn.FilterQuery, ch chan<- types.Log) (klaytn.Subscription, error) {
func (b *SimulatedBackend) SubscribeFilterLogs(_ context.Context, query kaia.FilterQuery, ch chan<- types.Log) (kaia.Subscription, error) {
// Subscribe to contract events
sink := make(chan []*types.Log)

Expand Down Expand Up @@ -583,7 +583,7 @@ func (b *SimulatedBackend) CurrentBlockNumber(ctx context.Context) (uint64, erro
}

// SubscribeNewHead returns an event subscription for a new header
func (b *SimulatedBackend) SubscribeNewHead(_ context.Context, ch chan<- *types.Header) (klaytn.Subscription, error) {
func (b *SimulatedBackend) SubscribeNewHead(_ context.Context, ch chan<- *types.Header) (kaia.Subscription, error) {
// subscribe to a new head
sink := make(chan *types.Header)
sub := b.events.SubscribeNewHeads(sink)
Expand Down