diff --git a/api/go.mod b/api/go.mod index 03574dc698..866b9dc901 100644 --- a/api/go.mod +++ b/api/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/cosmos/cosmos-proto v1.0.0-alpha7 github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 - github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 github.com/gogo/protobuf v1.3.2 - google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb + google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) @@ -15,7 +15,8 @@ require ( require ( github.com/DataDog/zstd v1.4.5 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/dgraph-io/badger/v2 v2.2007.2 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect @@ -26,8 +27,7 @@ require ( github.com/jmhodges/levigo v1.0.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect - github.com/tendermint/tm-db v0.6.6 // indirect + github.com/tendermint/tm-db v0.6.7 // indirect go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect diff --git a/api/go.sum b/api/go.sum index d7c761a227..75955079c8 100644 --- a/api/go.sum +++ b/api/go.sum @@ -25,13 +25,14 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 h1:UlK7NOHGlEbvbDTCM0cN7BJN6hhqeXZIuLv6KapFYTc= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 h1:YT5p2bEI7cIXpYyniSPckptI/DctTOcMpl0vTyy5vxA= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10/go.mod h1:WwRYmcnmSJpdOwr9ADwGr9gVBjYIre5TMz/nX4fStU0= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 h1:Ep7FHNViVwwGnwLFEPewZYsyN2CJNVMmMvFmtNQtbnw= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3/go.mod h1:HFea93YKmoMJ/mNKtkSeJZDtyJ4inxBsUK928KONcqo= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 h1:DSSxPDuX/Cr8AvmwipMkB1ObL8GQneZplSz4Sq9tH9M= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11/go.mod h1:2cogMfVz3OHvzGRWd9xUUJ8nqrzfdD96NGf+FNtzkQ4= +github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -53,12 +54,12 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -94,8 +95,9 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -147,10 +149,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= -github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -244,8 +244,9 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -253,7 +254,6 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/api/regen/data/v1/state.cosmos_orm.go b/api/regen/data/v1/state.cosmos_orm.go index def211d18a..754f6ecb5a 100644 --- a/api/regen/data/v1/state.cosmos_orm.go +++ b/api/regen/data/v1/state.cosmos_orm.go @@ -9,7 +9,7 @@ import ( ormerrors "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" ) -type DataIDStore interface { +type DataIDTable interface { Insert(ctx context.Context, dataID *DataID) error Update(ctx context.Context, dataID *DataID) error Save(ctx context.Context, dataID *DataID) error @@ -73,31 +73,31 @@ func (this DataIDIriIndexKey) WithIri(iri string) DataIDIriIndexKey { return this } -type dataIDStore struct { +type dataIDTable struct { table ormtable.Table } -func (this dataIDStore) Insert(ctx context.Context, dataID *DataID) error { +func (this dataIDTable) Insert(ctx context.Context, dataID *DataID) error { return this.table.Insert(ctx, dataID) } -func (this dataIDStore) Update(ctx context.Context, dataID *DataID) error { +func (this dataIDTable) Update(ctx context.Context, dataID *DataID) error { return this.table.Update(ctx, dataID) } -func (this dataIDStore) Save(ctx context.Context, dataID *DataID) error { +func (this dataIDTable) Save(ctx context.Context, dataID *DataID) error { return this.table.Save(ctx, dataID) } -func (this dataIDStore) Delete(ctx context.Context, dataID *DataID) error { +func (this dataIDTable) Delete(ctx context.Context, dataID *DataID) error { return this.table.Delete(ctx, dataID) } -func (this dataIDStore) Has(ctx context.Context, id []byte) (found bool, err error) { +func (this dataIDTable) Has(ctx context.Context, id []byte) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this dataIDStore) Get(ctx context.Context, id []byte) (*DataID, error) { +func (this dataIDTable) Get(ctx context.Context, id []byte) (*DataID, error) { var dataID DataID found, err := this.table.PrimaryKey().Get(ctx, &dataID, id) if err != nil { @@ -109,13 +109,13 @@ func (this dataIDStore) Get(ctx context.Context, id []byte) (*DataID, error) { return &dataID, nil } -func (this dataIDStore) HasByIri(ctx context.Context, iri string) (found bool, err error) { +func (this dataIDTable) HasByIri(ctx context.Context, iri string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, iri, ) } -func (this dataIDStore) GetByIri(ctx context.Context, iri string) (*DataID, error) { +func (this dataIDTable) GetByIri(ctx context.Context, iri string) (*DataID, error) { var dataID DataID found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &dataID, iri, @@ -129,37 +129,37 @@ func (this dataIDStore) GetByIri(ctx context.Context, iri string) (*DataID, erro return &dataID, nil } -func (this dataIDStore) List(ctx context.Context, prefixKey DataIDIndexKey, opts ...ormlist.Option) (DataIDIterator, error) { +func (this dataIDTable) List(ctx context.Context, prefixKey DataIDIndexKey, opts ...ormlist.Option) (DataIDIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return DataIDIterator{it}, err } -func (this dataIDStore) ListRange(ctx context.Context, from, to DataIDIndexKey, opts ...ormlist.Option) (DataIDIterator, error) { +func (this dataIDTable) ListRange(ctx context.Context, from, to DataIDIndexKey, opts ...ormlist.Option) (DataIDIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return DataIDIterator{it}, err } -func (this dataIDStore) DeleteBy(ctx context.Context, prefixKey DataIDIndexKey) error { +func (this dataIDTable) DeleteBy(ctx context.Context, prefixKey DataIDIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this dataIDStore) DeleteRange(ctx context.Context, from, to DataIDIndexKey) error { +func (this dataIDTable) DeleteRange(ctx context.Context, from, to DataIDIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this dataIDStore) doNotImplement() {} +func (this dataIDTable) doNotImplement() {} -var _ DataIDStore = dataIDStore{} +var _ DataIDTable = dataIDTable{} -func NewDataIDStore(db ormtable.Schema) (DataIDStore, error) { +func NewDataIDTable(db ormtable.Schema) (DataIDTable, error) { table := db.GetTable(&DataID{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&DataID{}).ProtoReflect().Descriptor().FullName())) } - return dataIDStore{table}, nil + return dataIDTable{table}, nil } -type DataAnchorStore interface { +type DataAnchorTable interface { Insert(ctx context.Context, dataAnchor *DataAnchor) error Update(ctx context.Context, dataAnchor *DataAnchor) error Save(ctx context.Context, dataAnchor *DataAnchor) error @@ -207,31 +207,31 @@ func (this DataAnchorIdIndexKey) WithId(id []byte) DataAnchorIdIndexKey { return this } -type dataAnchorStore struct { +type dataAnchorTable struct { table ormtable.Table } -func (this dataAnchorStore) Insert(ctx context.Context, dataAnchor *DataAnchor) error { +func (this dataAnchorTable) Insert(ctx context.Context, dataAnchor *DataAnchor) error { return this.table.Insert(ctx, dataAnchor) } -func (this dataAnchorStore) Update(ctx context.Context, dataAnchor *DataAnchor) error { +func (this dataAnchorTable) Update(ctx context.Context, dataAnchor *DataAnchor) error { return this.table.Update(ctx, dataAnchor) } -func (this dataAnchorStore) Save(ctx context.Context, dataAnchor *DataAnchor) error { +func (this dataAnchorTable) Save(ctx context.Context, dataAnchor *DataAnchor) error { return this.table.Save(ctx, dataAnchor) } -func (this dataAnchorStore) Delete(ctx context.Context, dataAnchor *DataAnchor) error { +func (this dataAnchorTable) Delete(ctx context.Context, dataAnchor *DataAnchor) error { return this.table.Delete(ctx, dataAnchor) } -func (this dataAnchorStore) Has(ctx context.Context, id []byte) (found bool, err error) { +func (this dataAnchorTable) Has(ctx context.Context, id []byte) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this dataAnchorStore) Get(ctx context.Context, id []byte) (*DataAnchor, error) { +func (this dataAnchorTable) Get(ctx context.Context, id []byte) (*DataAnchor, error) { var dataAnchor DataAnchor found, err := this.table.PrimaryKey().Get(ctx, &dataAnchor, id) if err != nil { @@ -243,37 +243,37 @@ func (this dataAnchorStore) Get(ctx context.Context, id []byte) (*DataAnchor, er return &dataAnchor, nil } -func (this dataAnchorStore) List(ctx context.Context, prefixKey DataAnchorIndexKey, opts ...ormlist.Option) (DataAnchorIterator, error) { +func (this dataAnchorTable) List(ctx context.Context, prefixKey DataAnchorIndexKey, opts ...ormlist.Option) (DataAnchorIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return DataAnchorIterator{it}, err } -func (this dataAnchorStore) ListRange(ctx context.Context, from, to DataAnchorIndexKey, opts ...ormlist.Option) (DataAnchorIterator, error) { +func (this dataAnchorTable) ListRange(ctx context.Context, from, to DataAnchorIndexKey, opts ...ormlist.Option) (DataAnchorIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return DataAnchorIterator{it}, err } -func (this dataAnchorStore) DeleteBy(ctx context.Context, prefixKey DataAnchorIndexKey) error { +func (this dataAnchorTable) DeleteBy(ctx context.Context, prefixKey DataAnchorIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this dataAnchorStore) DeleteRange(ctx context.Context, from, to DataAnchorIndexKey) error { +func (this dataAnchorTable) DeleteRange(ctx context.Context, from, to DataAnchorIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this dataAnchorStore) doNotImplement() {} +func (this dataAnchorTable) doNotImplement() {} -var _ DataAnchorStore = dataAnchorStore{} +var _ DataAnchorTable = dataAnchorTable{} -func NewDataAnchorStore(db ormtable.Schema) (DataAnchorStore, error) { +func NewDataAnchorTable(db ormtable.Schema) (DataAnchorTable, error) { table := db.GetTable(&DataAnchor{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&DataAnchor{}).ProtoReflect().Descriptor().FullName())) } - return dataAnchorStore{table}, nil + return dataAnchorTable{table}, nil } -type DataSignerStore interface { +type DataSignerTable interface { Insert(ctx context.Context, dataSigner *DataSigner) error Update(ctx context.Context, dataSigner *DataSigner) error Save(ctx context.Context, dataSigner *DataSigner) error @@ -326,31 +326,31 @@ func (this DataSignerIdSignerIndexKey) WithIdSigner(id []byte, signer []byte) Da return this } -type dataSignerStore struct { +type dataSignerTable struct { table ormtable.Table } -func (this dataSignerStore) Insert(ctx context.Context, dataSigner *DataSigner) error { +func (this dataSignerTable) Insert(ctx context.Context, dataSigner *DataSigner) error { return this.table.Insert(ctx, dataSigner) } -func (this dataSignerStore) Update(ctx context.Context, dataSigner *DataSigner) error { +func (this dataSignerTable) Update(ctx context.Context, dataSigner *DataSigner) error { return this.table.Update(ctx, dataSigner) } -func (this dataSignerStore) Save(ctx context.Context, dataSigner *DataSigner) error { +func (this dataSignerTable) Save(ctx context.Context, dataSigner *DataSigner) error { return this.table.Save(ctx, dataSigner) } -func (this dataSignerStore) Delete(ctx context.Context, dataSigner *DataSigner) error { +func (this dataSignerTable) Delete(ctx context.Context, dataSigner *DataSigner) error { return this.table.Delete(ctx, dataSigner) } -func (this dataSignerStore) Has(ctx context.Context, id []byte, signer []byte) (found bool, err error) { +func (this dataSignerTable) Has(ctx context.Context, id []byte, signer []byte) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id, signer) } -func (this dataSignerStore) Get(ctx context.Context, id []byte, signer []byte) (*DataSigner, error) { +func (this dataSignerTable) Get(ctx context.Context, id []byte, signer []byte) (*DataSigner, error) { var dataSigner DataSigner found, err := this.table.PrimaryKey().Get(ctx, &dataSigner, id, signer) if err != nil { @@ -362,37 +362,37 @@ func (this dataSignerStore) Get(ctx context.Context, id []byte, signer []byte) ( return &dataSigner, nil } -func (this dataSignerStore) List(ctx context.Context, prefixKey DataSignerIndexKey, opts ...ormlist.Option) (DataSignerIterator, error) { +func (this dataSignerTable) List(ctx context.Context, prefixKey DataSignerIndexKey, opts ...ormlist.Option) (DataSignerIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return DataSignerIterator{it}, err } -func (this dataSignerStore) ListRange(ctx context.Context, from, to DataSignerIndexKey, opts ...ormlist.Option) (DataSignerIterator, error) { +func (this dataSignerTable) ListRange(ctx context.Context, from, to DataSignerIndexKey, opts ...ormlist.Option) (DataSignerIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return DataSignerIterator{it}, err } -func (this dataSignerStore) DeleteBy(ctx context.Context, prefixKey DataSignerIndexKey) error { +func (this dataSignerTable) DeleteBy(ctx context.Context, prefixKey DataSignerIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this dataSignerStore) DeleteRange(ctx context.Context, from, to DataSignerIndexKey) error { +func (this dataSignerTable) DeleteRange(ctx context.Context, from, to DataSignerIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this dataSignerStore) doNotImplement() {} +func (this dataSignerTable) doNotImplement() {} -var _ DataSignerStore = dataSignerStore{} +var _ DataSignerTable = dataSignerTable{} -func NewDataSignerStore(db ormtable.Schema) (DataSignerStore, error) { +func NewDataSignerTable(db ormtable.Schema) (DataSignerTable, error) { table := db.GetTable(&DataSigner{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&DataSigner{}).ProtoReflect().Descriptor().FullName())) } - return dataSignerStore{table}, nil + return dataSignerTable{table}, nil } -type ResolverInfoStore interface { +type ResolverInfoTable interface { Insert(ctx context.Context, resolverInfo *ResolverInfo) error InsertReturningID(ctx context.Context, resolverInfo *ResolverInfo) (uint64, error) Update(ctx context.Context, resolverInfo *ResolverInfo) error @@ -470,35 +470,35 @@ func (this ResolverInfoManagerIndexKey) WithManager(manager []byte) ResolverInfo return this } -type resolverInfoStore struct { +type resolverInfoTable struct { table ormtable.AutoIncrementTable } -func (this resolverInfoStore) Insert(ctx context.Context, resolverInfo *ResolverInfo) error { +func (this resolverInfoTable) Insert(ctx context.Context, resolverInfo *ResolverInfo) error { return this.table.Insert(ctx, resolverInfo) } -func (this resolverInfoStore) Update(ctx context.Context, resolverInfo *ResolverInfo) error { +func (this resolverInfoTable) Update(ctx context.Context, resolverInfo *ResolverInfo) error { return this.table.Update(ctx, resolverInfo) } -func (this resolverInfoStore) Save(ctx context.Context, resolverInfo *ResolverInfo) error { +func (this resolverInfoTable) Save(ctx context.Context, resolverInfo *ResolverInfo) error { return this.table.Save(ctx, resolverInfo) } -func (this resolverInfoStore) Delete(ctx context.Context, resolverInfo *ResolverInfo) error { +func (this resolverInfoTable) Delete(ctx context.Context, resolverInfo *ResolverInfo) error { return this.table.Delete(ctx, resolverInfo) } -func (this resolverInfoStore) InsertReturningID(ctx context.Context, resolverInfo *ResolverInfo) (uint64, error) { +func (this resolverInfoTable) InsertReturningID(ctx context.Context, resolverInfo *ResolverInfo) (uint64, error) { return this.table.InsertReturningID(ctx, resolverInfo) } -func (this resolverInfoStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this resolverInfoTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this resolverInfoStore) Get(ctx context.Context, id uint64) (*ResolverInfo, error) { +func (this resolverInfoTable) Get(ctx context.Context, id uint64) (*ResolverInfo, error) { var resolverInfo ResolverInfo found, err := this.table.PrimaryKey().Get(ctx, &resolverInfo, id) if err != nil { @@ -510,13 +510,13 @@ func (this resolverInfoStore) Get(ctx context.Context, id uint64) (*ResolverInfo return &resolverInfo, nil } -func (this resolverInfoStore) HasByUrl(ctx context.Context, url string) (found bool, err error) { +func (this resolverInfoTable) HasByUrl(ctx context.Context, url string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, url, ) } -func (this resolverInfoStore) GetByUrl(ctx context.Context, url string) (*ResolverInfo, error) { +func (this resolverInfoTable) GetByUrl(ctx context.Context, url string) (*ResolverInfo, error) { var resolverInfo ResolverInfo found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &resolverInfo, url, @@ -530,37 +530,37 @@ func (this resolverInfoStore) GetByUrl(ctx context.Context, url string) (*Resolv return &resolverInfo, nil } -func (this resolverInfoStore) List(ctx context.Context, prefixKey ResolverInfoIndexKey, opts ...ormlist.Option) (ResolverInfoIterator, error) { +func (this resolverInfoTable) List(ctx context.Context, prefixKey ResolverInfoIndexKey, opts ...ormlist.Option) (ResolverInfoIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return ResolverInfoIterator{it}, err } -func (this resolverInfoStore) ListRange(ctx context.Context, from, to ResolverInfoIndexKey, opts ...ormlist.Option) (ResolverInfoIterator, error) { +func (this resolverInfoTable) ListRange(ctx context.Context, from, to ResolverInfoIndexKey, opts ...ormlist.Option) (ResolverInfoIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return ResolverInfoIterator{it}, err } -func (this resolverInfoStore) DeleteBy(ctx context.Context, prefixKey ResolverInfoIndexKey) error { +func (this resolverInfoTable) DeleteBy(ctx context.Context, prefixKey ResolverInfoIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this resolverInfoStore) DeleteRange(ctx context.Context, from, to ResolverInfoIndexKey) error { +func (this resolverInfoTable) DeleteRange(ctx context.Context, from, to ResolverInfoIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this resolverInfoStore) doNotImplement() {} +func (this resolverInfoTable) doNotImplement() {} -var _ ResolverInfoStore = resolverInfoStore{} +var _ ResolverInfoTable = resolverInfoTable{} -func NewResolverInfoStore(db ormtable.Schema) (ResolverInfoStore, error) { +func NewResolverInfoTable(db ormtable.Schema) (ResolverInfoTable, error) { table := db.GetTable(&ResolverInfo{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&ResolverInfo{}).ProtoReflect().Descriptor().FullName())) } - return resolverInfoStore{table.(ormtable.AutoIncrementTable)}, nil + return resolverInfoTable{table.(ormtable.AutoIncrementTable)}, nil } -type DataResolverStore interface { +type DataResolverTable interface { Insert(ctx context.Context, dataResolver *DataResolver) error Update(ctx context.Context, dataResolver *DataResolver) error Save(ctx context.Context, dataResolver *DataResolver) error @@ -613,31 +613,31 @@ func (this DataResolverIdResolverIdIndexKey) WithIdResolverId(id []byte, resolve return this } -type dataResolverStore struct { +type dataResolverTable struct { table ormtable.Table } -func (this dataResolverStore) Insert(ctx context.Context, dataResolver *DataResolver) error { +func (this dataResolverTable) Insert(ctx context.Context, dataResolver *DataResolver) error { return this.table.Insert(ctx, dataResolver) } -func (this dataResolverStore) Update(ctx context.Context, dataResolver *DataResolver) error { +func (this dataResolverTable) Update(ctx context.Context, dataResolver *DataResolver) error { return this.table.Update(ctx, dataResolver) } -func (this dataResolverStore) Save(ctx context.Context, dataResolver *DataResolver) error { +func (this dataResolverTable) Save(ctx context.Context, dataResolver *DataResolver) error { return this.table.Save(ctx, dataResolver) } -func (this dataResolverStore) Delete(ctx context.Context, dataResolver *DataResolver) error { +func (this dataResolverTable) Delete(ctx context.Context, dataResolver *DataResolver) error { return this.table.Delete(ctx, dataResolver) } -func (this dataResolverStore) Has(ctx context.Context, id []byte, resolver_id uint64) (found bool, err error) { +func (this dataResolverTable) Has(ctx context.Context, id []byte, resolver_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id, resolver_id) } -func (this dataResolverStore) Get(ctx context.Context, id []byte, resolver_id uint64) (*DataResolver, error) { +func (this dataResolverTable) Get(ctx context.Context, id []byte, resolver_id uint64) (*DataResolver, error) { var dataResolver DataResolver found, err := this.table.PrimaryKey().Get(ctx, &dataResolver, id, resolver_id) if err != nil { @@ -649,71 +649,71 @@ func (this dataResolverStore) Get(ctx context.Context, id []byte, resolver_id ui return &dataResolver, nil } -func (this dataResolverStore) List(ctx context.Context, prefixKey DataResolverIndexKey, opts ...ormlist.Option) (DataResolverIterator, error) { +func (this dataResolverTable) List(ctx context.Context, prefixKey DataResolverIndexKey, opts ...ormlist.Option) (DataResolverIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return DataResolverIterator{it}, err } -func (this dataResolverStore) ListRange(ctx context.Context, from, to DataResolverIndexKey, opts ...ormlist.Option) (DataResolverIterator, error) { +func (this dataResolverTable) ListRange(ctx context.Context, from, to DataResolverIndexKey, opts ...ormlist.Option) (DataResolverIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return DataResolverIterator{it}, err } -func (this dataResolverStore) DeleteBy(ctx context.Context, prefixKey DataResolverIndexKey) error { +func (this dataResolverTable) DeleteBy(ctx context.Context, prefixKey DataResolverIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this dataResolverStore) DeleteRange(ctx context.Context, from, to DataResolverIndexKey) error { +func (this dataResolverTable) DeleteRange(ctx context.Context, from, to DataResolverIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this dataResolverStore) doNotImplement() {} +func (this dataResolverTable) doNotImplement() {} -var _ DataResolverStore = dataResolverStore{} +var _ DataResolverTable = dataResolverTable{} -func NewDataResolverStore(db ormtable.Schema) (DataResolverStore, error) { +func NewDataResolverTable(db ormtable.Schema) (DataResolverTable, error) { table := db.GetTable(&DataResolver{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&DataResolver{}).ProtoReflect().Descriptor().FullName())) } - return dataResolverStore{table}, nil + return dataResolverTable{table}, nil } type StateStore interface { - DataIDStore() DataIDStore - DataAnchorStore() DataAnchorStore - DataSignerStore() DataSignerStore - ResolverInfoStore() ResolverInfoStore - DataResolverStore() DataResolverStore + DataIDTable() DataIDTable + DataAnchorTable() DataAnchorTable + DataSignerTable() DataSignerTable + ResolverInfoTable() ResolverInfoTable + DataResolverTable() DataResolverTable doNotImplement() } type stateStore struct { - dataID DataIDStore - dataAnchor DataAnchorStore - dataSigner DataSignerStore - resolverInfo ResolverInfoStore - dataResolver DataResolverStore + dataID DataIDTable + dataAnchor DataAnchorTable + dataSigner DataSignerTable + resolverInfo ResolverInfoTable + dataResolver DataResolverTable } -func (x stateStore) DataIDStore() DataIDStore { +func (x stateStore) DataIDTable() DataIDTable { return x.dataID } -func (x stateStore) DataAnchorStore() DataAnchorStore { +func (x stateStore) DataAnchorTable() DataAnchorTable { return x.dataAnchor } -func (x stateStore) DataSignerStore() DataSignerStore { +func (x stateStore) DataSignerTable() DataSignerTable { return x.dataSigner } -func (x stateStore) ResolverInfoStore() ResolverInfoStore { +func (x stateStore) ResolverInfoTable() ResolverInfoTable { return x.resolverInfo } -func (x stateStore) DataResolverStore() DataResolverStore { +func (x stateStore) DataResolverTable() DataResolverTable { return x.dataResolver } @@ -722,36 +722,36 @@ func (stateStore) doNotImplement() {} var _ StateStore = stateStore{} func NewStateStore(db ormtable.Schema) (StateStore, error) { - dataIDStore, err := NewDataIDStore(db) + dataIDTable, err := NewDataIDTable(db) if err != nil { return nil, err } - dataAnchorStore, err := NewDataAnchorStore(db) + dataAnchorTable, err := NewDataAnchorTable(db) if err != nil { return nil, err } - dataSignerStore, err := NewDataSignerStore(db) + dataSignerTable, err := NewDataSignerTable(db) if err != nil { return nil, err } - resolverInfoStore, err := NewResolverInfoStore(db) + resolverInfoTable, err := NewResolverInfoTable(db) if err != nil { return nil, err } - dataResolverStore, err := NewDataResolverStore(db) + dataResolverTable, err := NewDataResolverTable(db) if err != nil { return nil, err } return stateStore{ - dataIDStore, - dataAnchorStore, - dataSignerStore, - resolverInfoStore, - dataResolverStore, + dataIDTable, + dataAnchorTable, + dataSignerTable, + resolverInfoTable, + dataResolverTable, }, nil } diff --git a/api/regen/ecocredit/basket/v1/state.cosmos_orm.go b/api/regen/ecocredit/basket/v1/state.cosmos_orm.go index 6eea0af3f1..c3261fb427 100644 --- a/api/regen/ecocredit/basket/v1/state.cosmos_orm.go +++ b/api/regen/ecocredit/basket/v1/state.cosmos_orm.go @@ -10,7 +10,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) -type BasketStore interface { +type BasketTable interface { Insert(ctx context.Context, basket *Basket) error InsertReturningID(ctx context.Context, basket *Basket) (uint64, error) Update(ctx context.Context, basket *Basket) error @@ -91,35 +91,35 @@ func (this BasketNameIndexKey) WithName(name string) BasketNameIndexKey { return this } -type basketStore struct { +type basketTable struct { table ormtable.AutoIncrementTable } -func (this basketStore) Insert(ctx context.Context, basket *Basket) error { +func (this basketTable) Insert(ctx context.Context, basket *Basket) error { return this.table.Insert(ctx, basket) } -func (this basketStore) Update(ctx context.Context, basket *Basket) error { +func (this basketTable) Update(ctx context.Context, basket *Basket) error { return this.table.Update(ctx, basket) } -func (this basketStore) Save(ctx context.Context, basket *Basket) error { +func (this basketTable) Save(ctx context.Context, basket *Basket) error { return this.table.Save(ctx, basket) } -func (this basketStore) Delete(ctx context.Context, basket *Basket) error { +func (this basketTable) Delete(ctx context.Context, basket *Basket) error { return this.table.Delete(ctx, basket) } -func (this basketStore) InsertReturningID(ctx context.Context, basket *Basket) (uint64, error) { +func (this basketTable) InsertReturningID(ctx context.Context, basket *Basket) (uint64, error) { return this.table.InsertReturningID(ctx, basket) } -func (this basketStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this basketTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this basketStore) Get(ctx context.Context, id uint64) (*Basket, error) { +func (this basketTable) Get(ctx context.Context, id uint64) (*Basket, error) { var basket Basket found, err := this.table.PrimaryKey().Get(ctx, &basket, id) if err != nil { @@ -131,13 +131,13 @@ func (this basketStore) Get(ctx context.Context, id uint64) (*Basket, error) { return &basket, nil } -func (this basketStore) HasByBasketDenom(ctx context.Context, basket_denom string) (found bool, err error) { +func (this basketTable) HasByBasketDenom(ctx context.Context, basket_denom string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, basket_denom, ) } -func (this basketStore) GetByBasketDenom(ctx context.Context, basket_denom string) (*Basket, error) { +func (this basketTable) GetByBasketDenom(ctx context.Context, basket_denom string) (*Basket, error) { var basket Basket found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &basket, basket_denom, @@ -151,13 +151,13 @@ func (this basketStore) GetByBasketDenom(ctx context.Context, basket_denom strin return &basket, nil } -func (this basketStore) HasByName(ctx context.Context, name string) (found bool, err error) { +func (this basketTable) HasByName(ctx context.Context, name string) (found bool, err error) { return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx, name, ) } -func (this basketStore) GetByName(ctx context.Context, name string) (*Basket, error) { +func (this basketTable) GetByName(ctx context.Context, name string) (*Basket, error) { var basket Basket found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &basket, name, @@ -171,37 +171,37 @@ func (this basketStore) GetByName(ctx context.Context, name string) (*Basket, er return &basket, nil } -func (this basketStore) List(ctx context.Context, prefixKey BasketIndexKey, opts ...ormlist.Option) (BasketIterator, error) { +func (this basketTable) List(ctx context.Context, prefixKey BasketIndexKey, opts ...ormlist.Option) (BasketIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BasketIterator{it}, err } -func (this basketStore) ListRange(ctx context.Context, from, to BasketIndexKey, opts ...ormlist.Option) (BasketIterator, error) { +func (this basketTable) ListRange(ctx context.Context, from, to BasketIndexKey, opts ...ormlist.Option) (BasketIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BasketIterator{it}, err } -func (this basketStore) DeleteBy(ctx context.Context, prefixKey BasketIndexKey) error { +func (this basketTable) DeleteBy(ctx context.Context, prefixKey BasketIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this basketStore) DeleteRange(ctx context.Context, from, to BasketIndexKey) error { +func (this basketTable) DeleteRange(ctx context.Context, from, to BasketIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this basketStore) doNotImplement() {} +func (this basketTable) doNotImplement() {} -var _ BasketStore = basketStore{} +var _ BasketTable = basketTable{} -func NewBasketStore(db ormtable.Schema) (BasketStore, error) { +func NewBasketTable(db ormtable.Schema) (BasketTable, error) { table := db.GetTable(&Basket{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&Basket{}).ProtoReflect().Descriptor().FullName())) } - return basketStore{table.(ormtable.AutoIncrementTable)}, nil + return basketTable{table.(ormtable.AutoIncrementTable)}, nil } -type BasketClassStore interface { +type BasketClassTable interface { Insert(ctx context.Context, basketClass *BasketClass) error Update(ctx context.Context, basketClass *BasketClass) error Save(ctx context.Context, basketClass *BasketClass) error @@ -254,31 +254,31 @@ func (this BasketClassBasketIdClassIdIndexKey) WithBasketIdClassId(basket_id uin return this } -type basketClassStore struct { +type basketClassTable struct { table ormtable.Table } -func (this basketClassStore) Insert(ctx context.Context, basketClass *BasketClass) error { +func (this basketClassTable) Insert(ctx context.Context, basketClass *BasketClass) error { return this.table.Insert(ctx, basketClass) } -func (this basketClassStore) Update(ctx context.Context, basketClass *BasketClass) error { +func (this basketClassTable) Update(ctx context.Context, basketClass *BasketClass) error { return this.table.Update(ctx, basketClass) } -func (this basketClassStore) Save(ctx context.Context, basketClass *BasketClass) error { +func (this basketClassTable) Save(ctx context.Context, basketClass *BasketClass) error { return this.table.Save(ctx, basketClass) } -func (this basketClassStore) Delete(ctx context.Context, basketClass *BasketClass) error { +func (this basketClassTable) Delete(ctx context.Context, basketClass *BasketClass) error { return this.table.Delete(ctx, basketClass) } -func (this basketClassStore) Has(ctx context.Context, basket_id uint64, class_id string) (found bool, err error) { +func (this basketClassTable) Has(ctx context.Context, basket_id uint64, class_id string) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, basket_id, class_id) } -func (this basketClassStore) Get(ctx context.Context, basket_id uint64, class_id string) (*BasketClass, error) { +func (this basketClassTable) Get(ctx context.Context, basket_id uint64, class_id string) (*BasketClass, error) { var basketClass BasketClass found, err := this.table.PrimaryKey().Get(ctx, &basketClass, basket_id, class_id) if err != nil { @@ -290,37 +290,37 @@ func (this basketClassStore) Get(ctx context.Context, basket_id uint64, class_id return &basketClass, nil } -func (this basketClassStore) List(ctx context.Context, prefixKey BasketClassIndexKey, opts ...ormlist.Option) (BasketClassIterator, error) { +func (this basketClassTable) List(ctx context.Context, prefixKey BasketClassIndexKey, opts ...ormlist.Option) (BasketClassIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BasketClassIterator{it}, err } -func (this basketClassStore) ListRange(ctx context.Context, from, to BasketClassIndexKey, opts ...ormlist.Option) (BasketClassIterator, error) { +func (this basketClassTable) ListRange(ctx context.Context, from, to BasketClassIndexKey, opts ...ormlist.Option) (BasketClassIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BasketClassIterator{it}, err } -func (this basketClassStore) DeleteBy(ctx context.Context, prefixKey BasketClassIndexKey) error { +func (this basketClassTable) DeleteBy(ctx context.Context, prefixKey BasketClassIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this basketClassStore) DeleteRange(ctx context.Context, from, to BasketClassIndexKey) error { +func (this basketClassTable) DeleteRange(ctx context.Context, from, to BasketClassIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this basketClassStore) doNotImplement() {} +func (this basketClassTable) doNotImplement() {} -var _ BasketClassStore = basketClassStore{} +var _ BasketClassTable = basketClassTable{} -func NewBasketClassStore(db ormtable.Schema) (BasketClassStore, error) { +func NewBasketClassTable(db ormtable.Schema) (BasketClassTable, error) { table := db.GetTable(&BasketClass{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BasketClass{}).ProtoReflect().Descriptor().FullName())) } - return basketClassStore{table}, nil + return basketClassTable{table}, nil } -type BasketBalanceStore interface { +type BasketBalanceTable interface { Insert(ctx context.Context, basketBalance *BasketBalance) error Update(ctx context.Context, basketBalance *BasketBalance) error Save(ctx context.Context, basketBalance *BasketBalance) error @@ -391,31 +391,31 @@ func (this BasketBalanceBasketIdBatchStartDateIndexKey) WithBasketIdBatchStartDa return this } -type basketBalanceStore struct { +type basketBalanceTable struct { table ormtable.Table } -func (this basketBalanceStore) Insert(ctx context.Context, basketBalance *BasketBalance) error { +func (this basketBalanceTable) Insert(ctx context.Context, basketBalance *BasketBalance) error { return this.table.Insert(ctx, basketBalance) } -func (this basketBalanceStore) Update(ctx context.Context, basketBalance *BasketBalance) error { +func (this basketBalanceTable) Update(ctx context.Context, basketBalance *BasketBalance) error { return this.table.Update(ctx, basketBalance) } -func (this basketBalanceStore) Save(ctx context.Context, basketBalance *BasketBalance) error { +func (this basketBalanceTable) Save(ctx context.Context, basketBalance *BasketBalance) error { return this.table.Save(ctx, basketBalance) } -func (this basketBalanceStore) Delete(ctx context.Context, basketBalance *BasketBalance) error { +func (this basketBalanceTable) Delete(ctx context.Context, basketBalance *BasketBalance) error { return this.table.Delete(ctx, basketBalance) } -func (this basketBalanceStore) Has(ctx context.Context, basket_id uint64, batch_denom string) (found bool, err error) { +func (this basketBalanceTable) Has(ctx context.Context, basket_id uint64, batch_denom string) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, basket_id, batch_denom) } -func (this basketBalanceStore) Get(ctx context.Context, basket_id uint64, batch_denom string) (*BasketBalance, error) { +func (this basketBalanceTable) Get(ctx context.Context, basket_id uint64, batch_denom string) (*BasketBalance, error) { var basketBalance BasketBalance found, err := this.table.PrimaryKey().Get(ctx, &basketBalance, basket_id, batch_denom) if err != nil { @@ -427,59 +427,59 @@ func (this basketBalanceStore) Get(ctx context.Context, basket_id uint64, batch_ return &basketBalance, nil } -func (this basketBalanceStore) List(ctx context.Context, prefixKey BasketBalanceIndexKey, opts ...ormlist.Option) (BasketBalanceIterator, error) { +func (this basketBalanceTable) List(ctx context.Context, prefixKey BasketBalanceIndexKey, opts ...ormlist.Option) (BasketBalanceIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BasketBalanceIterator{it}, err } -func (this basketBalanceStore) ListRange(ctx context.Context, from, to BasketBalanceIndexKey, opts ...ormlist.Option) (BasketBalanceIterator, error) { +func (this basketBalanceTable) ListRange(ctx context.Context, from, to BasketBalanceIndexKey, opts ...ormlist.Option) (BasketBalanceIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BasketBalanceIterator{it}, err } -func (this basketBalanceStore) DeleteBy(ctx context.Context, prefixKey BasketBalanceIndexKey) error { +func (this basketBalanceTable) DeleteBy(ctx context.Context, prefixKey BasketBalanceIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this basketBalanceStore) DeleteRange(ctx context.Context, from, to BasketBalanceIndexKey) error { +func (this basketBalanceTable) DeleteRange(ctx context.Context, from, to BasketBalanceIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this basketBalanceStore) doNotImplement() {} +func (this basketBalanceTable) doNotImplement() {} -var _ BasketBalanceStore = basketBalanceStore{} +var _ BasketBalanceTable = basketBalanceTable{} -func NewBasketBalanceStore(db ormtable.Schema) (BasketBalanceStore, error) { +func NewBasketBalanceTable(db ormtable.Schema) (BasketBalanceTable, error) { table := db.GetTable(&BasketBalance{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BasketBalance{}).ProtoReflect().Descriptor().FullName())) } - return basketBalanceStore{table}, nil + return basketBalanceTable{table}, nil } type StateStore interface { - BasketStore() BasketStore - BasketClassStore() BasketClassStore - BasketBalanceStore() BasketBalanceStore + BasketTable() BasketTable + BasketClassTable() BasketClassTable + BasketBalanceTable() BasketBalanceTable doNotImplement() } type stateStore struct { - basket BasketStore - basketClass BasketClassStore - basketBalance BasketBalanceStore + basket BasketTable + basketClass BasketClassTable + basketBalance BasketBalanceTable } -func (x stateStore) BasketStore() BasketStore { +func (x stateStore) BasketTable() BasketTable { return x.basket } -func (x stateStore) BasketClassStore() BasketClassStore { +func (x stateStore) BasketClassTable() BasketClassTable { return x.basketClass } -func (x stateStore) BasketBalanceStore() BasketBalanceStore { +func (x stateStore) BasketBalanceTable() BasketBalanceTable { return x.basketBalance } @@ -488,24 +488,24 @@ func (stateStore) doNotImplement() {} var _ StateStore = stateStore{} func NewStateStore(db ormtable.Schema) (StateStore, error) { - basketStore, err := NewBasketStore(db) + basketTable, err := NewBasketTable(db) if err != nil { return nil, err } - basketClassStore, err := NewBasketClassStore(db) + basketClassTable, err := NewBasketClassTable(db) if err != nil { return nil, err } - basketBalanceStore, err := NewBasketBalanceStore(db) + basketBalanceTable, err := NewBasketBalanceTable(db) if err != nil { return nil, err } return stateStore{ - basketStore, - basketClassStore, - basketBalanceStore, + basketTable, + basketClassTable, + basketBalanceTable, }, nil } diff --git a/api/regen/ecocredit/marketplace/v1/state.cosmos_orm.go b/api/regen/ecocredit/marketplace/v1/state.cosmos_orm.go index cfe6b739a1..2346d26c5c 100644 --- a/api/regen/ecocredit/marketplace/v1/state.cosmos_orm.go +++ b/api/regen/ecocredit/marketplace/v1/state.cosmos_orm.go @@ -10,7 +10,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) -type SellOrderStore interface { +type SellOrderTable interface { Insert(ctx context.Context, sellOrder *SellOrder) error InsertReturningID(ctx context.Context, sellOrder *SellOrder) (uint64, error) Update(ctx context.Context, sellOrder *SellOrder) error @@ -98,35 +98,35 @@ func (this SellOrderExpirationIndexKey) WithExpiration(expiration *timestamppb.T return this } -type sellOrderStore struct { +type sellOrderTable struct { table ormtable.AutoIncrementTable } -func (this sellOrderStore) Insert(ctx context.Context, sellOrder *SellOrder) error { +func (this sellOrderTable) Insert(ctx context.Context, sellOrder *SellOrder) error { return this.table.Insert(ctx, sellOrder) } -func (this sellOrderStore) Update(ctx context.Context, sellOrder *SellOrder) error { +func (this sellOrderTable) Update(ctx context.Context, sellOrder *SellOrder) error { return this.table.Update(ctx, sellOrder) } -func (this sellOrderStore) Save(ctx context.Context, sellOrder *SellOrder) error { +func (this sellOrderTable) Save(ctx context.Context, sellOrder *SellOrder) error { return this.table.Save(ctx, sellOrder) } -func (this sellOrderStore) Delete(ctx context.Context, sellOrder *SellOrder) error { +func (this sellOrderTable) Delete(ctx context.Context, sellOrder *SellOrder) error { return this.table.Delete(ctx, sellOrder) } -func (this sellOrderStore) InsertReturningID(ctx context.Context, sellOrder *SellOrder) (uint64, error) { +func (this sellOrderTable) InsertReturningID(ctx context.Context, sellOrder *SellOrder) (uint64, error) { return this.table.InsertReturningID(ctx, sellOrder) } -func (this sellOrderStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this sellOrderTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this sellOrderStore) Get(ctx context.Context, id uint64) (*SellOrder, error) { +func (this sellOrderTable) Get(ctx context.Context, id uint64) (*SellOrder, error) { var sellOrder SellOrder found, err := this.table.PrimaryKey().Get(ctx, &sellOrder, id) if err != nil { @@ -138,37 +138,37 @@ func (this sellOrderStore) Get(ctx context.Context, id uint64) (*SellOrder, erro return &sellOrder, nil } -func (this sellOrderStore) List(ctx context.Context, prefixKey SellOrderIndexKey, opts ...ormlist.Option) (SellOrderIterator, error) { +func (this sellOrderTable) List(ctx context.Context, prefixKey SellOrderIndexKey, opts ...ormlist.Option) (SellOrderIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return SellOrderIterator{it}, err } -func (this sellOrderStore) ListRange(ctx context.Context, from, to SellOrderIndexKey, opts ...ormlist.Option) (SellOrderIterator, error) { +func (this sellOrderTable) ListRange(ctx context.Context, from, to SellOrderIndexKey, opts ...ormlist.Option) (SellOrderIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return SellOrderIterator{it}, err } -func (this sellOrderStore) DeleteBy(ctx context.Context, prefixKey SellOrderIndexKey) error { +func (this sellOrderTable) DeleteBy(ctx context.Context, prefixKey SellOrderIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this sellOrderStore) DeleteRange(ctx context.Context, from, to SellOrderIndexKey) error { +func (this sellOrderTable) DeleteRange(ctx context.Context, from, to SellOrderIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this sellOrderStore) doNotImplement() {} +func (this sellOrderTable) doNotImplement() {} -var _ SellOrderStore = sellOrderStore{} +var _ SellOrderTable = sellOrderTable{} -func NewSellOrderStore(db ormtable.Schema) (SellOrderStore, error) { +func NewSellOrderTable(db ormtable.Schema) (SellOrderTable, error) { table := db.GetTable(&SellOrder{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&SellOrder{}).ProtoReflect().Descriptor().FullName())) } - return sellOrderStore{table.(ormtable.AutoIncrementTable)}, nil + return sellOrderTable{table.(ormtable.AutoIncrementTable)}, nil } -type BuyOrderStore interface { +type BuyOrderTable interface { Insert(ctx context.Context, buyOrder *BuyOrder) error InsertReturningID(ctx context.Context, buyOrder *BuyOrder) (uint64, error) Update(ctx context.Context, buyOrder *BuyOrder) error @@ -243,35 +243,35 @@ func (this BuyOrderExpirationIndexKey) WithExpiration(expiration *timestamppb.Ti return this } -type buyOrderStore struct { +type buyOrderTable struct { table ormtable.AutoIncrementTable } -func (this buyOrderStore) Insert(ctx context.Context, buyOrder *BuyOrder) error { +func (this buyOrderTable) Insert(ctx context.Context, buyOrder *BuyOrder) error { return this.table.Insert(ctx, buyOrder) } -func (this buyOrderStore) Update(ctx context.Context, buyOrder *BuyOrder) error { +func (this buyOrderTable) Update(ctx context.Context, buyOrder *BuyOrder) error { return this.table.Update(ctx, buyOrder) } -func (this buyOrderStore) Save(ctx context.Context, buyOrder *BuyOrder) error { +func (this buyOrderTable) Save(ctx context.Context, buyOrder *BuyOrder) error { return this.table.Save(ctx, buyOrder) } -func (this buyOrderStore) Delete(ctx context.Context, buyOrder *BuyOrder) error { +func (this buyOrderTable) Delete(ctx context.Context, buyOrder *BuyOrder) error { return this.table.Delete(ctx, buyOrder) } -func (this buyOrderStore) InsertReturningID(ctx context.Context, buyOrder *BuyOrder) (uint64, error) { +func (this buyOrderTable) InsertReturningID(ctx context.Context, buyOrder *BuyOrder) (uint64, error) { return this.table.InsertReturningID(ctx, buyOrder) } -func (this buyOrderStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this buyOrderTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this buyOrderStore) Get(ctx context.Context, id uint64) (*BuyOrder, error) { +func (this buyOrderTable) Get(ctx context.Context, id uint64) (*BuyOrder, error) { var buyOrder BuyOrder found, err := this.table.PrimaryKey().Get(ctx, &buyOrder, id) if err != nil { @@ -283,37 +283,37 @@ func (this buyOrderStore) Get(ctx context.Context, id uint64) (*BuyOrder, error) return &buyOrder, nil } -func (this buyOrderStore) List(ctx context.Context, prefixKey BuyOrderIndexKey, opts ...ormlist.Option) (BuyOrderIterator, error) { +func (this buyOrderTable) List(ctx context.Context, prefixKey BuyOrderIndexKey, opts ...ormlist.Option) (BuyOrderIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BuyOrderIterator{it}, err } -func (this buyOrderStore) ListRange(ctx context.Context, from, to BuyOrderIndexKey, opts ...ormlist.Option) (BuyOrderIterator, error) { +func (this buyOrderTable) ListRange(ctx context.Context, from, to BuyOrderIndexKey, opts ...ormlist.Option) (BuyOrderIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BuyOrderIterator{it}, err } -func (this buyOrderStore) DeleteBy(ctx context.Context, prefixKey BuyOrderIndexKey) error { +func (this buyOrderTable) DeleteBy(ctx context.Context, prefixKey BuyOrderIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this buyOrderStore) DeleteRange(ctx context.Context, from, to BuyOrderIndexKey) error { +func (this buyOrderTable) DeleteRange(ctx context.Context, from, to BuyOrderIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this buyOrderStore) doNotImplement() {} +func (this buyOrderTable) doNotImplement() {} -var _ BuyOrderStore = buyOrderStore{} +var _ BuyOrderTable = buyOrderTable{} -func NewBuyOrderStore(db ormtable.Schema) (BuyOrderStore, error) { +func NewBuyOrderTable(db ormtable.Schema) (BuyOrderTable, error) { table := db.GetTable(&BuyOrder{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrder{}).ProtoReflect().Descriptor().FullName())) } - return buyOrderStore{table.(ormtable.AutoIncrementTable)}, nil + return buyOrderTable{table.(ormtable.AutoIncrementTable)}, nil } -type AllowedDenomStore interface { +type AllowedDenomTable interface { Insert(ctx context.Context, allowedDenom *AllowedDenom) error Update(ctx context.Context, allowedDenom *AllowedDenom) error Save(ctx context.Context, allowedDenom *AllowedDenom) error @@ -377,31 +377,31 @@ func (this AllowedDenomDisplayDenomIndexKey) WithDisplayDenom(display_denom stri return this } -type allowedDenomStore struct { +type allowedDenomTable struct { table ormtable.Table } -func (this allowedDenomStore) Insert(ctx context.Context, allowedDenom *AllowedDenom) error { +func (this allowedDenomTable) Insert(ctx context.Context, allowedDenom *AllowedDenom) error { return this.table.Insert(ctx, allowedDenom) } -func (this allowedDenomStore) Update(ctx context.Context, allowedDenom *AllowedDenom) error { +func (this allowedDenomTable) Update(ctx context.Context, allowedDenom *AllowedDenom) error { return this.table.Update(ctx, allowedDenom) } -func (this allowedDenomStore) Save(ctx context.Context, allowedDenom *AllowedDenom) error { +func (this allowedDenomTable) Save(ctx context.Context, allowedDenom *AllowedDenom) error { return this.table.Save(ctx, allowedDenom) } -func (this allowedDenomStore) Delete(ctx context.Context, allowedDenom *AllowedDenom) error { +func (this allowedDenomTable) Delete(ctx context.Context, allowedDenom *AllowedDenom) error { return this.table.Delete(ctx, allowedDenom) } -func (this allowedDenomStore) Has(ctx context.Context, bank_denom string) (found bool, err error) { +func (this allowedDenomTable) Has(ctx context.Context, bank_denom string) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, bank_denom) } -func (this allowedDenomStore) Get(ctx context.Context, bank_denom string) (*AllowedDenom, error) { +func (this allowedDenomTable) Get(ctx context.Context, bank_denom string) (*AllowedDenom, error) { var allowedDenom AllowedDenom found, err := this.table.PrimaryKey().Get(ctx, &allowedDenom, bank_denom) if err != nil { @@ -413,13 +413,13 @@ func (this allowedDenomStore) Get(ctx context.Context, bank_denom string) (*Allo return &allowedDenom, nil } -func (this allowedDenomStore) HasByDisplayDenom(ctx context.Context, display_denom string) (found bool, err error) { +func (this allowedDenomTable) HasByDisplayDenom(ctx context.Context, display_denom string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, display_denom, ) } -func (this allowedDenomStore) GetByDisplayDenom(ctx context.Context, display_denom string) (*AllowedDenom, error) { +func (this allowedDenomTable) GetByDisplayDenom(ctx context.Context, display_denom string) (*AllowedDenom, error) { var allowedDenom AllowedDenom found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &allowedDenom, display_denom, @@ -433,37 +433,37 @@ func (this allowedDenomStore) GetByDisplayDenom(ctx context.Context, display_den return &allowedDenom, nil } -func (this allowedDenomStore) List(ctx context.Context, prefixKey AllowedDenomIndexKey, opts ...ormlist.Option) (AllowedDenomIterator, error) { +func (this allowedDenomTable) List(ctx context.Context, prefixKey AllowedDenomIndexKey, opts ...ormlist.Option) (AllowedDenomIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return AllowedDenomIterator{it}, err } -func (this allowedDenomStore) ListRange(ctx context.Context, from, to AllowedDenomIndexKey, opts ...ormlist.Option) (AllowedDenomIterator, error) { +func (this allowedDenomTable) ListRange(ctx context.Context, from, to AllowedDenomIndexKey, opts ...ormlist.Option) (AllowedDenomIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return AllowedDenomIterator{it}, err } -func (this allowedDenomStore) DeleteBy(ctx context.Context, prefixKey AllowedDenomIndexKey) error { +func (this allowedDenomTable) DeleteBy(ctx context.Context, prefixKey AllowedDenomIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this allowedDenomStore) DeleteRange(ctx context.Context, from, to AllowedDenomIndexKey) error { +func (this allowedDenomTable) DeleteRange(ctx context.Context, from, to AllowedDenomIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this allowedDenomStore) doNotImplement() {} +func (this allowedDenomTable) doNotImplement() {} -var _ AllowedDenomStore = allowedDenomStore{} +var _ AllowedDenomTable = allowedDenomTable{} -func NewAllowedDenomStore(db ormtable.Schema) (AllowedDenomStore, error) { +func NewAllowedDenomTable(db ormtable.Schema) (AllowedDenomTable, error) { table := db.GetTable(&AllowedDenom{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&AllowedDenom{}).ProtoReflect().Descriptor().FullName())) } - return allowedDenomStore{table}, nil + return allowedDenomTable{table}, nil } -type MarketStore interface { +type MarketTable interface { Insert(ctx context.Context, market *Market) error InsertReturningID(ctx context.Context, market *Market) (uint64, error) Update(ctx context.Context, market *Market) error @@ -533,35 +533,35 @@ func (this MarketCreditTypeBankDenomIndexKey) WithCreditTypeBankDenom(credit_typ return this } -type marketStore struct { +type marketTable struct { table ormtable.AutoIncrementTable } -func (this marketStore) Insert(ctx context.Context, market *Market) error { +func (this marketTable) Insert(ctx context.Context, market *Market) error { return this.table.Insert(ctx, market) } -func (this marketStore) Update(ctx context.Context, market *Market) error { +func (this marketTable) Update(ctx context.Context, market *Market) error { return this.table.Update(ctx, market) } -func (this marketStore) Save(ctx context.Context, market *Market) error { +func (this marketTable) Save(ctx context.Context, market *Market) error { return this.table.Save(ctx, market) } -func (this marketStore) Delete(ctx context.Context, market *Market) error { +func (this marketTable) Delete(ctx context.Context, market *Market) error { return this.table.Delete(ctx, market) } -func (this marketStore) InsertReturningID(ctx context.Context, market *Market) (uint64, error) { +func (this marketTable) InsertReturningID(ctx context.Context, market *Market) (uint64, error) { return this.table.InsertReturningID(ctx, market) } -func (this marketStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this marketTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this marketStore) Get(ctx context.Context, id uint64) (*Market, error) { +func (this marketTable) Get(ctx context.Context, id uint64) (*Market, error) { var market Market found, err := this.table.PrimaryKey().Get(ctx, &market, id) if err != nil { @@ -573,14 +573,14 @@ func (this marketStore) Get(ctx context.Context, id uint64) (*Market, error) { return &market, nil } -func (this marketStore) HasByCreditTypeBankDenom(ctx context.Context, credit_type string, bank_denom string) (found bool, err error) { +func (this marketTable) HasByCreditTypeBankDenom(ctx context.Context, credit_type string, bank_denom string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, credit_type, bank_denom, ) } -func (this marketStore) GetByCreditTypeBankDenom(ctx context.Context, credit_type string, bank_denom string) (*Market, error) { +func (this marketTable) GetByCreditTypeBankDenom(ctx context.Context, credit_type string, bank_denom string) (*Market, error) { var market Market found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &market, credit_type, @@ -595,65 +595,65 @@ func (this marketStore) GetByCreditTypeBankDenom(ctx context.Context, credit_typ return &market, nil } -func (this marketStore) List(ctx context.Context, prefixKey MarketIndexKey, opts ...ormlist.Option) (MarketIterator, error) { +func (this marketTable) List(ctx context.Context, prefixKey MarketIndexKey, opts ...ormlist.Option) (MarketIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return MarketIterator{it}, err } -func (this marketStore) ListRange(ctx context.Context, from, to MarketIndexKey, opts ...ormlist.Option) (MarketIterator, error) { +func (this marketTable) ListRange(ctx context.Context, from, to MarketIndexKey, opts ...ormlist.Option) (MarketIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return MarketIterator{it}, err } -func (this marketStore) DeleteBy(ctx context.Context, prefixKey MarketIndexKey) error { +func (this marketTable) DeleteBy(ctx context.Context, prefixKey MarketIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this marketStore) DeleteRange(ctx context.Context, from, to MarketIndexKey) error { +func (this marketTable) DeleteRange(ctx context.Context, from, to MarketIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this marketStore) doNotImplement() {} +func (this marketTable) doNotImplement() {} -var _ MarketStore = marketStore{} +var _ MarketTable = marketTable{} -func NewMarketStore(db ormtable.Schema) (MarketStore, error) { +func NewMarketTable(db ormtable.Schema) (MarketTable, error) { table := db.GetTable(&Market{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&Market{}).ProtoReflect().Descriptor().FullName())) } - return marketStore{table.(ormtable.AutoIncrementTable)}, nil + return marketTable{table.(ormtable.AutoIncrementTable)}, nil } type StateStore interface { - SellOrderStore() SellOrderStore - BuyOrderStore() BuyOrderStore - AllowedDenomStore() AllowedDenomStore - MarketStore() MarketStore + SellOrderTable() SellOrderTable + BuyOrderTable() BuyOrderTable + AllowedDenomTable() AllowedDenomTable + MarketTable() MarketTable doNotImplement() } type stateStore struct { - sellOrder SellOrderStore - buyOrder BuyOrderStore - allowedDenom AllowedDenomStore - market MarketStore + sellOrder SellOrderTable + buyOrder BuyOrderTable + allowedDenom AllowedDenomTable + market MarketTable } -func (x stateStore) SellOrderStore() SellOrderStore { +func (x stateStore) SellOrderTable() SellOrderTable { return x.sellOrder } -func (x stateStore) BuyOrderStore() BuyOrderStore { +func (x stateStore) BuyOrderTable() BuyOrderTable { return x.buyOrder } -func (x stateStore) AllowedDenomStore() AllowedDenomStore { +func (x stateStore) AllowedDenomTable() AllowedDenomTable { return x.allowedDenom } -func (x stateStore) MarketStore() MarketStore { +func (x stateStore) MarketTable() MarketTable { return x.market } @@ -662,30 +662,30 @@ func (stateStore) doNotImplement() {} var _ StateStore = stateStore{} func NewStateStore(db ormtable.Schema) (StateStore, error) { - sellOrderStore, err := NewSellOrderStore(db) + sellOrderTable, err := NewSellOrderTable(db) if err != nil { return nil, err } - buyOrderStore, err := NewBuyOrderStore(db) + buyOrderTable, err := NewBuyOrderTable(db) if err != nil { return nil, err } - allowedDenomStore, err := NewAllowedDenomStore(db) + allowedDenomTable, err := NewAllowedDenomTable(db) if err != nil { return nil, err } - marketStore, err := NewMarketStore(db) + marketTable, err := NewMarketTable(db) if err != nil { return nil, err } return stateStore{ - sellOrderStore, - buyOrderStore, - allowedDenomStore, - marketStore, + sellOrderTable, + buyOrderTable, + allowedDenomTable, + marketTable, }, nil } diff --git a/api/regen/ecocredit/orderbook/v1alpha1/memory.cosmos_orm.go b/api/regen/ecocredit/orderbook/v1alpha1/memory.cosmos_orm.go index 6a1bc8bc5d..b6ba09d87a 100644 --- a/api/regen/ecocredit/orderbook/v1alpha1/memory.cosmos_orm.go +++ b/api/regen/ecocredit/orderbook/v1alpha1/memory.cosmos_orm.go @@ -9,7 +9,7 @@ import ( ormerrors "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" ) -type BuyOrderSellOrderMatchStore interface { +type BuyOrderSellOrderMatchTable interface { Insert(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error Update(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error Save(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error @@ -113,31 +113,31 @@ func (this BuyOrderSellOrderMatchSellOrderIdIndexKey) WithSellOrderId(sell_order return this } -type buyOrderSellOrderMatchStore struct { +type buyOrderSellOrderMatchTable struct { table ormtable.Table } -func (this buyOrderSellOrderMatchStore) Insert(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { +func (this buyOrderSellOrderMatchTable) Insert(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { return this.table.Insert(ctx, buyOrderSellOrderMatch) } -func (this buyOrderSellOrderMatchStore) Update(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { +func (this buyOrderSellOrderMatchTable) Update(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { return this.table.Update(ctx, buyOrderSellOrderMatch) } -func (this buyOrderSellOrderMatchStore) Save(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { +func (this buyOrderSellOrderMatchTable) Save(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { return this.table.Save(ctx, buyOrderSellOrderMatch) } -func (this buyOrderSellOrderMatchStore) Delete(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { +func (this buyOrderSellOrderMatchTable) Delete(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error { return this.table.Delete(ctx, buyOrderSellOrderMatch) } -func (this buyOrderSellOrderMatchStore) Has(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (found bool, err error) { +func (this buyOrderSellOrderMatchTable) Has(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, buy_order_id, sell_order_id) } -func (this buyOrderSellOrderMatchStore) Get(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (*BuyOrderSellOrderMatch, error) { +func (this buyOrderSellOrderMatchTable) Get(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (*BuyOrderSellOrderMatch, error) { var buyOrderSellOrderMatch BuyOrderSellOrderMatch found, err := this.table.PrimaryKey().Get(ctx, &buyOrderSellOrderMatch, buy_order_id, sell_order_id) if err != nil { @@ -149,37 +149,37 @@ func (this buyOrderSellOrderMatchStore) Get(ctx context.Context, buy_order_id ui return &buyOrderSellOrderMatch, nil } -func (this buyOrderSellOrderMatchStore) List(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error) { +func (this buyOrderSellOrderMatchTable) List(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BuyOrderSellOrderMatchIterator{it}, err } -func (this buyOrderSellOrderMatchStore) ListRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error) { +func (this buyOrderSellOrderMatchTable) ListRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BuyOrderSellOrderMatchIterator{it}, err } -func (this buyOrderSellOrderMatchStore) DeleteBy(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey) error { +func (this buyOrderSellOrderMatchTable) DeleteBy(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this buyOrderSellOrderMatchStore) DeleteRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey) error { +func (this buyOrderSellOrderMatchTable) DeleteRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this buyOrderSellOrderMatchStore) doNotImplement() {} +func (this buyOrderSellOrderMatchTable) doNotImplement() {} -var _ BuyOrderSellOrderMatchStore = buyOrderSellOrderMatchStore{} +var _ BuyOrderSellOrderMatchTable = buyOrderSellOrderMatchTable{} -func NewBuyOrderSellOrderMatchStore(db ormtable.Schema) (BuyOrderSellOrderMatchStore, error) { +func NewBuyOrderSellOrderMatchTable(db ormtable.Schema) (BuyOrderSellOrderMatchTable, error) { table := db.GetTable(&BuyOrderSellOrderMatch{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderSellOrderMatch{}).ProtoReflect().Descriptor().FullName())) } - return buyOrderSellOrderMatchStore{table}, nil + return buyOrderSellOrderMatchTable{table}, nil } -type BuyOrderClassSelectorStore interface { +type BuyOrderClassSelectorTable interface { Insert(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error Update(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error Save(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error @@ -245,31 +245,31 @@ func (this BuyOrderClassSelectorClassIdIndexKey) WithClassId(class_id uint64) Bu return this } -type buyOrderClassSelectorStore struct { +type buyOrderClassSelectorTable struct { table ormtable.Table } -func (this buyOrderClassSelectorStore) Insert(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { +func (this buyOrderClassSelectorTable) Insert(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { return this.table.Insert(ctx, buyOrderClassSelector) } -func (this buyOrderClassSelectorStore) Update(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { +func (this buyOrderClassSelectorTable) Update(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { return this.table.Update(ctx, buyOrderClassSelector) } -func (this buyOrderClassSelectorStore) Save(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { +func (this buyOrderClassSelectorTable) Save(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { return this.table.Save(ctx, buyOrderClassSelector) } -func (this buyOrderClassSelectorStore) Delete(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { +func (this buyOrderClassSelectorTable) Delete(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error { return this.table.Delete(ctx, buyOrderClassSelector) } -func (this buyOrderClassSelectorStore) Has(ctx context.Context, buy_order_id uint64, class_id uint64) (found bool, err error) { +func (this buyOrderClassSelectorTable) Has(ctx context.Context, buy_order_id uint64, class_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, buy_order_id, class_id) } -func (this buyOrderClassSelectorStore) Get(ctx context.Context, buy_order_id uint64, class_id uint64) (*BuyOrderClassSelector, error) { +func (this buyOrderClassSelectorTable) Get(ctx context.Context, buy_order_id uint64, class_id uint64) (*BuyOrderClassSelector, error) { var buyOrderClassSelector BuyOrderClassSelector found, err := this.table.PrimaryKey().Get(ctx, &buyOrderClassSelector, buy_order_id, class_id) if err != nil { @@ -281,37 +281,37 @@ func (this buyOrderClassSelectorStore) Get(ctx context.Context, buy_order_id uin return &buyOrderClassSelector, nil } -func (this buyOrderClassSelectorStore) List(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error) { +func (this buyOrderClassSelectorTable) List(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BuyOrderClassSelectorIterator{it}, err } -func (this buyOrderClassSelectorStore) ListRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error) { +func (this buyOrderClassSelectorTable) ListRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BuyOrderClassSelectorIterator{it}, err } -func (this buyOrderClassSelectorStore) DeleteBy(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey) error { +func (this buyOrderClassSelectorTable) DeleteBy(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this buyOrderClassSelectorStore) DeleteRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey) error { +func (this buyOrderClassSelectorTable) DeleteRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this buyOrderClassSelectorStore) doNotImplement() {} +func (this buyOrderClassSelectorTable) doNotImplement() {} -var _ BuyOrderClassSelectorStore = buyOrderClassSelectorStore{} +var _ BuyOrderClassSelectorTable = buyOrderClassSelectorTable{} -func NewBuyOrderClassSelectorStore(db ormtable.Schema) (BuyOrderClassSelectorStore, error) { +func NewBuyOrderClassSelectorTable(db ormtable.Schema) (BuyOrderClassSelectorTable, error) { table := db.GetTable(&BuyOrderClassSelector{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderClassSelector{}).ProtoReflect().Descriptor().FullName())) } - return buyOrderClassSelectorStore{table}, nil + return buyOrderClassSelectorTable{table}, nil } -type BuyOrderProjectSelectorStore interface { +type BuyOrderProjectSelectorTable interface { Insert(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error Update(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error Save(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error @@ -377,31 +377,31 @@ func (this BuyOrderProjectSelectorProjectIdIndexKey) WithProjectId(project_id ui return this } -type buyOrderProjectSelectorStore struct { +type buyOrderProjectSelectorTable struct { table ormtable.Table } -func (this buyOrderProjectSelectorStore) Insert(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { +func (this buyOrderProjectSelectorTable) Insert(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { return this.table.Insert(ctx, buyOrderProjectSelector) } -func (this buyOrderProjectSelectorStore) Update(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { +func (this buyOrderProjectSelectorTable) Update(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { return this.table.Update(ctx, buyOrderProjectSelector) } -func (this buyOrderProjectSelectorStore) Save(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { +func (this buyOrderProjectSelectorTable) Save(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { return this.table.Save(ctx, buyOrderProjectSelector) } -func (this buyOrderProjectSelectorStore) Delete(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { +func (this buyOrderProjectSelectorTable) Delete(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error { return this.table.Delete(ctx, buyOrderProjectSelector) } -func (this buyOrderProjectSelectorStore) Has(ctx context.Context, buy_order_id uint64, project_id uint64) (found bool, err error) { +func (this buyOrderProjectSelectorTable) Has(ctx context.Context, buy_order_id uint64, project_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, buy_order_id, project_id) } -func (this buyOrderProjectSelectorStore) Get(ctx context.Context, buy_order_id uint64, project_id uint64) (*BuyOrderProjectSelector, error) { +func (this buyOrderProjectSelectorTable) Get(ctx context.Context, buy_order_id uint64, project_id uint64) (*BuyOrderProjectSelector, error) { var buyOrderProjectSelector BuyOrderProjectSelector found, err := this.table.PrimaryKey().Get(ctx, &buyOrderProjectSelector, buy_order_id, project_id) if err != nil { @@ -413,37 +413,37 @@ func (this buyOrderProjectSelectorStore) Get(ctx context.Context, buy_order_id u return &buyOrderProjectSelector, nil } -func (this buyOrderProjectSelectorStore) List(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error) { +func (this buyOrderProjectSelectorTable) List(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BuyOrderProjectSelectorIterator{it}, err } -func (this buyOrderProjectSelectorStore) ListRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error) { +func (this buyOrderProjectSelectorTable) ListRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BuyOrderProjectSelectorIterator{it}, err } -func (this buyOrderProjectSelectorStore) DeleteBy(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey) error { +func (this buyOrderProjectSelectorTable) DeleteBy(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this buyOrderProjectSelectorStore) DeleteRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey) error { +func (this buyOrderProjectSelectorTable) DeleteRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this buyOrderProjectSelectorStore) doNotImplement() {} +func (this buyOrderProjectSelectorTable) doNotImplement() {} -var _ BuyOrderProjectSelectorStore = buyOrderProjectSelectorStore{} +var _ BuyOrderProjectSelectorTable = buyOrderProjectSelectorTable{} -func NewBuyOrderProjectSelectorStore(db ormtable.Schema) (BuyOrderProjectSelectorStore, error) { +func NewBuyOrderProjectSelectorTable(db ormtable.Schema) (BuyOrderProjectSelectorTable, error) { table := db.GetTable(&BuyOrderProjectSelector{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderProjectSelector{}).ProtoReflect().Descriptor().FullName())) } - return buyOrderProjectSelectorStore{table}, nil + return buyOrderProjectSelectorTable{table}, nil } -type BuyOrderBatchSelectorStore interface { +type BuyOrderBatchSelectorTable interface { Insert(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error Update(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error Save(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error @@ -509,31 +509,31 @@ func (this BuyOrderBatchSelectorBatchIdIndexKey) WithBatchId(batch_id uint64) Bu return this } -type buyOrderBatchSelectorStore struct { +type buyOrderBatchSelectorTable struct { table ormtable.Table } -func (this buyOrderBatchSelectorStore) Insert(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { +func (this buyOrderBatchSelectorTable) Insert(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { return this.table.Insert(ctx, buyOrderBatchSelector) } -func (this buyOrderBatchSelectorStore) Update(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { +func (this buyOrderBatchSelectorTable) Update(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { return this.table.Update(ctx, buyOrderBatchSelector) } -func (this buyOrderBatchSelectorStore) Save(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { +func (this buyOrderBatchSelectorTable) Save(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { return this.table.Save(ctx, buyOrderBatchSelector) } -func (this buyOrderBatchSelectorStore) Delete(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { +func (this buyOrderBatchSelectorTable) Delete(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error { return this.table.Delete(ctx, buyOrderBatchSelector) } -func (this buyOrderBatchSelectorStore) Has(ctx context.Context, buy_order_id uint64, batch_id uint64) (found bool, err error) { +func (this buyOrderBatchSelectorTable) Has(ctx context.Context, buy_order_id uint64, batch_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, buy_order_id, batch_id) } -func (this buyOrderBatchSelectorStore) Get(ctx context.Context, buy_order_id uint64, batch_id uint64) (*BuyOrderBatchSelector, error) { +func (this buyOrderBatchSelectorTable) Get(ctx context.Context, buy_order_id uint64, batch_id uint64) (*BuyOrderBatchSelector, error) { var buyOrderBatchSelector BuyOrderBatchSelector found, err := this.table.PrimaryKey().Get(ctx, &buyOrderBatchSelector, buy_order_id, batch_id) if err != nil { @@ -545,65 +545,65 @@ func (this buyOrderBatchSelectorStore) Get(ctx context.Context, buy_order_id uin return &buyOrderBatchSelector, nil } -func (this buyOrderBatchSelectorStore) List(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error) { +func (this buyOrderBatchSelectorTable) List(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BuyOrderBatchSelectorIterator{it}, err } -func (this buyOrderBatchSelectorStore) ListRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error) { +func (this buyOrderBatchSelectorTable) ListRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BuyOrderBatchSelectorIterator{it}, err } -func (this buyOrderBatchSelectorStore) DeleteBy(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey) error { +func (this buyOrderBatchSelectorTable) DeleteBy(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this buyOrderBatchSelectorStore) DeleteRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey) error { +func (this buyOrderBatchSelectorTable) DeleteRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this buyOrderBatchSelectorStore) doNotImplement() {} +func (this buyOrderBatchSelectorTable) doNotImplement() {} -var _ BuyOrderBatchSelectorStore = buyOrderBatchSelectorStore{} +var _ BuyOrderBatchSelectorTable = buyOrderBatchSelectorTable{} -func NewBuyOrderBatchSelectorStore(db ormtable.Schema) (BuyOrderBatchSelectorStore, error) { +func NewBuyOrderBatchSelectorTable(db ormtable.Schema) (BuyOrderBatchSelectorTable, error) { table := db.GetTable(&BuyOrderBatchSelector{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderBatchSelector{}).ProtoReflect().Descriptor().FullName())) } - return buyOrderBatchSelectorStore{table}, nil + return buyOrderBatchSelectorTable{table}, nil } type MemoryStore interface { - BuyOrderSellOrderMatchStore() BuyOrderSellOrderMatchStore - BuyOrderClassSelectorStore() BuyOrderClassSelectorStore - BuyOrderProjectSelectorStore() BuyOrderProjectSelectorStore - BuyOrderBatchSelectorStore() BuyOrderBatchSelectorStore + BuyOrderSellOrderMatchTable() BuyOrderSellOrderMatchTable + BuyOrderClassSelectorTable() BuyOrderClassSelectorTable + BuyOrderProjectSelectorTable() BuyOrderProjectSelectorTable + BuyOrderBatchSelectorTable() BuyOrderBatchSelectorTable doNotImplement() } type memoryStore struct { - buyOrderSellOrderMatch BuyOrderSellOrderMatchStore - buyOrderClassSelector BuyOrderClassSelectorStore - buyOrderProjectSelector BuyOrderProjectSelectorStore - buyOrderBatchSelector BuyOrderBatchSelectorStore + buyOrderSellOrderMatch BuyOrderSellOrderMatchTable + buyOrderClassSelector BuyOrderClassSelectorTable + buyOrderProjectSelector BuyOrderProjectSelectorTable + buyOrderBatchSelector BuyOrderBatchSelectorTable } -func (x memoryStore) BuyOrderSellOrderMatchStore() BuyOrderSellOrderMatchStore { +func (x memoryStore) BuyOrderSellOrderMatchTable() BuyOrderSellOrderMatchTable { return x.buyOrderSellOrderMatch } -func (x memoryStore) BuyOrderClassSelectorStore() BuyOrderClassSelectorStore { +func (x memoryStore) BuyOrderClassSelectorTable() BuyOrderClassSelectorTable { return x.buyOrderClassSelector } -func (x memoryStore) BuyOrderProjectSelectorStore() BuyOrderProjectSelectorStore { +func (x memoryStore) BuyOrderProjectSelectorTable() BuyOrderProjectSelectorTable { return x.buyOrderProjectSelector } -func (x memoryStore) BuyOrderBatchSelectorStore() BuyOrderBatchSelectorStore { +func (x memoryStore) BuyOrderBatchSelectorTable() BuyOrderBatchSelectorTable { return x.buyOrderBatchSelector } @@ -612,30 +612,30 @@ func (memoryStore) doNotImplement() {} var _ MemoryStore = memoryStore{} func NewMemoryStore(db ormtable.Schema) (MemoryStore, error) { - buyOrderSellOrderMatchStore, err := NewBuyOrderSellOrderMatchStore(db) + buyOrderSellOrderMatchTable, err := NewBuyOrderSellOrderMatchTable(db) if err != nil { return nil, err } - buyOrderClassSelectorStore, err := NewBuyOrderClassSelectorStore(db) + buyOrderClassSelectorTable, err := NewBuyOrderClassSelectorTable(db) if err != nil { return nil, err } - buyOrderProjectSelectorStore, err := NewBuyOrderProjectSelectorStore(db) + buyOrderProjectSelectorTable, err := NewBuyOrderProjectSelectorTable(db) if err != nil { return nil, err } - buyOrderBatchSelectorStore, err := NewBuyOrderBatchSelectorStore(db) + buyOrderBatchSelectorTable, err := NewBuyOrderBatchSelectorTable(db) if err != nil { return nil, err } return memoryStore{ - buyOrderSellOrderMatchStore, - buyOrderClassSelectorStore, - buyOrderProjectSelectorStore, - buyOrderBatchSelectorStore, + buyOrderSellOrderMatchTable, + buyOrderClassSelectorTable, + buyOrderProjectSelectorTable, + buyOrderBatchSelectorTable, }, nil } diff --git a/api/regen/ecocredit/v1/state.cosmos_orm.go b/api/regen/ecocredit/v1/state.cosmos_orm.go index a4d0e6af77..8181ffaaae 100644 --- a/api/regen/ecocredit/v1/state.cosmos_orm.go +++ b/api/regen/ecocredit/v1/state.cosmos_orm.go @@ -10,7 +10,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) -type CreditTypeStore interface { +type CreditTypeTable interface { Insert(ctx context.Context, creditType *CreditType) error Update(ctx context.Context, creditType *CreditType) error Save(ctx context.Context, creditType *CreditType) error @@ -74,31 +74,31 @@ func (this CreditTypeNameIndexKey) WithName(name string) CreditTypeNameIndexKey return this } -type creditTypeStore struct { +type creditTypeTable struct { table ormtable.Table } -func (this creditTypeStore) Insert(ctx context.Context, creditType *CreditType) error { +func (this creditTypeTable) Insert(ctx context.Context, creditType *CreditType) error { return this.table.Insert(ctx, creditType) } -func (this creditTypeStore) Update(ctx context.Context, creditType *CreditType) error { +func (this creditTypeTable) Update(ctx context.Context, creditType *CreditType) error { return this.table.Update(ctx, creditType) } -func (this creditTypeStore) Save(ctx context.Context, creditType *CreditType) error { +func (this creditTypeTable) Save(ctx context.Context, creditType *CreditType) error { return this.table.Save(ctx, creditType) } -func (this creditTypeStore) Delete(ctx context.Context, creditType *CreditType) error { +func (this creditTypeTable) Delete(ctx context.Context, creditType *CreditType) error { return this.table.Delete(ctx, creditType) } -func (this creditTypeStore) Has(ctx context.Context, abbreviation string) (found bool, err error) { +func (this creditTypeTable) Has(ctx context.Context, abbreviation string) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, abbreviation) } -func (this creditTypeStore) Get(ctx context.Context, abbreviation string) (*CreditType, error) { +func (this creditTypeTable) Get(ctx context.Context, abbreviation string) (*CreditType, error) { var creditType CreditType found, err := this.table.PrimaryKey().Get(ctx, &creditType, abbreviation) if err != nil { @@ -110,13 +110,13 @@ func (this creditTypeStore) Get(ctx context.Context, abbreviation string) (*Cred return &creditType, nil } -func (this creditTypeStore) HasByName(ctx context.Context, name string) (found bool, err error) { +func (this creditTypeTable) HasByName(ctx context.Context, name string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, name, ) } -func (this creditTypeStore) GetByName(ctx context.Context, name string) (*CreditType, error) { +func (this creditTypeTable) GetByName(ctx context.Context, name string) (*CreditType, error) { var creditType CreditType found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &creditType, name, @@ -130,37 +130,37 @@ func (this creditTypeStore) GetByName(ctx context.Context, name string) (*Credit return &creditType, nil } -func (this creditTypeStore) List(ctx context.Context, prefixKey CreditTypeIndexKey, opts ...ormlist.Option) (CreditTypeIterator, error) { +func (this creditTypeTable) List(ctx context.Context, prefixKey CreditTypeIndexKey, opts ...ormlist.Option) (CreditTypeIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return CreditTypeIterator{it}, err } -func (this creditTypeStore) ListRange(ctx context.Context, from, to CreditTypeIndexKey, opts ...ormlist.Option) (CreditTypeIterator, error) { +func (this creditTypeTable) ListRange(ctx context.Context, from, to CreditTypeIndexKey, opts ...ormlist.Option) (CreditTypeIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return CreditTypeIterator{it}, err } -func (this creditTypeStore) DeleteBy(ctx context.Context, prefixKey CreditTypeIndexKey) error { +func (this creditTypeTable) DeleteBy(ctx context.Context, prefixKey CreditTypeIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this creditTypeStore) DeleteRange(ctx context.Context, from, to CreditTypeIndexKey) error { +func (this creditTypeTable) DeleteRange(ctx context.Context, from, to CreditTypeIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this creditTypeStore) doNotImplement() {} +func (this creditTypeTable) doNotImplement() {} -var _ CreditTypeStore = creditTypeStore{} +var _ CreditTypeTable = creditTypeTable{} -func NewCreditTypeStore(db ormtable.Schema) (CreditTypeStore, error) { +func NewCreditTypeTable(db ormtable.Schema) (CreditTypeTable, error) { table := db.GetTable(&CreditType{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&CreditType{}).ProtoReflect().Descriptor().FullName())) } - return creditTypeStore{table}, nil + return creditTypeTable{table}, nil } -type ClassInfoStore interface { +type ClassInfoTable interface { Insert(ctx context.Context, classInfo *ClassInfo) error InsertReturningID(ctx context.Context, classInfo *ClassInfo) (uint64, error) Update(ctx context.Context, classInfo *ClassInfo) error @@ -251,35 +251,35 @@ func (this ClassInfoCreditTypeIndexKey) WithCreditType(credit_type string) Class return this } -type classInfoStore struct { +type classInfoTable struct { table ormtable.AutoIncrementTable } -func (this classInfoStore) Insert(ctx context.Context, classInfo *ClassInfo) error { +func (this classInfoTable) Insert(ctx context.Context, classInfo *ClassInfo) error { return this.table.Insert(ctx, classInfo) } -func (this classInfoStore) Update(ctx context.Context, classInfo *ClassInfo) error { +func (this classInfoTable) Update(ctx context.Context, classInfo *ClassInfo) error { return this.table.Update(ctx, classInfo) } -func (this classInfoStore) Save(ctx context.Context, classInfo *ClassInfo) error { +func (this classInfoTable) Save(ctx context.Context, classInfo *ClassInfo) error { return this.table.Save(ctx, classInfo) } -func (this classInfoStore) Delete(ctx context.Context, classInfo *ClassInfo) error { +func (this classInfoTable) Delete(ctx context.Context, classInfo *ClassInfo) error { return this.table.Delete(ctx, classInfo) } -func (this classInfoStore) InsertReturningID(ctx context.Context, classInfo *ClassInfo) (uint64, error) { +func (this classInfoTable) InsertReturningID(ctx context.Context, classInfo *ClassInfo) (uint64, error) { return this.table.InsertReturningID(ctx, classInfo) } -func (this classInfoStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this classInfoTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this classInfoStore) Get(ctx context.Context, id uint64) (*ClassInfo, error) { +func (this classInfoTable) Get(ctx context.Context, id uint64) (*ClassInfo, error) { var classInfo ClassInfo found, err := this.table.PrimaryKey().Get(ctx, &classInfo, id) if err != nil { @@ -291,13 +291,13 @@ func (this classInfoStore) Get(ctx context.Context, id uint64) (*ClassInfo, erro return &classInfo, nil } -func (this classInfoStore) HasByName(ctx context.Context, name string) (found bool, err error) { +func (this classInfoTable) HasByName(ctx context.Context, name string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, name, ) } -func (this classInfoStore) GetByName(ctx context.Context, name string) (*ClassInfo, error) { +func (this classInfoTable) GetByName(ctx context.Context, name string) (*ClassInfo, error) { var classInfo ClassInfo found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &classInfo, name, @@ -311,37 +311,37 @@ func (this classInfoStore) GetByName(ctx context.Context, name string) (*ClassIn return &classInfo, nil } -func (this classInfoStore) List(ctx context.Context, prefixKey ClassInfoIndexKey, opts ...ormlist.Option) (ClassInfoIterator, error) { +func (this classInfoTable) List(ctx context.Context, prefixKey ClassInfoIndexKey, opts ...ormlist.Option) (ClassInfoIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return ClassInfoIterator{it}, err } -func (this classInfoStore) ListRange(ctx context.Context, from, to ClassInfoIndexKey, opts ...ormlist.Option) (ClassInfoIterator, error) { +func (this classInfoTable) ListRange(ctx context.Context, from, to ClassInfoIndexKey, opts ...ormlist.Option) (ClassInfoIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return ClassInfoIterator{it}, err } -func (this classInfoStore) DeleteBy(ctx context.Context, prefixKey ClassInfoIndexKey) error { +func (this classInfoTable) DeleteBy(ctx context.Context, prefixKey ClassInfoIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this classInfoStore) DeleteRange(ctx context.Context, from, to ClassInfoIndexKey) error { +func (this classInfoTable) DeleteRange(ctx context.Context, from, to ClassInfoIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this classInfoStore) doNotImplement() {} +func (this classInfoTable) doNotImplement() {} -var _ ClassInfoStore = classInfoStore{} +var _ ClassInfoTable = classInfoTable{} -func NewClassInfoStore(db ormtable.Schema) (ClassInfoStore, error) { +func NewClassInfoTable(db ormtable.Schema) (ClassInfoTable, error) { table := db.GetTable(&ClassInfo{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&ClassInfo{}).ProtoReflect().Descriptor().FullName())) } - return classInfoStore{table.(ormtable.AutoIncrementTable)}, nil + return classInfoTable{table.(ormtable.AutoIncrementTable)}, nil } -type ClassIssuerStore interface { +type ClassIssuerTable interface { Insert(ctx context.Context, classIssuer *ClassIssuer) error Update(ctx context.Context, classIssuer *ClassIssuer) error Save(ctx context.Context, classIssuer *ClassIssuer) error @@ -394,31 +394,31 @@ func (this ClassIssuerClassIdIssuerIndexKey) WithClassIdIssuer(class_id uint64, return this } -type classIssuerStore struct { +type classIssuerTable struct { table ormtable.Table } -func (this classIssuerStore) Insert(ctx context.Context, classIssuer *ClassIssuer) error { +func (this classIssuerTable) Insert(ctx context.Context, classIssuer *ClassIssuer) error { return this.table.Insert(ctx, classIssuer) } -func (this classIssuerStore) Update(ctx context.Context, classIssuer *ClassIssuer) error { +func (this classIssuerTable) Update(ctx context.Context, classIssuer *ClassIssuer) error { return this.table.Update(ctx, classIssuer) } -func (this classIssuerStore) Save(ctx context.Context, classIssuer *ClassIssuer) error { +func (this classIssuerTable) Save(ctx context.Context, classIssuer *ClassIssuer) error { return this.table.Save(ctx, classIssuer) } -func (this classIssuerStore) Delete(ctx context.Context, classIssuer *ClassIssuer) error { +func (this classIssuerTable) Delete(ctx context.Context, classIssuer *ClassIssuer) error { return this.table.Delete(ctx, classIssuer) } -func (this classIssuerStore) Has(ctx context.Context, class_id uint64, issuer []byte) (found bool, err error) { +func (this classIssuerTable) Has(ctx context.Context, class_id uint64, issuer []byte) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, class_id, issuer) } -func (this classIssuerStore) Get(ctx context.Context, class_id uint64, issuer []byte) (*ClassIssuer, error) { +func (this classIssuerTable) Get(ctx context.Context, class_id uint64, issuer []byte) (*ClassIssuer, error) { var classIssuer ClassIssuer found, err := this.table.PrimaryKey().Get(ctx, &classIssuer, class_id, issuer) if err != nil { @@ -430,37 +430,37 @@ func (this classIssuerStore) Get(ctx context.Context, class_id uint64, issuer [] return &classIssuer, nil } -func (this classIssuerStore) List(ctx context.Context, prefixKey ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) { +func (this classIssuerTable) List(ctx context.Context, prefixKey ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return ClassIssuerIterator{it}, err } -func (this classIssuerStore) ListRange(ctx context.Context, from, to ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) { +func (this classIssuerTable) ListRange(ctx context.Context, from, to ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return ClassIssuerIterator{it}, err } -func (this classIssuerStore) DeleteBy(ctx context.Context, prefixKey ClassIssuerIndexKey) error { +func (this classIssuerTable) DeleteBy(ctx context.Context, prefixKey ClassIssuerIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this classIssuerStore) DeleteRange(ctx context.Context, from, to ClassIssuerIndexKey) error { +func (this classIssuerTable) DeleteRange(ctx context.Context, from, to ClassIssuerIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this classIssuerStore) doNotImplement() {} +func (this classIssuerTable) doNotImplement() {} -var _ ClassIssuerStore = classIssuerStore{} +var _ ClassIssuerTable = classIssuerTable{} -func NewClassIssuerStore(db ormtable.Schema) (ClassIssuerStore, error) { +func NewClassIssuerTable(db ormtable.Schema) (ClassIssuerTable, error) { table := db.GetTable(&ClassIssuer{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&ClassIssuer{}).ProtoReflect().Descriptor().FullName())) } - return classIssuerStore{table}, nil + return classIssuerTable{table}, nil } -type ProjectInfoStore interface { +type ProjectInfoTable interface { Insert(ctx context.Context, projectInfo *ProjectInfo) error InsertReturningID(ctx context.Context, projectInfo *ProjectInfo) (uint64, error) Update(ctx context.Context, projectInfo *ProjectInfo) error @@ -546,35 +546,35 @@ func (this ProjectInfoClassIdNameIndexKey) WithClassIdName(class_id uint64, name return this } -type projectInfoStore struct { +type projectInfoTable struct { table ormtable.AutoIncrementTable } -func (this projectInfoStore) Insert(ctx context.Context, projectInfo *ProjectInfo) error { +func (this projectInfoTable) Insert(ctx context.Context, projectInfo *ProjectInfo) error { return this.table.Insert(ctx, projectInfo) } -func (this projectInfoStore) Update(ctx context.Context, projectInfo *ProjectInfo) error { +func (this projectInfoTable) Update(ctx context.Context, projectInfo *ProjectInfo) error { return this.table.Update(ctx, projectInfo) } -func (this projectInfoStore) Save(ctx context.Context, projectInfo *ProjectInfo) error { +func (this projectInfoTable) Save(ctx context.Context, projectInfo *ProjectInfo) error { return this.table.Save(ctx, projectInfo) } -func (this projectInfoStore) Delete(ctx context.Context, projectInfo *ProjectInfo) error { +func (this projectInfoTable) Delete(ctx context.Context, projectInfo *ProjectInfo) error { return this.table.Delete(ctx, projectInfo) } -func (this projectInfoStore) InsertReturningID(ctx context.Context, projectInfo *ProjectInfo) (uint64, error) { +func (this projectInfoTable) InsertReturningID(ctx context.Context, projectInfo *ProjectInfo) (uint64, error) { return this.table.InsertReturningID(ctx, projectInfo) } -func (this projectInfoStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this projectInfoTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this projectInfoStore) Get(ctx context.Context, id uint64) (*ProjectInfo, error) { +func (this projectInfoTable) Get(ctx context.Context, id uint64) (*ProjectInfo, error) { var projectInfo ProjectInfo found, err := this.table.PrimaryKey().Get(ctx, &projectInfo, id) if err != nil { @@ -586,13 +586,13 @@ func (this projectInfoStore) Get(ctx context.Context, id uint64) (*ProjectInfo, return &projectInfo, nil } -func (this projectInfoStore) HasByName(ctx context.Context, name string) (found bool, err error) { +func (this projectInfoTable) HasByName(ctx context.Context, name string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, name, ) } -func (this projectInfoStore) GetByName(ctx context.Context, name string) (*ProjectInfo, error) { +func (this projectInfoTable) GetByName(ctx context.Context, name string) (*ProjectInfo, error) { var projectInfo ProjectInfo found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &projectInfo, name, @@ -606,14 +606,14 @@ func (this projectInfoStore) GetByName(ctx context.Context, name string) (*Proje return &projectInfo, nil } -func (this projectInfoStore) HasByClassIdName(ctx context.Context, class_id uint64, name string) (found bool, err error) { +func (this projectInfoTable) HasByClassIdName(ctx context.Context, class_id uint64, name string) (found bool, err error) { return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx, class_id, name, ) } -func (this projectInfoStore) GetByClassIdName(ctx context.Context, class_id uint64, name string) (*ProjectInfo, error) { +func (this projectInfoTable) GetByClassIdName(ctx context.Context, class_id uint64, name string) (*ProjectInfo, error) { var projectInfo ProjectInfo found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &projectInfo, class_id, @@ -628,37 +628,37 @@ func (this projectInfoStore) GetByClassIdName(ctx context.Context, class_id uint return &projectInfo, nil } -func (this projectInfoStore) List(ctx context.Context, prefixKey ProjectInfoIndexKey, opts ...ormlist.Option) (ProjectInfoIterator, error) { +func (this projectInfoTable) List(ctx context.Context, prefixKey ProjectInfoIndexKey, opts ...ormlist.Option) (ProjectInfoIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return ProjectInfoIterator{it}, err } -func (this projectInfoStore) ListRange(ctx context.Context, from, to ProjectInfoIndexKey, opts ...ormlist.Option) (ProjectInfoIterator, error) { +func (this projectInfoTable) ListRange(ctx context.Context, from, to ProjectInfoIndexKey, opts ...ormlist.Option) (ProjectInfoIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return ProjectInfoIterator{it}, err } -func (this projectInfoStore) DeleteBy(ctx context.Context, prefixKey ProjectInfoIndexKey) error { +func (this projectInfoTable) DeleteBy(ctx context.Context, prefixKey ProjectInfoIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this projectInfoStore) DeleteRange(ctx context.Context, from, to ProjectInfoIndexKey) error { +func (this projectInfoTable) DeleteRange(ctx context.Context, from, to ProjectInfoIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this projectInfoStore) doNotImplement() {} +func (this projectInfoTable) doNotImplement() {} -var _ ProjectInfoStore = projectInfoStore{} +var _ ProjectInfoTable = projectInfoTable{} -func NewProjectInfoStore(db ormtable.Schema) (ProjectInfoStore, error) { +func NewProjectInfoTable(db ormtable.Schema) (ProjectInfoTable, error) { table := db.GetTable(&ProjectInfo{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&ProjectInfo{}).ProtoReflect().Descriptor().FullName())) } - return projectInfoStore{table.(ormtable.AutoIncrementTable)}, nil + return projectInfoTable{table.(ormtable.AutoIncrementTable)}, nil } -type BatchInfoStore interface { +type BatchInfoTable interface { Insert(ctx context.Context, batchInfo *BatchInfo) error InsertReturningID(ctx context.Context, batchInfo *BatchInfo) (uint64, error) Update(ctx context.Context, batchInfo *BatchInfo) error @@ -749,35 +749,35 @@ func (this BatchInfoStartDateIndexKey) WithStartDate(start_date *timestamppb.Tim return this } -type batchInfoStore struct { +type batchInfoTable struct { table ormtable.AutoIncrementTable } -func (this batchInfoStore) Insert(ctx context.Context, batchInfo *BatchInfo) error { +func (this batchInfoTable) Insert(ctx context.Context, batchInfo *BatchInfo) error { return this.table.Insert(ctx, batchInfo) } -func (this batchInfoStore) Update(ctx context.Context, batchInfo *BatchInfo) error { +func (this batchInfoTable) Update(ctx context.Context, batchInfo *BatchInfo) error { return this.table.Update(ctx, batchInfo) } -func (this batchInfoStore) Save(ctx context.Context, batchInfo *BatchInfo) error { +func (this batchInfoTable) Save(ctx context.Context, batchInfo *BatchInfo) error { return this.table.Save(ctx, batchInfo) } -func (this batchInfoStore) Delete(ctx context.Context, batchInfo *BatchInfo) error { +func (this batchInfoTable) Delete(ctx context.Context, batchInfo *BatchInfo) error { return this.table.Delete(ctx, batchInfo) } -func (this batchInfoStore) InsertReturningID(ctx context.Context, batchInfo *BatchInfo) (uint64, error) { +func (this batchInfoTable) InsertReturningID(ctx context.Context, batchInfo *BatchInfo) (uint64, error) { return this.table.InsertReturningID(ctx, batchInfo) } -func (this batchInfoStore) Has(ctx context.Context, id uint64) (found bool, err error) { +func (this batchInfoTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } -func (this batchInfoStore) Get(ctx context.Context, id uint64) (*BatchInfo, error) { +func (this batchInfoTable) Get(ctx context.Context, id uint64) (*BatchInfo, error) { var batchInfo BatchInfo found, err := this.table.PrimaryKey().Get(ctx, &batchInfo, id) if err != nil { @@ -789,13 +789,13 @@ func (this batchInfoStore) Get(ctx context.Context, id uint64) (*BatchInfo, erro return &batchInfo, nil } -func (this batchInfoStore) HasByBatchDenom(ctx context.Context, batch_denom string) (found bool, err error) { +func (this batchInfoTable) HasByBatchDenom(ctx context.Context, batch_denom string) (found bool, err error) { return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, batch_denom, ) } -func (this batchInfoStore) GetByBatchDenom(ctx context.Context, batch_denom string) (*BatchInfo, error) { +func (this batchInfoTable) GetByBatchDenom(ctx context.Context, batch_denom string) (*BatchInfo, error) { var batchInfo BatchInfo found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &batchInfo, batch_denom, @@ -809,37 +809,37 @@ func (this batchInfoStore) GetByBatchDenom(ctx context.Context, batch_denom stri return &batchInfo, nil } -func (this batchInfoStore) List(ctx context.Context, prefixKey BatchInfoIndexKey, opts ...ormlist.Option) (BatchInfoIterator, error) { +func (this batchInfoTable) List(ctx context.Context, prefixKey BatchInfoIndexKey, opts ...ormlist.Option) (BatchInfoIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BatchInfoIterator{it}, err } -func (this batchInfoStore) ListRange(ctx context.Context, from, to BatchInfoIndexKey, opts ...ormlist.Option) (BatchInfoIterator, error) { +func (this batchInfoTable) ListRange(ctx context.Context, from, to BatchInfoIndexKey, opts ...ormlist.Option) (BatchInfoIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BatchInfoIterator{it}, err } -func (this batchInfoStore) DeleteBy(ctx context.Context, prefixKey BatchInfoIndexKey) error { +func (this batchInfoTable) DeleteBy(ctx context.Context, prefixKey BatchInfoIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this batchInfoStore) DeleteRange(ctx context.Context, from, to BatchInfoIndexKey) error { +func (this batchInfoTable) DeleteRange(ctx context.Context, from, to BatchInfoIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this batchInfoStore) doNotImplement() {} +func (this batchInfoTable) doNotImplement() {} -var _ BatchInfoStore = batchInfoStore{} +var _ BatchInfoTable = batchInfoTable{} -func NewBatchInfoStore(db ormtable.Schema) (BatchInfoStore, error) { +func NewBatchInfoTable(db ormtable.Schema) (BatchInfoTable, error) { table := db.GetTable(&BatchInfo{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BatchInfo{}).ProtoReflect().Descriptor().FullName())) } - return batchInfoStore{table.(ormtable.AutoIncrementTable)}, nil + return batchInfoTable{table.(ormtable.AutoIncrementTable)}, nil } -type ClassSequenceStore interface { +type ClassSequenceTable interface { Insert(ctx context.Context, classSequence *ClassSequence) error Update(ctx context.Context, classSequence *ClassSequence) error Save(ctx context.Context, classSequence *ClassSequence) error @@ -887,31 +887,31 @@ func (this ClassSequenceCreditTypeIndexKey) WithCreditType(credit_type string) C return this } -type classSequenceStore struct { +type classSequenceTable struct { table ormtable.Table } -func (this classSequenceStore) Insert(ctx context.Context, classSequence *ClassSequence) error { +func (this classSequenceTable) Insert(ctx context.Context, classSequence *ClassSequence) error { return this.table.Insert(ctx, classSequence) } -func (this classSequenceStore) Update(ctx context.Context, classSequence *ClassSequence) error { +func (this classSequenceTable) Update(ctx context.Context, classSequence *ClassSequence) error { return this.table.Update(ctx, classSequence) } -func (this classSequenceStore) Save(ctx context.Context, classSequence *ClassSequence) error { +func (this classSequenceTable) Save(ctx context.Context, classSequence *ClassSequence) error { return this.table.Save(ctx, classSequence) } -func (this classSequenceStore) Delete(ctx context.Context, classSequence *ClassSequence) error { +func (this classSequenceTable) Delete(ctx context.Context, classSequence *ClassSequence) error { return this.table.Delete(ctx, classSequence) } -func (this classSequenceStore) Has(ctx context.Context, credit_type string) (found bool, err error) { +func (this classSequenceTable) Has(ctx context.Context, credit_type string) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, credit_type) } -func (this classSequenceStore) Get(ctx context.Context, credit_type string) (*ClassSequence, error) { +func (this classSequenceTable) Get(ctx context.Context, credit_type string) (*ClassSequence, error) { var classSequence ClassSequence found, err := this.table.PrimaryKey().Get(ctx, &classSequence, credit_type) if err != nil { @@ -923,37 +923,37 @@ func (this classSequenceStore) Get(ctx context.Context, credit_type string) (*Cl return &classSequence, nil } -func (this classSequenceStore) List(ctx context.Context, prefixKey ClassSequenceIndexKey, opts ...ormlist.Option) (ClassSequenceIterator, error) { +func (this classSequenceTable) List(ctx context.Context, prefixKey ClassSequenceIndexKey, opts ...ormlist.Option) (ClassSequenceIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return ClassSequenceIterator{it}, err } -func (this classSequenceStore) ListRange(ctx context.Context, from, to ClassSequenceIndexKey, opts ...ormlist.Option) (ClassSequenceIterator, error) { +func (this classSequenceTable) ListRange(ctx context.Context, from, to ClassSequenceIndexKey, opts ...ormlist.Option) (ClassSequenceIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return ClassSequenceIterator{it}, err } -func (this classSequenceStore) DeleteBy(ctx context.Context, prefixKey ClassSequenceIndexKey) error { +func (this classSequenceTable) DeleteBy(ctx context.Context, prefixKey ClassSequenceIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this classSequenceStore) DeleteRange(ctx context.Context, from, to ClassSequenceIndexKey) error { +func (this classSequenceTable) DeleteRange(ctx context.Context, from, to ClassSequenceIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this classSequenceStore) doNotImplement() {} +func (this classSequenceTable) doNotImplement() {} -var _ ClassSequenceStore = classSequenceStore{} +var _ ClassSequenceTable = classSequenceTable{} -func NewClassSequenceStore(db ormtable.Schema) (ClassSequenceStore, error) { +func NewClassSequenceTable(db ormtable.Schema) (ClassSequenceTable, error) { table := db.GetTable(&ClassSequence{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&ClassSequence{}).ProtoReflect().Descriptor().FullName())) } - return classSequenceStore{table}, nil + return classSequenceTable{table}, nil } -type ProjectSequenceStore interface { +type ProjectSequenceTable interface { Insert(ctx context.Context, projectSequence *ProjectSequence) error Update(ctx context.Context, projectSequence *ProjectSequence) error Save(ctx context.Context, projectSequence *ProjectSequence) error @@ -1001,31 +1001,31 @@ func (this ProjectSequenceClassIdIndexKey) WithClassId(class_id uint64) ProjectS return this } -type projectSequenceStore struct { +type projectSequenceTable struct { table ormtable.Table } -func (this projectSequenceStore) Insert(ctx context.Context, projectSequence *ProjectSequence) error { +func (this projectSequenceTable) Insert(ctx context.Context, projectSequence *ProjectSequence) error { return this.table.Insert(ctx, projectSequence) } -func (this projectSequenceStore) Update(ctx context.Context, projectSequence *ProjectSequence) error { +func (this projectSequenceTable) Update(ctx context.Context, projectSequence *ProjectSequence) error { return this.table.Update(ctx, projectSequence) } -func (this projectSequenceStore) Save(ctx context.Context, projectSequence *ProjectSequence) error { +func (this projectSequenceTable) Save(ctx context.Context, projectSequence *ProjectSequence) error { return this.table.Save(ctx, projectSequence) } -func (this projectSequenceStore) Delete(ctx context.Context, projectSequence *ProjectSequence) error { +func (this projectSequenceTable) Delete(ctx context.Context, projectSequence *ProjectSequence) error { return this.table.Delete(ctx, projectSequence) } -func (this projectSequenceStore) Has(ctx context.Context, class_id uint64) (found bool, err error) { +func (this projectSequenceTable) Has(ctx context.Context, class_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, class_id) } -func (this projectSequenceStore) Get(ctx context.Context, class_id uint64) (*ProjectSequence, error) { +func (this projectSequenceTable) Get(ctx context.Context, class_id uint64) (*ProjectSequence, error) { var projectSequence ProjectSequence found, err := this.table.PrimaryKey().Get(ctx, &projectSequence, class_id) if err != nil { @@ -1037,37 +1037,37 @@ func (this projectSequenceStore) Get(ctx context.Context, class_id uint64) (*Pro return &projectSequence, nil } -func (this projectSequenceStore) List(ctx context.Context, prefixKey ProjectSequenceIndexKey, opts ...ormlist.Option) (ProjectSequenceIterator, error) { +func (this projectSequenceTable) List(ctx context.Context, prefixKey ProjectSequenceIndexKey, opts ...ormlist.Option) (ProjectSequenceIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return ProjectSequenceIterator{it}, err } -func (this projectSequenceStore) ListRange(ctx context.Context, from, to ProjectSequenceIndexKey, opts ...ormlist.Option) (ProjectSequenceIterator, error) { +func (this projectSequenceTable) ListRange(ctx context.Context, from, to ProjectSequenceIndexKey, opts ...ormlist.Option) (ProjectSequenceIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return ProjectSequenceIterator{it}, err } -func (this projectSequenceStore) DeleteBy(ctx context.Context, prefixKey ProjectSequenceIndexKey) error { +func (this projectSequenceTable) DeleteBy(ctx context.Context, prefixKey ProjectSequenceIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this projectSequenceStore) DeleteRange(ctx context.Context, from, to ProjectSequenceIndexKey) error { +func (this projectSequenceTable) DeleteRange(ctx context.Context, from, to ProjectSequenceIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this projectSequenceStore) doNotImplement() {} +func (this projectSequenceTable) doNotImplement() {} -var _ ProjectSequenceStore = projectSequenceStore{} +var _ ProjectSequenceTable = projectSequenceTable{} -func NewProjectSequenceStore(db ormtable.Schema) (ProjectSequenceStore, error) { +func NewProjectSequenceTable(db ormtable.Schema) (ProjectSequenceTable, error) { table := db.GetTable(&ProjectSequence{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&ProjectSequence{}).ProtoReflect().Descriptor().FullName())) } - return projectSequenceStore{table}, nil + return projectSequenceTable{table}, nil } -type BatchSequenceStore interface { +type BatchSequenceTable interface { Insert(ctx context.Context, batchSequence *BatchSequence) error Update(ctx context.Context, batchSequence *BatchSequence) error Save(ctx context.Context, batchSequence *BatchSequence) error @@ -1115,31 +1115,31 @@ func (this BatchSequenceProjectIdIndexKey) WithProjectId(project_id string) Batc return this } -type batchSequenceStore struct { +type batchSequenceTable struct { table ormtable.Table } -func (this batchSequenceStore) Insert(ctx context.Context, batchSequence *BatchSequence) error { +func (this batchSequenceTable) Insert(ctx context.Context, batchSequence *BatchSequence) error { return this.table.Insert(ctx, batchSequence) } -func (this batchSequenceStore) Update(ctx context.Context, batchSequence *BatchSequence) error { +func (this batchSequenceTable) Update(ctx context.Context, batchSequence *BatchSequence) error { return this.table.Update(ctx, batchSequence) } -func (this batchSequenceStore) Save(ctx context.Context, batchSequence *BatchSequence) error { +func (this batchSequenceTable) Save(ctx context.Context, batchSequence *BatchSequence) error { return this.table.Save(ctx, batchSequence) } -func (this batchSequenceStore) Delete(ctx context.Context, batchSequence *BatchSequence) error { +func (this batchSequenceTable) Delete(ctx context.Context, batchSequence *BatchSequence) error { return this.table.Delete(ctx, batchSequence) } -func (this batchSequenceStore) Has(ctx context.Context, project_id string) (found bool, err error) { +func (this batchSequenceTable) Has(ctx context.Context, project_id string) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, project_id) } -func (this batchSequenceStore) Get(ctx context.Context, project_id string) (*BatchSequence, error) { +func (this batchSequenceTable) Get(ctx context.Context, project_id string) (*BatchSequence, error) { var batchSequence BatchSequence found, err := this.table.PrimaryKey().Get(ctx, &batchSequence, project_id) if err != nil { @@ -1151,37 +1151,37 @@ func (this batchSequenceStore) Get(ctx context.Context, project_id string) (*Bat return &batchSequence, nil } -func (this batchSequenceStore) List(ctx context.Context, prefixKey BatchSequenceIndexKey, opts ...ormlist.Option) (BatchSequenceIterator, error) { +func (this batchSequenceTable) List(ctx context.Context, prefixKey BatchSequenceIndexKey, opts ...ormlist.Option) (BatchSequenceIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BatchSequenceIterator{it}, err } -func (this batchSequenceStore) ListRange(ctx context.Context, from, to BatchSequenceIndexKey, opts ...ormlist.Option) (BatchSequenceIterator, error) { +func (this batchSequenceTable) ListRange(ctx context.Context, from, to BatchSequenceIndexKey, opts ...ormlist.Option) (BatchSequenceIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BatchSequenceIterator{it}, err } -func (this batchSequenceStore) DeleteBy(ctx context.Context, prefixKey BatchSequenceIndexKey) error { +func (this batchSequenceTable) DeleteBy(ctx context.Context, prefixKey BatchSequenceIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this batchSequenceStore) DeleteRange(ctx context.Context, from, to BatchSequenceIndexKey) error { +func (this batchSequenceTable) DeleteRange(ctx context.Context, from, to BatchSequenceIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this batchSequenceStore) doNotImplement() {} +func (this batchSequenceTable) doNotImplement() {} -var _ BatchSequenceStore = batchSequenceStore{} +var _ BatchSequenceTable = batchSequenceTable{} -func NewBatchSequenceStore(db ormtable.Schema) (BatchSequenceStore, error) { +func NewBatchSequenceTable(db ormtable.Schema) (BatchSequenceTable, error) { table := db.GetTable(&BatchSequence{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BatchSequence{}).ProtoReflect().Descriptor().FullName())) } - return batchSequenceStore{table}, nil + return batchSequenceTable{table}, nil } -type BatchBalanceStore interface { +type BatchBalanceTable interface { Insert(ctx context.Context, batchBalance *BatchBalance) error Update(ctx context.Context, batchBalance *BatchBalance) error Save(ctx context.Context, batchBalance *BatchBalance) error @@ -1252,31 +1252,31 @@ func (this BatchBalanceBatchIdAddressIndexKey) WithBatchIdAddress(batch_id uint6 return this } -type batchBalanceStore struct { +type batchBalanceTable struct { table ormtable.Table } -func (this batchBalanceStore) Insert(ctx context.Context, batchBalance *BatchBalance) error { +func (this batchBalanceTable) Insert(ctx context.Context, batchBalance *BatchBalance) error { return this.table.Insert(ctx, batchBalance) } -func (this batchBalanceStore) Update(ctx context.Context, batchBalance *BatchBalance) error { +func (this batchBalanceTable) Update(ctx context.Context, batchBalance *BatchBalance) error { return this.table.Update(ctx, batchBalance) } -func (this batchBalanceStore) Save(ctx context.Context, batchBalance *BatchBalance) error { +func (this batchBalanceTable) Save(ctx context.Context, batchBalance *BatchBalance) error { return this.table.Save(ctx, batchBalance) } -func (this batchBalanceStore) Delete(ctx context.Context, batchBalance *BatchBalance) error { +func (this batchBalanceTable) Delete(ctx context.Context, batchBalance *BatchBalance) error { return this.table.Delete(ctx, batchBalance) } -func (this batchBalanceStore) Has(ctx context.Context, address []byte, batch_id uint64) (found bool, err error) { +func (this batchBalanceTable) Has(ctx context.Context, address []byte, batch_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, address, batch_id) } -func (this batchBalanceStore) Get(ctx context.Context, address []byte, batch_id uint64) (*BatchBalance, error) { +func (this batchBalanceTable) Get(ctx context.Context, address []byte, batch_id uint64) (*BatchBalance, error) { var batchBalance BatchBalance found, err := this.table.PrimaryKey().Get(ctx, &batchBalance, address, batch_id) if err != nil { @@ -1288,37 +1288,37 @@ func (this batchBalanceStore) Get(ctx context.Context, address []byte, batch_id return &batchBalance, nil } -func (this batchBalanceStore) List(ctx context.Context, prefixKey BatchBalanceIndexKey, opts ...ormlist.Option) (BatchBalanceIterator, error) { +func (this batchBalanceTable) List(ctx context.Context, prefixKey BatchBalanceIndexKey, opts ...ormlist.Option) (BatchBalanceIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BatchBalanceIterator{it}, err } -func (this batchBalanceStore) ListRange(ctx context.Context, from, to BatchBalanceIndexKey, opts ...ormlist.Option) (BatchBalanceIterator, error) { +func (this batchBalanceTable) ListRange(ctx context.Context, from, to BatchBalanceIndexKey, opts ...ormlist.Option) (BatchBalanceIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BatchBalanceIterator{it}, err } -func (this batchBalanceStore) DeleteBy(ctx context.Context, prefixKey BatchBalanceIndexKey) error { +func (this batchBalanceTable) DeleteBy(ctx context.Context, prefixKey BatchBalanceIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this batchBalanceStore) DeleteRange(ctx context.Context, from, to BatchBalanceIndexKey) error { +func (this batchBalanceTable) DeleteRange(ctx context.Context, from, to BatchBalanceIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this batchBalanceStore) doNotImplement() {} +func (this batchBalanceTable) doNotImplement() {} -var _ BatchBalanceStore = batchBalanceStore{} +var _ BatchBalanceTable = batchBalanceTable{} -func NewBatchBalanceStore(db ormtable.Schema) (BatchBalanceStore, error) { +func NewBatchBalanceTable(db ormtable.Schema) (BatchBalanceTable, error) { table := db.GetTable(&BatchBalance{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BatchBalance{}).ProtoReflect().Descriptor().FullName())) } - return batchBalanceStore{table}, nil + return batchBalanceTable{table}, nil } -type BatchSupplyStore interface { +type BatchSupplyTable interface { Insert(ctx context.Context, batchSupply *BatchSupply) error Update(ctx context.Context, batchSupply *BatchSupply) error Save(ctx context.Context, batchSupply *BatchSupply) error @@ -1366,31 +1366,31 @@ func (this BatchSupplyBatchIdIndexKey) WithBatchId(batch_id uint64) BatchSupplyB return this } -type batchSupplyStore struct { +type batchSupplyTable struct { table ormtable.Table } -func (this batchSupplyStore) Insert(ctx context.Context, batchSupply *BatchSupply) error { +func (this batchSupplyTable) Insert(ctx context.Context, batchSupply *BatchSupply) error { return this.table.Insert(ctx, batchSupply) } -func (this batchSupplyStore) Update(ctx context.Context, batchSupply *BatchSupply) error { +func (this batchSupplyTable) Update(ctx context.Context, batchSupply *BatchSupply) error { return this.table.Update(ctx, batchSupply) } -func (this batchSupplyStore) Save(ctx context.Context, batchSupply *BatchSupply) error { +func (this batchSupplyTable) Save(ctx context.Context, batchSupply *BatchSupply) error { return this.table.Save(ctx, batchSupply) } -func (this batchSupplyStore) Delete(ctx context.Context, batchSupply *BatchSupply) error { +func (this batchSupplyTable) Delete(ctx context.Context, batchSupply *BatchSupply) error { return this.table.Delete(ctx, batchSupply) } -func (this batchSupplyStore) Has(ctx context.Context, batch_id uint64) (found bool, err error) { +func (this batchSupplyTable) Has(ctx context.Context, batch_id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, batch_id) } -func (this batchSupplyStore) Get(ctx context.Context, batch_id uint64) (*BatchSupply, error) { +func (this batchSupplyTable) Get(ctx context.Context, batch_id uint64) (*BatchSupply, error) { var batchSupply BatchSupply found, err := this.table.PrimaryKey().Get(ctx, &batchSupply, batch_id) if err != nil { @@ -1402,101 +1402,101 @@ func (this batchSupplyStore) Get(ctx context.Context, batch_id uint64) (*BatchSu return &batchSupply, nil } -func (this batchSupplyStore) List(ctx context.Context, prefixKey BatchSupplyIndexKey, opts ...ormlist.Option) (BatchSupplyIterator, error) { +func (this batchSupplyTable) List(ctx context.Context, prefixKey BatchSupplyIndexKey, opts ...ormlist.Option) (BatchSupplyIterator, error) { it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) return BatchSupplyIterator{it}, err } -func (this batchSupplyStore) ListRange(ctx context.Context, from, to BatchSupplyIndexKey, opts ...ormlist.Option) (BatchSupplyIterator, error) { +func (this batchSupplyTable) ListRange(ctx context.Context, from, to BatchSupplyIndexKey, opts ...ormlist.Option) (BatchSupplyIterator, error) { it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) return BatchSupplyIterator{it}, err } -func (this batchSupplyStore) DeleteBy(ctx context.Context, prefixKey BatchSupplyIndexKey) error { +func (this batchSupplyTable) DeleteBy(ctx context.Context, prefixKey BatchSupplyIndexKey) error { return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) } -func (this batchSupplyStore) DeleteRange(ctx context.Context, from, to BatchSupplyIndexKey) error { +func (this batchSupplyTable) DeleteRange(ctx context.Context, from, to BatchSupplyIndexKey) error { return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) } -func (this batchSupplyStore) doNotImplement() {} +func (this batchSupplyTable) doNotImplement() {} -var _ BatchSupplyStore = batchSupplyStore{} +var _ BatchSupplyTable = batchSupplyTable{} -func NewBatchSupplyStore(db ormtable.Schema) (BatchSupplyStore, error) { +func NewBatchSupplyTable(db ormtable.Schema) (BatchSupplyTable, error) { table := db.GetTable(&BatchSupply{}) if table == nil { return nil, ormerrors.TableNotFound.Wrap(string((&BatchSupply{}).ProtoReflect().Descriptor().FullName())) } - return batchSupplyStore{table}, nil + return batchSupplyTable{table}, nil } type StateStore interface { - CreditTypeStore() CreditTypeStore - ClassInfoStore() ClassInfoStore - ClassIssuerStore() ClassIssuerStore - ProjectInfoStore() ProjectInfoStore - BatchInfoStore() BatchInfoStore - ClassSequenceStore() ClassSequenceStore - ProjectSequenceStore() ProjectSequenceStore - BatchSequenceStore() BatchSequenceStore - BatchBalanceStore() BatchBalanceStore - BatchSupplyStore() BatchSupplyStore + CreditTypeTable() CreditTypeTable + ClassInfoTable() ClassInfoTable + ClassIssuerTable() ClassIssuerTable + ProjectInfoTable() ProjectInfoTable + BatchInfoTable() BatchInfoTable + ClassSequenceTable() ClassSequenceTable + ProjectSequenceTable() ProjectSequenceTable + BatchSequenceTable() BatchSequenceTable + BatchBalanceTable() BatchBalanceTable + BatchSupplyTable() BatchSupplyTable doNotImplement() } type stateStore struct { - creditType CreditTypeStore - classInfo ClassInfoStore - classIssuer ClassIssuerStore - projectInfo ProjectInfoStore - batchInfo BatchInfoStore - classSequence ClassSequenceStore - projectSequence ProjectSequenceStore - batchSequence BatchSequenceStore - batchBalance BatchBalanceStore - batchSupply BatchSupplyStore -} - -func (x stateStore) CreditTypeStore() CreditTypeStore { + creditType CreditTypeTable + classInfo ClassInfoTable + classIssuer ClassIssuerTable + projectInfo ProjectInfoTable + batchInfo BatchInfoTable + classSequence ClassSequenceTable + projectSequence ProjectSequenceTable + batchSequence BatchSequenceTable + batchBalance BatchBalanceTable + batchSupply BatchSupplyTable +} + +func (x stateStore) CreditTypeTable() CreditTypeTable { return x.creditType } -func (x stateStore) ClassInfoStore() ClassInfoStore { +func (x stateStore) ClassInfoTable() ClassInfoTable { return x.classInfo } -func (x stateStore) ClassIssuerStore() ClassIssuerStore { +func (x stateStore) ClassIssuerTable() ClassIssuerTable { return x.classIssuer } -func (x stateStore) ProjectInfoStore() ProjectInfoStore { +func (x stateStore) ProjectInfoTable() ProjectInfoTable { return x.projectInfo } -func (x stateStore) BatchInfoStore() BatchInfoStore { +func (x stateStore) BatchInfoTable() BatchInfoTable { return x.batchInfo } -func (x stateStore) ClassSequenceStore() ClassSequenceStore { +func (x stateStore) ClassSequenceTable() ClassSequenceTable { return x.classSequence } -func (x stateStore) ProjectSequenceStore() ProjectSequenceStore { +func (x stateStore) ProjectSequenceTable() ProjectSequenceTable { return x.projectSequence } -func (x stateStore) BatchSequenceStore() BatchSequenceStore { +func (x stateStore) BatchSequenceTable() BatchSequenceTable { return x.batchSequence } -func (x stateStore) BatchBalanceStore() BatchBalanceStore { +func (x stateStore) BatchBalanceTable() BatchBalanceTable { return x.batchBalance } -func (x stateStore) BatchSupplyStore() BatchSupplyStore { +func (x stateStore) BatchSupplyTable() BatchSupplyTable { return x.batchSupply } @@ -1505,66 +1505,66 @@ func (stateStore) doNotImplement() {} var _ StateStore = stateStore{} func NewStateStore(db ormtable.Schema) (StateStore, error) { - creditTypeStore, err := NewCreditTypeStore(db) + creditTypeTable, err := NewCreditTypeTable(db) if err != nil { return nil, err } - classInfoStore, err := NewClassInfoStore(db) + classInfoTable, err := NewClassInfoTable(db) if err != nil { return nil, err } - classIssuerStore, err := NewClassIssuerStore(db) + classIssuerTable, err := NewClassIssuerTable(db) if err != nil { return nil, err } - projectInfoStore, err := NewProjectInfoStore(db) + projectInfoTable, err := NewProjectInfoTable(db) if err != nil { return nil, err } - batchInfoStore, err := NewBatchInfoStore(db) + batchInfoTable, err := NewBatchInfoTable(db) if err != nil { return nil, err } - classSequenceStore, err := NewClassSequenceStore(db) + classSequenceTable, err := NewClassSequenceTable(db) if err != nil { return nil, err } - projectSequenceStore, err := NewProjectSequenceStore(db) + projectSequenceTable, err := NewProjectSequenceTable(db) if err != nil { return nil, err } - batchSequenceStore, err := NewBatchSequenceStore(db) + batchSequenceTable, err := NewBatchSequenceTable(db) if err != nil { return nil, err } - batchBalanceStore, err := NewBatchBalanceStore(db) + batchBalanceTable, err := NewBatchBalanceTable(db) if err != nil { return nil, err } - batchSupplyStore, err := NewBatchSupplyStore(db) + batchSupplyTable, err := NewBatchSupplyTable(db) if err != nil { return nil, err } return stateStore{ - creditTypeStore, - classInfoStore, - classIssuerStore, - projectInfoStore, - batchInfoStore, - classSequenceStore, - projectSequenceStore, - batchSequenceStore, - batchBalanceStore, - batchSupplyStore, + creditTypeTable, + classInfoTable, + classIssuerTable, + projectInfoTable, + batchInfoTable, + classSequenceTable, + projectSequenceTable, + batchSequenceTable, + batchBalanceTable, + batchSupplyTable, }, nil } diff --git a/go.mod b/go.mod index 3217368841..1dc123bb51 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.15 - github.com/tendermint/tm-db v0.6.6 + github.com/tendermint/tm-db v0.6.7 golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf // indirect ) @@ -43,9 +43,10 @@ require ( github.com/cosmos/btcutil v1.0.4 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 // indirect - github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect - github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.17.3 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect @@ -116,7 +117,6 @@ require ( github.com/spf13/viper v1.10.1 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -139,8 +139,6 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2 replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -replace github.com/tecbot/gorocksdb => github.com/cosmos/gorocksdb v1.2.0 - replace github.com/cosmos/cosmos-sdk => github.com/regen-network/cosmos-sdk v0.45.0-regen-1 replace github.com/regen-network/regen-ledger/types => ./types diff --git a/go.sum b/go.sum index 3c024ea331..afad8c5f58 100644 --- a/go.sum +++ b/go.sum @@ -215,13 +215,12 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 h1:UlK7NOHGlEbvbDTCM0cN7BJN6hhqeXZIuLv6KapFYTc= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 h1:YT5p2bEI7cIXpYyniSPckptI/DctTOcMpl0vTyy5vxA= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10/go.mod h1:WwRYmcnmSJpdOwr9ADwGr9gVBjYIre5TMz/nX4fStU0= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 h1:Ep7FHNViVwwGnwLFEPewZYsyN2CJNVMmMvFmtNQtbnw= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3/go.mod h1:HFea93YKmoMJ/mNKtkSeJZDtyJ4inxBsUK928KONcqo= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 h1:DSSxPDuX/Cr8AvmwipMkB1ObL8GQneZplSz4Sq9tH9M= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11/go.mod h1:2cogMfVz3OHvzGRWd9xUUJ8nqrzfdD96NGf+FNtzkQ4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -416,8 +415,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -926,6 +926,7 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= @@ -935,8 +936,9 @@ github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM github.com/tendermint/tendermint v0.34.14 h1:GCXmlS8Bqd2Ix3TQCpwYLUNHe+Y+QyJsm5YE+S/FkPo= github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo= github.com/thanhpk/randstr v1.0.4/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= diff --git a/types/go.mod b/types/go.mod index ab762feaee..aee8a5382f 100644 --- a/types/go.mod +++ b/types/go.mod @@ -6,7 +6,7 @@ require ( github.com/cockroachdb/apd/v2 v2.0.2 github.com/cosmos/cosmos-sdk v0.45.0 github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 - github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 github.com/gogo/protobuf v1.3.3 github.com/golang/mock v1.6.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -14,9 +14,8 @@ require ( github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.15 - github.com/tendermint/tm-db v0.6.6 + github.com/tendermint/tm-db v0.6.7 google.golang.org/grpc v1.44.0 - google.golang.org/protobuf v1.27.1 pgregory.net/rapid v0.4.7 ) @@ -36,8 +35,9 @@ require ( github.com/confio/ics23/go v0.6.6 // indirect github.com/cosmos/btcutil v1.0.4 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect - github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.17.3 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect @@ -108,7 +108,6 @@ require ( github.com/spf13/viper v1.9.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -119,7 +118,8 @@ require ( golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 // indirect golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect + google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf // indirect + google.golang.org/protobuf v1.27.1 // indirect gopkg.in/ini.v1 v1.63.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect diff --git a/types/go.sum b/types/go.sum index e53f456d56..2e7d6bf925 100644 --- a/types/go.sum +++ b/types/go.sum @@ -210,16 +210,17 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 h1:UlK7NOHGlEbvbDTCM0cN7BJN6hhqeXZIuLv6KapFYTc= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 h1:YT5p2bEI7cIXpYyniSPckptI/DctTOcMpl0vTyy5vxA= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10/go.mod h1:WwRYmcnmSJpdOwr9ADwGr9gVBjYIre5TMz/nX4fStU0= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 h1:Ep7FHNViVwwGnwLFEPewZYsyN2CJNVMmMvFmtNQtbnw= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3/go.mod h1:HFea93YKmoMJ/mNKtkSeJZDtyJ4inxBsUK928KONcqo= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 h1:DSSxPDuX/Cr8AvmwipMkB1ObL8GQneZplSz4Sq9tH9M= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11/go.mod h1:2cogMfVz3OHvzGRWd9xUUJ8nqrzfdD96NGf+FNtzkQ4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= @@ -281,12 +282,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -413,8 +416,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -906,7 +910,6 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= @@ -917,8 +920,8 @@ github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM github.com/tendermint/tendermint v0.34.14 h1:GCXmlS8Bqd2Ix3TQCpwYLUNHe+Y+QyJsm5YE+S/FkPo= github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= -github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -1422,8 +1425,9 @@ google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwy google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/types/ormstore/db.go b/types/ormstore/db.go index f6c1ddca6f..4850e36aae 100644 --- a/types/ormstore/db.go +++ b/types/ormstore/db.go @@ -2,6 +2,8 @@ package ormstore import ( "context" + ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" + "github.com/regen-network/regen-ledger/types" queryv1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/query/v1beta1" "github.com/cosmos/cosmos-sdk/types/query" @@ -9,26 +11,25 @@ import ( "github.com/cosmos/cosmos-sdk/orm/model/ormdb" "github.com/cosmos/cosmos-sdk/orm/model/ormtable" storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) // NewStoreKeyDB creates an ormdb.ModuleDB from an ormdb.ModuleDB and a StoreKey. // It is an interim solution for using the ORM in existing Cosmos SDK modules // before fuller integration has been done. -func NewStoreKeyDB(desc ormdb.ModuleSchema, key storetypes.StoreKey, options ormdb.ModuleDBOptions) (ormdb.ModuleDB, error) { - getBackend := func(ctx context.Context) (ormtable.Backend, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - store := sdkCtx.KVStore(key) - wrapper := storeWrapper{store} - return ormtable.NewBackend(ormtable.BackendOptions{ - CommitmentStore: wrapper, - IndexStore: wrapper, - }), nil - } - options.GetBackend = getBackend - options.GetReadBackend = func(ctx context.Context) (ormtable.ReadBackend, error) { - return getBackend(ctx) +func NewStoreKeyDB(desc *ormv1alpha1.ModuleSchemaDescriptor, key storetypes.StoreKey, options ormdb.ModuleDBOptions) (ormdb.ModuleDB, error) { + backEndResolver := func(_ ormv1alpha1.StorageType) (ormtable.BackendResolver, error) { + getBackend := func(ctx context.Context) (ormtable.ReadBackend, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + store := sdkCtx.KVStore(key) + wrapper := storeWrapper{store} + return ormtable.NewBackend(ormtable.BackendOptions{ + CommitmentStore: wrapper, + IndexStore: wrapper, + }), nil + } + return getBackend, nil } + options.GetBackendResolver = backEndResolver return ormdb.NewModuleDB(desc, options) } diff --git a/types/ormstore/db_test.go b/types/ormstore/db_test.go index a81e4dd58c..61f7a638b1 100644 --- a/types/ormstore/db_test.go +++ b/types/ormstore/db_test.go @@ -1,6 +1,7 @@ package ormstore import ( + ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" "testing" ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" @@ -14,7 +15,6 @@ import ( "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - "google.golang.org/protobuf/reflect/protoreflect" ) func sdkContextForStoreKey(key *types.KVStoreKey) sdk.Context { @@ -31,9 +31,12 @@ func sdkContextForStoreKey(key *types.KVStoreKey) sdk.Context { func TestStoreKeyDB(t *testing.T) { storeKey := types.NewKVStoreKey("test") db, err := NewStoreKeyDB( - ormdb.ModuleSchema{FileDescriptors: map[uint32]protoreflect.FileDescriptor{ - 1: ecocreditv1.File_regen_ecocredit_v1_state_proto, - }}, + &ormv1alpha1.ModuleSchemaDescriptor{ + SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{ + {Id: 1, ProtoFileName: ecocreditv1.File_regen_ecocredit_v1_state_proto.Path()}, + }, + Prefix: nil, + }, storeKey, ormdb.ModuleDBOptions{}, ) diff --git a/x/data/go.mod b/x/data/go.mod index 1593ea418b..827dd75560 100644 --- a/x/data/go.mod +++ b/x/data/go.mod @@ -6,7 +6,7 @@ require ( github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cosmos/cosmos-sdk v0.45.0 github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 - github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 @@ -16,7 +16,7 @@ require ( github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.15 - google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb + google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) @@ -37,8 +37,9 @@ require ( github.com/confio/ics23/go v0.6.6 // indirect github.com/cosmos/btcutil v1.0.4 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect - github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.17.3 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect @@ -106,11 +107,10 @@ require ( github.com/spf13/viper v1.9.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tendermint/tm-db v0.6.6 // indirect + github.com/tendermint/tm-db v0.6.7 // indirect github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect diff --git a/x/data/go.sum b/x/data/go.sum index 5ab8d7fda7..86ee5322c4 100644 --- a/x/data/go.sum +++ b/x/data/go.sum @@ -213,16 +213,17 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 h1:UlK7NOHGlEbvbDTCM0cN7BJN6hhqeXZIuLv6KapFYTc= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 h1:YT5p2bEI7cIXpYyniSPckptI/DctTOcMpl0vTyy5vxA= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10/go.mod h1:WwRYmcnmSJpdOwr9ADwGr9gVBjYIre5TMz/nX4fStU0= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 h1:Ep7FHNViVwwGnwLFEPewZYsyN2CJNVMmMvFmtNQtbnw= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3/go.mod h1:HFea93YKmoMJ/mNKtkSeJZDtyJ4inxBsUK928KONcqo= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 h1:DSSxPDuX/Cr8AvmwipMkB1ObL8GQneZplSz4Sq9tH9M= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11/go.mod h1:2cogMfVz3OHvzGRWd9xUUJ8nqrzfdD96NGf+FNtzkQ4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= @@ -284,12 +285,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -416,8 +419,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -914,7 +918,6 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= @@ -926,8 +929,9 @@ github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5 github.com/tendermint/tendermint v0.34.15 h1:45OEYTBD/TL0YFn8MF7yYJvC5iubyN4AbEjctPi1UqA= github.com/tendermint/tendermint v0.34.15/go.mod h1:/7EDAw02rD7GT8syC317cX9ZhZTCdaFVvYjU8W+yJSs= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -1437,8 +1441,9 @@ google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwy google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/x/data/server/msg_server.go b/x/data/server/msg_server.go index da89a01005..e14718ee68 100644 --- a/x/data/server/msg_server.go +++ b/x/data/server/msg_server.go @@ -132,7 +132,7 @@ func (s serverImpl) DefineResolver(ctx context.Context, msg *data.MsgDefineResol return nil, err } - id, err := s.stateStore.ResolverInfoStore().InsertReturningID(ctx, &api.ResolverInfo{ + id, err := s.stateStore.ResolverInfoTable().InsertReturningID(ctx, &api.ResolverInfo{ Url: msg.ResolverUrl, Manager: manager.Bytes(), }) @@ -144,7 +144,7 @@ func (s serverImpl) DefineResolver(ctx context.Context, msg *data.MsgDefineResol } func (s serverImpl) RegisterResolver(ctx context.Context, msg *data.MsgRegisterResolver) (*data.MsgRegisterResolverResponse, error) { - resolverInfo, err := s.stateStore.ResolverInfoStore().Get(ctx, msg.ResolverId) + resolverInfo, err := s.stateStore.ResolverInfoTable().Get(ctx, msg.ResolverId) if err != nil { return nil, err } @@ -163,7 +163,7 @@ func (s serverImpl) RegisterResolver(ctx context.Context, msg *data.MsgRegisterR if err != nil { return nil, err } - err = s.stateStore.DataResolverStore().Save( + err = s.stateStore.DataResolverTable().Save( ctx, &api.DataResolver{ ResolverId: msg.ResolverId, diff --git a/x/data/server/query_server.go b/x/data/server/query_server.go index 83cb811969..baf1d45669 100644 --- a/x/data/server/query_server.go +++ b/x/data/server/query_server.go @@ -130,7 +130,7 @@ func (s serverImpl) Resolvers(ctx context.Context, request *data.QueryResolversR request.Pagination = &query.PageRequest{} } - it, err := s.stateStore.DataResolverStore(). + it, err := s.stateStore.DataResolverTable(). List(ctx, api.DataResolverPrimaryKey{}.WithId(id), ormlist.Paginate(ormstore.GogoPageReqToPulsarPageReq(request.Pagination))) if err != nil { @@ -144,7 +144,7 @@ func (s serverImpl) Resolvers(ctx context.Context, request *data.QueryResolversR return nil, err } - resolverInfo, err := s.stateStore.ResolverInfoStore().Get(ctx, item.ResolverId) + resolverInfo, err := s.stateStore.ResolverInfoTable().Get(ctx, item.ResolverId) if err != nil { return nil, err } @@ -160,7 +160,7 @@ func (s serverImpl) Resolvers(ctx context.Context, request *data.QueryResolversR } func (s serverImpl) ResolverInfo(ctx context.Context, request *data.QueryResolverInfoRequest) (*data.QueryResolverInfoResponse, error) { - res, err := s.stateStore.ResolverInfoStore().GetByUrl(ctx, request.Url) + res, err := s.stateStore.ResolverInfoTable().GetByUrl(ctx, request.Url) if err != nil { return nil, err } diff --git a/x/data/server/server.go b/x/data/server/server.go index 08530b07fe..1d9ccfca24 100644 --- a/x/data/server/server.go +++ b/x/data/server/server.go @@ -1,8 +1,7 @@ package server import ( - "google.golang.org/protobuf/reflect/protoreflect" - + ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" "github.com/cosmos/cosmos-sdk/orm/model/ormdb" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,9 +12,9 @@ import ( "github.com/regen-network/regen-ledger/x/data/server/lookup" ) -var ModuleSchema = ormdb.ModuleSchema{ - FileDescriptors: map[uint32]protoreflect.FileDescriptor{ - 1: api.File_regen_data_v1_state_proto, +var ModuleSchema = ormv1alpha1.ModuleSchemaDescriptor{ + SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{ + {Id: 1, ProtoFileName: api.File_regen_data_v1_state_proto.Path(), StorageType: ormv1alpha1.StorageType_STORAGE_TYPE_DEFAULT_UNSPECIFIED}, }, Prefix: []byte{ORMStatePrefix}, } @@ -32,7 +31,7 @@ func newServer(storeKey sdk.StoreKey) serverImpl { panic(err) } - db, err := ormstore.NewStoreKeyDB(ModuleSchema, storeKey, ormdb.ModuleDBOptions{}) + db, err := ormstore.NewStoreKeyDB(&ModuleSchema, storeKey, ormdb.ModuleDBOptions{}) if err != nil { panic(err) } diff --git a/x/ecocredit/go.mod b/x/ecocredit/go.mod index 121af27fd9..10615dd7b2 100644 --- a/x/ecocredit/go.mod +++ b/x/ecocredit/go.mod @@ -5,8 +5,8 @@ go 1.17 require ( github.com/cosmos/cosmos-sdk v0.45.0 github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 - github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 github.com/gogo/protobuf v1.3.3 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.2 @@ -19,9 +19,9 @@ require ( github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.15 - github.com/tendermint/tm-db v0.6.6 + github.com/tendermint/tm-db v0.6.7 github.com/thanhpk/randstr v1.0.4 - google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb + google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 gotest.tools/v3 v3.1.0 @@ -47,6 +47,7 @@ require ( github.com/cosmos/btcutil v1.0.4 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.17.3 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect @@ -67,7 +68,7 @@ require ( github.com/gogo/gateway v1.1.0 // indirect github.com/golang/snappy v0.0.3 // indirect github.com/google/btree v1.0.0 // indirect - github.com/google/go-cmp v0.5.6 // indirect + github.com/google/go-cmp v0.5.7 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect @@ -114,7 +115,6 @@ require ( github.com/spf13/viper v1.9.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect diff --git a/x/ecocredit/go.sum b/x/ecocredit/go.sum index 020d9c6f1c..b852b239a7 100644 --- a/x/ecocredit/go.sum +++ b/x/ecocredit/go.sum @@ -210,16 +210,17 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 h1:UlK7NOHGlEbvbDTCM0cN7BJN6hhqeXZIuLv6KapFYTc= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 h1:YT5p2bEI7cIXpYyniSPckptI/DctTOcMpl0vTyy5vxA= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10/go.mod h1:WwRYmcnmSJpdOwr9ADwGr9gVBjYIre5TMz/nX4fStU0= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 h1:Ep7FHNViVwwGnwLFEPewZYsyN2CJNVMmMvFmtNQtbnw= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3/go.mod h1:HFea93YKmoMJ/mNKtkSeJZDtyJ4inxBsUK928KONcqo= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 h1:DSSxPDuX/Cr8AvmwipMkB1ObL8GQneZplSz4Sq9tH9M= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11/go.mod h1:2cogMfVz3OHvzGRWd9xUUJ8nqrzfdD96NGf+FNtzkQ4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.17.1/go.mod h1:7aisPZK8yCpQdy3PMvKeO+bhq1NwDjUwjzxwwROUxFk= github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= @@ -283,12 +284,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -415,8 +418,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -909,7 +913,6 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= @@ -920,8 +923,8 @@ github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM github.com/tendermint/tendermint v0.34.14 h1:GCXmlS8Bqd2Ix3TQCpwYLUNHe+Y+QyJsm5YE+S/FkPo= github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= -github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo= github.com/thanhpk/randstr v1.0.4/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= @@ -1429,8 +1432,9 @@ google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwy google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/x/ecocredit/module/module.go b/x/ecocredit/module/module.go index 5c93b04974..bb2cb900b9 100644 --- a/x/ecocredit/module/module.go +++ b/x/ecocredit/module/module.go @@ -88,7 +88,7 @@ func (a Module) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runt } func (a Module) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - db, err := ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{}) + db, err := ormdb.NewModuleDB(&server.ModuleSchema, ormdb.ModuleDBOptions{}) if err != nil { panic(err) } @@ -113,7 +113,7 @@ func (a Module) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } func (a Module) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage) error { - db, err := ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{}) + db, err := ormdb.NewModuleDB(&server.ModuleSchema, ormdb.ModuleDBOptions{}) if err != nil { return err } diff --git a/x/ecocredit/server/basket/create.go b/x/ecocredit/server/basket/create.go index 90d95b4b39..26e5bfbd11 100644 --- a/x/ecocredit/server/basket/create.go +++ b/x/ecocredit/server/basket/create.go @@ -37,7 +37,7 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC return nil, err } - id, err := k.stateStore.BasketStore().InsertReturningID(ctx, &api.Basket{ + id, err := k.stateStore.BasketTable().InsertReturningID(ctx, &api.Basket{ Curator: msg.Curator, BasketDenom: denom, DisableAutoRetire: msg.DisableAutoRetire, @@ -113,7 +113,7 @@ func (k Keeper) indexAllowedClasses(ctx types.Context, basketID uint64, allowedC } wrappedCtx := sdk.WrapSDKContext(ctx.Context) - err := k.stateStore.BasketClassStore().Insert(wrappedCtx, + err := k.stateStore.BasketClassTable().Insert(wrappedCtx, &api.BasketClass{ BasketId: basketID, ClassId: class, diff --git a/x/ecocredit/server/basket/create_test.go b/x/ecocredit/server/basket/create_test.go index 45c893980e..8b9284c177 100644 --- a/x/ecocredit/server/basket/create_test.go +++ b/x/ecocredit/server/basket/create_test.go @@ -81,7 +81,7 @@ func TestDuplicateDenom(t *testing.T) { } denom, _, err := basket.BasketDenom(mc.Name, mc.CreditTypeAbbrev, mc.Exponent) assert.NilError(t, err) - assert.NilError(t, s.stateStore.BasketStore().Insert(s.ctx, + assert.NilError(t, s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{BasketDenom: denom}, )) @@ -162,7 +162,7 @@ func TestGoodBasket(t *testing.T) { }) assert.NilError(t, err) - basket, err := s.stateStore.BasketStore().GetByBasketDenom(s.ctx, "eco.uC.foo") + basket, err := s.stateStore.BasketTable().GetByBasketDenom(s.ctx, "eco.uC.foo") assert.NilError(t, err) assert.Equal(t, s.addr.String(), basket.Curator) assert.Equal(t, "eco.uC.foo", basket.BasketDenom) diff --git a/x/ecocredit/server/basket/invariants.go b/x/ecocredit/server/basket/invariants.go index dcef06d777..61d7d18fdb 100644 --- a/x/ecocredit/server/basket/invariants.go +++ b/x/ecocredit/server/basket/invariants.go @@ -25,7 +25,7 @@ func (k Keeper) basketSupplyInvariant() sdk.Invariant { if err != nil { return err.Error(), true } - return BasketSupplyInvariant(ctx, k.stateStore.BasketStore(), k.bankKeeper, bals) + return BasketSupplyInvariant(ctx, k.stateStore.BasketTable(), k.bankKeeper, bals) } } @@ -34,7 +34,7 @@ type bankSupplyStore interface { } // BasketSupplyInvariant cross check the balance of baskets and bank -func BasketSupplyInvariant(ctx sdk.Context, store api.BasketStore, bank bankSupplyStore, basketBalances map[uint64]math.Dec) (string, bool) { +func BasketSupplyInvariant(ctx sdk.Context, store api.BasketTable, bank bankSupplyStore, basketBalances map[uint64]math.Dec) (string, bool) { goCtx := sdk.WrapSDKContext(ctx) bids := make([]uint64, len(basketBalances)) @@ -76,7 +76,7 @@ func BasketSupplyInvariant(ctx sdk.Context, store api.BasketStore, bank bankSupp // computeBasketBalances returns a map from basket id to the total number of eco credits func (k Keeper) computeBasketBalances(ctx context.Context) (map[uint64]math.Dec, error) { - it, err := k.stateStore.BasketBalanceStore().List(ctx, &api.BasketBalancePrimaryKey{}) + it, err := k.stateStore.BasketBalanceTable().List(ctx, &api.BasketBalancePrimaryKey{}) if err != nil { return nil, fmt.Errorf("can't create basket balance iterator, %w", err) } diff --git a/x/ecocredit/server/basket/invariants_test.go b/x/ecocredit/server/basket/invariants_test.go index f1f9445191..1fb97cccfa 100644 --- a/x/ecocredit/server/basket/invariants_test.go +++ b/x/ecocredit/server/basket/invariants_test.go @@ -34,7 +34,7 @@ func TestBasketSupplyInvarint(t *testing.T) { {10, api.Basket{BasketDenom: "bb1", Name: "b1"}}, {20, api.Basket{BasketDenom: "bb2", Name: "b2"}}, } - store := s.stateStore.BasketStore() + store := s.stateStore.BasketTable() basketBalances := map[uint64]math.Dec{} correctBalances := BankSupplyMock{} for _, b := range baskets { diff --git a/x/ecocredit/server/basket/keeper_test.go b/x/ecocredit/server/basket/keeper_test.go index aef496b800..34b4bbefc1 100644 --- a/x/ecocredit/server/basket/keeper_test.go +++ b/x/ecocredit/server/basket/keeper_test.go @@ -44,7 +44,7 @@ func setupBase(t *testing.T) *baseSuite { // prepare database s := &baseSuite{t: t} var err error - s.db, err = ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{}) + s.db, err = ormdb.NewModuleDB(&server.ModuleSchema, ormdb.ModuleDBOptions{}) assert.NilError(t, err) s.stateStore, err = api.NewStateStore(s.db) assert.NilError(t, err) diff --git a/x/ecocredit/server/basket/put.go b/x/ecocredit/server/basket/put.go index 15ef1ee069..1366c588d9 100644 --- a/x/ecocredit/server/basket/put.go +++ b/x/ecocredit/server/basket/put.go @@ -26,7 +26,7 @@ func (k Keeper) Put(ctx context.Context, req *baskettypes.MsgPut) (*baskettypes. } // get the basket - basket, err := k.stateStore.BasketStore().GetByBasketDenom(ctx, req.BasketDenom) + basket, err := k.stateStore.BasketTable().GetByBasketDenom(ctx, req.BasketDenom) if err != nil { if orm.ErrNotFound.Is(err) { return nil, sdkerrors.ErrNotFound.Wrapf("basket %s not found", req.BasketDenom) @@ -131,7 +131,7 @@ func (k Keeper) canBasketAcceptCredit(ctx context.Context, basket *api.Basket, b classId := projectRes.Info.ClassId // check credit class match - found, err := k.stateStore.BasketClassStore().Has(ctx, basket.Id, classId) + found, err := k.stateStore.BasketClassTable().Has(ctx, basket.Id, classId) if err != nil { return err } @@ -171,7 +171,7 @@ func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt // update basket balance with amount sent var bal *api.BasketBalance - bal, err = k.stateStore.BasketBalanceStore().Get(ctx, basket.Id, batchInfo.BatchDenom) + bal, err = k.stateStore.BasketBalanceTable().Get(ctx, basket.Id, batchInfo.BatchDenom) if err != nil { if ormerrors.IsNotFound(err) { bal = &api.BasketBalance{ @@ -194,7 +194,7 @@ func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt } bal.Balance = newBalance.String() } - if err = k.stateStore.BasketBalanceStore().Save(ctx, bal); err != nil { + if err = k.stateStore.BasketBalanceTable().Save(ctx, bal); err != nil { return err } return nil diff --git a/x/ecocredit/server/basket/put_test.go b/x/ecocredit/server/basket/put_test.go index ef8ab70e0b..dfd83ab32a 100644 --- a/x/ecocredit/server/basket/put_test.go +++ b/x/ecocredit/server/basket/put_test.go @@ -5,32 +5,19 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/cosmos/cosmos-sdk/orm/model/ormdb" - "github.com/cosmos/cosmos-sdk/orm/model/ormtable" - "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" - "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" "github.com/regen-network/regen-ledger/orm" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" basket2 "github.com/regen-network/regen-ledger/x/ecocredit/basket" - mocks2 "github.com/regen-network/regen-ledger/x/ecocredit/mocks" - "github.com/regen-network/regen-ledger/x/ecocredit/server" "github.com/regen-network/regen-ledger/x/ecocredit/server/basket" - "github.com/regen-network/regen-ledger/x/ecocredit/server/basket/mocks" ) func TestPut(t *testing.T) { @@ -77,21 +64,9 @@ func TestPut(t *testing.T) { } batchInfoRes := ecocredit.QueryBatchInfoResponse{Info: &testBatchInfo} - ctx := context.Background() - _, _, addr := testdata.KeyTestPubAddr() - ctrl := gomock.NewController(t) - b := ormtest.NewMemoryBackend() - db, err := ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{ - GetBackend: func(ctx context.Context) (ormtable.Backend, error) { - return b, nil - }, - GetReadBackend: func(ctx context.Context) (ormtable.ReadBackend, error) { - return b, nil - }, - }) - require.NoError(t, err) - basketTbl := db.GetTable(&api.Basket{}) - err = basketTbl.Insert(ctx, &api.Basket{ + s := setupBase(t) + + err = s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: basketDenom, Name: basketDenom, DisableAutoRetire: true, @@ -100,10 +75,10 @@ func TestPut(t *testing.T) { Exponent: 6, }) require.NoError(t, err) - basketBalanceTbl := db.GetTable(&api.BasketBalance{}) + var dur time.Duration = 500000000000000000 validStartDateWindow := startDate.Add(-dur) - err = basketTbl.Insert(ctx, &api.Basket{ + err = s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: basketDenom2, Name: basketDenom2, DisableAutoRetire: true, @@ -115,28 +90,19 @@ func TestPut(t *testing.T) { basketDenomToId := make(map[string]uint64) basketDenomToId[basketDenom] = 1 basketDenomToId[basketDenom2] = 2 - bsktClsTbl := db.GetTable(&api.BasketClass{}) - err = bsktClsTbl.Insert(ctx, &api.BasketClass{ + err = s.stateStore.BasketClassTable().Insert(s.ctx, &api.BasketClass{ BasketId: 1, ClassId: classId, }) require.NoError(t, err) - err = bsktClsTbl.Insert(ctx, &api.BasketClass{ + err = s.stateStore.BasketClassTable().Insert(s.ctx, &api.BasketClass{ BasketId: 2, ClassId: classId, }) require.NoError(t, err) - bankKeeper := mocks2.NewMockBankKeeper(ctrl) - ecocreditKeeper := mocks.NewMockEcocreditKeeper(ctrl) - distKeeper := mocks2.NewMockDistributionKeeper(ctrl) - sk := sdk.NewKVStoreKey("test") - k := basket.NewKeeper(db, ecocreditKeeper, bankKeeper, distKeeper, sk) - require.NotNil(t, k) - - sdkCtx := sdkContextForStoreKey(sk).WithContext(ctx).WithBlockTime(startDate) - ctx = sdk.WrapSDKContext(sdkCtx) - sdkCtx = ctx.Value(sdk.SdkContextKey).(sdk.Context) + s.sdkCtx = s.sdkCtx.WithBlockTime(startDate) + s.ctx = sdk.WrapSDKContext(s.sdkCtx) testCases := []struct { name string @@ -151,32 +117,32 @@ func TestPut(t *testing.T) { name: "valid case", startingBalance: "100000000", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, expectedCredits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, expectedBasketCoins: "2000000", // 2 million expectCalls: func() { - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&batchInfoRes, nil) - ecocreditKeeper.EXPECT(). - ProjectInfo(ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). + s.ecocreditKeeper.EXPECT(). + ProjectInfo(s.ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). Return(&projectInfoRes, nil) - ecocreditKeeper.EXPECT(). - ClassInfo(ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). + s.ecocreditKeeper.EXPECT(). + ClassInfo(s.ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). Return(&classInfoRes, nil) coinAward := sdk.NewCoins(sdk.NewCoin(basketDenom, sdk.NewInt(2_000_000))) - bankKeeper.EXPECT(). - MintCoins(sdkCtx, basket2.BasketSubModuleName, coinAward). + s.bankKeeper.EXPECT(). + MintCoins(s.sdkCtx, basket2.BasketSubModuleName, coinAward). Return(nil) - bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(sdkCtx, basket2.BasketSubModuleName, addr, coinAward). + s.bankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(s.sdkCtx, basket2.BasketSubModuleName, s.addr, coinAward). Return(nil) }, }, @@ -184,32 +150,32 @@ func TestPut(t *testing.T) { name: "valid case - basket with existing balance", startingBalance: "100000000", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "1"}}, }, expectedCredits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "3"}}, expectedBasketCoins: "1000000", // 1 million expectCalls: func() { - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&batchInfoRes, nil) - ecocreditKeeper.EXPECT(). - ProjectInfo(ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). + s.ecocreditKeeper.EXPECT(). + ProjectInfo(s.ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). Return(&projectInfoRes, nil) - ecocreditKeeper.EXPECT(). - ClassInfo(ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). + s.ecocreditKeeper.EXPECT(). + ClassInfo(s.ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). Return(&classInfoRes, nil) coinAward := sdk.NewCoins(sdk.NewCoin(basketDenom, sdk.NewInt(1_000_000))) - bankKeeper.EXPECT(). - MintCoins(sdkCtx, basket2.BasketSubModuleName, coinAward). + s.bankKeeper.EXPECT(). + MintCoins(s.sdkCtx, basket2.BasketSubModuleName, coinAward). Return(nil) - bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(sdkCtx, basket2.BasketSubModuleName, addr, coinAward). + s.bankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(s.sdkCtx, basket2.BasketSubModuleName, s.addr, coinAward). Return(nil) }, }, @@ -217,32 +183,32 @@ func TestPut(t *testing.T) { name: "valid case - basket 2 with rolling window", startingBalance: "100000000", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom2, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, expectedCredits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, expectedBasketCoins: "2000000", // 2 million expectCalls: func() { - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&batchInfoRes, nil) - ecocreditKeeper.EXPECT(). - ProjectInfo(ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). + s.ecocreditKeeper.EXPECT(). + ProjectInfo(s.ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). Return(&projectInfoRes, nil) - ecocreditKeeper.EXPECT(). - ClassInfo(ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). + s.ecocreditKeeper.EXPECT(). + ClassInfo(s.ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). Return(&classInfoRes, nil) coinAward := sdk.NewCoins(sdk.NewCoin(basketDenom2, sdk.NewInt(2_000_000))) - bankKeeper.EXPECT(). - MintCoins(sdkCtx, basket2.BasketSubModuleName, coinAward). + s.bankKeeper.EXPECT(). + MintCoins(s.sdkCtx, basket2.BasketSubModuleName, coinAward). Return(nil) - bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(sdkCtx, basket2.BasketSubModuleName, addr, coinAward). + s.bankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(s.sdkCtx, basket2.BasketSubModuleName, s.addr, coinAward). Return(nil) }, }, @@ -250,22 +216,22 @@ func TestPut(t *testing.T) { name: "insufficient funds", startingBalance: "1", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, expectedBasketCoins: "2000000", // 2 million expectCalls: func() { - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&batchInfoRes, nil) - ecocreditKeeper.EXPECT(). - ProjectInfo(ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). + s.ecocreditKeeper.EXPECT(). + ProjectInfo(s.ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). Return(&projectInfoRes, nil) - ecocreditKeeper.EXPECT(). - ClassInfo(ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). + s.ecocreditKeeper.EXPECT(). + ClassInfo(s.ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). Return(&classInfoRes, nil) }, @@ -275,7 +241,7 @@ func TestPut(t *testing.T) { name: "basket not found", startingBalance: "1", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: "FooBar", Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, @@ -288,14 +254,14 @@ func TestPut(t *testing.T) { name: "batch not found", startingBalance: "20", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom, Credits: []*basket2.BasketCredit{{BatchDenom: "FooBarBaz", Amount: "2"}}, }, expectedBasketCoins: "2000000", // 2 million expectCalls: func() { - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: "FooBarBaz"}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: "FooBarBaz"}). Return(nil, orm.ErrNotFound) }, errMsg: orm.ErrNotFound.Error(), @@ -304,7 +270,7 @@ func TestPut(t *testing.T) { // name: "class not allowed", // startingBalance: "100000000", // msg: basket2.MsgPut{ - // Owner: addr.String(), + // Owner: s.addr.String(), // BasketDenom: basketDenom, // Credits: []*basket2.BasketCredit{{BatchDenom: "blah", Amount: "2"}}, // }, @@ -313,7 +279,7 @@ func TestPut(t *testing.T) { // badInfo := *batchInfoRes.Info // badInfo.ClassId = "blah01" // ecocreditKeeper.EXPECT(). - // BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: "blah"}). + // BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: "blah"}). // Return(&ecocredit.QueryBatchInfoResponse{Info: &badInfo}, nil) // }, // errMsg: "credit class blah01 is not allowed in this basket", @@ -322,24 +288,24 @@ func TestPut(t *testing.T) { name: "wrong credit type", startingBalance: "100000000", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, expectedBasketCoins: "2000000", // 2 million expectCalls: func() { - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&batchInfoRes, nil) - ecocreditKeeper.EXPECT(). - ProjectInfo(ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). + s.ecocreditKeeper.EXPECT(). + ProjectInfo(s.ctx, &ecocredit.QueryProjectInfoRequest{ProjectId: projectId}). Return(&projectInfoRes, nil) badClass := *classInfoRes.Info badClass.CreditType.Abbreviation = "FOO" - ecocreditKeeper.EXPECT(). - ClassInfo(ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). + s.ecocreditKeeper.EXPECT(). + ClassInfo(s.ctx, &ecocredit.QueryClassInfoRequest{ClassId: classId}). Return(&ecocredit.QueryClassInfoResponse{Info: &badClass}, nil) }, errMsg: "cannot use credit of type FOO in a basket that requires credit type C", @@ -348,7 +314,7 @@ func TestPut(t *testing.T) { name: "batch out of time window", startingBalance: "100000000", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, @@ -358,8 +324,8 @@ func TestPut(t *testing.T) { require.NoError(t, err) badTimeInfo := *batchInfoRes.Info badTimeInfo.StartDate = &badTime - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&ecocredit.QueryBatchInfoResponse{Info: &badTimeInfo}, nil) }, @@ -369,7 +335,7 @@ func TestPut(t *testing.T) { name: "batch outside of rolling time window", startingBalance: "100000000", msg: basket2.MsgPut{ - Owner: addr.String(), + Owner: s.addr.String(), BasketDenom: basketDenom2, Credits: []*basket2.BasketCredit{{BatchDenom: denom, Amount: "2"}}, }, @@ -379,8 +345,8 @@ func TestPut(t *testing.T) { bogusDur := time.Duration(999999999999999) badTime := validStartDateWindow.Add(-bogusDur) badTimeInfo.StartDate = &badTime - ecocreditKeeper.EXPECT(). - BatchInfo(ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). + s.ecocreditKeeper.EXPECT(). + BatchInfo(s.ctx, &ecocredit.QueryBatchInfoRequest{BatchDenom: denom}). Return(&ecocredit.QueryBatchInfoResponse{Info: &badTimeInfo}, nil) }, @@ -391,12 +357,12 @@ func TestPut(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.expectCalls() - legacyStore := sdkCtx.KVStore(sk) - tradKey := ecocredit.TradableBalanceKey(addr, ecocredit.BatchDenomT(denom)) + legacyStore := s.sdkCtx.KVStore(s.storeKey) + tradKey := ecocredit.TradableBalanceKey(s.addr, ecocredit.BatchDenomT(denom)) userFunds, err := math.NewDecFromString(tc.startingBalance) require.NoError(t, err) ecocredit.SetDecimal(legacyStore, tradKey, userFunds) - res, err := k.Put(ctx, &tc.msg) + res, err := s.k.Put(s.ctx, &tc.msg) if tc.errMsg == "" { // no error! require.NoError(t, err) require.Equal(t, res.AmountReceived, tc.expectedBasketCoins) @@ -404,7 +370,7 @@ func TestPut(t *testing.T) { assertUserSentCredits(t, userFunds, credit.Amount, tradKey, legacyStore) } for _, credit := range tc.expectedCredits { - assertBasketHasCredits(t, ctx, credit, basketDenomToId[tc.msg.BasketDenom], basketBalanceTbl) + assertBasketHasCredits(t, s.ctx, credit, basketDenomToId[tc.msg.BasketDenom], s.stateStore.BasketBalanceTable()) } } else { require.Error(t, err) @@ -414,17 +380,10 @@ func TestPut(t *testing.T) { } } -func assertBasketHasCredits(t *testing.T, ctx context.Context, credit *basket2.BasketCredit, basketID uint64, basketBalTbl ormtable.Table) { - basketBal := api.BasketBalance{ - BasketId: basketID, - BatchDenom: credit.BatchDenom, - Balance: "", - BatchStartDate: nil, - } - found, err := basketBalTbl.Get(ctx, &basketBal) +func assertBasketHasCredits(t *testing.T, ctx context.Context, credit *basket2.BasketCredit, basketID uint64, balanceTable api.BasketBalanceTable) { + bal, err := balanceTable.Get(ctx, basketID, credit.BatchDenom) require.NoError(t, err) - require.True(t, found) - require.Equal(t, basketBal.Balance, credit.Amount) + require.Equal(t, bal.Balance, credit.Amount) } func assertUserSentCredits(t *testing.T, oldBalance math.Dec, amountSent string, balanceKey []byte, store types.KVStore) { @@ -438,14 +397,3 @@ func assertUserSentCredits(t *testing.T, oldBalance math.Dec, amountSent string, require.True(t, checkBalance.Equal(oldBalance)) } - -func sdkContextForStoreKey(key *types.KVStoreKey) sdk.Context { - db := dbm.NewMemDB() - cms := store.NewCommitMultiStore(db) - cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db) - err := cms.LoadLatestVersion() - if err != nil { - panic(err) - } - return sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger()) -} diff --git a/x/ecocredit/server/basket/query_balance.go b/x/ecocredit/server/basket/query_balance.go index e398a7e5b2..062ad3fa1e 100644 --- a/x/ecocredit/server/basket/query_balance.go +++ b/x/ecocredit/server/basket/query_balance.go @@ -14,12 +14,12 @@ func (k Keeper) BasketBalance(ctx context.Context, request *baskettypes.QueryBas return nil, status.Errorf(codes.InvalidArgument, "empty request") } - basket, err := k.stateStore.BasketStore().GetByBasketDenom(ctx, request.BasketDenom) + basket, err := k.stateStore.BasketTable().GetByBasketDenom(ctx, request.BasketDenom) if err != nil { return nil, err } - balance, err := k.stateStore.BasketBalanceStore().Get(ctx, basket.Id, request.BatchDenom) + balance, err := k.stateStore.BasketBalanceTable().Get(ctx, basket.Id, request.BatchDenom) if err != nil { return nil, err } diff --git a/x/ecocredit/server/basket/query_balance_test.go b/x/ecocredit/server/basket/query_balance_test.go index b4e7323348..8af5a7c681 100644 --- a/x/ecocredit/server/basket/query_balance_test.go +++ b/x/ecocredit/server/basket/query_balance_test.go @@ -17,13 +17,13 @@ func TestKeeper_BasketBalance(t *testing.T) { basketDenom := "foo" batchDenom := "bar" balance := "5.3" - id, err := s.stateStore.BasketStore().InsertReturningID(s.ctx, &api.Basket{ + id, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: basketDenom, }) require.NoError(t, err) // add a balance - require.NoError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + require.NoError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: id, BatchDenom: batchDenom, Balance: balance, diff --git a/x/ecocredit/server/basket/query_balances.go b/x/ecocredit/server/basket/query_balances.go index 5237ae7bae..6cc9e1bc7f 100644 --- a/x/ecocredit/server/basket/query_balances.go +++ b/x/ecocredit/server/basket/query_balances.go @@ -17,7 +17,7 @@ func (k Keeper) BasketBalances(ctx context.Context, request *baskettypes.QueryBa return nil, status.Errorf(codes.InvalidArgument, "empty request") } - basket, err := k.stateStore.BasketStore().GetByBasketDenom(ctx, request.BasketDenom) + basket, err := k.stateStore.BasketTable().GetByBasketDenom(ctx, request.BasketDenom) if err != nil { return nil, err } @@ -27,7 +27,7 @@ func (k Keeper) BasketBalances(ctx context.Context, request *baskettypes.QueryBa return nil, err } - it, err := k.stateStore.BasketBalanceStore().List(ctx, api.BasketBalancePrimaryKey{}.WithBasketId(basket.Id), + it, err := k.stateStore.BasketBalanceTable().List(ctx, api.BasketBalancePrimaryKey{}.WithBasketId(basket.Id), ormlist.Paginate(pulsarPageReq), ) if err != nil { diff --git a/x/ecocredit/server/basket/query_balances_test.go b/x/ecocredit/server/basket/query_balances_test.go index ab73026b4f..fadada78ed 100644 --- a/x/ecocredit/server/basket/query_balances_test.go +++ b/x/ecocredit/server/basket/query_balances_test.go @@ -18,22 +18,22 @@ func TestQueryBalances(t *testing.T) { // add some baskets basketDenom := "foo" batchDenoms := []string{"bar", "baz", "qux"} - require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &api.Basket{ + require.NoError(t, s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: basketDenom, })) - require.NoError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + require.NoError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: 1, BatchDenom: batchDenoms[0], Balance: "100.50", BatchStartDate: nil, })) - require.NoError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + require.NoError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: 1, BatchDenom: batchDenoms[1], Balance: "4.20", BatchStartDate: nil, })) - require.NoError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + require.NoError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: 1, BatchDenom: batchDenoms[2], Balance: "6.10", diff --git a/x/ecocredit/server/basket/query_basket.go b/x/ecocredit/server/basket/query_basket.go index 4f56826302..da3fd89a47 100644 --- a/x/ecocredit/server/basket/query_basket.go +++ b/x/ecocredit/server/basket/query_basket.go @@ -14,7 +14,7 @@ func (k Keeper) Basket(ctx context.Context, request *baskettypes.QueryBasketRequ return nil, status.Errorf(codes.InvalidArgument, "empty request") } - basket, err := k.stateStore.BasketStore().GetByBasketDenom(ctx, request.BasketDenom) + basket, err := k.stateStore.BasketTable().GetByBasketDenom(ctx, request.BasketDenom) if err != nil { return nil, err } @@ -25,7 +25,7 @@ func (k Keeper) Basket(ctx context.Context, request *baskettypes.QueryBasketRequ return nil, err } - it, err := k.stateStore.BasketClassStore().List(ctx, api.BasketClassPrimaryKey{}.WithBasketId(basket.Id)) + it, err := k.stateStore.BasketClassTable().List(ctx, api.BasketClassPrimaryKey{}.WithBasketId(basket.Id)) if err != nil { return nil, err } diff --git a/x/ecocredit/server/basket/query_basket_test.go b/x/ecocredit/server/basket/query_basket_test.go index 6f3ff370cd..9fe56bc249 100644 --- a/x/ecocredit/server/basket/query_basket_test.go +++ b/x/ecocredit/server/basket/query_basket_test.go @@ -16,7 +16,7 @@ func TestKeeper_Basket(t *testing.T) { // add a basket basketDenom := "foo" batchDenom := "bar" - err := s.stateStore.BasketStore().Insert(s.ctx, &api.Basket{ + err := s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: basketDenom, }) require.NoError(t, err) @@ -41,14 +41,14 @@ func TestKeeper_BasketClasses(t *testing.T) { // add a basket basketDenom := "foo" - err := s.stateStore.BasketStore().Insert(s.ctx, &api.Basket{ + err := s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: basketDenom, }) require.NoError(t, err) // add a basket class classId := "C01" - err = s.stateStore.BasketClassStore().Insert(s.ctx, &api.BasketClass{ + err = s.stateStore.BasketClassTable().Insert(s.ctx, &api.BasketClass{ BasketId: 1, ClassId: classId, }) diff --git a/x/ecocredit/server/basket/query_baskets.go b/x/ecocredit/server/basket/query_baskets.go index a679b17f42..a86c5b79a1 100644 --- a/x/ecocredit/server/basket/query_baskets.go +++ b/x/ecocredit/server/basket/query_baskets.go @@ -21,7 +21,7 @@ func (k Keeper) Baskets(ctx context.Context, request *baskettypes.QueryBasketsRe if err != nil { return nil, err } - it, err := k.stateStore.BasketStore().List(ctx, api.BasketPrimaryKey{}, + it, err := k.stateStore.BasketTable().List(ctx, api.BasketPrimaryKey{}, ormlist.Paginate(pulsarPageReq), ) diff --git a/x/ecocredit/server/basket/query_baskets_test.go b/x/ecocredit/server/basket/query_baskets_test.go index c1362a9ab9..7d3b24d44d 100644 --- a/x/ecocredit/server/basket/query_baskets_test.go +++ b/x/ecocredit/server/basket/query_baskets_test.go @@ -16,13 +16,13 @@ func TestQueryBaskets(t *testing.T) { s := setupBase(t) // add some baskets - require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &api.Basket{ + require.NoError(t, s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: "foo", Name: "foo", })) - require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &api.Basket{ + require.NoError(t, s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: "bar", Name: "bar", })) - require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &api.Basket{ + require.NoError(t, s.stateStore.BasketTable().Insert(s.ctx, &api.Basket{ BasketDenom: "baz", Name: "baz", })) diff --git a/x/ecocredit/server/basket/take.go b/x/ecocredit/server/basket/take.go index 98ac49f76f..9bd5c8c9bb 100644 --- a/x/ecocredit/server/basket/take.go +++ b/x/ecocredit/server/basket/take.go @@ -15,7 +15,7 @@ import ( ) func (k Keeper) Take(ctx context.Context, msg *baskettypes.MsgTake) (*baskettypes.MsgTakeResponse, error) { - basket, err := k.stateStore.BasketStore().GetByBasketDenom(ctx, msg.BasketDenom) + basket, err := k.stateStore.BasketTable().GetByBasketDenom(ctx, msg.BasketDenom) if err != nil { return nil, err } @@ -60,7 +60,7 @@ func (k Keeper) Take(ctx context.Context, msg *baskettypes.MsgTake) (*baskettype var credits []*baskettypes.BasketCredit for { - it, err := k.stateStore.BasketBalanceStore().List(ctx, + it, err := k.stateStore.BasketBalanceTable().List(ctx, api.BasketBalanceBasketIdBatchStartDateIndexKey{}.WithBasketId(basket.Id), ) if err != nil { @@ -109,7 +109,7 @@ func (k Keeper) Take(ctx context.Context, msg *baskettypes.MsgTake) (*baskettype } basketBalance.Balance = newBalance.String() - err = k.stateStore.BasketBalanceStore().Update(ctx, basketBalance) + err = k.stateStore.BasketBalanceTable().Update(ctx, basketBalance) if err != nil { return nil, err } @@ -134,7 +134,7 @@ func (k Keeper) Take(ctx context.Context, msg *baskettypes.MsgTake) (*baskettype return nil, err } - err = k.stateStore.BasketBalanceStore().Delete(ctx, basketBalance) + err = k.stateStore.BasketBalanceTable().Delete(ctx, basketBalance) if err != nil { return nil, err } diff --git a/x/ecocredit/server/basket/take_test.go b/x/ecocredit/server/basket/take_test.go index a59bbac69b..9cd2f6e922 100644 --- a/x/ecocredit/server/basket/take_test.go +++ b/x/ecocredit/server/basket/take_test.go @@ -31,7 +31,7 @@ func setupTake(t *testing.T) *takeSuite { // add some data var err error - s.fooBasketId, err = s.stateStore.BasketStore().InsertReturningID(s.ctx, &api.Basket{ + s.fooBasketId, err = s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: "foo", Name: "foo", DisableAutoRetire: false, @@ -40,7 +40,7 @@ func setupTake(t *testing.T) *takeSuite { }) assert.NilError(t, err) - assert.NilError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + assert.NilError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: s.fooBasketId, BatchDenom: "C1", Balance: "3.0", @@ -48,7 +48,7 @@ func setupTake(t *testing.T) *takeSuite { })) s.setTradableSupply("C1", "3.0") - assert.NilError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + assert.NilError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: s.fooBasketId, BatchDenom: "C2", Balance: "5.0", @@ -56,7 +56,7 @@ func setupTake(t *testing.T) *takeSuite { })) s.setTradableSupply("C2", "5.0") - s.barBasketId, err = s.stateStore.BasketStore().InsertReturningID(s.ctx, &api.Basket{ + s.barBasketId, err = s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: "bar", Name: "bar", DisableAutoRetire: true, @@ -65,7 +65,7 @@ func setupTake(t *testing.T) *takeSuite { }) assert.NilError(t, err) - assert.NilError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + assert.NilError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: s.barBasketId, BatchDenom: "C3", Balance: "7.0", @@ -73,7 +73,7 @@ func setupTake(t *testing.T) *takeSuite { })) s.setTradableSupply("C3", "7.0") - assert.NilError(t, s.stateStore.BasketBalanceStore().Insert(s.ctx, &api.BasketBalance{ + assert.NilError(t, s.stateStore.BasketBalanceTable().Insert(s.ctx, &api.BasketBalance{ BasketId: s.barBasketId, BatchDenom: "C4", Balance: "4.0", @@ -120,10 +120,10 @@ func TestTakeRetire(t *testing.T) { assertDecStringEqual(t, "5.0", res.Credits[0].Amount) assert.Equal(t, "C1", res.Credits[1].BatchDenom) assertDecStringEqual(t, "1.0", res.Credits[1].Amount) - found, err := s.stateStore.BasketBalanceStore().Has(s.ctx, s.fooBasketId, "C2") + found, err := s.stateStore.BasketBalanceTable().Has(s.ctx, s.fooBasketId, "C2") assert.NilError(t, err) assert.Assert(t, !found) - balance, err := s.stateStore.BasketBalanceStore().Get(s.ctx, s.fooBasketId, "C1") + balance, err := s.stateStore.BasketBalanceTable().Get(s.ctx, s.fooBasketId, "C1") assert.NilError(t, err) assertDecStringEqual(t, "2.0", balance.Balance) @@ -157,10 +157,10 @@ func TestTakeTradable(t *testing.T) { assertDecStringEqual(t, "7.0", res.Credits[0].Amount) assert.Equal(t, "C4", res.Credits[1].BatchDenom) assertDecStringEqual(t, "3.0", res.Credits[1].Amount) - found, err := s.stateStore.BasketBalanceStore().Has(s.ctx, s.barBasketId, "C3") + found, err := s.stateStore.BasketBalanceTable().Has(s.ctx, s.barBasketId, "C3") assert.NilError(t, err) assert.Assert(t, !found) - balance, err := s.stateStore.BasketBalanceStore().Get(s.ctx, s.barBasketId, "C4") + balance, err := s.stateStore.BasketBalanceTable().Get(s.ctx, s.barBasketId, "C4") assert.NilError(t, err) assertDecStringEqual(t, "1.0", balance.Balance) @@ -215,10 +215,10 @@ func TestTakeAllTradable(t *testing.T) { assertDecStringEqual(t, "7.0", res.Credits[0].Amount) assert.Equal(t, "C4", res.Credits[1].BatchDenom) assertDecStringEqual(t, "4.0", res.Credits[1].Amount) - found, err := s.stateStore.BasketBalanceStore().Has(s.ctx, s.barBasketId, "C3") + found, err := s.stateStore.BasketBalanceTable().Has(s.ctx, s.barBasketId, "C3") assert.NilError(t, err) assert.Assert(t, !found) - _, err = s.stateStore.BasketBalanceStore().Get(s.ctx, s.barBasketId, "C4") + _, err = s.stateStore.BasketBalanceTable().Get(s.ctx, s.barBasketId, "C4") assert.ErrorIs(t, err, ormerrors.NotFound) s.expectTradableBalance("C3", "7") diff --git a/x/ecocredit/server/core/cancel.go b/x/ecocredit/server/core/cancel.go index 9733e26e53..20f893ea03 100644 --- a/x/ecocredit/server/core/cancel.go +++ b/x/ecocredit/server/core/cancel.go @@ -21,7 +21,7 @@ func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCance } for _, credit := range req.Credits { - batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) + batch, err := k.stateStore.BatchInfoTable().GetByBatchDenom(ctx, credit.BatchDenom) if err != nil { return nil, err } @@ -31,11 +31,11 @@ func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCance } precision := creditType.Precision - userBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) + userBalance, err := k.stateStore.BatchBalanceTable().Get(ctx, holder, batch.Id) if err != nil { return nil, err } - batchSupply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + batchSupply, err := k.stateStore.BatchSupplyTable().Get(ctx, batch.Id) if err != nil { return nil, err } @@ -56,7 +56,7 @@ func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCance if err != nil { return nil, err } - if err = k.stateStore.BatchBalanceStore().Update(ctx, &api.BatchBalance{ + if err = k.stateStore.BatchBalanceTable().Update(ctx, &api.BatchBalance{ Address: holder, BatchId: batch.Id, Tradable: userBalTradable.String(), @@ -64,7 +64,7 @@ func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCance }); err != nil { return nil, err } - if err = k.stateStore.BatchSupplyStore().Update(ctx, &api.BatchSupply{ + if err = k.stateStore.BatchSupplyTable().Update(ctx, &api.BatchSupply{ BatchId: batch.Id, TradableAmount: supplyTradable.String(), RetiredAmount: batchSupply.RetiredAmount, diff --git a/x/ecocredit/server/core/cancel_test.go b/x/ecocredit/server/core/cancel_test.go index 72eb626fe4..d2d75ad9e1 100644 --- a/x/ecocredit/server/core/cancel_test.go +++ b/x/ecocredit/server/core/cancel_test.go @@ -38,12 +38,12 @@ func TestCancel_Valid(t *testing.T) { // we cancel 10.5 credits, removing them from the s.addr balance, as well as supply, resulting in 0 to both. - sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + sup, err := s.stateStore.BatchSupplyTable().Get(s.ctx, 1) assert.NilError(t, err) assert.Equal(t, sup.TradableAmount, "0.0") assert.Equal(t, sup.RetiredAmount, "10.5") - bal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + bal, err := s.stateStore.BatchBalanceTable().Get(s.ctx, s.addr, 1) assert.NilError(t, err) assert.Equal(t, bal.Tradable, "0.0") assert.Equal(t, bal.Retired, "10.5") diff --git a/x/ecocredit/server/core/create_batch.go b/x/ecocredit/server/core/create_batch.go index 4d5c17884e..a9bded084d 100644 --- a/x/ecocredit/server/core/create_batch.go +++ b/x/ecocredit/server/core/create_batch.go @@ -21,12 +21,12 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor sdkCtx := sdk.UnwrapSDKContext(ctx) projectID := req.ProjectId - projectInfo, err := k.stateStore.ProjectInfoStore().GetByName(ctx, projectID) + projectInfo, err := k.stateStore.ProjectInfoTable().GetByName(ctx, projectID) if err != nil { return nil, err } - classInfo, err := k.stateStore.ClassInfoStore().Get(ctx, projectInfo.ClassId) + classInfo, err := k.stateStore.ClassInfoTable().Get(ctx, projectInfo.ClassId) if err != nil { return nil, err } @@ -47,7 +47,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor } startDate, endDate := timestamppb.New(req.StartDate.UTC()), timestamppb.New(req.EndDate.UTC()) - rowID, err := k.stateStore.BatchInfoStore().InsertReturningID(ctx, &api.BatchInfo{ + rowID, err := k.stateStore.BatchInfoTable().InsertReturningID(ctx, &api.BatchInfo{ ProjectId: projectInfo.Id, BatchDenom: batchDenom, Metadata: req.Metadata, @@ -93,7 +93,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor return nil, err } } - if err = k.stateStore.BatchBalanceStore().Insert(ctx, &api.BatchBalance{ + if err = k.stateStore.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ Address: recipient, BatchId: rowID, Tradable: tradable.String(), @@ -114,7 +114,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") } - if err = k.stateStore.BatchSupplyStore().Insert(ctx, &api.BatchSupply{ + if err = k.stateStore.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ BatchId: rowID, TradableAmount: tradableSupply.String(), RetiredAmount: retiredSupply.String(), @@ -147,7 +147,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor // getBatchSeqNo gets the batch sequence number func (k Keeper) getBatchSeqNo(ctx context.Context, projectID string) (uint64, error) { var seq uint64 = 1 - batchSeq, err := k.stateStore.BatchSequenceStore().Get(ctx, projectID) + batchSeq, err := k.stateStore.BatchSequenceTable().Get(ctx, projectID) if err != nil { if !ormerrors.IsNotFound(err) { return 0, err @@ -156,7 +156,7 @@ func (k Keeper) getBatchSeqNo(ctx context.Context, projectID string) (uint64, er seq = batchSeq.NextBatchId } - if err = k.stateStore.BatchSequenceStore().Save(ctx, &api.BatchSequence{ + if err = k.stateStore.BatchSequenceTable().Save(ctx, &api.BatchSequence{ ProjectId: projectID, NextBatchId: seq + 1, }); err != nil { diff --git a/x/ecocredit/server/core/create_batch_test.go b/x/ecocredit/server/core/create_batch_test.go index d4c9d3c477..315f21bc3f 100644 --- a/x/ecocredit/server/core/create_batch_test.go +++ b/x/ecocredit/server/core/create_batch_test.go @@ -53,30 +53,30 @@ func TestCreateBatch_Valid(t *testing.T) { totalRetired := "8.7" // check the batch - batch, err := s.stateStore.BatchInfoStore().Get(s.ctx, 1) + batch, err := s.stateStore.BatchInfoTable().Get(s.ctx, 1) assert.NilError(t, err, "unexpected error: %w", err) assert.Equal(t, res.BatchDenom, batch.BatchDenom) // check the supply was set - sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + sup, err := s.stateStore.BatchSupplyTable().Get(s.ctx, 1) assert.NilError(t, err) assert.Equal(t, totalTradable, sup.TradableAmount, "got %s", sup.TradableAmount) assert.Equal(t, totalRetired, sup.RetiredAmount, "got %s", sup.RetiredAmount) assert.Equal(t, "0", sup.CancelledAmount, "got %s", sup.CancelledAmount) // check balances were allocated - bal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + bal, err := s.stateStore.BatchBalanceTable().Get(s.ctx, s.addr, 1) assert.NilError(t, err) assert.Equal(t, "10", bal.Tradable) assert.Equal(t, "5.3", bal.Retired) - bal2, err := s.stateStore.BatchBalanceStore().Get(s.ctx, addr2, 1) + bal2, err := s.stateStore.BatchBalanceTable().Get(s.ctx, addr2, 1) assert.NilError(t, err) assert.Equal(t, "2.4", bal2.Tradable) assert.Equal(t, "3.4", bal2.Retired) // check sequence number - seq, err := s.stateStore.BatchSequenceStore().Get(s.ctx, projectName) + seq, err := s.stateStore.BatchSequenceTable().Get(s.ctx, projectName) assert.NilError(t, err) assert.Equal(t, uint64(2), seq.NextBatchId) } @@ -134,19 +134,19 @@ func TestCreateBatch_ProjectNotFound(t *testing.T) { // creates a class "C01", with a single class issuer, and a project "PRO" func batchTestSetup(t *testing.T, ctx context.Context, ss api.StateStore, addr types.AccAddress) (className, projectName string) { className, projectName = "C01", "PRO" - cid, err := ss.ClassInfoStore().InsertReturningID(ctx, &api.ClassInfo{ + cid, err := ss.ClassInfoTable().InsertReturningID(ctx, &api.ClassInfo{ Name: className, Admin: addr, Metadata: "", CreditType: "C", }) assert.NilError(t, err) - err = ss.ClassIssuerStore().Insert(ctx, &api.ClassIssuer{ + err = ss.ClassIssuerTable().Insert(ctx, &api.ClassIssuer{ ClassId: cid, Issuer: addr, }) assert.NilError(t, err) - _, err = ss.ProjectInfoStore().InsertReturningID(ctx, &api.ProjectInfo{ + _, err = ss.ProjectInfoTable().InsertReturningID(ctx, &api.ProjectInfo{ Name: projectName, ClassId: 1, ProjectLocation: "", diff --git a/x/ecocredit/server/core/create_class.go b/x/ecocredit/server/core/create_class.go index 4cc4689003..a8648da06b 100644 --- a/x/ecocredit/server/core/create_class.go +++ b/x/ecocredit/server/core/create_class.go @@ -46,7 +46,7 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c // default the sequence to 1 for the `not found` case. // will get overwritten by the actual sequence if it exists. var seq uint64 = 1 - classSeq, err := k.stateStore.ClassSequenceStore().Get(goCtx, creditType.Abbreviation) + classSeq, err := k.stateStore.ClassSequenceTable().Get(goCtx, creditType.Abbreviation) if err != nil { if !ormerrors.IsNotFound(err) { return nil, err @@ -54,7 +54,7 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c } else { seq = classSeq.NextClassId } - if err = k.stateStore.ClassSequenceStore().Save(goCtx, &api.ClassSequence{ + if err = k.stateStore.ClassSequenceTable().Save(goCtx, &api.ClassSequence{ CreditType: creditType.Abbreviation, NextClassId: seq + 1, }); err != nil { @@ -63,7 +63,7 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c classID := ecocredit.FormatClassID(creditType.Abbreviation, seq) - rowId, err := k.stateStore.ClassInfoStore().InsertReturningID(goCtx, &api.ClassInfo{ + rowId, err := k.stateStore.ClassInfoTable().InsertReturningID(goCtx, &api.ClassInfo{ Name: classID, Admin: adminAddress, Metadata: req.Metadata, @@ -78,7 +78,7 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c if err != nil { return nil, err } - if err = k.stateStore.ClassIssuerStore().Insert(goCtx, &api.ClassIssuer{ + if err = k.stateStore.ClassIssuerTable().Insert(goCtx, &api.ClassIssuer{ ClassId: rowId, Issuer: issuer, }); err != nil { diff --git a/x/ecocredit/server/core/create_class_test.go b/x/ecocredit/server/core/create_class_test.go index 6c6eab24b1..4edb6b866d 100644 --- a/x/ecocredit/server/core/create_class_test.go +++ b/x/ecocredit/server/core/create_class_test.go @@ -35,16 +35,16 @@ func TestCreateClass_Valid(t *testing.T) { assert.Equal(t, res.ClassId, "C01") // check class info - ci, err := s.stateStore.ClassInfoStore().GetByName(s.ctx, res.ClassId) + ci, err := s.stateStore.ClassInfoTable().GetByName(s.ctx, res.ClassId) assert.NilError(t, err) assert.Equal(t, res.ClassId, ci.Name) // check class issuer - _, err = s.stateStore.ClassIssuerStore().Get(s.ctx, ci.Id, s.addr) + _, err = s.stateStore.ClassIssuerTable().Get(s.ctx, ci.Id, s.addr) assert.NilError(t, err) // check sequence number - seq, err := s.stateStore.ClassSequenceStore().Get(s.ctx, "C") + seq, err := s.stateStore.ClassSequenceTable().Get(s.ctx, "C") assert.NilError(t, err) assert.Equal(t, uint64(2), seq.NextClassId) } diff --git a/x/ecocredit/server/core/create_project.go b/x/ecocredit/server/core/create_project.go index c41e372be9..529f8fc476 100644 --- a/x/ecocredit/server/core/create_project.go +++ b/x/ecocredit/server/core/create_project.go @@ -15,7 +15,7 @@ import ( func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) (*core.MsgCreateProjectResponse, error) { sdkCtx := types.UnwrapSDKContext(ctx) classID := req.ClassId - classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, classID) + classInfo, err := k.stateStore.ClassInfoTable().GetByName(ctx, classID) if err != nil { return nil, err } @@ -33,14 +33,14 @@ func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) ( if err != nil { return nil, err } - exists, err = k.stateStore.ProjectInfoStore().HasByClassIdName(ctx, classInfo.Id, projectID) + exists, err = k.stateStore.ProjectInfoTable().HasByClassIdName(ctx, classInfo.Id, projectID) if err != nil { return nil, err } } } - if err = k.stateStore.ProjectInfoStore().Insert(ctx, &api.ProjectInfo{ + if err = k.stateStore.ProjectInfoTable().Insert(ctx, &api.ProjectInfo{ Name: projectID, ClassId: classInfo.Id, ProjectLocation: req.ProjectLocation, @@ -67,7 +67,7 @@ func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) ( // The ID is generated by concatenating the classID and a sequence number. func (k Keeper) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { var nextID uint64 - projectSeqNo, err := k.stateStore.ProjectSequenceStore().Get(ctx, classRowID) + projectSeqNo, err := k.stateStore.ProjectSequenceTable().Get(ctx, classRowID) switch err { case ormerrors.NotFound: nextID = 1 @@ -77,7 +77,7 @@ func (k Keeper) genProjectID(ctx context.Context, classRowID uint64, classID str return "", err } - if err = k.stateStore.ProjectSequenceStore().Save(ctx, &api.ProjectSequence{ + if err = k.stateStore.ProjectSequenceTable().Save(ctx, &api.ProjectSequence{ ClassId: classRowID, NextProjectId: nextID + 1, }); err != nil { diff --git a/x/ecocredit/server/core/create_project_test.go b/x/ecocredit/server/core/create_project_test.go index f8ae7a333d..f72a824265 100644 --- a/x/ecocredit/server/core/create_project_test.go +++ b/x/ecocredit/server/core/create_project_test.go @@ -27,7 +27,7 @@ func TestCreateProject_ValidProjectState(t *testing.T) { assert.NilError(t, err) assert.Equal(t, res.ProjectId, "FOO") - project, err := s.stateStore.ProjectInfoStore().GetByName(s.ctx, "FOO") + project, err := s.stateStore.ProjectInfoTable().GetByName(s.ctx, "FOO") assert.NilError(t, err) assert.Equal(t, project.ProjectLocation, "US-NY") } @@ -91,13 +91,13 @@ func TestCreateProject_NoDuplicates(t *testing.T) { } func makeClass(t *testing.T, ctx context.Context, ss api.StateStore, addr types.AccAddress) { - assert.NilError(t, ss.ClassInfoStore().Insert(ctx, &api.ClassInfo{ + assert.NilError(t, ss.ClassInfoTable().Insert(ctx, &api.ClassInfo{ Name: "C01", Admin: addr, Metadata: "", CreditType: "C", })) - assert.NilError(t, ss.ClassIssuerStore().Insert(ctx, &api.ClassIssuer{ + assert.NilError(t, ss.ClassIssuerTable().Insert(ctx, &api.ClassIssuer{ ClassId: 1, Issuer: addr, })) diff --git a/x/ecocredit/server/core/keeper_test.go b/x/ecocredit/server/core/keeper_test.go index 80f9ecd5b2..365eafd667 100644 --- a/x/ecocredit/server/core/keeper_test.go +++ b/x/ecocredit/server/core/keeper_test.go @@ -43,7 +43,7 @@ func setupBase(t *testing.T) *baseSuite { // prepare database s := &baseSuite{t: t} var err error - s.db, err = ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{}) + s.db, err = ormdb.NewModuleDB(&server.ModuleSchema, ormdb.ModuleDBOptions{}) assert.NilError(t, err) s.stateStore, err = api.NewStateStore(s.db) assert.NilError(t, err) @@ -72,32 +72,32 @@ func setupBase(t *testing.T) *baseSuite { // supply/balance of "10.5" for both retired and tradable. func (s baseSuite) setupClassProjectBatch(t *testing.T) (className, projectName, batchDenom string) { className, projectName, batchDenom = "C01", "PRO", "C01-20200101-20210101-01" - assert.NilError(t, s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + assert.NilError(t, s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", CreditType: "C", })) - assert.NilError(t, s.stateStore.ProjectInfoStore().Insert(s.ctx, &api.ProjectInfo{ + assert.NilError(t, s.stateStore.ProjectInfoTable().Insert(s.ctx, &api.ProjectInfo{ Name: "PRO", ClassId: 1, ProjectLocation: "US-OR", Metadata: "", })) - assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &api.BatchInfo{ + assert.NilError(t, s.stateStore.BatchInfoTable().Insert(s.ctx, &api.BatchInfo{ ProjectId: 1, BatchDenom: "C01-20200101-20210101-01", Metadata: "", StartDate: ×tamppb.Timestamp{Seconds: 2}, EndDate: ×tamppb.Timestamp{Seconds: 2}, })) - assert.NilError(t, s.stateStore.BatchSupplyStore().Insert(s.ctx, &api.BatchSupply{ + assert.NilError(t, s.stateStore.BatchSupplyTable().Insert(s.ctx, &api.BatchSupply{ BatchId: 1, TradableAmount: "10.5", RetiredAmount: "10.5", CancelledAmount: "", })) - assert.NilError(t, s.stateStore.BatchBalanceStore().Insert(s.ctx, &api.BatchBalance{ + assert.NilError(t, s.stateStore.BatchBalanceTable().Insert(s.ctx, &api.BatchBalance{ Address: s.addr, BatchId: 1, Tradable: "10.5", diff --git a/x/ecocredit/server/core/query_balance.go b/x/ecocredit/server/core/query_balance.go index a7b0ff33a9..e97df68902 100644 --- a/x/ecocredit/server/core/query_balance.go +++ b/x/ecocredit/server/core/query_balance.go @@ -12,7 +12,7 @@ import ( // Balance queries the balance (both tradable and retired) of a given credit // batch for a given account. func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*core.QueryBalanceResponse, error) { - batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, req.BatchDenom) + batch, err := k.stateStore.BatchInfoTable().GetByBatchDenom(ctx, req.BatchDenom) if err != nil { return nil, err } @@ -21,7 +21,7 @@ func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*co return nil, err } - balance, err := k.stateStore.BatchBalanceStore().Get(ctx, addr, batch.Id) + balance, err := k.stateStore.BatchBalanceTable().Get(ctx, addr, batch.Id) if err != nil { if ormerrors.IsNotFound(err) { return &core.QueryBalanceResponse{ diff --git a/x/ecocredit/server/core/query_balance_test.go b/x/ecocredit/server/core/query_balance_test.go index 713af6fae7..c06893b426 100644 --- a/x/ecocredit/server/core/query_balance_test.go +++ b/x/ecocredit/server/core/query_balance_test.go @@ -20,14 +20,14 @@ func TestQuery_Balance(t *testing.T) { retired := "50.3214" // make a batch and give s.addr some balance - assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &api.BatchInfo{ + assert.NilError(t, s.stateStore.BatchInfoTable().Insert(s.ctx, &api.BatchInfo{ ProjectId: 1, BatchDenom: batchDenom, Metadata: "", StartDate: nil, EndDate: nil, })) - assert.NilError(t, s.stateStore.BatchBalanceStore().Insert(s.ctx, &api.BatchBalance{ + assert.NilError(t, s.stateStore.BatchBalanceTable().Insert(s.ctx, &api.BatchBalance{ Address: s.addr, BatchId: 1, Tradable: tradable, diff --git a/x/ecocredit/server/core/query_batch_info.go b/x/ecocredit/server/core/query_batch_info.go index b5a437d538..121668683d 100644 --- a/x/ecocredit/server/core/query_batch_info.go +++ b/x/ecocredit/server/core/query_batch_info.go @@ -13,7 +13,7 @@ func (k Keeper) BatchInfo(ctx context.Context, request *core.QueryBatchInfoReque return nil, err } - batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) + batch, err := k.stateStore.BatchInfoTable().GetByBatchDenom(ctx, request.BatchDenom) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_batch_info_test.go b/x/ecocredit/server/core/query_batch_info_test.go index cd3145e347..23dcfa6572 100644 --- a/x/ecocredit/server/core/query_batch_info_test.go +++ b/x/ecocredit/server/core/query_batch_info_test.go @@ -15,7 +15,7 @@ func TestQuery_BatchInfo(t *testing.T) { t.Parallel() s := setupBase(t) batchDenom := "C01-20200101-20220101-001" - assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &api.BatchInfo{ + assert.NilError(t, s.stateStore.BatchInfoTable().Insert(s.ctx, &api.BatchInfo{ ProjectId: 1, BatchDenom: batchDenom, Metadata: "", diff --git a/x/ecocredit/server/core/query_batches.go b/x/ecocredit/server/core/query_batches.go index ded45a87d1..d1a5de6241 100644 --- a/x/ecocredit/server/core/query_batches.go +++ b/x/ecocredit/server/core/query_batches.go @@ -14,11 +14,11 @@ func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) if err != nil { return nil, err } - project, err := k.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) + project, err := k.stateStore.ProjectInfoTable().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } - it, err := k.stateStore.BatchInfoStore().List(ctx, api.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(pg)) + it, err := k.stateStore.BatchInfoTable().List(ctx, api.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(pg)) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_batches_test.go b/x/ecocredit/server/core/query_batches_test.go index 501720dfdb..653c33bd83 100644 --- a/x/ecocredit/server/core/query_batches_test.go +++ b/x/ecocredit/server/core/query_batches_test.go @@ -17,20 +17,20 @@ func TestQuery_Batches(t *testing.T) { s := setupBase(t) // make a project and two batches - assert.NilError(t, s.stateStore.ProjectInfoStore().Insert(s.ctx, &api.ProjectInfo{ + assert.NilError(t, s.stateStore.ProjectInfoTable().Insert(s.ctx, &api.ProjectInfo{ Name: "P01", ClassId: 1, ProjectLocation: "US-CA", Metadata: "", })) - assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &api.BatchInfo{ + assert.NilError(t, s.stateStore.BatchInfoTable().Insert(s.ctx, &api.BatchInfo{ ProjectId: 1, BatchDenom: "C01-20200101-20220101-001", Metadata: "", StartDate: nil, EndDate: nil, })) - assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &api.BatchInfo{ + assert.NilError(t, s.stateStore.BatchInfoTable().Insert(s.ctx, &api.BatchInfo{ ProjectId: 1, BatchDenom: "C01-20200101-20220101-002", Metadata: "", diff --git a/x/ecocredit/server/core/query_class_info.go b/x/ecocredit/server/core/query_class_info.go index 738d839874..5acf8fa93e 100644 --- a/x/ecocredit/server/core/query_class_info.go +++ b/x/ecocredit/server/core/query_class_info.go @@ -7,7 +7,7 @@ import ( // ClassInfo queries for information on a credit class. func (k Keeper) ClassInfo(ctx context.Context, request *core.QueryClassInfoRequest) (*core.QueryClassInfoResponse, error) { - classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + classInfo, err := k.stateStore.ClassInfoTable().GetByName(ctx, request.ClassId) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_class_info_test.go b/x/ecocredit/server/core/query_class_info_test.go index 7d03ea760c..48d30f7b40 100644 --- a/x/ecocredit/server/core/query_class_info_test.go +++ b/x/ecocredit/server/core/query_class_info_test.go @@ -14,7 +14,7 @@ import ( func TestQuery_ClassInfo(t *testing.T) { t.Parallel() s := setupBase(t) - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", diff --git a/x/ecocredit/server/core/query_class_issuers.go b/x/ecocredit/server/core/query_class_issuers.go index 495342727b..42cf42b74d 100644 --- a/x/ecocredit/server/core/query_class_issuers.go +++ b/x/ecocredit/server/core/query_class_issuers.go @@ -17,12 +17,12 @@ func (k Keeper) ClassIssuers(ctx context.Context, request *core.QueryClassIssuer return nil, err } - classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + classInfo, err := k.stateStore.ClassInfoTable().GetByName(ctx, request.ClassId) if err != nil { return nil, err } - it, err := k.stateStore.ClassIssuerStore().List(ctx, api.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(pg)) + it, err := k.stateStore.ClassIssuerTable().List(ctx, api.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(pg)) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_class_issuers_test.go b/x/ecocredit/server/core/query_class_issuers_test.go index 1d3d1a8b41..3afa5e6792 100644 --- a/x/ecocredit/server/core/query_class_issuers_test.go +++ b/x/ecocredit/server/core/query_class_issuers_test.go @@ -19,22 +19,22 @@ func TestQuery_ClassIssuers(t *testing.T) { // make a class with 3 issuers. addrs := genAddrs(2) issuers := append(addrs, s.addr) - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &ecocreditv1.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", CreditType: "C", }) assert.NilError(t, err) - assert.NilError(t, s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1.ClassIssuer{ + assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &ecocreditv1.ClassIssuer{ ClassId: 1, Issuer: s.addr, })) - assert.NilError(t, s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1.ClassIssuer{ + assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &ecocreditv1.ClassIssuer{ ClassId: 1, Issuer: addrs[0], })) - assert.NilError(t, s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1.ClassIssuer{ + assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &ecocreditv1.ClassIssuer{ ClassId: 1, Issuer: addrs[1], })) diff --git a/x/ecocredit/server/core/query_classes.go b/x/ecocredit/server/core/query_classes.go index 16f01e8513..d407395ffe 100644 --- a/x/ecocredit/server/core/query_classes.go +++ b/x/ecocredit/server/core/query_classes.go @@ -14,7 +14,7 @@ func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) if err != nil { return nil, err } - it, err := k.stateStore.ClassInfoStore().List(ctx, &api.ClassInfoPrimaryKey{}, ormlist.Paginate(pg)) + it, err := k.stateStore.ClassInfoTable().List(ctx, &api.ClassInfoPrimaryKey{}, ormlist.Paginate(pg)) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_classes_test.go b/x/ecocredit/server/core/query_classes_test.go index ffbee72bec..4252f2893a 100644 --- a/x/ecocredit/server/core/query_classes_test.go +++ b/x/ecocredit/server/core/query_classes_test.go @@ -14,14 +14,14 @@ import ( func TestQuery_Classes(t *testing.T) { t.Parallel() s := setupBase(t) - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", CreditType: "C", }) assert.NilError(t, err) - err = s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err = s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C02", Admin: s.addr, Metadata: "", diff --git a/x/ecocredit/server/core/query_credit_types.go b/x/ecocredit/server/core/query_credit_types.go index 12b7a4ebf3..dfd8787078 100644 --- a/x/ecocredit/server/core/query_credit_types.go +++ b/x/ecocredit/server/core/query_credit_types.go @@ -10,7 +10,7 @@ import ( // CreditTypes queries the list of allowed types that credit classes can have. func (k Keeper) CreditTypes(ctx context.Context, _ *core.QueryCreditTypesRequest) (*core.QueryCreditTypesResponse, error) { creditTypes := make([]*core.CreditType, 0) - it, err := k.stateStore.CreditTypeStore().List(ctx, api.CreditTypePrimaryKey{}) + it, err := k.stateStore.CreditTypeTable().List(ctx, api.CreditTypePrimaryKey{}) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_credit_types_test.go b/x/ecocredit/server/core/query_credit_types_test.go index f53f474d0d..8e2da0a4cd 100644 --- a/x/ecocredit/server/core/query_credit_types_test.go +++ b/x/ecocredit/server/core/query_credit_types_test.go @@ -14,13 +14,13 @@ func TestQuery_CreditTypes(t *testing.T) { s := setupBase(t) // insert a few credit types - assert.NilError(t, s.stateStore.CreditTypeStore().Insert(s.ctx, &api.CreditType{ + assert.NilError(t, s.stateStore.CreditTypeTable().Insert(s.ctx, &api.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "a ton", Precision: 6, })) - assert.NilError(t, s.stateStore.CreditTypeStore().Insert(s.ctx, &api.CreditType{ + assert.NilError(t, s.stateStore.CreditTypeTable().Insert(s.ctx, &api.CreditType{ Abbreviation: "F", Name: "foobar", Unit: "foo per inch", diff --git a/x/ecocredit/server/core/query_params_test.go b/x/ecocredit/server/core/query_params_test.go index 2e2eb4f856..6c8a16e4a3 100644 --- a/x/ecocredit/server/core/query_params_test.go +++ b/x/ecocredit/server/core/query_params_test.go @@ -18,7 +18,7 @@ func TestQuery_Params(t *testing.T) { s := setupBase(t) any := gomock.Any() - assert.NilError(t, s.stateStore.CreditTypeStore().Insert(s.ctx, &api.CreditType{ + assert.NilError(t, s.stateStore.CreditTypeTable().Insert(s.ctx, &api.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "a ton", diff --git a/x/ecocredit/server/core/query_project_info.go b/x/ecocredit/server/core/query_project_info.go index b244cf750e..19c8a33031 100644 --- a/x/ecocredit/server/core/query_project_info.go +++ b/x/ecocredit/server/core/query_project_info.go @@ -7,7 +7,7 @@ import ( // ProjectInfo queries project info from the given project name. func (k Keeper) ProjectInfo(ctx context.Context, request *core.QueryProjectInfoRequest) (*core.QueryProjectInfoResponse, error) { - info, err := k.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) + info, err := k.stateStore.ProjectInfoTable().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_project_info_test.go b/x/ecocredit/server/core/query_project_info_test.go index 5dcb5d9aef..ca5a7eca2e 100644 --- a/x/ecocredit/server/core/query_project_info_test.go +++ b/x/ecocredit/server/core/query_project_info_test.go @@ -16,7 +16,7 @@ func TestQuery_ProjectInfo(t *testing.T) { s := setupBase(t) // insert 1 project - err := s.stateStore.ProjectInfoStore().Insert(s.ctx, &api.ProjectInfo{ + err := s.stateStore.ProjectInfoTable().Insert(s.ctx, &api.ProjectInfo{ Name: "P01", ClassId: 1, ProjectLocation: "US-CA", diff --git a/x/ecocredit/server/core/query_projects.go b/x/ecocredit/server/core/query_projects.go index ae7c198c5e..60fad84afc 100644 --- a/x/ecocredit/server/core/query_projects.go +++ b/x/ecocredit/server/core/query_projects.go @@ -14,11 +14,11 @@ func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest if err != nil { return nil, err } - cInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + cInfo, err := k.stateStore.ClassInfoTable().GetByName(ctx, request.ClassId) if err != nil { return nil, err } - it, err := k.stateStore.ProjectInfoStore().List(ctx, api.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(pg)) + it, err := k.stateStore.ProjectInfoTable().List(ctx, api.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(pg)) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_projects_test.go b/x/ecocredit/server/core/query_projects_test.go index 64066e4182..685e855373 100644 --- a/x/ecocredit/server/core/query_projects_test.go +++ b/x/ecocredit/server/core/query_projects_test.go @@ -17,21 +17,21 @@ func TestQuery_Projects(t *testing.T) { s := setupBase(t) // create a class and 2 projects from it - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", CreditType: "C", }) assert.NilError(t, err) - err = s.stateStore.ProjectInfoStore().Insert(s.ctx, &api.ProjectInfo{ + err = s.stateStore.ProjectInfoTable().Insert(s.ctx, &api.ProjectInfo{ Name: "P01", ClassId: 1, ProjectLocation: "US-CA", Metadata: "", }) assert.NilError(t, err) - err = s.stateStore.ProjectInfoStore().Insert(s.ctx, &api.ProjectInfo{ + err = s.stateStore.ProjectInfoTable().Insert(s.ctx, &api.ProjectInfo{ Name: "P02", ClassId: 1, ProjectLocation: "US-CA", diff --git a/x/ecocredit/server/core/query_supply.go b/x/ecocredit/server/core/query_supply.go index 2652eacf0c..f4eeaf7150 100644 --- a/x/ecocredit/server/core/query_supply.go +++ b/x/ecocredit/server/core/query_supply.go @@ -8,12 +8,12 @@ import ( // Supply queries the supply (tradable, retired, cancelled) of a given credit batch. func (k Keeper) Supply(ctx context.Context, request *core.QuerySupplyRequest) (*core.QuerySupplyResponse, error) { - batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) + batch, err := k.stateStore.BatchInfoTable().GetByBatchDenom(ctx, request.BatchDenom) if err != nil { return nil, err } - supply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + supply, err := k.stateStore.BatchSupplyTable().Get(ctx, batch.Id) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/query_supply_test.go b/x/ecocredit/server/core/query_supply_test.go index 22511f7f4d..ce9e280731 100644 --- a/x/ecocredit/server/core/query_supply_test.go +++ b/x/ecocredit/server/core/query_supply_test.go @@ -20,14 +20,14 @@ func TestQuery_Supply(t *testing.T) { cancelled := "0.3215" // make a batch and some supply - assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &api.BatchInfo{ + assert.NilError(t, s.stateStore.BatchInfoTable().Insert(s.ctx, &api.BatchInfo{ ProjectId: 1, BatchDenom: batchDenom, Metadata: "", StartDate: nil, EndDate: nil, })) - assert.NilError(t, s.stateStore.BatchSupplyStore().Insert(s.ctx, &api.BatchSupply{ + assert.NilError(t, s.stateStore.BatchSupplyTable().Insert(s.ctx, &api.BatchSupply{ BatchId: 1, TradableAmount: tradable, RetiredAmount: retired, diff --git a/x/ecocredit/server/core/retire.go b/x/ecocredit/server/core/retire.go index 2aaa27a695..212d0083a9 100644 --- a/x/ecocredit/server/core/retire.go +++ b/x/ecocredit/server/core/retire.go @@ -19,7 +19,7 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir holder, _ := sdk.AccAddressFromBech32(req.Holder) for _, credit := range req.Credits { - batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) + batch, err := k.stateStore.BatchInfoTable().GetByBatchDenom(ctx, credit.BatchDenom) if err != nil { return nil, err } @@ -27,7 +27,7 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir if err != nil { return nil, err } - userBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) + userBalance, err := k.stateStore.BatchBalanceTable().Get(ctx, holder, batch.Id) if err != nil { return nil, err } @@ -50,7 +50,7 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir if err != nil { return nil, err } - batchSupply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + batchSupply, err := k.stateStore.BatchSupplyTable().Get(ctx, batch.Id) if err != nil { return nil, err } @@ -68,7 +68,7 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir return nil, err } - if err = k.stateStore.BatchBalanceStore().Update(ctx, &api.BatchBalance{ + if err = k.stateStore.BatchBalanceTable().Update(ctx, &api.BatchBalance{ Address: holder, BatchId: batch.Id, Tradable: userTradableBalance.String(), @@ -76,7 +76,7 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir }); err != nil { return nil, err } - err = k.stateStore.BatchSupplyStore().Update(ctx, &api.BatchSupply{ + err = k.stateStore.BatchSupplyTable().Update(ctx, &api.BatchSupply{ BatchId: batch.Id, TradableAmount: supplyTradable.String(), RetiredAmount: supplyRetired.String(), diff --git a/x/ecocredit/server/core/retire_test.go b/x/ecocredit/server/core/retire_test.go index 84421b1c15..264a468b05 100644 --- a/x/ecocredit/server/core/retire_test.go +++ b/x/ecocredit/server/core/retire_test.go @@ -41,12 +41,12 @@ func TestRetire_Valid(t *testing.T) { // check both balance and supply reflect the change - bal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + bal, err := s.stateStore.BatchBalanceTable().Get(s.ctx, s.addr, 1) assert.NilError(t, err) assert.Equal(t, bal.Tradable, "0.5") assert.Equal(t, bal.Retired, "20.5") - sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + sup, err := s.stateStore.BatchSupplyTable().Get(s.ctx, 1) assert.NilError(t, err) assert.Equal(t, sup.TradableAmount, "0.5") assert.Equal(t, sup.RetiredAmount, "20.5") diff --git a/x/ecocredit/server/core/send.go b/x/ecocredit/server/core/send.go index abf2fa5598..d91123fce6 100644 --- a/x/ecocredit/server/core/send.go +++ b/x/ecocredit/server/core/send.go @@ -41,7 +41,7 @@ func (k Keeper) Send(ctx context.Context, req *core.MsgSend) (*core.MsgSendRespo } func (k Keeper) sendEcocredits(ctx context.Context, credit *core.MsgSend_SendCredits, to, from sdk.AccAddress) error { - batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) + batch, err := k.stateStore.BatchInfoTable().GetByBatchDenom(ctx, credit.BatchDenom) if err != nil { return err } @@ -51,11 +51,11 @@ func (k Keeper) sendEcocredits(ctx context.Context, credit *core.MsgSend_SendCre } precision := creditType.Precision - batchSupply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + batchSupply, err := k.stateStore.BatchSupplyTable().Get(ctx, batch.Id) if err != nil { return err } - fromBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, from, batch.Id) + fromBalance, err := k.stateStore.BatchBalanceTable().Get(ctx, from, batch.Id) if err != nil { if err == ormerrors.NotFound { return ecocredit.ErrInsufficientFunds.Wrapf("you do not have any credits from batch %s", batch.BatchDenom) @@ -63,7 +63,7 @@ func (k Keeper) sendEcocredits(ctx context.Context, credit *core.MsgSend_SendCre return err } - toBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, to, batch.Id) + toBalance, err := k.stateStore.BatchBalanceTable().Get(ctx, to, batch.Id) if err != nil { if err == ormerrors.NotFound { toBalance = &api.BatchBalance{ @@ -117,7 +117,7 @@ func (k Keeper) sendEcocredits(ctx context.Context, credit *core.MsgSend_SendCre } } // update the "to" balance - if err := k.stateStore.BatchBalanceStore().Save(ctx, &api.BatchBalance{ + if err := k.stateStore.BatchBalanceTable().Save(ctx, &api.BatchBalance{ Address: to, BatchId: batch.Id, Tradable: toTradableBalance.String(), @@ -127,7 +127,7 @@ func (k Keeper) sendEcocredits(ctx context.Context, credit *core.MsgSend_SendCre } // update the "from" balance - if err := k.stateStore.BatchBalanceStore().Update(ctx, &api.BatchBalance{ + if err := k.stateStore.BatchBalanceTable().Update(ctx, &api.BatchBalance{ Address: from, BatchId: batch.Id, Tradable: fromTradableBalance.String(), @@ -137,7 +137,7 @@ func (k Keeper) sendEcocredits(ctx context.Context, credit *core.MsgSend_SendCre } // update the "retired" supply only if credits were retired if didRetire { - if err := k.stateStore.BatchSupplyStore().Update(ctx, &api.BatchSupply{ + if err := k.stateStore.BatchSupplyTable().Update(ctx, &api.BatchSupply{ BatchId: batch.Id, TradableAmount: batchSupplyTradable.String(), RetiredAmount: batchSupplyRetired.String(), diff --git a/x/ecocredit/server/core/send_test.go b/x/ecocredit/server/core/send_test.go index 05c987147b..c49025f920 100644 --- a/x/ecocredit/server/core/send_test.go +++ b/x/ecocredit/server/core/send_test.go @@ -34,10 +34,10 @@ func TestSend_Valid(t *testing.T) { }) assert.NilError(t, err) - senderBal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + senderBal, err := s.stateStore.BatchBalanceTable().Get(s.ctx, s.addr, 1) assert.NilError(t, err) - recipientBal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, recipient, 1) + recipientBal, err := s.stateStore.BatchBalanceTable().Get(s.ctx, recipient, 1) assert.NilError(t, err) // sender tradable -> 10.5 - 2.51 = 7.99 @@ -50,7 +50,7 @@ func TestSend_Valid(t *testing.T) { assert.Equal(t, "1.30", recipientBal.Retired) assert.Equal(t, "10.5", senderBal.Retired) // retired credits should be untouched - sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + sup, err := s.stateStore.BatchSupplyTable().Get(s.ctx, 1) assert.NilError(t, err) // retired -> 10.5 + 1.30(retired) = 11.80 diff --git a/x/ecocredit/server/core/update_class.go b/x/ecocredit/server/core/update_class.go index 5fbf53e5ab..bea5bb6c58 100644 --- a/x/ecocredit/server/core/update_class.go +++ b/x/ecocredit/server/core/update_class.go @@ -23,7 +23,7 @@ func (k Keeper) UpdateClassAdmin(ctx context.Context, req *core.MsgUpdateClassAd return nil, err } - classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) + classInfo, err := k.stateStore.ClassInfoTable().GetByName(ctx, req.ClassId) if err != nil { return nil, sdkerrors.ErrNotFound.Wrapf("class %s not found", req.ClassId) } @@ -33,7 +33,7 @@ func (k Keeper) UpdateClassAdmin(ctx context.Context, req *core.MsgUpdateClassAd return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) } classInfo.Admin = newAdmin - if err = k.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { + if err = k.stateStore.ClassInfoTable().Update(ctx, classInfo); err != nil { return nil, err } return &core.MsgUpdateClassAdminResponse{}, err @@ -46,7 +46,7 @@ func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClass return nil, err } - class, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) + class, err := k.stateStore.ClassInfoTable().GetByName(ctx, req.ClassId) if err != nil { return nil, sdkerrors.ErrNotFound.Wrapf("class %s not found", req.ClassId) } @@ -62,7 +62,7 @@ func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClass if err != nil { return nil, err } - if err = k.stateStore.ClassIssuerStore().Delete(ctx, &api.ClassIssuer{ + if err = k.stateStore.ClassIssuerTable().Delete(ctx, &api.ClassIssuer{ ClassId: class.Id, Issuer: issuerAcc, }); err != nil { @@ -76,7 +76,7 @@ func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClass if err != nil { return nil, err } - if err = k.stateStore.ClassIssuerStore().Insert(ctx, &api.ClassIssuer{ + if err = k.stateStore.ClassIssuerTable().Insert(ctx, &api.ClassIssuer{ ClassId: class.Id, Issuer: issuerAcc, }); err != nil { @@ -93,7 +93,7 @@ func (k Keeper) UpdateClassMetadata(ctx context.Context, req *core.MsgUpdateClas return nil, err } - classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) + classInfo, err := k.stateStore.ClassInfoTable().GetByName(ctx, req.ClassId) if err != nil { return nil, sdkerrors.ErrNotFound.Wrapf("class %s not found", req.ClassId) } @@ -104,7 +104,7 @@ func (k Keeper) UpdateClassMetadata(ctx context.Context, req *core.MsgUpdateClas } classInfo.Metadata = req.Metadata - if err = k.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { + if err = k.stateStore.ClassInfoTable().Update(ctx, classInfo); err != nil { return nil, err } diff --git a/x/ecocredit/server/core/update_class_test.go b/x/ecocredit/server/core/update_class_test.go index 865041ec98..3af2b0bdda 100644 --- a/x/ecocredit/server/core/update_class_test.go +++ b/x/ecocredit/server/core/update_class_test.go @@ -21,7 +21,7 @@ func TestUpdateClass_UpdateAdmin(t *testing.T) { addrs := genAddrs(1) newAdmin := addrs[0] - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", @@ -36,7 +36,7 @@ func TestUpdateClass_UpdateAdmin(t *testing.T) { }) assert.NilError(t, err) - cInfo, err := s.stateStore.ClassInfoStore().Get(s.ctx, 1) + cInfo, err := s.stateStore.ClassInfoTable().Get(s.ctx, 1) assert.NilError(t, err) assert.Check(t, newAdmin.Equals(types.AccAddress(cInfo.Admin))) } @@ -46,7 +46,7 @@ func TestUpdateClass_UpdateAdminErrs(t *testing.T) { s := setupBase(t) addr := genAddrs(1)[0] - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", @@ -78,7 +78,7 @@ func TestUpdateClass_Issuers(t *testing.T) { addrs := genAddrs(3) // addrs to initially populate the class issuer store newAddrs := genAddrs(3) // addrs to add in an update call - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", @@ -88,7 +88,7 @@ func TestUpdateClass_Issuers(t *testing.T) { // insert some addrs for _, addr := range addrs { - err := s.stateStore.ClassIssuerStore().Insert(s.ctx, &api.ClassIssuer{ + err := s.stateStore.ClassIssuerTable().Insert(s.ctx, &api.ClassIssuer{ ClassId: 1, Issuer: addr, }) @@ -110,7 +110,7 @@ func TestUpdateClass_Issuers(t *testing.T) { // check that the new addrs were added count := 0 - it, err := s.stateStore.ClassIssuerStore().List(s.ctx, api.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(1)) + it, err := s.stateStore.ClassIssuerTable().List(s.ctx, api.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(1)) assert.NilError(t, err) for it.Next() { count++ @@ -132,7 +132,7 @@ func TestUpdateClass_Issuers(t *testing.T) { assert.NilError(t, err) // check that the removed addrs no longer exist - it, err = s.stateStore.ClassIssuerStore().List(s.ctx, api.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(1)) + it, err = s.stateStore.ClassIssuerTable().List(s.ctx, api.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(1)) assert.NilError(t, err) for it.Next() { val, err := it.Value() @@ -149,14 +149,14 @@ func TestUpdateClass_IssuersErrs(t *testing.T) { s := setupBase(t) addr := genAddrs(1)[0] - classRowId, err := s.stateStore.ClassInfoStore().InsertReturningID(s.ctx, &api.ClassInfo{ + classRowId, err := s.stateStore.ClassInfoTable().InsertReturningID(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", CreditType: "C", }) assert.NilError(t, err) - err = s.stateStore.ClassIssuerStore().Insert(s.ctx, &api.ClassIssuer{ + err = s.stateStore.ClassIssuerTable().Insert(s.ctx, &api.ClassIssuer{ ClassId: classRowId, Issuer: s.addr, }) @@ -194,7 +194,7 @@ func TestUpdateClass_Metadata(t *testing.T) { t.Parallel() s := setupBase(t) - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "foobar", @@ -209,7 +209,7 @@ func TestUpdateClass_Metadata(t *testing.T) { }) assert.NilError(t, err) - class, err := s.stateStore.ClassInfoStore().Get(s.ctx, 1) + class, err := s.stateStore.ClassInfoTable().Get(s.ctx, 1) assert.NilError(t, err) assert.Equal(t, "barfoo", class.Metadata) } @@ -219,7 +219,7 @@ func TestUpdateClass_MetadataErrs(t *testing.T) { s := setupBase(t) addr := genAddrs(1)[0] - err := s.stateStore.ClassInfoStore().Insert(s.ctx, &api.ClassInfo{ + err := s.stateStore.ClassInfoTable().Insert(s.ctx, &api.ClassInfo{ Name: "C01", Admin: s.addr, Metadata: "", diff --git a/x/ecocredit/server/core/utils.go b/x/ecocredit/server/core/utils.go index 97f1795dd0..6ce00eb0ec 100644 --- a/x/ecocredit/server/core/utils.go +++ b/x/ecocredit/server/core/utils.go @@ -14,7 +14,7 @@ func (k Keeper) assertClassIssuer(goCtx context.Context, classID uint64, issuer if err != nil { return err } - found, err := k.stateStore.ClassIssuerStore().Has(goCtx, classID, addr) + found, err := k.stateStore.ClassIssuerTable().Has(goCtx, classID, addr) if err != nil { return err } diff --git a/x/ecocredit/server/marketplace/keeper_test.go b/x/ecocredit/server/marketplace/keeper_test.go index f836b684b9..9888e49ec6 100644 --- a/x/ecocredit/server/marketplace/keeper_test.go +++ b/x/ecocredit/server/marketplace/keeper_test.go @@ -43,7 +43,7 @@ func setupBase(t *testing.T) *baseSuite { // prepare database s := &baseSuite{t: t} var err error - s.db, err = ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{}) + s.db, err = ormdb.NewModuleDB(&server.ModuleSchema, ormdb.ModuleDBOptions{}) assert.NilError(t, err) s.coreStore, err = ecocreditv1.NewStateStore(s.db) assert.NilError(t, err) diff --git a/x/ecocredit/server/marketplace/sell.go b/x/ecocredit/server/marketplace/sell.go index 8e605090eb..dcee44b03a 100644 --- a/x/ecocredit/server/marketplace/sell.go +++ b/x/ecocredit/server/marketplace/sell.go @@ -27,7 +27,7 @@ func (k Keeper) Sell(ctx context.Context, req *marketplacev1.MsgSell) (*marketpl sellOrderIds := make([]uint64, len(req.Orders)) for i, order := range req.Orders { - batch, err := k.coreStore.BatchInfoStore().GetByBatchDenom(ctx, order.BatchDenom) + batch, err := k.coreStore.BatchInfoTable().GetByBatchDenom(ctx, order.BatchDenom) if err != nil { return nil, fmt.Errorf("batch denom %v: %v", order.BatchDenom, err) } @@ -57,7 +57,7 @@ func (k Keeper) Sell(ctx context.Context, req *marketplacev1.MsgSell) (*marketpl // return nil, ecocredit.ErrInvalidSellOrder.Wrapf("cannot use coin with denom %s in sell orders", order.AskPrice.Denom) //} - id, err := k.stateStore.SellOrderStore().InsertReturningID(ctx, &marketApi.SellOrder{ + id, err := k.stateStore.SellOrderTable().InsertReturningID(ctx, &marketApi.SellOrder{ Seller: ownerAcc, BatchId: batch.Id, Quantity: order.Quantity, @@ -78,12 +78,12 @@ func (k Keeper) Sell(ctx context.Context, req *marketplacev1.MsgSell) (*marketpl // getOrCreateMarketId attempts to get a market, creating one otherwise, and return the Id. func (k Keeper) getOrCreateMarketId(ctx context.Context, creditTypeAbbrev, bankDenom string) (uint64, error) { - market, err := k.stateStore.MarketStore().GetByCreditTypeBankDenom(ctx, creditTypeAbbrev, bankDenom) + market, err := k.stateStore.MarketTable().GetByCreditTypeBankDenom(ctx, creditTypeAbbrev, bankDenom) switch err { case nil: return market.Id, nil case ormerrors.NotFound: - return k.stateStore.MarketStore().InsertReturningID(ctx, &marketApi.Market{ + return k.stateStore.MarketTable().InsertReturningID(ctx, &marketApi.Market{ CreditType: creditTypeAbbrev, BankDenom: bankDenom, PrecisionModifier: 0, diff --git a/x/ecocredit/server/marketplace/sell_test.go b/x/ecocredit/server/marketplace/sell_test.go index 705014e53c..e064b324c8 100644 --- a/x/ecocredit/server/marketplace/sell_test.go +++ b/x/ecocredit/server/marketplace/sell_test.go @@ -46,7 +46,7 @@ func TestSell_Valid(t *testing.T) { assert.NilError(t, err) assert.Equal(t, 2, len(res.SellOrderIds)) - it, err := s.marketStore.SellOrderStore().List(s.ctx, marketApi.SellOrderSellerIndexKey{}) + it, err := s.marketStore.SellOrderTable().List(s.ctx, marketApi.SellOrderSellerIndexKey{}) assert.NilError(t, err) count := 0 for it.Next() { @@ -79,7 +79,7 @@ func TestSell_CreatesMarket(t *testing.T) { }).Times(1) // market shouldn't exist before sell call - has, err := s.k.stateStore.MarketStore().HasByCreditTypeBankDenom(s.ctx, creditType.Abbreviation, ask.Denom) + has, err := s.k.stateStore.MarketTable().HasByCreditTypeBankDenom(s.ctx, creditType.Abbreviation, ask.Denom) assert.NilError(t, err) assert.Equal(t, false, has) @@ -92,7 +92,7 @@ func TestSell_CreatesMarket(t *testing.T) { assert.NilError(t, err) // market should exist now - has, err = s.k.stateStore.MarketStore().HasByCreditTypeBankDenom(s.ctx, creditType.Abbreviation, ask.Denom) + has, err = s.k.stateStore.MarketTable().HasByCreditTypeBankDenom(s.ctx, creditType.Abbreviation, ask.Denom) assert.NilError(t, err) assert.Equal(t, true, has) } @@ -150,31 +150,31 @@ func TestSell_Invalid(t *testing.T) { } func testSellSetup(t *testing.T, s *baseSuite, batchDenom, bankDenom, displayDenom, classId string, start, end *timestamppb.Timestamp, creditType ecocredit.CreditType) { - assert.NilError(t, s.coreStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1.BatchInfo{ + assert.NilError(t, s.coreStore.BatchInfoTable().Insert(s.ctx, &ecocreditv1.BatchInfo{ ProjectId: 1, BatchDenom: batchDenom, Metadata: "", StartDate: start, EndDate: end, })) - assert.NilError(t, s.coreStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1.ClassInfo{ + assert.NilError(t, s.coreStore.ClassInfoTable().Insert(s.ctx, &ecocreditv1.ClassInfo{ Name: classId, Admin: s.addr, Metadata: "", CreditType: creditType.Abbreviation, })) - assert.NilError(t, s.marketStore.MarketStore().Insert(s.ctx, &marketApi.Market{ + assert.NilError(t, s.marketStore.MarketTable().Insert(s.ctx, &marketApi.Market{ CreditType: creditType.Abbreviation, BankDenom: bankDenom, PrecisionModifier: 0, })) // TODO: awaiting param refactor https://github.com/regen-network/regen-ledger/issues/624 - //assert.NilError(t, s.marketStore.AllowedDenomStore().Insert(s.ctx, &marketApi.AllowedDenom{ + //assert.NilError(t, s.marketStore.AllowedDenomTable().Insert(s.ctx, &marketApi.AllowedDenom{ // BankDenom: bankDenom, // DisplayDenom: displayDenom, // Exponent: 1, //})) - assert.NilError(t, s.k.coreStore.BatchBalanceStore().Insert(s.ctx, &ecocreditv1.BatchBalance{ + assert.NilError(t, s.k.coreStore.BatchBalanceTable().Insert(s.ctx, &ecocreditv1.BatchBalance{ Address: s.addr, BatchId: 1, Tradable: "100", diff --git a/x/ecocredit/server/marketplace/utils.go b/x/ecocredit/server/marketplace/utils.go index f0b64e78f9..e11bed0879 100644 --- a/x/ecocredit/server/marketplace/utils.go +++ b/x/ecocredit/server/marketplace/utils.go @@ -11,7 +11,7 @@ import ( // assertHasBalance checks that the account has `qty` credits from the given batch id. func assertHasBalance(ctx context.Context, store ecocreditv1.StateStore, acc sdk.AccAddress, batchId uint64, qty math.Dec) error { - res, err := store.BatchBalanceStore().Get(ctx, acc, batchId) + res, err := store.BatchBalanceTable().Get(ctx, acc, batchId) if err != nil { return err } @@ -27,5 +27,5 @@ func assertHasBalance(ctx context.Context, store ecocreditv1.StateStore, acc sdk // isDenomAllowed checks if the denom is allowed to be used in orders. func isDenomAllowed(ctx context.Context, store marketplacev1.StateStore, denom string) (bool, error) { - return store.AllowedDenomStore().Has(ctx, denom) + return store.AllowedDenomTable().Has(ctx, denom) } diff --git a/x/ecocredit/server/ormutil/db.go b/x/ecocredit/server/ormutil/db.go index 95dbb1fa25..3654707bd4 100644 --- a/x/ecocredit/server/ormutil/db.go +++ b/x/ecocredit/server/ormutil/db.go @@ -2,6 +2,7 @@ package ormutil import ( "context" + ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" "github.com/regen-network/regen-ledger/types" @@ -13,19 +14,19 @@ import ( // NewStoreKeyDB creates an ormdb.ModuleDB from an ormdb.ModuleDB and a StoreKey. // It is an interim solution for using the ORM in existing Cosmos SDK modules // before fuller integration has been done. -func NewStoreKeyDB(desc ormdb.ModuleSchema, key storetypes.StoreKey, options ormdb.ModuleDBOptions) (ormdb.ModuleDB, error) { - getBackend := func(ctx context.Context) (ormtable.Backend, error) { - sdkCtx := types.UnwrapSDKContext(ctx) - store := sdkCtx.KVStore(key) - wrapper := storeWrapper{store} - return ormtable.NewBackend(ormtable.BackendOptions{ - CommitmentStore: wrapper, - IndexStore: wrapper, - }), nil - } - options.GetBackend = getBackend - options.GetReadBackend = func(ctx context.Context) (ormtable.ReadBackend, error) { - return getBackend(ctx) +func NewStoreKeyDB(desc *ormv1alpha1.ModuleSchemaDescriptor, key storetypes.StoreKey, options ormdb.ModuleDBOptions) (ormdb.ModuleDB, error) { + backEndResolver := func(_ ormv1alpha1.StorageType) (ormtable.BackendResolver, error) { + getBackend := func(ctx context.Context) (ormtable.ReadBackend, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + store := sdkCtx.KVStore(key) + wrapper := storeWrapper{store} + return ormtable.NewBackend(ormtable.BackendOptions{ + CommitmentStore: wrapper, + IndexStore: wrapper, + }), nil + } + return getBackend, nil } + options.GetBackendResolver = backEndResolver return ormdb.NewModuleDB(desc, options) } diff --git a/x/ecocredit/server/ormutil/db_test.go b/x/ecocredit/server/ormutil/db_test.go index 2424ab477e..c668d8a3c5 100644 --- a/x/ecocredit/server/ormutil/db_test.go +++ b/x/ecocredit/server/ormutil/db_test.go @@ -1,15 +1,14 @@ package ormutil import ( + ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" "testing" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/reflect/protoreflect" - "github.com/cosmos/cosmos-sdk/orm/model/ormdb" "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" @@ -30,10 +29,16 @@ func sdkContextForStoreKey(key *types.KVStoreKey) sdk.Context { func TestStoreKeyDB(t *testing.T) { storeKey := types.NewKVStoreKey("test") + db, err := NewStoreKeyDB( - ormdb.ModuleSchema{FileDescriptors: map[uint32]protoreflect.FileDescriptor{ - 1: ecocreditv1.File_regen_ecocredit_v1_state_proto, - }}, + &ormv1alpha1.ModuleSchemaDescriptor{ + SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{ + { + Id: 1, + ProtoFileName: ecocreditv1.File_regen_ecocredit_v1_state_proto.Path(), + StorageType: ormv1alpha1.StorageType_STORAGE_TYPE_DEFAULT_UNSPECIFIED, + }, + }}, storeKey, ormdb.ModuleDBOptions{}, ) diff --git a/x/ecocredit/server/server.go b/x/ecocredit/server/server.go index 1205f8ff0b..8cd5a1bb71 100644 --- a/x/ecocredit/server/server.go +++ b/x/ecocredit/server/server.go @@ -1,8 +1,8 @@ package server import ( + ormv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" marketApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - "google.golang.org/protobuf/reflect/protoreflect" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/orm/model/ormdb" @@ -21,14 +21,6 @@ import ( ) const ( - TradableBalancePrefix byte = 0x0 - TradableSupplyPrefix byte = 0x1 - RetiredBalancePrefix byte = 0x2 - RetiredSupplyPrefix byte = 0x3 - CreditTypeSeqTablePrefix byte = 0x4 - ClassInfoTablePrefix byte = 0x5 - BatchInfoTablePrefix byte = 0x6 - ProjectInfoTablePrefix byte = 0x10 ProjectInfoTableSeqPrefix byte = 0x11 ProjectsByClassIDIndex byte = 0x12 @@ -87,11 +79,11 @@ type serverImpl struct { db ormdb.ModuleDB } -var ModuleSchema = ormdb.ModuleSchema{ - FileDescriptors: map[uint32]protoreflect.FileDescriptor{ - 1: api.File_regen_ecocredit_v1_state_proto, - 2: basketapi.File_regen_ecocredit_basket_v1_state_proto, - 3: marketApi.File_regen_ecocredit_marketplace_v1_state_proto, +var ModuleSchema = ormv1alpha1.ModuleSchemaDescriptor{ + SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{ + {Id: 1, ProtoFileName: api.File_regen_ecocredit_v1_state_proto.Path()}, + {Id: 2, ProtoFileName: basketapi.File_regen_ecocredit_basket_v1_state_proto.Path()}, + {Id: 3, ProtoFileName: marketApi.File_regen_ecocredit_marketplace_v1_state_proto.Path()}, }, Prefix: []byte{ecocredit.ORMPrefix}, } @@ -236,7 +228,7 @@ func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, s.projectInfoTable = projectInfoTableBuilder.Build() - s.db, err = ormutil.NewStoreKeyDB(ModuleSchema, storeKey, ormdb.ModuleDBOptions{}) + s.db, err = ormutil.NewStoreKeyDB(&ModuleSchema, storeKey, ormdb.ModuleDBOptions{}) if err != nil { panic(err) } diff --git a/x/ecocredit/server/utils.go b/x/ecocredit/server/utils.go index 148398c938..86bb06d312 100644 --- a/x/ecocredit/server/utils.go +++ b/x/ecocredit/server/utils.go @@ -31,7 +31,7 @@ func GetCreditType(ctAbbrev string, creditTypes []*ecocredit.CreditType) (ecocre func GetCreditTypeFromBatchDenom(ctx context.Context, store ecocreditv1.StateStore, k ParamKeeper, denom string) (ecocredit.CreditType, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) classId := ecocredit.GetClassIdFromBatchDenom(denom) - classInfo, err := store.ClassInfoStore().GetByName(ctx, classId) + classInfo, err := store.ClassInfoTable().GetByName(ctx, classId) if err != nil { return ecocredit.CreditType{}, err } diff --git a/x/group/go.mod b/x/group/go.mod index 5f23f769ec..18be1bee92 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -17,8 +17,8 @@ require ( github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.15 - github.com/tendermint/tm-db v0.6.6 - google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb + github.com/tendermint/tm-db v0.6.7 + google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) @@ -41,9 +41,10 @@ require ( github.com/confio/ics23/go v0.6.6 // indirect github.com/cosmos/btcutil v1.0.4 // indirect github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 // indirect - github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect - github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.17.3 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect @@ -112,7 +113,6 @@ require ( github.com/spf13/viper v1.9.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index 7edafeaca9..c911e147de 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -218,16 +218,17 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5 h1:UlK7NOHGlEbvbDTCM0cN7BJN6hhqeXZIuLv6KapFYTc= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha5/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= -github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10 h1:YT5p2bEI7cIXpYyniSPckptI/DctTOcMpl0vTyy5vxA= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.10/go.mod h1:WwRYmcnmSJpdOwr9ADwGr9gVBjYIre5TMz/nX4fStU0= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3 h1:Ep7FHNViVwwGnwLFEPewZYsyN2CJNVMmMvFmtNQtbnw= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.3/go.mod h1:HFea93YKmoMJ/mNKtkSeJZDtyJ4inxBsUK928KONcqo= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11 h1:DSSxPDuX/Cr8AvmwipMkB1ObL8GQneZplSz4Sq9tH9M= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.11/go.mod h1:2cogMfVz3OHvzGRWd9xUUJ8nqrzfdD96NGf+FNtzkQ4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= @@ -295,12 +296,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -427,8 +430,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -929,7 +933,6 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= @@ -947,8 +950,9 @@ github.com/tendermint/tendermint v0.34.15/go.mod h1:/7EDAw02rD7GT8syC317cX9ZhZTC github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo= github.com/thanhpk/randstr v1.0.4/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= @@ -1465,8 +1469,9 @@ google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwy google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=