Skip to content

Commit

Permalink
feat: add expected fee to order fulfillment (#37)
Browse files Browse the repository at this point in the history
* Add expected fee to order fulfillment

* Add expected fee to order fulfillment

* Fix event subscriptions: order-created, order-finalized

* Fix linter issue

* Fix linter issue

* Fix more linter issues
  • Loading branch information
zale144 authored Sep 17, 2024
1 parent 8640841 commit 2575621
Show file tree
Hide file tree
Showing 17 changed files with 1,502 additions and 570 deletions.
4 changes: 2 additions & 2 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type accountService struct {
balances sdk.Coins
minimumGasBalance sdk.Coin
accountName string
topUpFactor uint64
topUpFactor int
topUpCh chan<- topUpRequest
}

Expand All @@ -38,7 +38,7 @@ type accountStore interface {

type option func(*accountService)

func withTopUpFactor(topUpFactor uint64) option {
func withTopUpFactor(topUpFactor int) option {
return func(s *accountService) {
s.topUpFactor = topUpFactor
}
Expand Down
2 changes: 1 addition & 1 deletion cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var initCmd = &cobra.Command{

// if home dir doesn't exist, create it
if _, err := os.Stat(config.HomeDir); os.IsNotExist(err) {
if err := os.MkdirAll(config.HomeDir, 0755); err != nil {
if err := os.MkdirAll(config.HomeDir, 0o755); err != nil {
log.Fatalf("failed to create home directory: %v", err)
}
}
Expand Down
6 changes: 1 addition & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"log"
"time"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/dymensionxyz/cosmosclient/cosmosclient"
"github.com/ignite/cli/ignite/pkg/cosmosaccount"
"github.com/mitchellh/go-homedir"
Expand Down Expand Up @@ -42,7 +41,7 @@ type botConfig struct {
NumberOfBots int `mapstructure:"number_of_bots"`
KeyringBackend cosmosaccount.KeyringBackend `mapstructure:"keyring_backend"`
KeyringDir string `mapstructure:"keyring_dir"`
TopUpFactor uint64 `mapstructure:"top_up_factor"`
TopUpFactor int `mapstructure:"top_up_factor"`
MaxOrdersPerTx int `mapstructure:"max_orders_per_tx"`
}

Expand All @@ -66,7 +65,6 @@ const (
hubAddressPrefix = "dym"
pubKeyPrefix = "pub"
defaultLogLevel = "info"
defaultGasLimit = 300000
defaultHubDenom = "adym"
defaultGasFees = "3000000000000000" + defaultHubDenom
defaultMinimumGasBalance = "1000000000000000000" + defaultHubDenom
Expand Down Expand Up @@ -142,10 +140,8 @@ func getCosmosClientOptions(config clientConfig) []cosmosclient.Option {
options := []cosmosclient.Option{
cosmosclient.WithAddressPrefix(hubAddressPrefix),
cosmosclient.WithHome(config.homeDir),
cosmosclient.WithBroadcastMode(flags.BroadcastBlock),
cosmosclient.WithNodeAddress(config.nodeAddress),
cosmosclient.WithFees(config.gasFees),
cosmosclient.WithGasLimit(defaultGasLimit),
cosmosclient.WithGasPrices(config.gasPrices),
cosmosclient.WithKeyringBackend(config.keyringBackend),
cosmosclient.WithKeyringDir(config.homeDir),
Expand Down
91 changes: 46 additions & 45 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,39 @@ module github.com/dymensionxyz/eibc-client
go 1.22.2

require (
cosmossdk.io/errors v1.0.1
github.com/cosmos/cosmos-sdk v0.46.16
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/ibc-go/v6 v6.2.1
github.com/dymensionxyz/cosmosclient v0.4.2-beta
github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240417155018-964ae3e745d1
github.com/google/uuid v1.4.0
github.com/ignite/cli v0.25.2
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240807121611-4f3f13b5ad2b
github.com/google/uuid v1.6.0
github.com/ignite/cli v0.26.1
github.com/mitchellh/go-homedir v1.1.0
github.com/ory/dockertest v3.3.5+incompatible
github.com/ory/dockertest/v3 v3.9.1
github.com/slack-go/slack v0.12.5
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.15.0
github.com/spf13/viper v1.18.1
github.com/stretchr/testify v1.8.4
github.com/tendermint/tendermint v0.34.29
go.mongodb.org/mongo-driver v1.15.0
go.uber.org/zap v1.24.0
google.golang.org/grpc v1.62.1
gopkg.in/yaml.v3 v3.0.1
)

require (
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/math v1.3.0 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/btcsuite/btcd v0.23.4 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
Expand All @@ -48,34 +49,33 @@ require (
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogoproto v1.4.8 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/dgraph-io/badger/v3 v3.2103.3 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/docker/cli v20.10.21+incompatible // indirect
github.com/docker/docker v20.10.21+incompatible // indirect
github.com/docker/cli v23.0.1+incompatible // indirect
github.com/docker/docker v23.0.1+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/ethereum/go-ethereum v1.10.26 // indirect
github.com/evmos/evmos/v12 v12.1.6 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/protobuf v1.3.3 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand All @@ -95,37 +95,39 @@ require (
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runc v1.1.4 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rs/cors v1.9.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/tm-db v0.6.8-0.20220506192307-f628bb5dc95b // indirect
Expand All @@ -146,31 +148,30 @@ require (
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace (
github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3
github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.0-dymension-v1.1.3
github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.28
github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20240807121422-5299b866061c
)
Loading

0 comments on commit 2575621

Please sign in to comment.