Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/repository/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Asset interface {
Transactable
Create(model.Asset) (model.Asset, error)
GetById(id string) (model.Asset, error)
GetName(name string) (model.Asset, error)
GetByName(name string) (model.Asset, error)
Update(ID string, updates any) error
}

Expand Down Expand Up @@ -41,7 +41,7 @@ func (a asset[T]) Create(insert model.Asset) (model.Asset, error) {
return m, err
}

func (a asset[T]) GetName(name string) (model.Asset, error) {
func (a asset[T]) GetByName(name string) (model.Asset, error) {
m := model.Asset{}
err := a.store.Get(&m, fmt.Sprintf("SELECT * FROM %s WHERE name = $1", a.table), name)
if err != nil && err == sql.ErrNoRows {
Expand Down
4 changes: 2 additions & 2 deletions pkg/repository/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Network interface {
Transactable
Create(model.Network) (model.Network, error)
GetById(id string) (model.Network, error)
GetChainID(chainId uint64) (model.Network, error)
GetByChainId(chainId uint64) (model.Network, error)
Update(ID string, updates any) error
}

Expand Down Expand Up @@ -47,7 +47,7 @@ func (n network[T]) Create(insert model.Network) (model.Network, error) {
return m, nil
}

func (n network[T]) GetChainID(chainId uint64) (model.Network, error) {
func (n network[T]) GetByChainId(chainId uint64) (model.Network, error) {
m := model.Network{}
err := n.store.Get(&m, fmt.Sprintf("SELECT * FROM %s WHERE chain_id = $1", n.table), chainId)
if err != nil && err == sql.ErrNoRows {
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func stringFee(chainId uint64) (float64, error) {
}

func ChainInfo(chainId uint64, networkRepo repository.Network, assetRepo repository.Asset) (Chain, error) {
network, err := networkRepo.GetChainID(chainId)
network, err := networkRepo.GetByChainId(chainId)
if err != nil {
return Chain{}, common.StringError(err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/service/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Executor interface {
Estimate(call ContractCall) (CallEstimate, error)
TxWait(txID string) (uint64, error)
Close() error
GetChainID() (uint64, error)
GetByChainId() (uint64, error)
GetBalance() (float64, error)
}

Expand Down Expand Up @@ -245,7 +245,7 @@ func (e executor) TxWait(txID string) (uint64, error) {
return receipt.GasUsed, nil
}

func (e executor) GetChainID() (uint64, error) {
func (e executor) GetByChainId() (uint64, error) {
// Get ChainID from state
var chainId64 uint64
err := e.client.Call(eth.ChainID().Returns(&chainId64))
Expand Down
6 changes: 3 additions & 3 deletions pkg/service/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (t transaction) populateInitialTxModelData(e model.ExecutionRequest, m *mod
contractFunc := e.CxFunc + e.CxReturn
m.ContractFunc = &contractFunc

asset, err := t.repos.Asset.GetName("USD")
asset, err := t.repos.Asset.GetByName("USD")
if err != nil {
return model.Asset{}, common.StringError(err)
}
Expand Down Expand Up @@ -401,7 +401,7 @@ func (t transaction) testTransaction(executor Executor, request model.Transactio
wei := gas.Add(&estimateEVM.Value, gas)
eth := common.WeiToEther(wei)

chainID, err := executor.GetChainID()
chainID, err := executor.GetByChainId()
if err != nil {
return res, eth, common.StringError(err)
}
Expand Down Expand Up @@ -644,7 +644,7 @@ func (t transaction) tenderTransaction(p transactionProcessingData) (float64, er
profit := p.executionRequest.Quote.TotalUSD - trueUSD

// Create Receive Tx leg
asset, err := t.repos.Asset.GetName("ETH")
asset, err := t.repos.Asset.GetById(p.chain.GasTokenID)
if err != nil {
return profit, common.StringError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/stubs/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import (
// return model.Asset{}, nil
// }

// func (Asset) GetName(name string) (model.Asset, error) {
// func (Asset) GetByName(name string) (model.Asset, error) {
// if name == "AVAX" {
// return avax, nil
// }
Expand Down