Compare commits

...

20 Commits

Author SHA1 Message Date
a8ebc0aceb Update distribution JSON structure in add-genesis-lockup-account cmd (#75)
All checks were successful
Integration Tests / test-integration (push) Successful in 55s
E2E Tests / test-e2e (push) Successful in 2m8s
Unit Tests / test-unit (push) Successful in 50s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 5m0s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 10m41s
SDK Tests / sdk_tests (push) Successful in 14m28s
Publish on release / Run docker build and publish (release) Successful in 1m21s
Reviewed-on: cerc-io/laconicd#75
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-06-18 19:12:53 +00:00
e02d221dea Update e2e and integration tests for new tokens setup (#73)
All checks were successful
Protobuf / lint (pull_request) Successful in 6s
Integration Tests / test-integration (pull_request) Successful in 1m25s
Build / build (pull_request) Successful in 1m27s
E2E Tests / test-e2e (pull_request) Successful in 2m29s
Unit Tests / test-unit (pull_request) Successful in 1m11s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 5m26s
SDK Tests / sdk_tests_authority_auctions (pull_request) Successful in 11m16s
Integration Tests / test-integration (push) Successful in 1m13s
E2E Tests / test-e2e (push) Successful in 2m16s
Unit Tests / test-unit (push) Successful in 1m4s
Publish on release / Run docker build and publish (release) Successful in 1m29s
SDK Tests / sdk_tests (pull_request) Successful in 14m57s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 5m27s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 11m1s
SDK Tests / sdk_tests (push) Successful in 14m47s
Part of https://www.notion.so/Multiple-tokens-support-1f2a6b22d47280269f87df3fe03e8d64

Reviewed-on: cerc-io/laconicd#73
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-19 10:10:54 +00:00
59236e5ce6 Add a custom lockup account to hold locked tokens (#72)
Part of https://www.notion.so/Lockup-LPS-tokens-into-a-module-account-1f2a6b22d472802cbb35e8ce052d22ca

- Added a command to create the custom lockup account in genesis:
  ```bash
  laconicd genesis add-genesis-lockup-account <account_name> <distribution-json-file> <coin>[,<coin>...]
  ```

Reviewed-on: cerc-io/laconicd#72
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-16 09:26:10 +00:00
7af9e9d496 Add evidence module (#71)
Part of https://www.notion.so/Add-evidence-module-for-double-signing-slashing-1f2a6b22d472805b8609e2122c5b0328

Reviewed-on: cerc-io/laconicd#71
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-14 06:24:55 +00:00
31ef3afb9a Add a new token and only allow fees in alnt (#68)
Part of https://www.notion.so/Multiple-tokens-support-and-disable-transfers-for-LSTAKE-1f2a6b22d47280269f87df3fe03e8d64
- Add base token with denoms `alps` and `lps` (`1 lps = 10^18 alps`)
- Keep `alnt` as the staking token and for laconic module ops
- Accept tx fees only in `alnt`

Reviewed-on: cerc-io/laconicd#68
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-13 18:17:38 +05:30
f4cf8ac744 Disable staking rewards (#70)
All checks were successful
Integration Tests / test-integration (push) Successful in 1m32s
Unit Tests / test-unit (push) Successful in 1m41s
E2E Tests / test-e2e (push) Successful in 2m41s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 5m37s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 11m10s
SDK Tests / sdk_tests (push) Successful in 15m6s
Part of https://www.notion.so/Disable-staking-reward-1f2a6b22d47280c68d11ee179f5b894d
Staking rewards is disabled by performing the following
- Redirect all fee to community pool
- Increase threshold for accepting gov proposals so that it becomes difficult to spend funds from community pool

Reviewed-on: cerc-io/laconicd#70
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-05-13 12:35:15 +00:00
c14f1d3b00 Set graphiql package version in GQL playground (#67)
All checks were successful
E2E Tests / test-e2e (push) Successful in 1m55s
Unit Tests / test-unit (push) Successful in 1m12s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 10m21s
Integration Tests / test-integration (push) Successful in 46s
SDK Tests / sdk_tests (push) Successful in 13m58s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 4m34s
Publish on release / Run docker build and publish (release) Successful in 1m27s
Part of https://www.notion.so/Laconic-Mainnet-Plan-1eca6b22d47280569cd0d1e6d711d949

Reviewed-on: cerc-io/laconicd#67
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-05-09 09:49:28 +00:00
07297a27d1 Merge pull request 'Bump Cosmos SDK and other dependency versions' (#64) from bump-iavl into main
All checks were successful
Integration Tests / test-integration (push) Successful in 2m50s
E2E Tests / test-e2e (push) Successful in 4m24s
Unit Tests / test-unit (push) Successful in 2m30s
Publish on release / Run docker build and publish (release) Successful in 2m46s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m30s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 15m18s
SDK Tests / sdk_tests (push) Successful in 19m9s
Reviewed-on: cerc-io/laconicd#64
2024-11-28 16:15:54 +00:00
zramsay
d3a06319ce go mod tidy
All checks were successful
Integration Tests / test-integration (pull_request) Successful in 3m30s
Build / build (pull_request) Successful in 3m53s
E2E Tests / test-e2e (pull_request) Successful in 4m57s
Unit Tests / test-unit (pull_request) Successful in 2m11s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 9m50s
SDK Tests / sdk_tests_authority_auctions (pull_request) Successful in 15m35s
SDK Tests / sdk_tests (pull_request) Successful in 20m36s
2024-11-28 10:52:09 -05:00
zramsay
973bf51573 bump cosmos sdk to latest
Some checks failed
Integration Tests / test-integration (pull_request) Failing after 47s
E2E Tests / test-e2e (pull_request) Failing after 48s
Build / build (pull_request) Failing after 49s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 1m15s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 1m16s
Unit Tests / test-unit (pull_request) Failing after 44s
SDK Tests / sdk_tests (pull_request) Failing after 1m0s
2024-11-28 10:48:41 -05:00
zramsay
aee4758538 bump cosmossdk.io/store
Some checks failed
Build / build (pull_request) Failing after 42s
Integration Tests / test-integration (pull_request) Failing after 42s
E2E Tests / test-e2e (pull_request) Failing after 42s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 1m9s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 1m7s
SDK Tests / sdk_tests (pull_request) Failing after 1m9s
Unit Tests / test-unit (pull_request) Failing after 41s
2024-11-28 10:44:05 -05:00
zramsay
c3854c30cf bump iavl version, fix for consensus failure
Some checks failed
Build / build (pull_request) Failing after 1m29s
E2E Tests / test-e2e (pull_request) Failing after 1m28s
Integration Tests / test-integration (pull_request) Failing after 1m31s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 1m37s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 1m44s
SDK Tests / sdk_tests (pull_request) Failing after 1m42s
Unit Tests / test-unit (pull_request) Failing after 1m19s
2024-11-28 10:27:29 -05:00
65957d6199 Remove stale auctions after a year (#63)
All checks were successful
Integration Tests / test-integration (push) Successful in 2m52s
Unit Tests / test-unit (push) Successful in 3m28s
E2E Tests / test-e2e (push) Successful in 4m21s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m42s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 15m26s
SDK Tests / sdk_tests (push) Successful in 20m49s
Publish on release / Run docker build and publish (release) Successful in 2m40s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Reviewed-on: cerc-io/laconicd#63
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-29 04:04:49 +00:00
c807a9db80 Make min-gas-price configurable in node initialization script (#62)
All checks were successful
E2E Tests / test-e2e (push) Successful in 2m52s
Integration Tests / test-integration (push) Successful in 1m44s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 13m3s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m18s
SDK Tests / sdk_tests (push) Successful in 19m0s
Unit Tests / test-unit (push) Successful in 1m56s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Reviewed-on: cerc-io/laconicd#62
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-28 04:22:56 +00:00
3a551bce99 Reset block height for imported authorities (#61)
All checks were successful
Integration Tests / test-integration (push) Successful in 2m31s
E2E Tests / test-e2e (push) Successful in 3m56s
Unit Tests / test-unit (push) Successful in 2m5s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m13s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 14m55s
SDK Tests / sdk_tests (push) Successful in 19m16s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

- Reset block height for authorities being imported from genesis, same is being done for name records

Reviewed-on: cerc-io/laconicd#61
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-24 05:25:24 +00:00
6f75370b17 Updates for stage2 setup (#60)
All checks were successful
Integration Tests / test-integration (push) Successful in 2m0s
E2E Tests / test-e2e (push) Successful in 3m26s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m19s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 13m22s
Unit Tests / test-unit (push) Successful in 1m52s
SDK Tests / sdk_tests (push) Successful in 19m16s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

- Add `bc` installation in Dockerfile (required for stage1 to stage2 testnet migration)
- Populate attributes map index when importing records from genesis to allow fetching records with filters from a chain with imported state

Reviewed-on: cerc-io/laconicd#60
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-22 09:54:33 +00:00
52e8d322fa Add service provider auctions (#59)
Some checks failed
Integration Tests / test-integration (push) Successful in 2m29s
E2E Tests / test-e2e (push) Successful in 4m6s
Unit Tests / test-unit (push) Successful in 2m3s
SDK Tests / sdk_tests_authority_auctions (push) Failing after 6m31s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m11s
SDK Tests / sdk_tests (push) Failing after 10m14s
Part of [Service provider auctions](https://www.notion.so/Service-provider-auctions-a7b63697d818479493ec145ea6ea3c1c)

- Add a new type of auction for service providers
  - Add a command to release provider auction funds
- Remove unused auction module params

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Co-authored-by: Isha Venikar <ishavenikar@Ishas-MacBook-Air.local>
Reviewed-on: cerc-io/laconicd#59
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-25 12:38:49 +00:00
df43322ef3 Add pagination for query to get records (#58)
All checks were successful
Integration Tests / test-integration (push) Successful in 2m57s
E2E Tests / test-e2e (push) Successful in 4m25s
Unit Tests / test-unit (push) Successful in 2m53s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m50s
SDK Tests / sdk_tests_auctions (push) Successful in 15m1s
SDK Tests / sdk_tests (push) Successful in 8m43s
Publish on release / Run docker build and publish (release) Successful in 2m31s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)
Handles cerc-io/laconic-console#59

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: cerc-io/laconicd#58
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-05 07:33:48 +00:00
94ba057807 Add methods to update laconic module params (#57)
Some checks failed
Integration Tests / test-integration (push) Successful in 2m42s
E2E Tests / test-e2e (push) Successful in 4m23s
Unit Tests / test-unit (push) Successful in 2m39s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 10m14s
SDK Tests / sdk_tests (push) Failing after 11m55s
SDK Tests / sdk_tests_auctions (push) Successful in 15m48s
Part of [Add gov module to laconicd](https://www.notion.so/Add-gov-module-to-laconicd-938c9f5f87634b4fbd7896d3907fb89e)

- Add methods to update params for `bond`, `registry` and `auction` modules

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: cerc-io/laconicd#57
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-05 07:07:54 +00:00
a01a5d24d1 Add gov module to the chain (#56)
Some checks failed
Integration Tests / test-integration (push) Successful in 2m36s
E2E Tests / test-e2e (push) Successful in 3m48s
Unit Tests / test-unit (push) Successful in 2m39s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 11m11s
SDK Tests / sdk_tests (push) Failing after 13m14s
SDK Tests / sdk_tests_auctions (push) Successful in 16m0s
Part of [Add gov module to laconicd](https://www.notion.so/Add-gov-module-to-laconicd-938c9f5f87634b4fbd7896d3907fb89e)

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: cerc-io/laconicd#56
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-05 04:15:42 +00:00
81 changed files with 11656 additions and 2954 deletions

View File

@ -7,7 +7,7 @@ on:
- release/**
jobs:
sdk_tests_auctions:
sdk_tests_authority_auctions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -35,6 +35,6 @@ jobs:
TEST_AUCTION_ENABLED: true
run: docker compose up -d
- name: Run auction tests
- name: Run authority auction tests
working-directory: tests/sdk_tests
run: ./run-tests.sh test:auctions
run: ./run-tests.sh test:authority-auctions

View File

@ -19,13 +19,13 @@ FROM ubuntu:22.04
# Install ca-certificates, jq, curl, bash, and other necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
jq curl netcat bash \
jq curl netcat bash bc \
&& rm -rf /var/lib/apt/lists/*
# Copy over binary from the builder
COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/build/laconicd /usr/bin/laconicd
# Copy over init script from builder
# Copy over init script from builder
COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/scripts/init.sh scripts/init.sh
WORKDIR /

View File

@ -43,7 +43,7 @@ build-linux:
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
@echo "--> installing laconicd"
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./...
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./cmd/laconicd
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/

View File

@ -27,6 +27,8 @@ Run with a single node fixture:
./scripts/init.sh clean
```
See [lockup.md](./lockup.md) for lockup account usage.
## Tests
Run tests:

View File

@ -14,12 +14,14 @@ import (
)
var (
md_Module protoreflect.MessageDescriptor
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_auction_module_v1_module_proto_init()
md_Module = File_cerc_auction_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.auction.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.auction.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_auction_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_auction_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_auction_module_v1_module_proto_rawDesc = []byte{
@ -419,25 +494,27 @@ var file_cerc_auction_module_v1_module_proto_rawDesc = []byte{
0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x37, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x2d, 0xba, 0xc0, 0x96, 0xda, 0x01,
0x27, 0x0a, 0x25, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65,
0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78,
0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xe5, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d,
0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e,
0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e,
0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x4d, 0xaa, 0x02, 0x16,
0x43, 0x65, 0x72, 0x63, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2,
0x02, 0x22, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x41, 0x75, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x55, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74,
0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2d, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x27, 0x0a,
0x25, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x61,
0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xe5, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f,
0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63,
0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x4d, 0xaa, 0x02, 0x16, 0x43, 0x65,
0x72, 0x63, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x22,
0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x41, 0x75, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,8 @@ const (
Msg_CreateAuction_FullMethodName = "/cerc.auction.v1.Msg/CreateAuction"
Msg_CommitBid_FullMethodName = "/cerc.auction.v1.Msg/CommitBid"
Msg_RevealBid_FullMethodName = "/cerc.auction.v1.Msg/RevealBid"
Msg_UpdateParams_FullMethodName = "/cerc.auction.v1.Msg/UpdateParams"
Msg_ReleaseFunds_FullMethodName = "/cerc.auction.v1.Msg/ReleaseFunds"
)
// MsgClient is the client API for Msg service.
@ -34,6 +36,11 @@ type MsgClient interface {
CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error)
// RevealBid is the command for revealing a bid
RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// ReleaseFunds is the command for paying the winners of provider auctions
ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error)
}
type msgClient struct {
@ -71,6 +78,24 @@ func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grp
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error) {
out := new(MsgReleaseFundsResponse)
err := c.cc.Invoke(ctx, Msg_ReleaseFunds_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@ -81,6 +106,11 @@ type MsgServer interface {
CommitBid(context.Context, *MsgCommitBid) (*MsgCommitBidResponse, error)
// RevealBid is the command for revealing a bid
RevealBid(context.Context, *MsgRevealBid) (*MsgRevealBidResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// ReleaseFunds is the command for paying the winners of provider auctions
ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -97,6 +127,12 @@ func (UnimplementedMsgServer) CommitBid(context.Context, *MsgCommitBid) (*MsgCom
func (UnimplementedMsgServer) RevealBid(context.Context, *MsgRevealBid) (*MsgRevealBidResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RevealBid not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReleaseFunds not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -164,6 +200,42 @@ func _Msg_RevealBid_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ReleaseFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgReleaseFunds)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ReleaseFunds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ReleaseFunds_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ReleaseFunds(ctx, req.(*MsgReleaseFunds))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -183,6 +255,14 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "RevealBid",
Handler: _Msg_RevealBid_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "ReleaseFunds",
Handler: _Msg_ReleaseFunds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/auction/v1/tx.proto",

View File

@ -14,12 +14,14 @@ import (
)
var (
md_Module protoreflect.MessageDescriptor
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_bond_module_v1_module_proto_init()
md_Module = File_cerc_bond_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.bond.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.bond.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_bond_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_bond_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_bond_module_v1_module_proto_rawDesc = []byte{
@ -418,24 +493,26 @@ var file_cerc_bond_module_v1_module_proto_rawDesc = []byte{
0x74, 0x6f, 0x12, 0x13, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f,
0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x06, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74,
0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f,
0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x42,
0xd3, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e,
0x64, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e,
0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c,
0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x4d, 0xaa, 0x02,
0x13, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64,
0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x65, 0x72,
0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43,
0x65, 0x72, 0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x06, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74,
0x79, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74, 0x2e, 0x76,
0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61,
0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x42, 0xd3, 0x01,
0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64,
0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63,
0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62,
0x6f, 0x6e, 0x64, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x4d, 0xaa, 0x02, 0x13, 0x43,
0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e,
0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x65, 0x72, 0x63, 0x5c,
0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x65, 0x72,
0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,7 @@ const (
Msg_RefillBond_FullMethodName = "/cerc.bond.v1.Msg/RefillBond"
Msg_WithdrawBond_FullMethodName = "/cerc.bond.v1.Msg/WithdrawBond"
Msg_CancelBond_FullMethodName = "/cerc.bond.v1.Msg/CancelBond"
Msg_UpdateParams_FullMethodName = "/cerc.bond.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
@ -37,6 +38,9 @@ type MsgClient interface {
WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -83,6 +87,15 @@ func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...g
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@ -95,6 +108,9 @@ type MsgServer interface {
WithdrawBond(context.Context, *MsgWithdrawBond) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -114,6 +130,9 @@ func (UnimplementedMsgServer) WithdrawBond(context.Context, *MsgWithdrawBond) (*
func (UnimplementedMsgServer) CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelBond not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -199,6 +218,24 @@ func _Msg_CancelBond_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -222,6 +259,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "CancelBond",
Handler: _Msg_CancelBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/bond/v1/tx.proto",

View File

@ -14,12 +14,14 @@ import (
)
var (
md_Module protoreflect.MessageDescriptor
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_registry_module_v1_module_proto_init()
md_Module = File_cerc_registry_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.registry.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.registry.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_registry_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_registry_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_registry_module_v1_module_proto_rawDesc = []byte{
@ -419,26 +494,27 @@ var file_cerc_registry_module_v1_module_proto_rawDesc = []byte{
0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a,
0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c,
0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x38, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x2e, 0xba, 0xc0, 0x96,
0xda, 0x01, 0x28, 0x0a, 0x26, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f,
0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64,
0x2f, 0x78, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0xeb, 0x01, 0x0a, 0x1b,
0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72,
0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x2e,
0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c,
0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43,
0x52, 0x4d, 0xaa, 0x02, 0x17, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x72, 0x79, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x43,
0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x43,
0x65, 0x72, 0x63, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x6f, 0x22, 0x56, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2e, 0xba, 0xc0, 0x96, 0xda, 0x01,
0x28, 0x0a, 0x26, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65,
0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78,
0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0xeb, 0x01, 0x0a, 0x1b, 0x63, 0x6f,
0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64,
0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63,
0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x72,
0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76,
0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x52, 0x4d,
0xaa, 0x02, 0x17, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x43, 0x65, 0x72,
0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69,
0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x43, 0x65, 0x72,
0x63, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@ const (
Msg_DeleteName_FullMethodName = "/cerc.registry.v1.Msg/DeleteName"
Msg_ReserveAuthority_FullMethodName = "/cerc.registry.v1.Msg/ReserveAuthority"
Msg_SetAuthorityBond_FullMethodName = "/cerc.registry.v1.Msg/SetAuthorityBond"
Msg_UpdateParams_FullMethodName = "/cerc.registry.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
@ -55,6 +56,9 @@ type MsgClient interface {
ReserveAuthority(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error)
// SetAuthorityBond
SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -155,6 +159,15 @@ func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBon
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@ -179,6 +192,9 @@ type MsgServer interface {
ReserveAuthority(context.Context, *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error)
// SetAuthorityBond
SetAuthorityBond(context.Context, *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -216,6 +232,9 @@ func (UnimplementedMsgServer) ReserveAuthority(context.Context, *MsgReserveAutho
func (UnimplementedMsgServer) SetAuthorityBond(context.Context, *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetAuthorityBond not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -409,6 +428,24 @@ func _Msg_SetAuthorityBond_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -456,6 +493,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "SetAuthorityBond",
Handler: _Msg_SetAuthorityBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/registry/v1/tx.proto",

View File

@ -0,0 +1,755 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package typesv1
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
runtime "github.com/cosmos/cosmos-proto/runtime"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
types "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/gogoproto/gogoproto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
md_LockupAccount protoreflect.MessageDescriptor
fd_LockupAccount_base_account protoreflect.FieldDescriptor
fd_LockupAccount_name protoreflect.FieldDescriptor
fd_LockupAccount_distribution protoreflect.FieldDescriptor
)
func init() {
file_cerc_types_v1_lockup_proto_init()
md_LockupAccount = File_cerc_types_v1_lockup_proto.Messages().ByName("LockupAccount")
fd_LockupAccount_base_account = md_LockupAccount.Fields().ByName("base_account")
fd_LockupAccount_name = md_LockupAccount.Fields().ByName("name")
fd_LockupAccount_distribution = md_LockupAccount.Fields().ByName("distribution")
}
var _ protoreflect.Message = (*fastReflection_LockupAccount)(nil)
type fastReflection_LockupAccount LockupAccount
func (x *LockupAccount) ProtoReflect() protoreflect.Message {
return (*fastReflection_LockupAccount)(x)
}
func (x *LockupAccount) slowProtoReflect() protoreflect.Message {
mi := &file_cerc_types_v1_lockup_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_LockupAccount_messageType fastReflection_LockupAccount_messageType
var _ protoreflect.MessageType = fastReflection_LockupAccount_messageType{}
type fastReflection_LockupAccount_messageType struct{}
func (x fastReflection_LockupAccount_messageType) Zero() protoreflect.Message {
return (*fastReflection_LockupAccount)(nil)
}
func (x fastReflection_LockupAccount_messageType) New() protoreflect.Message {
return new(fastReflection_LockupAccount)
}
func (x fastReflection_LockupAccount_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_LockupAccount
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_LockupAccount) Descriptor() protoreflect.MessageDescriptor {
return md_LockupAccount
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_LockupAccount) Type() protoreflect.MessageType {
return _fastReflection_LockupAccount_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_LockupAccount) New() protoreflect.Message {
return new(fastReflection_LockupAccount)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_LockupAccount) Interface() protoreflect.ProtoMessage {
return (*LockupAccount)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_LockupAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.BaseAccount != nil {
value := protoreflect.ValueOfMessage(x.BaseAccount.ProtoReflect())
if !f(fd_LockupAccount_base_account, value) {
return
}
}
if x.Name != "" {
value := protoreflect.ValueOfString(x.Name)
if !f(fd_LockupAccount_name, value) {
return
}
}
if x.Distribution != "" {
value := protoreflect.ValueOfString(x.Distribution)
if !f(fd_LockupAccount_distribution, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_LockupAccount) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
return x.BaseAccount != nil
case "cerc.types.v1.LockupAccount.name":
return x.Name != ""
case "cerc.types.v1.LockupAccount.distribution":
return x.Distribution != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
x.BaseAccount = nil
case "cerc.types.v1.LockupAccount.name":
x.Name = ""
case "cerc.types.v1.LockupAccount.distribution":
x.Distribution = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_LockupAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
value := x.BaseAccount
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "cerc.types.v1.LockupAccount.name":
value := x.Name
return protoreflect.ValueOfString(value)
case "cerc.types.v1.LockupAccount.distribution":
value := x.Distribution
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
x.BaseAccount = value.Message().Interface().(*types.BaseAccount)
case "cerc.types.v1.LockupAccount.name":
x.Name = value.Interface().(string)
case "cerc.types.v1.LockupAccount.distribution":
x.Distribution = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
if x.BaseAccount == nil {
x.BaseAccount = new(types.BaseAccount)
}
return protoreflect.ValueOfMessage(x.BaseAccount.ProtoReflect())
case "cerc.types.v1.LockupAccount.name":
panic(fmt.Errorf("field name of message cerc.types.v1.LockupAccount is not mutable"))
case "cerc.types.v1.LockupAccount.distribution":
panic(fmt.Errorf("field distribution of message cerc.types.v1.LockupAccount is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_LockupAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
m := new(types.BaseAccount)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "cerc.types.v1.LockupAccount.name":
return protoreflect.ValueOfString("")
case "cerc.types.v1.LockupAccount.distribution":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_LockupAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cerc.types.v1.LockupAccount", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_LockupAccount) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_LockupAccount) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_LockupAccount) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.BaseAccount != nil {
l = options.Size(x.BaseAccount)
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Name)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Distribution)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Distribution) > 0 {
i -= len(x.Distribution)
copy(dAtA[i:], x.Distribution)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Distribution)))
i--
dAtA[i] = 0x1a
}
if len(x.Name) > 0 {
i -= len(x.Name)
copy(dAtA[i:], x.Name)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name)))
i--
dAtA[i] = 0x12
}
if x.BaseAccount != nil {
encoded, err := options.Marshal(x.BaseAccount)
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LockupAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LockupAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if x.BaseAccount == nil {
x.BaseAccount = &types.BaseAccount{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BaseAccount); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Distribution", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Distribution = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cerc/types/v1/lockup.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// LockupAccount extends the Cosmos SDK BaseAccount with a name and distribution
// field. It satisfies the ModuleAccountI interface to allow querying it as a
// module account.
type LockupAccount struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
BaseAccount *types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3" json:"base_account,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Distribution string `protobuf:"bytes,3,opt,name=distribution,proto3" json:"distribution,omitempty"`
}
func (x *LockupAccount) Reset() {
*x = LockupAccount{}
if protoimpl.UnsafeEnabled {
mi := &file_cerc_types_v1_lockup_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LockupAccount) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LockupAccount) ProtoMessage() {}
// Deprecated: Use LockupAccount.ProtoReflect.Descriptor instead.
func (*LockupAccount) Descriptor() ([]byte, []int) {
return file_cerc_types_v1_lockup_proto_rawDescGZIP(), []int{0}
}
func (x *LockupAccount) GetBaseAccount() *types.BaseAccount {
if x != nil {
return x.BaseAccount
}
return nil
}
func (x *LockupAccount) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *LockupAccount) GetDistribution() string {
if x != nil {
return x.Distribution
}
return ""
}
var File_cerc_types_v1_lockup_proto protoreflect.FileDescriptor
var file_cerc_types_v1_lockup_proto_rawDesc = []byte{
0x0a, 0x1a, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f,
0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x63, 0x65,
0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69,
0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61,
0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x8b, 0x02, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x49, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61,
0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x04, 0xd0, 0xde, 0x1f, 0x01, 0x52,
0x0b, 0x62, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x77, 0x88, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x22, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
0xca, 0xb4, 0x2d, 0x1c, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76,
0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
0x8a, 0xe7, 0xb0, 0x2a, 0x15, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x2f, 0x4c, 0x6f, 0x63,
0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x92, 0xe7, 0xb0, 0x2a, 0x0e, 0x6c,
0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xad, 0x01,
0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63,
0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76,
0x31, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa,
0x02, 0x0d, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca,
0x02, 0x0d, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2,
0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c,
0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x65,
0x72, 0x63, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cerc_types_v1_lockup_proto_rawDescOnce sync.Once
file_cerc_types_v1_lockup_proto_rawDescData = file_cerc_types_v1_lockup_proto_rawDesc
)
func file_cerc_types_v1_lockup_proto_rawDescGZIP() []byte {
file_cerc_types_v1_lockup_proto_rawDescOnce.Do(func() {
file_cerc_types_v1_lockup_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_types_v1_lockup_proto_rawDescData)
})
return file_cerc_types_v1_lockup_proto_rawDescData
}
var file_cerc_types_v1_lockup_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cerc_types_v1_lockup_proto_goTypes = []interface{}{
(*LockupAccount)(nil), // 0: cerc.types.v1.LockupAccount
(*types.BaseAccount)(nil), // 1: cosmos.auth.v1beta1.BaseAccount
}
var file_cerc_types_v1_lockup_proto_depIdxs = []int32{
1, // 0: cerc.types.v1.LockupAccount.base_account:type_name -> cosmos.auth.v1beta1.BaseAccount
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_cerc_types_v1_lockup_proto_init() }
func file_cerc_types_v1_lockup_proto_init() {
if File_cerc_types_v1_lockup_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cerc_types_v1_lockup_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LockupAccount); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cerc_types_v1_lockup_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cerc_types_v1_lockup_proto_goTypes,
DependencyIndexes: file_cerc_types_v1_lockup_proto_depIdxs,
MessageInfos: file_cerc_types_v1_lockup_proto_msgTypes,
}.Build()
File_cerc_types_v1_lockup_proto = out.File
file_cerc_types_v1_lockup_proto_rawDesc = nil
file_cerc_types_v1_lockup_proto_goTypes = nil
file_cerc_types_v1_lockup_proto_depIdxs = nil
}

79
app/ante.go Normal file
View File

@ -0,0 +1,79 @@
package app
import (
_ "embed"
"math"
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"git.vdb.to/cerc-io/laconicd/app/params"
)
// Reference: https://github.com/cosmos/cosmos-sdk/blob/v0.50.10/x/auth/ante/validator_tx_fee.go#L15
// checkTxFeeWithValidatorMinGasPrices implements the default fee logic, where the minimum price per
// unit of gas is fixed and set by each validator, can the tx priority is computed from the gas price.
func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}
feeCoins := feeTx.GetFee()
gas := feeTx.GetGas()
// Only allow alnt as a fee token
for _, coin := range feeCoins {
if coin.Denom != params.CoinUnit {
return nil, 0, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid fee denom %s, only %s is accepted", coin.Denom, params.CoinUnit)
}
}
// Ensure that the provided fees meet a minimum threshold for the validator,
// if this is a CheckTx. This is only for local mempool purposes, and thus
// is only ran on check tx.
if ctx.IsCheckTx() {
minGasPrices := ctx.MinGasPrices()
if !minGasPrices.IsZero() {
requiredFees := make(sdk.Coins, len(minGasPrices))
// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
glDec := sdkmath.LegacyNewDec(int64(gas))
for i, gp := range minGasPrices {
fee := gp.Amount.Mul(glDec)
requiredFees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt())
}
if !feeCoins.IsAnyGTE(requiredFees) {
return nil, 0, errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %s required: %s", feeCoins, requiredFees)
}
}
}
priority := getTxPriority(feeCoins, int64(gas))
return feeCoins, priority, nil
}
// getTxPriority returns a naive tx priority based on the amount of the smallest denomination of the gas price
// provided in a transaction.
// NOTE: This implementation should be used with a great consideration as it opens potential attack vectors
// where txs with multiple coins could not be prioritize as expected.
func getTxPriority(fee sdk.Coins, gas int64) int64 {
var priority int64
for _, c := range fee {
p := int64(math.MaxInt64)
gasPrice := c.Amount.QuoRaw(gas)
if gasPrice.IsInt64() {
p = gasPrice.Int64()
}
if priority == 0 || p < priority {
priority = p
}
}
return priority
}

View File

@ -12,11 +12,13 @@ import (
"cosmossdk.io/depinject"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
auctionkeeper "git.vdb.to/cerc-io/laconicd/x/auction/keeper"
bondkeeper "git.vdb.to/cerc-io/laconicd/x/bond/keeper"
onboardingkeeper "git.vdb.to/cerc-io/laconicd/x/onboarding/keeper"
registrykeeper "git.vdb.to/cerc-io/laconicd/x/registry/keeper"
types "git.vdb.to/cerc-io/laconicd/x/types/v1"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
@ -26,18 +28,27 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
_ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects
_ "cosmossdk.io/x/evidence" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/auction/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/bond/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/onboarding/module" // import for side-effects
@ -80,8 +91,10 @@ type LaconicApp struct {
StakingKeeper *stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper *govkeeper.Keeper
CrisisKeeper *crisiskeeper.Keeper
ConsensusParamsKeeper consensuskeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
// laconic keepers
AuctionKeeper *auctionkeeper.Keeper // (Use * as per ProvideModule implementation)
@ -110,6 +123,11 @@ func AppConfig() depinject.Config {
// supply custom module basics
map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
},
),
},
),
)
@ -147,8 +165,10 @@ func NewLaconicApp(
&app.StakingKeeper,
&app.SlashingKeeper,
&app.DistrKeeper,
&app.GovKeeper,
&app.CrisisKeeper,
&app.ConsensusParamsKeeper,
&app.EvidenceKeeper,
&app.AuctionKeeper,
&app.BondKeeper,
&app.RegistryKeeper,
@ -157,6 +177,10 @@ func NewLaconicApp(
return nil, err
}
// Register custom interfaces
RegisterCustomInterfaces(app.interfaceRegistry)
RegisterCustomLegacyAminoCodec(app.legacyAmino)
app.App = appBuilder.Build(db, traceStore, baseAppOptions...)
// register streaming services
@ -173,6 +197,9 @@ func NewLaconicApp(
app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, make(map[string]module.AppModuleSimulation, 0))
app.sm.RegisterStoreDecoders()
// set custom ante handlers
app.setCustomAnteHandler()
if err := app.Load(loadLatest); err != nil {
return nil, err
}
@ -220,3 +247,59 @@ func (app *LaconicApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.AP
panic(err)
}
}
func RegisterCustomInterfaces(interfaceRegistry codectypes.InterfaceRegistry) {
// Custom LockupAccount type needs to be registered to be able to use it as a genesis account
interfaceRegistry.RegisterImplementations((*authtypes.GenesisAccount)(nil), &types.LockupAccount{})
// LockupAccount extends auth Account
interfaceRegistry.RegisterInterface(
"cosmos.auth.v1beta1.AccountI",
(*sdk.AccountI)(nil),
&types.LockupAccount{},
)
// LockupAccount extends auth ModuleAccount
interfaceRegistry.RegisterInterface(
"cosmos.auth.v1beta1.ModuleAccountI",
(*sdk.ModuleAccountI)(nil),
&types.LockupAccount{},
)
interfaceRegistry.RegisterInterface(
"cosmos.auth.v1beta1.GenesisAccount",
(*authtypes.GenesisAccount)(nil),
&types.LockupAccount{},
)
interfaceRegistry.RegisterInterface(
"cerc.types.v1.LockupAccountI",
(*types.LockupAccountI)(nil),
&types.LockupAccount{},
)
}
func RegisterCustomLegacyAminoCodec(registrar *codec.LegacyAmino) {
registrar.RegisterInterface((*types.LockupAccountI)(nil), nil)
registrar.RegisterConcrete(&types.LockupAccount{}, "laconic/LockupAccount", nil)
}
// setCustomAnteHandler overwrites default ante handlers with custom ante handlers
// Reference: https://github.com/cosmos/cosmos-sdk/blob/v0.50.10/x/auth/tx/config/config.go#L149
func (app *LaconicApp) setCustomAnteHandler() {
anteHandler, err := ante.NewAnteHandler(
ante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
SignModeHandler: app.txConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
TxFeeChecker: checkTxFeeWithValidatorMinGasPrices,
},
)
if err != nil {
panic(err)
}
// Set the AnteHandler for the app
app.SetAnteHandler(anteHandler)
}

View File

@ -6,11 +6,11 @@ modules:
# During begin block slashing happens after distr.BeginBlocker so that
# there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant.
# NOTE: staking module is required if HistoricalEntries param > 0
begin_blockers: [distribution, slashing, staking]
end_blockers: [crisis, staking, auction, registry]
begin_blockers: [distribution, slashing, evidence, staking]
end_blockers: [crisis, gov, staking, auction, registry]
# NOTE: The genutils module must occur after staking so that pools are properly initialized with tokens from genesis accounts.
# NOTE: The genutils module must also occur after auth so that it can access the params from auth.
init_genesis: [auth, bank, distribution, staking, slashing, crisis, genutil, auction, bond, registry, onboarding]
init_genesis: [auth, bank, distribution, staking, slashing, gov, crisis, genutil, evidence, auction, bond, registry, onboarding]
override_store_keys:
- module_name: auth
kv_store_key: acc
@ -25,12 +25,15 @@ modules:
permissions: [burner, staking]
- account: not_bonded_tokens_pool
permissions: [burner, staking]
- account: gov
permissions: [burner]
- account: auction
- account: auction_burn
- account: bond
- account: registry
- account: record_rent
- account: authority_rent
- account: lps_lockup
- name: bank
config:
"@type": cosmos.bank.module.v1.Module
@ -54,9 +57,15 @@ modules:
- name: tx
config:
"@type": cosmos.tx.config.v1.Config
- name: gov
config:
"@type": cosmos.gov.module.v1.Module
- name: crisis
config:
"@type": cosmos.crisis.module.v1.Module
- name: evidence
config:
"@type": cosmos.evidence.module.v1.Module
- name: bond
config:
"@type": cerc.bond.module.v1.Module

View File

@ -226,12 +226,18 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
/* Handle slashing state. */
// reset start height on signing infos
app.SlashingKeeper.IterateValidatorSigningInfos(
err = app.SlashingKeeper.IterateValidatorSigningInfos(
ctx,
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
info.StartHeight = 0
app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
if err != nil {
log.Fatal(err)
}
return false
},
)
if err != nil {
log.Fatal(err)
}
}

View File

@ -10,11 +10,14 @@ import (
)
const (
CoinUnit = "lnt"
BaseCoinUnit = "alnt"
LntExponent = 18
// Registered token
LpsCoinUnit = "lps"
LpsBaseCoinUnit = "alps"
LpsExponent = 18
DefaultBondDenom = BaseCoinUnit
// Native token, only denominated in alnt
// Used for staking, fees and laconic module ops
CoinUnit = "alnt"
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address.
Bech32PrefixAccAddr = "laconic"
@ -39,12 +42,11 @@ func init() {
}
func RegisterDenoms() {
err := sdk.RegisterDenom(CoinUnit, math.LegacyOneDec())
err := sdk.RegisterDenom(LpsCoinUnit, math.LegacyOneDec())
if err != nil {
panic(err)
}
err = sdk.RegisterDenom(BaseCoinUnit, math.LegacyNewDecWithPrec(1, LntExponent))
err = sdk.RegisterDenom(LpsBaseCoinUnit, math.LegacyNewDecWithPrec(1, LpsExponent))
if err != nil {
panic(err)
}

View File

@ -0,0 +1,154 @@
package cmd
import (
"encoding/json"
"fmt"
"os"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
types "git.vdb.to/cerc-io/laconicd/x/types/v1"
)
const (
flagAppendMode = "append"
)
// AddGenesisLockupAccountCmd returns add-genesis-lockup-account cobra Command.
func AddGenesisLockupAccountCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "add-genesis-lockup-account <account_name> <distribution-json-file> <coin>[,<coin>...]",
Short: "Add genesis lockup account with give name",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
config.SetRoot(clientCtx.HomeDir)
moduleName := args[0]
distributionFilePath := args[1]
var distribution []interface{}
distributionBytes, err := os.ReadFile(distributionFilePath)
if err != nil {
return fmt.Errorf("failed to read %s file: %w", distributionFilePath, err)
}
if err = json.Unmarshal(distributionBytes, &distribution); err != nil {
return fmt.Errorf("distribution is invalid json: %v", err)
}
appendflag, _ := cmd.Flags().GetBool(flagAppendMode)
return AddGenesisLockupAccount(clientCtx.Codec, moduleName, string(distributionBytes), appendflag, config.GenesisFile(), args[2])
},
}
cmd.Flags().Bool(flagAppendMode, false, "append the coins to an account already in the genesis.json file")
return cmd
}
func AddGenesisLockupAccount(
cdc codec.Codec,
moduleName string,
distribution string,
appendAcct bool,
genesisFileURL, amountStr string,
) error {
coins, err := sdk.ParseCoinsNormalized(amountStr)
if err != nil {
return fmt.Errorf("failed to parse coins: %w", err)
}
// create concrete account type based on input parameters
moduleAccount := authtypes.NewEmptyModuleAccount(moduleName)
accAddr := moduleAccount.GetAddress()
balances := banktypes.Balance{Address: accAddr.String(), Coins: coins.Sort()}
genAccount := &types.LockupAccount{
BaseAccount: moduleAccount.BaseAccount,
Name: moduleAccount.Name,
Distribution: distribution,
}
if err := genAccount.Validate(); err != nil {
return fmt.Errorf("failed to validate new genesis account: %w", err)
}
appState, appGenesis, err := genutiltypes.GenesisStateFromGenFile(genesisFileURL)
if err != nil {
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
}
authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState)
accs, err := authtypes.UnpackAccounts(authGenState.Accounts)
if err != nil {
return fmt.Errorf("failed to get accounts from any: %w", err)
}
bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState)
if accs.Contains(accAddr) {
if !appendAcct {
return fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr)
}
genesisB := banktypes.GetGenesisStateFromAppState(cdc, appState)
for idx, acc := range genesisB.Balances {
if acc.Address != accAddr.String() {
continue
}
updatedCoins := acc.Coins.Add(coins...)
bankGenState.Balances[idx] = banktypes.Balance{Address: accAddr.String(), Coins: updatedCoins.Sort()}
break
}
} else {
// Add the new account to the set of genesis accounts and sanitize the accounts afterwards.
accs = append(accs, genAccount)
accs = authtypes.SanitizeGenesisAccounts(accs)
genAccs, err := authtypes.PackAccounts(accs)
if err != nil {
return fmt.Errorf("failed to convert accounts into any's: %w", err)
}
authGenState.Accounts = genAccs
authGenStateBz, err := cdc.MarshalJSON(&authGenState)
if err != nil {
return fmt.Errorf("failed to marshal auth genesis state: %w", err)
}
appState[authtypes.ModuleName] = authGenStateBz
bankGenState.Balances = append(bankGenState.Balances, balances)
}
bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances)
bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...)
bankGenStateBz, err := cdc.MarshalJSON(bankGenState)
if err != nil {
return fmt.Errorf("failed to marshal bank genesis state: %w", err)
}
appState[banktypes.ModuleName] = bankGenStateBz
appStateJSON, err := json.Marshal(appState)
if err != nil {
return fmt.Errorf("failed to marshal application genesis state: %w", err)
}
appGenesis.AppState = appStateJSON
return genutil.ExportGenesisFile(appGenesis, genesisFileURL)
}

View File

@ -58,10 +58,14 @@ func initRootCmd(rootCmd *cobra.Command, txConfig client.TxConfig, basicManager
startCmd.RunE = newStartCmd.RunE
})
// Capture the genesis command from genutilcli and add new commands
genesisCmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome)
genesisCmd.AddCommand(AddGenesisLockupAccountCmd())
// add keybase, auxiliary RPC, query, genesis, and tx child commands
rootCmd.AddCommand(
server.StatusCommand(),
genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome),
genesisCmd,
queryCommand(),
txCommand(),
keys.Commands(),

View File

@ -1,6 +1,7 @@
package cmd
import (
"fmt"
"os"
"time"
@ -24,10 +25,12 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/app/params"
"git.vdb.to/cerc-io/laconicd/gql"
types "git.vdb.to/cerc-io/laconicd/x/types/v1"
)
const EnvPrefix = "LACONIC"
@ -98,7 +101,7 @@ func NewRootCmd() *cobra.Command {
// overwrite the minimum gas price from the app configuration
srvCfg := serverconfig.DefaultConfig()
srvCfg.MinGasPrices = "0alnt"
srvCfg.MinGasPrices = fmt.Sprintf("0%s", params.CoinUnit)
// overwrite the block timeout
cmtCfg := cmtcfg.DefaultConfig()
@ -133,7 +136,7 @@ func ProvideClientContext(
WithTxConfig(txConfig).
WithLegacyAmino(legacyAmino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithHomeDir(app.DefaultNodeHome).
WithViper(EnvPrefix) // env variable prefix
@ -146,6 +149,10 @@ func ProvideClientContext(
clientCtx.HomeDir = ""
clientCtx.KeyringDir = ""
// Custom LockupAccount type needs to be registered
interfaceRegistry.RegisterImplementations((*types.LockupAccountI)(nil), &types.LockupAccount{})
interfaceRegistry.RegisterImplementations((*authtypes.GenesisAccount)(nil), &types.LockupAccount{})
return clientCtx
}

122
go.mod
View File

@ -13,23 +13,24 @@ replace (
)
require (
cosmossdk.io/api v0.7.2
cosmossdk.io/api v0.7.5
cosmossdk.io/client/v2 v2.0.0-beta.1
cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.11.0
cosmossdk.io/depinject v1.0.0-alpha.4
cosmossdk.io/core v0.11.1
cosmossdk.io/depinject v1.0.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.3.0
cosmossdk.io/math v1.2.0
cosmossdk.io/store v1.0.2
cosmossdk.io/log v1.4.1
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.1.1
cosmossdk.io/tools/confix v0.1.0
cosmossdk.io/x/evidence v0.1.1
github.com/99designs/gqlgen v0.17.22
github.com/cometbft/cometbft v0.38.2
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.3
github.com/cometbft/cometbft v0.38.12
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.10
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/gogoproto v1.7.0
github.com/deckarep/golang-set v1.8.0
github.com/ethereum/go-ethereum v1.14.5
github.com/gibson042/canonicaljson-go v1.0.3
@ -38,21 +39,21 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ipfs/go-cid v0.4.1
github.com/ipld/go-ipld-prime v0.21.0
github.com/rs/cors v1.8.3
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.17.0
github.com/rs/cors v1.11.1
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/statechannels/go-nitro v0.1.2
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/vektah/gqlparser/v2 v2.5.11
golang.org/x/sync v0.7.0
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.33.0
golang.org/x/sync v0.8.0
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
)
require (
cosmossdk.io/x/tx v0.13.0 // indirect
cosmossdk.io/x/tx v0.13.5 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
@ -62,23 +63,24 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/pebble v1.1.1 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/cometbft/cometbft-db v0.11.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.0.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/iavl v1.2.0 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect
@ -90,12 +92,12 @@ require (
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/emicklei/dot v1.6.0 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/emicklei/dot v1.6.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
@ -110,14 +112,15 @@ require (
github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.1 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-plugin v1.5.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
@ -127,17 +130,16 @@ require (
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.6 // indirect
github.com/linxGnu/grocksdb v1.8.14 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
@ -149,28 +151,29 @@ require (
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.20.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
@ -178,23 +181,22 @@ require (
github.com/tidwall/btree v1.7.0 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.etcd.io/bbolt v1.3.10 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.5.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
replace github.com/statechannels/go-nitro v0.1.2 => github.com/cerc-io/go-nitro v0.1.3-ts-port-0.1.10

547
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# cerc-io laconic gql
> Browser : http://localhost:9473 for gql
> Browser : <http://localhost:9473> for gql
## Run gqlgen
@ -13,7 +13,7 @@ On having some change in the GQL schema (for example: adding a new query) update
go get github.com/99designs/gqlgen@v0.17.22
# Generate bindings
# In gql
cd gql
go run github.com/99designs/gqlgen generate
```

View File

@ -168,10 +168,14 @@ type Auction {
commitFee: Coin! # Fee required to bid/participate in the auction.
revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid).
minimumBid: Coin! # Minimum bid amount.
winnerAddress: String! # Winner address.
winnerBid: Coin! # The winning bid amount.
winnerAddresses: [String!]! # Winner address.
winnerBids: [Coin!]! # The winning bid amount.
winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid).
bids: [AuctionBid] # Bids make in the auction.
maxPrice: Coin! # Max bid amount for service provider auction.
kind: String! # Auction kind.
numProviders: Int # Number of service providers
fundsReleased: Boolean! # Whether funds have been released to providers
bids: [AuctionBid!]! # Bids made in the auction.
}
# Record defines the basic properties of an entity in the graph database.
@ -227,7 +231,7 @@ type Query {
getBondsByIds(ids: [String!]): [Bond]
# Query bonds.
queryBonds(attributes: [KeyValueInput!]): [Bond]
queryBonds: [Bond]
# Query bonds by owner.
queryBondsByOwner(ownerAddresses: [String!]): [OwnerBonds]
@ -246,6 +250,12 @@ type Query {
# Whether to query all records, not just named ones (false by default).
all: Boolean
# Pagination limit
limit: Int
# Pagination offset
offset: Int
): [Record]
#
@ -253,7 +263,7 @@ type Query {
#
# Get authorities list.
getAuthorities(owner: String): [Authority]
getAuthorities(owner: String): [Authority]!
# Lookup authority information.
lookupAuthorities(names: [String!]): [AuthorityRecord]!

View File

@ -61,19 +61,23 @@ type ComplexityRoot struct {
}
Auction struct {
Bids func(childComplexity int) int
CommitFee func(childComplexity int) int
CommitsEndTime func(childComplexity int) int
CreateTime func(childComplexity int) int
ID func(childComplexity int) int
MinimumBid func(childComplexity int) int
OwnerAddress func(childComplexity int) int
RevealFee func(childComplexity int) int
RevealsEndTime func(childComplexity int) int
Status func(childComplexity int) int
WinnerAddress func(childComplexity int) int
WinnerBid func(childComplexity int) int
WinnerPrice func(childComplexity int) int
Bids func(childComplexity int) int
CommitFee func(childComplexity int) int
CommitsEndTime func(childComplexity int) int
CreateTime func(childComplexity int) int
FundsReleased func(childComplexity int) int
ID func(childComplexity int) int
Kind func(childComplexity int) int
MaxPrice func(childComplexity int) int
MinimumBid func(childComplexity int) int
NumProviders func(childComplexity int) int
OwnerAddress func(childComplexity int) int
RevealFee func(childComplexity int) int
RevealsEndTime func(childComplexity int) int
Status func(childComplexity int) int
WinnerAddresses func(childComplexity int) int
WinnerBids func(childComplexity int) int
WinnerPrice func(childComplexity int) int
}
AuctionBid struct {
@ -183,9 +187,9 @@ type ComplexityRoot struct {
GetStatus func(childComplexity int) int
LookupAuthorities func(childComplexity int, names []string) int
LookupNames func(childComplexity int, names []string) int
QueryBonds func(childComplexity int, attributes []*KeyValueInput) int
QueryBonds func(childComplexity int) int
QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool) int
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool, limit *int, offset *int) int
ResolveNames func(childComplexity int, names []string) int
}
@ -233,10 +237,10 @@ type QueryResolver interface {
GetStatus(ctx context.Context) (*Status, error)
GetAccounts(ctx context.Context, addresses []string) ([]*Account, error)
GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error)
QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error)
QueryBonds(ctx context.Context) ([]*Bond, error)
QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error)
GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error)
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error)
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool, limit *int, offset *int) ([]*Record, error)
GetAuthorities(ctx context.Context, owner *string) ([]*Authority, error)
LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error)
LookupNames(ctx context.Context, names []string) ([]*NameRecord, error)
@ -346,6 +350,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.CreateTime(childComplexity), true
case "Auction.fundsReleased":
if e.complexity.Auction.FundsReleased == nil {
break
}
return e.complexity.Auction.FundsReleased(childComplexity), true
case "Auction.id":
if e.complexity.Auction.ID == nil {
break
@ -353,6 +364,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.ID(childComplexity), true
case "Auction.kind":
if e.complexity.Auction.Kind == nil {
break
}
return e.complexity.Auction.Kind(childComplexity), true
case "Auction.maxPrice":
if e.complexity.Auction.MaxPrice == nil {
break
}
return e.complexity.Auction.MaxPrice(childComplexity), true
case "Auction.minimumBid":
if e.complexity.Auction.MinimumBid == nil {
break
@ -360,6 +385,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.MinimumBid(childComplexity), true
case "Auction.numProviders":
if e.complexity.Auction.NumProviders == nil {
break
}
return e.complexity.Auction.NumProviders(childComplexity), true
case "Auction.ownerAddress":
if e.complexity.Auction.OwnerAddress == nil {
break
@ -388,19 +420,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.Status(childComplexity), true
case "Auction.winnerAddress":
if e.complexity.Auction.WinnerAddress == nil {
case "Auction.winnerAddresses":
if e.complexity.Auction.WinnerAddresses == nil {
break
}
return e.complexity.Auction.WinnerAddress(childComplexity), true
return e.complexity.Auction.WinnerAddresses(childComplexity), true
case "Auction.winnerBid":
if e.complexity.Auction.WinnerBid == nil {
case "Auction.winnerBids":
if e.complexity.Auction.WinnerBids == nil {
break
}
return e.complexity.Auction.WinnerBid(childComplexity), true
return e.complexity.Auction.WinnerBids(childComplexity), true
case "Auction.winnerPrice":
if e.complexity.Auction.WinnerPrice == nil {
@ -844,12 +876,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
break
}
args, err := ec.field_Query_queryBonds_args(context.TODO(), rawArgs)
if err != nil {
return 0, false
}
return e.complexity.Query.QueryBonds(childComplexity, args["attributes"].([]*KeyValueInput)), true
return e.complexity.Query.QueryBonds(childComplexity), true
case "Query.queryBondsByOwner":
if e.complexity.Query.QueryBondsByOwner == nil {
@ -873,7 +900,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return 0, false
}
return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool)), true
return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool), args["limit"].(*int), args["offset"].(*int)), true
case "Query.resolveNames":
if e.complexity.Query.ResolveNames == nil {
@ -1294,21 +1321,6 @@ func (ec *executionContext) field_Query_queryBondsByOwner_args(ctx context.Conte
return args, nil
}
func (ec *executionContext) field_Query_queryBonds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 []*KeyValueInput
if tmp, ok := rawArgs["attributes"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes"))
arg0, err = ec.unmarshalOKeyValueInput2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐKeyValueInputᚄ(ctx, tmp)
if err != nil {
return nil, err
}
}
args["attributes"] = arg0
return args, nil
}
func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
@ -1330,6 +1342,24 @@ func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, r
}
}
args["all"] = arg1
var arg2 *int
if tmp, ok := rawArgs["limit"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
if err != nil {
return nil, err
}
}
args["limit"] = arg2
var arg3 *int
if tmp, ok := rawArgs["offset"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset"))
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
if err != nil {
return nil, err
}
}
args["offset"] = arg3
return args, nil
}
@ -2149,8 +2179,8 @@ func (ec *executionContext) fieldContext_Auction_minimumBid(ctx context.Context,
return fc, nil
}
func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_winnerAddress(ctx, field)
func (ec *executionContext) _Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_winnerAddresses(ctx, field)
if err != nil {
return graphql.Null
}
@ -2163,7 +2193,7 @@ func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field gr
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.WinnerAddress, nil
return obj.WinnerAddresses, nil
})
if err != nil {
ec.Error(ctx, err)
@ -2175,12 +2205,12 @@ func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field gr
}
return graphql.Null
}
res := resTmp.(string)
res := resTmp.([]string)
fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
func (ec *executionContext) fieldContext_Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
@ -2193,8 +2223,8 @@ func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Conte
return fc, nil
}
func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_winnerBid(ctx, field)
func (ec *executionContext) _Auction_winnerBids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_winnerBids(ctx, field)
if err != nil {
return graphql.Null
}
@ -2207,7 +2237,7 @@ func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphq
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.WinnerBid, nil
return obj.WinnerBids, nil
})
if err != nil {
ec.Error(ctx, err)
@ -2219,12 +2249,12 @@ func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphq
}
return graphql.Null
}
res := resTmp.(*Coin)
res := resTmp.([]*Coin)
fc.Result = res
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_winnerBid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
func (ec *executionContext) fieldContext_Auction_winnerBids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
@ -2293,6 +2323,185 @@ func (ec *executionContext) fieldContext_Auction_winnerPrice(ctx context.Context
return fc, nil
}
func (ec *executionContext) _Auction_maxPrice(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_maxPrice(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.MaxPrice, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*Coin)
fc.Result = res
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_maxPrice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "type":
return ec.fieldContext_Coin_type(ctx, field)
case "quantity":
return ec.fieldContext_Coin_quantity(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type Coin", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _Auction_kind(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_kind(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Kind, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Auction_numProviders(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_numProviders(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.NumProviders, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*int)
fc.Result = res
return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_numProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Int does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Auction_fundsReleased(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_fundsReleased(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.FundsReleased, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_fundsReleased(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Boolean does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_bids(ctx, field)
if err != nil {
@ -2314,11 +2523,14 @@ func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*AuctionBid)
fc.Result = res
return ec.marshalOAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, field.Selections, res)
return ec.marshalNAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_bids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -3144,12 +3356,20 @@ func (ec *executionContext) fieldContext_AuthorityRecord_auction(ctx context.Con
return ec.fieldContext_Auction_revealFee(ctx, field)
case "minimumBid":
return ec.fieldContext_Auction_minimumBid(ctx, field)
case "winnerAddress":
return ec.fieldContext_Auction_winnerAddress(ctx, field)
case "winnerBid":
return ec.fieldContext_Auction_winnerBid(ctx, field)
case "winnerAddresses":
return ec.fieldContext_Auction_winnerAddresses(ctx, field)
case "winnerBids":
return ec.fieldContext_Auction_winnerBids(ctx, field)
case "winnerPrice":
return ec.fieldContext_Auction_winnerPrice(ctx, field)
case "maxPrice":
return ec.fieldContext_Auction_maxPrice(ctx, field)
case "kind":
return ec.fieldContext_Auction_kind(ctx, field)
case "numProviders":
return ec.fieldContext_Auction_numProviders(ctx, field)
case "fundsReleased":
return ec.fieldContext_Auction_fundsReleased(ctx, field)
case "bids":
return ec.fieldContext_Auction_bids(ctx, field)
}
@ -4578,7 +4798,7 @@ func (ec *executionContext) _Query_queryBonds(ctx context.Context, field graphql
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().QueryBonds(rctx, fc.Args["attributes"].([]*KeyValueInput))
return ec.resolvers.Query().QueryBonds(rctx)
})
if err != nil {
ec.Error(ctx, err)
@ -4610,17 +4830,6 @@ func (ec *executionContext) fieldContext_Query_queryBonds(ctx context.Context, f
return nil, fmt.Errorf("no field named %q was found under type Bond", field.Name)
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Query_queryBonds_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return
}
return fc, nil
}
@ -4766,7 +4975,7 @@ func (ec *executionContext) _Query_queryRecords(ctx context.Context, field graph
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().QueryRecords(rctx, fc.Args["attributes"].([]*KeyValueInput), fc.Args["all"].(*bool))
return ec.resolvers.Query().QueryRecords(rctx, fc.Args["attributes"].([]*KeyValueInput), fc.Args["all"].(*bool), fc.Args["limit"].(*int), fc.Args["offset"].(*int))
})
if err != nil {
ec.Error(ctx, err)
@ -4843,11 +5052,14 @@ func (ec *executionContext) _Query_getAuthorities(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*Authority)
fc.Result = res
return ec.marshalOAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, field.Selections, res)
return ec.marshalNAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Query_getAuthorities(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -5139,12 +5351,20 @@ func (ec *executionContext) fieldContext_Query_getAuctionsByIds(ctx context.Cont
return ec.fieldContext_Auction_revealFee(ctx, field)
case "minimumBid":
return ec.fieldContext_Auction_minimumBid(ctx, field)
case "winnerAddress":
return ec.fieldContext_Auction_winnerAddress(ctx, field)
case "winnerBid":
return ec.fieldContext_Auction_winnerBid(ctx, field)
case "winnerAddresses":
return ec.fieldContext_Auction_winnerAddresses(ctx, field)
case "winnerBids":
return ec.fieldContext_Auction_winnerBids(ctx, field)
case "winnerPrice":
return ec.fieldContext_Auction_winnerPrice(ctx, field)
case "maxPrice":
return ec.fieldContext_Auction_maxPrice(ctx, field)
case "kind":
return ec.fieldContext_Auction_kind(ctx, field)
case "numProviders":
return ec.fieldContext_Auction_numProviders(ctx, field)
case "fundsReleased":
return ec.fieldContext_Auction_fundsReleased(ctx, field)
case "bids":
return ec.fieldContext_Auction_bids(ctx, field)
}
@ -8720,16 +8940,16 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
if out.Values[i] == graphql.Null {
invalids++
}
case "winnerAddress":
case "winnerAddresses":
out.Values[i] = ec._Auction_winnerAddress(ctx, field, obj)
out.Values[i] = ec._Auction_winnerAddresses(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "winnerBid":
case "winnerBids":
out.Values[i] = ec._Auction_winnerBid(ctx, field, obj)
out.Values[i] = ec._Auction_winnerBids(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
@ -8738,6 +8958,31 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
out.Values[i] = ec._Auction_winnerPrice(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "maxPrice":
out.Values[i] = ec._Auction_maxPrice(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "kind":
out.Values[i] = ec._Auction_kind(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "numProviders":
out.Values[i] = ec._Auction_numProviders(ctx, field, obj)
case "fundsReleased":
out.Values[i] = ec._Auction_fundsReleased(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
@ -8745,6 +8990,9 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
out.Values[i] = ec._Auction_bids(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
@ -9581,6 +9829,9 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_getAuthorities(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -10396,6 +10647,98 @@ func (ec *executionContext) marshalNAttribute2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋla
return ec._Attribute(ctx, sel, v)
}
func (ec *executionContext) marshalNAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBidᚄ(ctx context.Context, sel ast.SelectionSet, v []*AuctionBid) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalNAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
for _, e := range ret {
if e == graphql.Null {
return graphql.Null
}
}
return ret
}
func (ec *executionContext) marshalNAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v *AuctionBid) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._AuctionBid(ctx, sel, v)
}
func (ec *executionContext) marshalNAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v []*Authority) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
return ret
}
func (ec *executionContext) marshalNAuthorityRecord2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v []*AuthorityRecord) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
@ -10469,6 +10812,50 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
return res
}
func (ec *executionContext) marshalNCoin2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoinᚄ(ctx context.Context, sel ast.SelectionSet, v []*Coin) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
for _, e := range ret {
if e == graphql.Null {
return graphql.Null
}
}
return ret
}
func (ec *executionContext) marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v *Coin) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@ -10701,6 +11088,38 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
return res
}
func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
var vSlice []interface{}
if v != nil {
vSlice = graphql.CoerceList(v)
}
var err error
res := make([]string, len(vSlice))
for i := range vSlice {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
res[i], err = ec.unmarshalNString2string(ctx, vSlice[i])
if err != nil {
return nil, err
}
}
return res, nil
}
func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
ret := make(graphql.Array, len(v))
for i := range v {
ret[i] = ec.marshalNString2string(ctx, sel, v[i])
}
for _, e := range ret {
if e == graphql.Null {
return graphql.Null
}
}
return ret
}
func (ec *executionContext) marshalNSyncInfo2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐSyncInfo(ctx context.Context, sel ast.SelectionSet, v *SyncInfo) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@ -11183,95 +11602,6 @@ func (ec *executionContext) marshalOAuction2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaco
return ec._Auction(ctx, sel, v)
}
func (ec *executionContext) marshalOAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v []*AuctionBid) graphql.Marshaler {
if v == nil {
return graphql.Null
}
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalOAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
return ret
}
func (ec *executionContext) marshalOAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v *AuctionBid) graphql.Marshaler {
if v == nil {
return graphql.Null
}
return ec._AuctionBid(ctx, sel, v)
}
func (ec *executionContext) marshalOAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v []*Authority) graphql.Marshaler {
if v == nil {
return graphql.Null
}
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
return ret
}
func (ec *executionContext) marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v *Authority) graphql.Marshaler {
if v == nil {
return graphql.Null

View File

@ -26,7 +26,7 @@ func PlaygroundHandler(apiURL string) http.HandlerFunc {
}
}
// https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html
// https://github.com/graphql/graphiql/blob/graphiql%402.4.7/examples/graphiql-cdn/index.html
var page = template.Must(template.New("graphiql").Parse(`
<!DOCTYPE html>
<html lang="en">
@ -68,17 +68,17 @@ var page = template.Must(template.New("graphiql").Parse(`
copy them directly into your environment, or perhaps include them in your
favored resource bundler.
-->
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
<link rel="stylesheet" href="https://unpkg.com/graphiql@2.4.7/graphiql.min.css" />
</head>
<body>
<div id="graphiql">Loading...</div>
<script
src="https://unpkg.com/graphiql/graphiql.min.js"
src="https://unpkg.com/graphiql@2.4.7/graphiql.min.js"
type="application/javascript"
></script>
<script>
// https://github.com/graphql/graphiql/blob/main/packages/graphiql/resources/renderExample.js
// https://github.com/graphql/graphiql/blob/graphiql%402.4.7/packages/graphiql/resources/renderExample.js
// Parse the search string to get url parameters.
var search = window.location.search;

View File

@ -26,19 +26,23 @@ type Attribute struct {
}
type Auction struct {
ID string `json:"id"`
Status string `json:"status"`
OwnerAddress string `json:"ownerAddress"`
CreateTime string `json:"createTime"`
CommitsEndTime string `json:"commitsEndTime"`
RevealsEndTime string `json:"revealsEndTime"`
CommitFee *Coin `json:"commitFee"`
RevealFee *Coin `json:"revealFee"`
MinimumBid *Coin `json:"minimumBid"`
WinnerAddress string `json:"winnerAddress"`
WinnerBid *Coin `json:"winnerBid"`
WinnerPrice *Coin `json:"winnerPrice"`
Bids []*AuctionBid `json:"bids"`
ID string `json:"id"`
Status string `json:"status"`
OwnerAddress string `json:"ownerAddress"`
CreateTime string `json:"createTime"`
CommitsEndTime string `json:"commitsEndTime"`
RevealsEndTime string `json:"revealsEndTime"`
CommitFee *Coin `json:"commitFee"`
RevealFee *Coin `json:"revealFee"`
MinimumBid *Coin `json:"minimumBid"`
WinnerAddresses []string `json:"winnerAddresses"`
WinnerBids []*Coin `json:"winnerBids"`
WinnerPrice *Coin `json:"winnerPrice"`
MaxPrice *Coin `json:"maxPrice"`
Kind string `json:"kind"`
NumProviders *int `json:"numProviders"`
FundsReleased bool `json:"fundsReleased"`
Bids []*AuctionBid `json:"bids"`
}
type AuctionBid struct {

View File

@ -8,6 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
types "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@ -23,6 +24,9 @@ const DefaultLogNumLines = 50
// MaxLogNumLines is the max number of log lines that can be tailed.
const MaxLogNumLines = 1000
// Whether to use default page limit when pagination args are not passed.
const UseDefaultPagination = false
type Resolver struct {
ctx client.Context
logFile string
@ -136,14 +140,34 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
return gqlResponse, nil
}
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) {
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool, limit *int, offset *int) ([]*Record, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
var pagination *query.PageRequest
// Use defaults only if limit and offset not provided
// and UseDefaultPagination is true
if limit == nil && offset == nil {
if UseDefaultPagination {
pagination = &query.PageRequest{}
}
} else {
pagination = &query.PageRequest{}
if limit != nil {
pagination.Limit = uint64(*limit)
}
if offset != nil {
pagination.Offset = uint64(*offset)
}
}
res, err := nsQueryClient.Records(
context.Background(),
&registrytypes.QueryRecordsRequest{
Attributes: toRPCAttributes(attributes),
All: (all != nil && *all),
Pagination: pagination,
},
)
if err != nil {
@ -296,7 +320,7 @@ func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) {
return getGQLBond(bondResp.GetBond())
}
func (q queryResolver) QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error) {
func (q queryResolver) QueryBonds(ctx context.Context) ([]*Bond, error) {
bondQueryClient := bondtypes.NewQueryClient(q.ctx)
bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryBondsRequest{})
if err != nil {
@ -413,7 +437,12 @@ func (q queryResolver) GetParticipantByAddress(ctx context.Context, address stri
func (q queryResolver) GetParticipantByNitroAddress(ctx context.Context, nitroAddress string) (*Participant, error) {
onboardingQueryClient := onboardingTypes.NewQueryClient(q.ctx)
participantResp, err := onboardingQueryClient.GetParticipantByNitroAddress(ctx, &onboardingTypes.QueryGetParticipantByNitroAddressRequest{NitroAddress: nitroAddress})
participantResp, err := onboardingQueryClient.GetParticipantByNitroAddress(
ctx,
&onboardingTypes.QueryGetParticipantByNitroAddressRequest{
NitroAddress: nitroAddress,
},
)
if err != nil {
return nil, err
}

View File

@ -232,19 +232,25 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
return nil, nil
}
numProviders := int(auction.NumProviders)
gqlAuction := Auction{
ID: auction.Id,
Status: auction.Status,
OwnerAddress: auction.OwnerAddress,
CreateTime: auction.GetCreateTime(),
CommitsEndTime: auction.GetCommitsEndTime(),
RevealsEndTime: auction.GetRevealsEndTime(),
CommitFee: getGQLCoin(auction.CommitFee),
RevealFee: getGQLCoin(auction.RevealFee),
MinimumBid: getGQLCoin(auction.MinimumBid),
WinnerAddress: auction.WinnerAddress,
WinnerBid: getGQLCoin(auction.WinningBid),
WinnerPrice: getGQLCoin(auction.WinningPrice),
ID: auction.Id,
Status: auction.Status,
OwnerAddress: auction.OwnerAddress,
CreateTime: auction.GetCreateTime(),
CommitsEndTime: auction.GetCommitsEndTime(),
RevealsEndTime: auction.GetRevealsEndTime(),
CommitFee: getGQLCoin(auction.CommitFee),
RevealFee: getGQLCoin(auction.RevealFee),
MinimumBid: getGQLCoin(auction.MinimumBid),
WinnerAddresses: auction.WinnerAddresses,
WinnerBids: getGQLCoins(auction.WinningBids),
WinnerPrice: getGQLCoin(auction.WinningPrice),
MaxPrice: getGQLCoin(auction.MaxPrice),
Kind: auction.Kind,
NumProviders: &numProviders,
FundsReleased: auction.FundsReleased,
}
auctionBids := make([]*AuctionBid, len(bids))

47
lockup.md Normal file
View File

@ -0,0 +1,47 @@
# Lockup Account Usage
* Add a genesis lockup account:
```bash
laconicd genesis add-genesis-lockup-account <account_name> <distribution-json-file> <coin>[,<coin>...]
# Example
# laconicd genesis add-genesis-lockup-account lps_lockup distribution.json 1000alps
```
* This adds a `LockupAccount` with given name and balance in the genesis file
* The lockup account can be queried as shown below once the chain starts
* Query a lockup account:
```bash
laconicd query auth module-account <account_name>
# Example
# laconicd query auth module-account lps_lockup
# account:
# type: laconic/LockupAccount
# value:
# base_account:
# account_number: "1"
# address: laconic1mprsxp9jqe0d0lp88fxuccthwgy7tqgt5x9y65
# distribution: |-
# {
# ...
```
* Query a lockup account's balance:
```bash
laconicd query bank balances <address>
# Example
lockup_account_address=$(laconicd query auth module-account lps_lockup -o json | jq -r '.account.value.base_account.address')
laconicd query bank balances $lockup_account_address
balances:
- amount: "1000"
denom: alps
pagination:
total: "1"
```

View File

@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/auction"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}

View File

@ -3,76 +3,44 @@ syntax = "proto3";
package cerc.auction.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "cosmos/base/v1beta1/coin.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/auction";
// Params defines the auction module parameters
message Params {
// Write custom stringer method
option (gogoproto.goproto_stringer) = false;
// Duration of the commits phase in seconds
google.protobuf.Duration commits_duration = 1 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
];
// Duration of the reveals phase in seconds
google.protobuf.Duration reveals_duration = 2 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
];
// Commit fees
cosmos.base.v1beta1.Coin commit_fee = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
];
// Reveal fees
cosmos.base.v1beta1.Coin reveal_fee = 4 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
];
// Minimum acceptable bid amount
cosmos.base.v1beta1.Coin minimum_bid = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
}
message Params {}
// Auction represents a sealed-bid on-chain auction
message Auction {
option (gogoproto.goproto_getters) = false;
string id = 1;
string status = 2;
// Auction kind (vickrey | provider)
string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
string status = 3;
// Address of the creator of the auction
string owner_address = 3;
string owner_address = 4;
// Timestamp at which the auction was created
google.protobuf.Timestamp create_time = 4 [
google.protobuf.Timestamp create_time = 5 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\""
];
// Timestamp at which the commits phase concluded
google.protobuf.Timestamp commits_end_time = 5 [
google.protobuf.Timestamp commits_end_time = 6 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\""
];
// Timestamp at which the reveals phase concluded
google.protobuf.Timestamp reveals_end_time = 6 [
google.protobuf.Timestamp reveals_end_time = 7 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\""
@ -80,35 +48,58 @@ message Auction {
// Commit and reveal fees must both be paid when committing a bid
// Reveal fee is returned only if the bid is revealed
cosmos.base.v1beta1.Coin commit_fee = 7 [
cosmos.base.v1beta1.Coin commit_fee = 8 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
];
cosmos.base.v1beta1.Coin reveal_fee = 8 [
cosmos.base.v1beta1.Coin reveal_fee = 9 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
];
// Minimum acceptable bid amount for a valid commit
cosmos.base.v1beta1.Coin minimum_bid = 9 [
// Only applicable in vickrey auctions
cosmos.base.v1beta1.Coin minimum_bid = 10 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
// Address of the winner
string winner_address = 10;
// Addresses of the winners
// (single winner for vickrey auction)
// (multiple winners for provider auctions)
repeated string winner_addresses = 11;
// Winning bid, i.e., the highest bid
cosmos.base.v1beta1.Coin winning_bid = 11 [
// Winning bids, i.e. the best bids
repeated cosmos.base.v1beta1.Coin winning_bids = 12 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\""
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\""
];
// Amount the winner pays, i.e. the second highest auction
cosmos.base.v1beta1.Coin winning_price = 12 [
// Auction winning price
// vickrey auction: second highest bid, paid by the winner
// provider auction: higest bid amongst winning_bids, paid by auction creator
// to each winner
cosmos.base.v1beta1.Coin winning_price = 13 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\""
];
// Maximum acceptable bid amount for a valid commit
// Only applicable in provider auctions
cosmos.base.v1beta1.Coin max_price = 14 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
];
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
int32 num_providers = 15;
// Whether funds have been released to providers
// Only applicable in provider auctions
bool funds_released = 16
[ (gogoproto.moretags) =
"json:\"funds_released\" yaml:\"funds_released\"" ];
}
// Auctions represent all the auctions in the module

View File

@ -7,6 +7,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/duration.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cerc/auction/v1/auction.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/auction";
@ -29,6 +30,15 @@ service Msg {
rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse) {
option (google.api.http).post = "/cerc/auction/v1/reveal_bid";
};
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// ReleaseFunds is the command for paying the winners of provider auctions
rpc ReleaseFunds(MsgReleaseFunds) returns (MsgReleaseFundsResponse) {
option (google.api.http).post = "/cerc/auction/v1/release_funds";
};
}
// MsgCreateAuction defines a create auction message
@ -36,41 +46,56 @@ message MsgCreateAuction {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Address of the signer
string signer = 1
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
// Auction kind (vickrey | provider)
string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
// Duration of the commits phase in seconds
google.protobuf.Duration commits_duration = 1 [
google.protobuf.Duration commits_duration = 3 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
];
// Duration of the reveals phase in seconds
google.protobuf.Duration reveals_duration = 2 [
google.protobuf.Duration reveals_duration = 4 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
];
// Commit fees
cosmos.base.v1beta1.Coin commit_fee = 3 [
cosmos.base.v1beta1.Coin commit_fee = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
];
// Reveal fees
cosmos.base.v1beta1.Coin reveal_fee = 4 [
cosmos.base.v1beta1.Coin reveal_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
];
// Minimum acceptable bid amount
cosmos.base.v1beta1.Coin minimum_bid = 5 [
// Only applicable in vickrey auctions
cosmos.base.v1beta1.Coin minimum_bid = 7 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
// Address of the signer
string signer = 6
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
// Maximum acceptable bid amount
// Only applicable in provider auctions
cosmos.base.v1beta1.Coin max_price = 8 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
];
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
int32 num_providers = 9;
}
// MsgCreateAuctionResponse returns the details of the created auction
@ -134,3 +159,45 @@ message MsgRevealBidResponse {
Auction auction = 1
[ (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" ];
}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/auction parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};
// ReleaseFunds defines the message to pay the winners of provider auctions
message MsgReleaseFunds {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Auction id
string auction_id = 1
[ (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" ];
// Address of the signer
string signer = 2
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
}
// MsgReleaseFundsResponse returns the state of the auction after releasing the
// funds
message MsgReleaseFundsResponse {
option (gogoproto.goproto_getters) = false;
// Auction details
Auction auction = 1
[ (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" ];
}

View File

@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/bond"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}

View File

@ -6,6 +6,8 @@ import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cerc/bond/v1/bond.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/bond";
@ -32,6 +34,10 @@ service Msg {
rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse) {
option (google.api.http).post = "/cerc/bond/v1/cancel_bond";
};
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgCreateBond defines a SDK message for creating a new bond.
@ -91,3 +97,21 @@ message MsgCancelBond {
// MsgCancelBondResponse defines the Msg/CancelBond response type.
message MsgCancelBondResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/bond parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};

View File

@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/registry"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}

View File

@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cosmos/msg/v1/msg.proto";
import "cerc/registry/v1/registry.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/registry";
@ -66,6 +67,10 @@ service Msg {
returns (MsgSetAuthorityBondResponse) {
option (google.api.http).post = "/cerc/registry/v1/set_authority_bond";
}
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgSetRecord
@ -203,3 +208,21 @@ message MsgReassociateRecords {
// MsgReassociateRecordsResponse
message MsgReassociateRecordsResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/registry parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {}

View File

@ -0,0 +1,26 @@
syntax = "proto3";
package cerc.types.v1;
import "amino/amino.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/auth/v1beta1/auth.proto";
import "gogoproto/gogo.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/types/v1";
// LockupAccount extends the Cosmos SDK BaseAccount with a name and distribution
// field. It satisfies the ModuleAccountI interface to allow querying it as a
// module account.
message LockupAccount {
option (amino.name) = "laconic/LockupAccount";
option (amino.message_encoding) = "lockup_account";
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) =
"cosmos.auth.v1beta1.ModuleAccountI";
option (cosmos_proto.implements_interface) = "cerc.types.v1.LockupAccountI";
cosmos.auth.v1beta1.BaseAccount base_account = 1 [ (gogoproto.embed) = true ];
string name = 2;
string distribution = 3;
}

View File

@ -1,16 +1,20 @@
#!/bin/bash
set -e
KEY="alice"
CHAINID=${CHAINID:-"laconic_9000-1"}
MONIKER=${MONIKER:-"localtestnet"}
KEYRING=${KEYRING:-"test"}
DENOM=${DENOM:-"alnt"}
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"}
BALANCE=${BALANCE:-"1000000000000000000000000000000"} # 10^32 alnt
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"} # 10^15 alnt
MIN_GAS_PRICE=${MIN_GAS_PRICE:-"0.001"}
LOGLEVEL=${LOGLEVEL:-"info"}
input_genesis_file=${GENESIS_FILE}
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then
# validate dependencies are installed
command -v jq > /dev/null 2>&1 || {
echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"
@ -30,7 +34,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
# if $KEY exists it should be deleted
laconicd keys add $KEY --keyring-backend $KEYRING
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
# Set moniker and chain-id
laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM
if [[ -f ${input_genesis_file} ]]; then
@ -62,7 +66,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
fi
if [[ "$ONBOARDING_ENABLED" == "true" ]]; then
echo "Enabling validator onboarding."
echo "Enabling onboarding."
update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true'
fi
@ -93,6 +97,16 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
# Set gas limit in genesis
update_genesis '.consensus["params"]["block"]["max_gas"]="10000000"'
# Set distribution community tax to 1 for disabling staking rewards
update_genesis '.app_state["distribution"]["params"]["community_tax"]="1.000000000000000000"'
echo "Setting high threshold for accepting governance proposal"
update_genesis '.app_state["gov"]["params"]["quorum"]="1.000000000000000000"'
# Set expedited threshold to 100%
update_genesis '.app_state["gov"]["params"]["expedited_threshold"]="1.000000000000000000"'
# Set normal threshold to 99% since it needs to be lesser than expedited threshold
update_genesis '.app_state["gov"]["params"]["threshold"]="0.990000000000000000"'
# disable produce empty block
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
@ -115,11 +129,9 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
fi
# Allocate genesis accounts (cosmos formatted addresses)
# 10^30 alnt | 10^12 lnt
laconicd genesis add-genesis-account $KEY 1000000000000000000000000000000$DENOM --keyring-backend $KEYRING
laconicd genesis add-genesis-account $KEY ${BALANCE}${DENOM} --keyring-backend $KEYRING
# Sign genesis transaction
# 10^15 alnt
laconicd genesis gentx $KEY $STAKING_AMOUNT$DENOM --keyring-backend $KEYRING --chain-id $CHAINID
# Collect genesis tx
@ -135,7 +147,7 @@ fi
laconicd start \
--pruning=nothing \
--log_level $LOGLEVEL \
--minimum-gas-prices=1$DENOM \
--minimum-gas-prices=$MIN_GAS_PRICE$DENOM \
--api.enable \
--rpc.laddr="tcp://0.0.0.0:26657" \
--gql-server --gql-playground

View File

@ -103,10 +103,13 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
if createAuction {
auctionArgs := []string{
types.AuctionKindVickrey,
sampleCommitTime, sampleRevealTime,
fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("100%s", ets.cfg.BondDenom),
fmt.Sprintf("0%s", ets.cfg.BondDenom),
"0",
}
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)

View File

@ -46,10 +46,13 @@ func (ets *E2ETestSuite) TestTxCommitBid() {
ets.Run(fmt.Sprintf("Case %s", test.msg), func() {
if test.createAuction {
auctionArgs := []string{
auctiontypes.AuctionKindVickrey,
sampleCommitTime, sampleRevealTime,
fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("100%s", ets.cfg.BondDenom),
fmt.Sprintf("0%s", ets.cfg.BondDenom),
"0",
}
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)

View File

@ -1,11 +1,13 @@
package e2e
import (
"encoding/json"
"fmt"
"os"
"cosmossdk.io/log"
pruningtypes "cosmossdk.io/store/pruning/types"
"github.com/cosmos/cosmos-sdk/codec"
dbm "github.com/cosmos/cosmos-db"
bam "github.com/cosmos/cosmos-sdk/baseapp"
@ -16,12 +18,14 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
laconicApp "git.vdb.to/cerc-io/laconicd/app"
auctionmodule "git.vdb.to/cerc-io/laconicd/x/auction/module"
bondmodule "git.vdb.to/cerc-io/laconicd/x/bond/module"
registrymodule "git.vdb.to/cerc-io/laconicd/x/registry/module"
"git.vdb.to/cerc-io/laconicd/app/params"
_ "git.vdb.to/cerc-io/laconicd/app/params" // import for side-effects (see init)
"git.vdb.to/cerc-io/laconicd/testutil/network"
)
@ -54,16 +58,40 @@ func NewTestNetworkFixture() network.TestFixture {
return app
}
encodingConfig := testutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
bank.AppModuleBasic{},
staking.AppModuleBasic{},
auctionmodule.AppModule{},
bondmodule.AppModule{},
registrymodule.AppModule{},
)
genesisState := app.DefaultGenesis()
genesisState, err = updateStakingGenesisBondDenom(genesisState, encodingConfig.Codec)
if err != nil {
panic(fmt.Sprintf("failed to update genesis state: %v", err))
}
return network.TestFixture{
AppConstructor: appCtr,
GenesisState: app.DefaultGenesis(),
EncodingConfig: testutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
bank.AppModuleBasic{},
staking.AppModuleBasic{},
auctionmodule.AppModule{},
bondmodule.AppModule{},
registrymodule.AppModule{},
),
GenesisState: genesisState,
EncodingConfig: encodingConfig,
}
}
func updateStakingGenesisBondDenom(genesisState map[string]json.RawMessage, codec codec.Codec) (map[string]json.RawMessage, error) {
var stakingGenesis stakingtypes.GenesisState
if err := codec.UnmarshalJSON(genesisState[stakingtypes.ModuleName], &stakingGenesis); err != nil {
return nil, nil
}
stakingGenesis.Params.BondDenom = params.CoinUnit
stakingGenesisBz, err := codec.MarshalJSON(&stakingGenesis)
if err != nil {
return nil, nil
}
genesisState[stakingtypes.ModuleName] = stakingGenesisBz
return genesisState, nil
}

View File

@ -3,10 +3,14 @@ package keeper_test
import (
"context"
"fmt"
"time"
"cosmossdk.io/math"
sdkmath "cosmossdk.io/math"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/app/params"
integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration"
types "git.vdb.to/cerc-io/laconicd/x/auction"
)
@ -284,6 +288,7 @@ func (kts *KeeperTestSuite) TestGrpcGetAuctionsByOwner() {
}
func (kts *KeeperTestSuite) TestGrpcQueryBalance() {
testCases := []struct {
msg string
req *types.QueryGetAuctionModuleBalanceRequest
@ -326,12 +331,18 @@ func (kts *KeeperTestSuite) createAuctionAndCommitBid(commitBid bool) (*types.Au
// Create funded account(s)
accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(1000000))
params, err := k.GetParams(ctx)
if err != nil {
return nil, nil, err
}
auction, err := k.CreateAuction(ctx, types.NewMsgCreateAuction(*params, accounts[0]))
auction, err := k.CreateAuction(
ctx,
types.MsgCreateAuction{
Kind: types.AuctionKindVickrey,
Signer: accounts[0].String(),
CommitsDuration: 5 * time.Minute,
RevealsDuration: 5 * time.Minute,
CommitFee: sdk.NewCoin(params.CoinUnit, sdkmath.NewInt(1000)),
RevealFee: sdk.NewCoin(params.CoinUnit, sdkmath.NewInt(1000)),
MinimumBid: sdk.NewCoin(params.CoinUnit, sdkmath.NewInt(1000000)),
},
)
if err != nil {
return nil, nil, err
}

View File

@ -8,6 +8,7 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/app/params"
integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration"
types "git.vdb.to/cerc-io/laconicd/x/bond"
)
@ -185,7 +186,7 @@ func (kts *KeeperTestSuite) TestGrpcGetModuleBalance() {
if !test.errResponse {
kts.Require().Nil(err)
kts.Require().NotNil(resp.GetBalance())
kts.Require().Equal(resp.GetBalance(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(10))))
kts.Require().Equal(resp.GetBalance(), sdk.NewCoins(sdk.NewCoin(params.CoinUnit, math.NewInt(10))))
} else {
kts.Require().NotNil(err)
kts.Require().Error(err)
@ -201,7 +202,7 @@ func (kts *KeeperTestSuite) createBond() (*types.Bond, error) {
// Create funded account(s)
accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(1000))
bond, err := k.CreateBond(ctx, accounts[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(10))))
bond, err := k.CreateBond(ctx, accounts[0], sdk.NewCoins(sdk.NewCoin(params.CoinUnit, math.NewInt(10))))
if err != nil {
return nil, err
}

View File

@ -23,6 +23,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"git.vdb.to/cerc-io/laconicd/app/params"
auctionTypes "git.vdb.to/cerc-io/laconicd/x/auction"
auctionkeeper "git.vdb.to/cerc-io/laconicd/x/auction/keeper"
auctionmodule "git.vdb.to/cerc-io/laconicd/x/auction/module"
@ -82,8 +83,8 @@ func (tf *TestFixture) Setup() error {
runtime.NewKVStoreService(keys[authtypes.StoreKey]),
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
sdk.Bech32MainPrefix,
addresscodec.NewBech32Codec(params.Bech32PrefixAccAddr),
params.Bech32PrefixAccAddr,
authority.String(),
)
@ -99,9 +100,9 @@ func (tf *TestFixture) Setup() error {
log.NewNopLogger(),
)
auctionKeeper := auctionkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[auctionTypes.StoreKey]), accountKeeper, bankKeeper)
auctionKeeper := auctionkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[auctionTypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
bondKeeper := bondkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[bondTypes.StoreKey]), accountKeeper, bankKeeper)
bondKeeper := bondkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[bondTypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
registryKeeper := registrykeeper.NewKeeper(
cdc,
@ -110,6 +111,7 @@ func (tf *TestFixture) Setup() error {
bankKeeper,
bondKeeper,
auctionKeeper,
authority.String(),
)
authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts, nil)
@ -160,5 +162,5 @@ func (tf *TestFixture) Setup() error {
type BondDenomProvider struct{}
func (bdp BondDenomProvider) BondDenom(ctx context.Context) (string, error) {
return sdk.DefaultBondDenom, nil
return params.CoinUnit, nil
}

View File

@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"git.vdb.to/cerc-io/laconicd/app/params"
integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration"
bondTypes "git.vdb.to/cerc-io/laconicd/x/bond"
types "git.vdb.to/cerc-io/laconicd/x/registry"
@ -51,7 +52,7 @@ func (kts *KeeperTestSuite) createBond() (*bondTypes.Bond, error) {
// Create a funded account
kts.accounts = simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, 1, math.NewInt(1000000000000))
bond, err := kts.BondKeeper.CreateBond(ctx, kts.accounts[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(1000000000))))
bond, err := kts.BondKeeper.CreateBond(ctx, kts.accounts[0], sdk.NewCoins(sdk.NewCoin(params.CoinUnit, math.NewInt(1000000000))))
if err != nil {
return nil, err
}

View File

@ -60,6 +60,8 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/params" // import params as a blank
_ "github.com/cosmos/cosmos-sdk/x/staking" // import staking as a blank
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"git.vdb.to/cerc-io/laconicd/app/params"
)
// package-wide network lock to only allow one test network at a time
@ -148,8 +150,8 @@ func DefaultConfig(factory TestFixtureFactory) Config {
TimeoutCommit: 2 * time.Second,
ChainID: "chain-" + unsafe.Str(6),
NumValidators: 4,
BondDenom: sdk.DefaultBondDenom,
MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom),
BondDenom: params.CoinUnit,
MinGasPrices: fmt.Sprintf("0.000006%s", params.CoinUnit),
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),

View File

@ -9,7 +9,6 @@ import (
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types"
_ "google.golang.org/protobuf/types/known/durationpb"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io"
math "math"
@ -31,20 +30,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the auction module parameters
type Params struct {
// Duration of the commits phase in seconds
CommitsDuration time.Duration `protobuf:"bytes,1,opt,name=commits_duration,json=commitsDuration,proto3,stdduration" json:"commits_duration" json:"commits_duration" yaml:"commits_duration"`
// Duration of the reveals phase in seconds
RevealsDuration time.Duration `protobuf:"bytes,2,opt,name=reveals_duration,json=revealsDuration,proto3,stdduration" json:"reveals_duration" json:"reveals_duration" yaml:"reveals_duration"`
// Commit fees
CommitFee types.Coin `protobuf:"bytes,3,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"`
// Reveal fees
RevealFee types.Coin `protobuf:"bytes,4,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"`
// Minimum acceptable bid amount
MinimumBid types.Coin `protobuf:"bytes,5,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"`
}
func (m *Params) Reset() { *m = Params{} }
func (*Params) ProtoMessage() {}
func (m *Params) Reset() { *m = Params{} }
func (m *Params) String() string { return proto.CompactTextString(m) }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_34b162eb5b365523, []int{0}
}
@ -75,65 +65,47 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetCommitsDuration() time.Duration {
if m != nil {
return m.CommitsDuration
}
return 0
}
func (m *Params) GetRevealsDuration() time.Duration {
if m != nil {
return m.RevealsDuration
}
return 0
}
func (m *Params) GetCommitFee() types.Coin {
if m != nil {
return m.CommitFee
}
return types.Coin{}
}
func (m *Params) GetRevealFee() types.Coin {
if m != nil {
return m.RevealFee
}
return types.Coin{}
}
func (m *Params) GetMinimumBid() types.Coin {
if m != nil {
return m.MinimumBid
}
return types.Coin{}
}
// Auction represents a sealed-bid on-chain auction
type Auction struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// Auction kind (vickrey | provider)
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty" json:"kind" yaml:"kind"`
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
// Address of the creator of the auction
OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"`
OwnerAddress string `protobuf:"bytes,4,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"`
// Timestamp at which the auction was created
CreateTime time.Time `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3,stdtime" json:"create_time" json:"create_time" yaml:"create_time"`
CreateTime time.Time `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3,stdtime" json:"create_time" json:"create_time" yaml:"create_time"`
// Timestamp at which the commits phase concluded
CommitsEndTime time.Time `protobuf:"bytes,5,opt,name=commits_end_time,json=commitsEndTime,proto3,stdtime" json:"commits_end_time" json:"commits_end_time" yaml:"commits_end_time"`
CommitsEndTime time.Time `protobuf:"bytes,6,opt,name=commits_end_time,json=commitsEndTime,proto3,stdtime" json:"commits_end_time" json:"commits_end_time" yaml:"commits_end_time"`
// Timestamp at which the reveals phase concluded
RevealsEndTime time.Time `protobuf:"bytes,6,opt,name=reveals_end_time,json=revealsEndTime,proto3,stdtime" json:"reveals_end_time" json:"reveals_end_time" yaml:"reveals_end_time"`
RevealsEndTime time.Time `protobuf:"bytes,7,opt,name=reveals_end_time,json=revealsEndTime,proto3,stdtime" json:"reveals_end_time" json:"reveals_end_time" yaml:"reveals_end_time"`
// Commit and reveal fees must both be paid when committing a bid
// Reveal fee is returned only if the bid is revealed
CommitFee types.Coin `protobuf:"bytes,7,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"`
RevealFee types.Coin `protobuf:"bytes,8,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"`
CommitFee types.Coin `protobuf:"bytes,8,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"`
RevealFee types.Coin `protobuf:"bytes,9,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"`
// Minimum acceptable bid amount for a valid commit
MinimumBid types.Coin `protobuf:"bytes,9,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"`
// Address of the winner
WinnerAddress string `protobuf:"bytes,10,opt,name=winner_address,json=winnerAddress,proto3" json:"winner_address,omitempty"`
// Winning bid, i.e., the highest bid
WinningBid types.Coin `protobuf:"bytes,11,opt,name=winning_bid,json=winningBid,proto3" json:"winning_bid" json:"winning_bid" yaml:"winning_bid"`
// Amount the winner pays, i.e. the second highest auction
WinningPrice types.Coin `protobuf:"bytes,12,opt,name=winning_price,json=winningPrice,proto3" json:"winning_price" json:"winning_price" yaml:"winning_price"`
// Only applicable in vickrey auctions
MinimumBid types.Coin `protobuf:"bytes,10,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"`
// Addresses of the winners
// (single winner for vickrey auction)
// (multiple winners for provider auctions)
WinnerAddresses []string `protobuf:"bytes,11,rep,name=winner_addresses,json=winnerAddresses,proto3" json:"winner_addresses,omitempty"`
// Winning bids, i.e. the best bids
WinningBids []types.Coin `protobuf:"bytes,12,rep,name=winning_bids,json=winningBids,proto3" json:"winning_bids" json:"winning_bids" yaml:"winning_bids"`
// Auction winning price
// vickrey auction: second highest bid, paid by the winner
// provider auction: higest bid amongst winning_bids, paid by auction creator
// to each winner
WinningPrice types.Coin `protobuf:"bytes,13,opt,name=winning_price,json=winningPrice,proto3" json:"winning_price" json:"winning_price" yaml:"winning_price"`
// Maximum acceptable bid amount for a valid commit
// Only applicable in provider auctions
MaxPrice types.Coin `protobuf:"bytes,14,opt,name=max_price,json=maxPrice,proto3" json:"max_price" json:"max_price" yaml:"max_price"`
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
NumProviders int32 `protobuf:"varint,15,opt,name=num_providers,json=numProviders,proto3" json:"num_providers,omitempty"`
// Whether funds have been released to providers
// Only applicable in provider auctions
FundsReleased bool `protobuf:"varint,16,opt,name=funds_released,json=fundsReleased,proto3" json:"funds_released,omitempty" json:"funds_released" yaml:"funds_released"`
}
func (m *Auction) Reset() { *m = Auction{} }
@ -263,57 +235,60 @@ func init() {
func init() { proto.RegisterFile("cerc/auction/v1/auction.proto", fileDescriptor_34b162eb5b365523) }
var fileDescriptor_34b162eb5b365523 = []byte{
// 798 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x4f, 0xdb,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xba,
0x55, 0x7a, 0xbd, 0x3d, 0x24, 0x99, 0x37, 0x41, 0xa1, 0x97, 0x51, 0x9f, 0x4f, 0xfd, 0x2e, 0xa1,
0xfe, 0x08, 0x46, 0x34, 0x21, 0x11, 0xf2, 0xdf, 0xe9, 0xff, 0x12, 0xc3, 0xaa, 0xe8, 0xf3, 0x83,
0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x61, 0xbb, 0x15, 0xc2, 0x47, 0x0a, 0x00, 0x00,
// 846 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcd, 0x6e, 0xeb, 0x44,
0x14, 0xc7, 0xe3, 0x7e, 0xe4, 0x26, 0x27, 0x4d, 0x5a, 0x59, 0x08, 0x4c, 0xd1, 0x8d, 0x43, 0xaa,
0x8a, 0x54, 0x57, 0xd7, 0x56, 0x60, 0x57, 0x16, 0xa8, 0x46, 0x20, 0x90, 0x58, 0x54, 0x16, 0x62,
0xc1, 0xc6, 0x1a, 0x7b, 0xa6, 0xe9, 0x40, 0x66, 0xa6, 0x78, 0xec, 0xdc, 0xb2, 0x64, 0xc7, 0xf2,
0xbe, 0x01, 0xec, 0x79, 0x91, 0xbb, 0xbc, 0x4b, 0x56, 0x01, 0xb5, 0x6f, 0xd0, 0x27, 0x40, 0x9e,
0x8f, 0xd4, 0x31, 0x1f, 0xa1, 0x57, 0xea, 0x6e, 0xce, 0x7f, 0xe6, 0xcc, 0xef, 0x9c, 0xc9, 0xf1,
0x5f, 0x81, 0xa7, 0x19, 0xc9, 0xb3, 0x10, 0x95, 0x59, 0x41, 0x05, 0x0f, 0x17, 0x53, 0xbb, 0x0c,
0xae, 0x72, 0x51, 0x08, 0x77, 0xbf, 0xda, 0x0e, 0xac, 0xb6, 0x98, 0x1e, 0xbe, 0x35, 0x13, 0x33,
0xa1, 0xf6, 0xc2, 0x6a, 0xa5, 0x8f, 0x1d, 0xf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, 0x3e, 0xf4, 0xcc, 0x27, 0x79, 0x89, 0xe4, 0xa5, 0xb1, 0x5e, 0xf3, 0xc9, 0x7f, 0x81, 0xe4,
0xa5, 0x32, 0x5e, 0x7d, 0xe0, 0x0d, 0x8d, 0xf7, 0x3e, 0xb9, 0xe1, 0x01, 0x75, 0xe3, 0x55, 0xca,
0x3f, 0x18, 0x4e, 0xfb, 0xb1, 0x0c, 0x87, 0x43, 0xcf, 0x78, 0xc4, 0xff, 0x74, 0xd5, 0x46, 0x5b,
0xb5, 0xe4, 0x86, 0xe7, 0xd4, 0xda, 0xd2, 0x8a, 0x6d, 0xab, 0x66, 0x70, 0x9d, 0xc7, 0x32, 0x38,
0x02, 0x90, 0x52, 0x9c, 0x20, 0x26, 0x4a, 0x5e, 0x3c, 0xd8, 0x47, 0xef, 0x53, 0x2d, 0xa6, 0xa6,
0xc4, 0xdd, 0x94, 0xe2, 0x33, 0xb5, 0xd6, 0x13, 0x1a, 0x7d, 0xf2, 0xea, 0x66, 0xe8, 0xbc, 0xbe,
0x19, 0x3a, 0x7f, 0xde, 0x0c, 0x9d, 0x97, 0xb7, 0xc3, 0xd6, 0xeb, 0xdb, 0x61, 0xeb, 0xf7, 0xdb,
0x61, 0xeb, 0xdb, 0xe3, 0x19, 0x2d, 0x82, 0x05, 0x4e, 0x83, 0x42, 0x84, 0xd5, 0xd4, 0x3f, 0xa7,
0x22, 0x9c, 0xa3, 0x4c, 0x70, 0x9a, 0xe1, 0xf0, 0xda, 0xfe, 0xad, 0x49, 0xdb, 0xea, 0x9d, 0x3f,
0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x67, 0x62, 0x6b, 0xf8, 0x08, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@ -336,52 +311,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
{
size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
{
size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
{
size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
n4, err4 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration):])
if err4 != nil {
return 0, err4
}
i -= n4
i = encodeVarintAuction(dAtA, i, uint64(n4))
i--
dAtA[i] = 0x12
n5, err5 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration):])
if err5 != nil {
return 0, err5
}
i -= n5
i = encodeVarintAuction(dAtA, i, uint64(n5))
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
@ -405,6 +334,33 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.FundsReleased {
i--
if m.FundsReleased {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x80
}
if m.NumProviders != 0 {
i = encodeVarintAuction(dAtA, i, uint64(m.NumProviders))
i--
dAtA[i] = 0x78
}
{
size, err := m.MaxPrice.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x72
{
size, err := m.WinningPrice.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -414,23 +370,29 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x62
{
size, err := m.WinningBid.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
dAtA[i] = 0x6a
if len(m.WinningBids) > 0 {
for iNdEx := len(m.WinningBids) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.WinningBids[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x62
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x5a
if len(m.WinnerAddress) > 0 {
i -= len(m.WinnerAddress)
copy(dAtA[i:], m.WinnerAddress)
i = encodeVarintAuction(dAtA, i, uint64(len(m.WinnerAddress)))
i--
dAtA[i] = 0x52
if len(m.WinnerAddresses) > 0 {
for iNdEx := len(m.WinnerAddresses) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.WinnerAddresses[iNdEx])
copy(dAtA[i:], m.WinnerAddresses[iNdEx])
i = encodeVarintAuction(dAtA, i, uint64(len(m.WinnerAddresses[iNdEx])))
i--
dAtA[i] = 0x5a
}
}
{
size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i])
@ -441,7 +403,7 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x4a
dAtA[i] = 0x52
{
size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -451,7 +413,7 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
dAtA[i] = 0x4a
{
size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -461,43 +423,50 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealsEndTime):])
if err11 != nil {
return 0, err11
dAtA[i] = 0x42
n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealsEndTime):])
if err6 != nil {
return 0, err6
}
i -= n11
i = encodeVarintAuction(dAtA, i, uint64(n11))
i -= n6
i = encodeVarintAuction(dAtA, i, uint64(n6))
i--
dAtA[i] = 0x3a
n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitsEndTime):])
if err7 != nil {
return 0, err7
}
i -= n7
i = encodeVarintAuction(dAtA, i, uint64(n7))
i--
dAtA[i] = 0x32
n12, err12 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitsEndTime):])
if err12 != nil {
return 0, err12
n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreateTime):])
if err8 != nil {
return 0, err8
}
i -= n12
i = encodeVarintAuction(dAtA, i, uint64(n12))
i -= n8
i = encodeVarintAuction(dAtA, i, uint64(n8))
i--
dAtA[i] = 0x2a
n13, err13 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreateTime):])
if err13 != nil {
return 0, err13
}
i -= n13
i = encodeVarintAuction(dAtA, i, uint64(n13))
i--
dAtA[i] = 0x22
if len(m.OwnerAddress) > 0 {
i -= len(m.OwnerAddress)
copy(dAtA[i:], m.OwnerAddress)
i = encodeVarintAuction(dAtA, i, uint64(len(m.OwnerAddress)))
i--
dAtA[i] = 0x1a
dAtA[i] = 0x22
}
if len(m.Status) > 0 {
i -= len(m.Status)
copy(dAtA[i:], m.Status)
i = encodeVarintAuction(dAtA, i, uint64(len(m.Status)))
i--
dAtA[i] = 0x1a
}
if len(m.Kind) > 0 {
i -= len(m.Kind)
copy(dAtA[i:], m.Kind)
i = encodeVarintAuction(dAtA, i, uint64(len(m.Kind)))
i--
dAtA[i] = 0x12
}
if len(m.Id) > 0 {
@ -587,12 +556,12 @@ func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) {
}
i--
dAtA[i] = 0x42
n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealTime):])
if err16 != nil {
return 0, err16
n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealTime):])
if err11 != nil {
return 0, err11
}
i -= n16
i = encodeVarintAuction(dAtA, i, uint64(n16))
i -= n11
i = encodeVarintAuction(dAtA, i, uint64(n11))
i--
dAtA[i] = 0x3a
{
@ -605,12 +574,12 @@ func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) {
}
i--
dAtA[i] = 0x32
n18, err18 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitTime):])
if err18 != nil {
return 0, err18
n13, err13 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitTime):])
if err13 != nil {
return 0, err13
}
i -= n18
i = encodeVarintAuction(dAtA, i, uint64(n18))
i -= n13
i = encodeVarintAuction(dAtA, i, uint64(n13))
i--
dAtA[i] = 0x2a
if len(m.CommitHash) > 0 {
@ -661,16 +630,6 @@ func (m *Params) Size() (n int) {
}
var l int
_ = l
l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration)
n += 1 + l + sovAuction(uint64(l))
l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration)
n += 1 + l + sovAuction(uint64(l))
l = m.CommitFee.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.RevealFee.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.MinimumBid.Size()
n += 1 + l + sovAuction(uint64(l))
return n
}
@ -684,6 +643,10 @@ func (m *Auction) Size() (n int) {
if l > 0 {
n += 1 + l + sovAuction(uint64(l))
}
l = len(m.Kind)
if l > 0 {
n += 1 + l + sovAuction(uint64(l))
}
l = len(m.Status)
if l > 0 {
n += 1 + l + sovAuction(uint64(l))
@ -704,14 +667,28 @@ func (m *Auction) Size() (n int) {
n += 1 + l + sovAuction(uint64(l))
l = m.MinimumBid.Size()
n += 1 + l + sovAuction(uint64(l))
l = len(m.WinnerAddress)
if l > 0 {
n += 1 + l + sovAuction(uint64(l))
if len(m.WinnerAddresses) > 0 {
for _, s := range m.WinnerAddresses {
l = len(s)
n += 1 + l + sovAuction(uint64(l))
}
}
if len(m.WinningBids) > 0 {
for _, e := range m.WinningBids {
l = e.Size()
n += 1 + l + sovAuction(uint64(l))
}
}
l = m.WinningBid.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.WinningPrice.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.MaxPrice.Size()
n += 1 + l + sovAuction(uint64(l))
if m.NumProviders != 0 {
n += 1 + sovAuction(uint64(m.NumProviders))
}
if m.FundsReleased {
n += 3
}
return n
}
@ -800,171 +777,6 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitsDuration", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.CommitsDuration, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealsDuration", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.RevealsDuration, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipAuction(dAtA[iNdEx:])
@ -1048,6 +860,38 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
m.Id = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Kind = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
@ -1079,7 +923,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
}
m.Status = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType)
}
@ -1111,7 +955,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
}
m.OwnerAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType)
}
@ -1144,7 +988,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 5:
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitsEndTime", wireType)
}
@ -1177,7 +1021,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 6:
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealsEndTime", wireType)
}
@ -1210,7 +1054,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 7:
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType)
}
@ -1243,7 +1087,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 8:
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType)
}
@ -1276,7 +1120,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 9:
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType)
}
@ -1309,9 +1153,9 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 10:
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WinnerAddress", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field WinnerAddresses", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@ -1339,11 +1183,11 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.WinnerAddress = string(dAtA[iNdEx:postIndex])
m.WinnerAddresses = append(m.WinnerAddresses, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 11:
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WinningBid", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field WinningBids", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@ -1370,11 +1214,12 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.WinningBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
m.WinningBids = append(m.WinningBids, types.Coin{})
if err := m.WinningBids[len(m.WinningBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 12:
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WinningPrice", wireType)
}
@ -1407,6 +1252,78 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 14:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 15:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NumProviders", wireType)
}
m.NumProviders = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NumProviders |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 16:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field FundsReleased", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.FundsReleased = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipAuction(dAtA[iNdEx:])

View File

@ -4,6 +4,7 @@ import (
"encoding/hex"
"fmt"
"os"
"strconv"
"time"
"github.com/cosmos/cosmos-sdk/client"
@ -12,7 +13,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"
"github.com/spf13/viper"
wnsUtils "git.vdb.to/cerc-io/laconicd/utils"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
@ -48,6 +48,16 @@ func GetCmdCommitBid() *cobra.Command {
return err
}
// Take chain id passed by user
chainId, _ := cmd.Flags().GetString(flags.FlagChainID)
if chainId == "" {
// Take from config if not provided
chainId = clientCtx.ChainID
}
if chainId == "" {
return fmt.Errorf("--chain-id required")
}
bidAmount, err := sdk.ParseCoinNormalized(args[1])
if err != nil {
return err
@ -58,7 +68,6 @@ func GetCmdCommitBid() *cobra.Command {
return err
}
chainId := viper.GetString("chain-id")
auctionId := args[0]
reveal := map[string]interface{}{
@ -132,48 +141,63 @@ func GetCmdRevealBid() *cobra.Command {
func GetCmdCreateAuction() *cobra.Command {
cmd := &cobra.Command{
Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid]",
Use: "create [kind] [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid] [max-price] [num-providers]",
Short: "Create auction.",
Args: cobra.ExactArgs(5),
Args: cobra.ExactArgs(8),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
commitsDuration, err := time.ParseDuration(args[0])
kind := args[0]
commitsDuration, err := time.ParseDuration(args[1])
if err != nil {
return err
}
revealsDuration, err := time.ParseDuration(args[1])
revealsDuration, err := time.ParseDuration(args[2])
if err != nil {
return err
}
commitFee, err := sdk.ParseCoinNormalized(args[2])
commitFee, err := sdk.ParseCoinNormalized(args[3])
if err != nil {
return err
}
revealFee, err := sdk.ParseCoinNormalized(args[3])
revealFee, err := sdk.ParseCoinNormalized(args[4])
if err != nil {
return err
}
minimumBid, err := sdk.ParseCoinNormalized(args[4])
minimumBid, err := sdk.ParseCoinNormalized(args[5])
if err != nil {
return err
}
params := auctiontypes.Params{
CommitsDuration: commitsDuration,
RevealsDuration: revealsDuration,
CommitFee: commitFee,
RevealFee: revealFee,
MinimumBid: minimumBid,
maxPrice, err := sdk.ParseCoinNormalized(args[6])
if err != nil {
return err
}
msg := auctiontypes.NewMsgCreateAuction(params, clientCtx.GetFromAddress())
numProviders, err := strconv.ParseInt(args[7], 10, 32)
if err != nil {
return err
}
msg := auctiontypes.NewMsgCreateAuction(
kind,
commitsDuration,
revealsDuration,
commitFee,
revealFee,
minimumBid,
maxPrice,
int32(numProviders),
clientCtx.GetFromAddress(),
)
err = msg.ValidateBasic()
if err != nil {
return err

View File

@ -4,6 +4,7 @@ const (
EventTypeCreateAuction = "create-auction"
EventTypeCommitBid = "commit-bid"
EventTypeRevealBid = "reveal-bid"
EventTypeReleaseFunds = "release-funds"
AttributeKeyCommitsDuration = "commits-duration"
AttributeKeyRevealsDuration = "reveals-duration"

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"slices"
"time"
"cosmossdk.io/collections"
@ -12,6 +13,7 @@ import (
storetypes "cosmossdk.io/core/store"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -24,7 +26,7 @@ import (
)
// CompletedAuctionDeleteTimeout => Completed auctions are deleted after this timeout (after reveals end time).
const CompletedAuctionDeleteTimeout = time.Hour * 24
const CompletedAuctionDeleteTimeout = 365 * 24 * time.Hour // 1 year
type AuctionsIndexes struct {
Owner *indexes.Multi[string, string, auctiontypes.Auction]
@ -67,6 +69,8 @@ type Keeper struct {
// Codecs
cdc codec.BinaryCodec
authority string
// External keepers
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
@ -91,10 +95,17 @@ func NewKeeper(
storeService storetypes.KVStoreService,
accountKeeper auth.AccountKeeper,
bankKeeper bank.Keeper,
authority string,
) *Keeper {
// ensure that authority is a valid AccAddress
if _, err := accountKeeper.AddressCodec().StringToBytes(authority); err != nil {
panic("authority is not a valid acc address")
}
sb := collections.NewSchemaBuilder(storeService)
k := Keeper{
cdc: cdc,
authority: authority,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
Params: collections.NewItem(sb, auctiontypes.ParamsPrefix, "params", codec.CollValue[auctiontypes.Params](cdc)),
@ -330,8 +341,18 @@ func (k Keeper) CreateAuction(ctx sdk.Context, msg auctiontypes.MsgCreateAuction
commitsEndTime := now.Add(msg.CommitsDuration)
revealsEndTime := now.Add(msg.CommitsDuration + msg.RevealsDuration)
if msg.Kind == auctiontypes.AuctionKindProvider {
totalLockedAmount := sdk.NewCoin(msg.MaxPrice.Denom, msg.MaxPrice.Amount.MulRaw(int64(msg.NumProviders)))
sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, auctiontypes.ModuleName, sdk.NewCoins(totalLockedAmount))
if sdkErr != nil {
return nil, errorsmod.Wrap(sdkErr, "Auction error transferring maximum price amount")
}
}
auction := auctiontypes.Auction{
Id: auctionId,
Kind: msg.Kind,
Status: auctiontypes.AuctionStatusCommitPhase,
OwnerAddress: signerAddress.String(),
CreateTime: now,
@ -340,6 +361,8 @@ func (k Keeper) CreateAuction(ctx sdk.Context, msg auctiontypes.MsgCreateAuction
CommitFee: msg.CommitFee,
RevealFee: msg.RevealFee,
MinimumBid: msg.MinimumBid,
MaxPrice: msg.MaxPrice,
NumProviders: msg.NumProviders,
}
// Save auction in store.
@ -507,14 +530,20 @@ func (k Keeper) RevealBid(ctx sdk.Context, msg auctiontypes.MsgRevealBid) (*auct
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.")
}
if bidAmount.IsLT(auction.MinimumBid) {
if auction.Kind == auctiontypes.AuctionKindVickrey && bidAmount.IsLT(auction.MinimumBid) {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Bid is lower than minimum bid.")
}
if auction.Kind == auctiontypes.AuctionKindProvider && auction.MaxPrice.IsLT(bidAmount) {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Bid is higher than max price.")
}
// Lock bid amount.
sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, auctiontypes.ModuleName, sdk.NewCoins(bidAmount))
if sdkErr != nil {
return nil, sdkErr
if auction.Kind == auctiontypes.AuctionKindVickrey {
sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, auctiontypes.ModuleName, sdk.NewCoins(bidAmount))
if sdkErr != nil {
return nil, sdkErr
}
}
// Update bid.
@ -528,6 +557,11 @@ func (k Keeper) RevealBid(ctx sdk.Context, msg auctiontypes.MsgRevealBid) (*auct
return &auction, nil
}
// GetAuthority returns the x/auction module's authority.
func (k Keeper) GetAuthority() string {
return k.authority
}
// GetParams gets the auction module's parameters.
func (k Keeper) GetParams(ctx sdk.Context) (*auctiontypes.Params, error) {
params, err := k.Params.Get(ctx)
@ -538,6 +572,11 @@ func (k Keeper) GetParams(ctx sdk.Context) (*auctiontypes.Params, error) {
return &params, nil
}
// SetParams sets the x/auction module parameters.
func (k Keeper) SetParams(ctx sdk.Context, params auctiontypes.Params) error {
return k.Params.Set(ctx, params)
}
// GetAuctionModuleBalances gets the auction module account(s) balances.
func (k Keeper) GetAuctionModuleBalances(ctx sdk.Context) sdk.Coins {
moduleAddress := k.accountKeeper.GetModuleAddress(auctiontypes.ModuleName)
@ -587,8 +626,14 @@ func (k Keeper) processAuctionPhases(ctx sdk.Context) error {
// If auction has expired, pick a winner from revealed bids.
if auction.Status == auctiontypes.AuctionStatusExpired {
if err = k.pickAuctionWinner(ctx, auction); err != nil {
return err
if auction.Kind == auctiontypes.AuctionKindVickrey {
if err = k.pickAuctionWinner(ctx, auction); err != nil {
return err
}
} else {
if err = k.pickProviderAuctionWinners(ctx, auction); err != nil {
return err
}
}
}
}
@ -616,6 +661,7 @@ func (k Keeper) deleteCompletedAuctions(ctx sdk.Context) error {
return nil
}
// Pick winner for vickrey auction
func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction) error {
k.Logger(ctx).Info(fmt.Sprintf("Picking auction %s winner.", auction.Id))
@ -667,17 +713,17 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction
auction.Status = auctiontypes.AuctionStatusCompleted
if highestBid != nil {
auction.WinnerAddress = highestBid.BidderAddress
auction.WinningBid = highestBid.BidAmount
auction.WinningBids = []sdk.Coin{highestBid.BidAmount}
auction.WinnerAddresses = []string{highestBid.BidderAddress}
// Winner pays 2nd price, if a 2nd price exists.
auction.WinningPrice = highestBid.BidAmount
if secondHighestBid != nil {
auction.WinningPrice = secondHighestBid.BidAmount
}
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String()))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String()))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddresses[0]))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBids[0].String()))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winning price %s.", auction.Id, auction.WinningPrice.String()))
} else {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id))
}
@ -711,8 +757,8 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction
}
// Process winner account (if nobody bids, there won't be a winner).
if auction.WinnerAddress != "" {
winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddress)
if len(auction.WinnerAddresses) != 0 {
winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddresses[0])
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid winner address. %v", err))
panic("Invalid winner address.")
@ -754,3 +800,173 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction
return nil
}
// Pick winner for provider auction
func (k Keeper) pickProviderAuctionWinners(ctx sdk.Context, auction *auctiontypes.Auction) error {
k.Logger(ctx).Info(fmt.Sprintf("Picking auction %s winners.", auction.Id))
bids, err := k.GetBids(ctx, auction.Id)
if err != nil {
return err
}
revealedBids := make([]*auctiontypes.Bid, 0, len(bids))
for _, bid := range bids {
k.Logger(ctx).Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String()))
// Only consider revealed bids.
if bid.Status != auctiontypes.BidStatusRevealed {
k.Logger(ctx).Info(fmt.Sprintf("Ignoring unrevealed bid %s %s", bid.BidderAddress, bid.BidAmount.String()))
continue
}
revealedBids = append(revealedBids, bid)
}
// Sort the valid bids
slices.SortStableFunc(revealedBids, func(a, b *auctiontypes.Bid) int {
if a.BidAmount.Amount.LT(b.BidAmount.Amount) {
return -1
} else if a.BidAmount.Amount.GT(b.BidAmount.Amount) {
return 1
}
return 0
})
// Take best min(len(revealedBids), auction.NumProviders) bids
numWinners := int(auction.NumProviders)
if len(revealedBids) < numWinners {
numWinners = len(revealedBids)
}
winnerBids := revealedBids[:numWinners]
auction.Status = auctiontypes.AuctionStatusCompleted
if len(winnerBids) > 0 {
winnerAddresses := make([]string, len(winnerBids))
winningBids := make([]sdk.Coin, len(winnerBids))
for i, bid := range winnerBids {
winnerAddresses[i] = bid.BidderAddress
winningBids[i] = bid.BidAmount
}
auction.WinnerAddresses = winnerAddresses
auction.WinningBids = winningBids
// The last best bid is the winning price
auction.WinningPrice = winnerBids[len(winnerBids)-1].BidAmount
for _, bid := range winnerBids {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner address: %s, bid amount: %s.", auction.Id, bid.BidderAddress, bid.BidAmount.String()))
}
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winning price %s.", auction.Id, auction.WinningPrice.String()))
} else {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id))
}
if err := k.SaveAuction(ctx, auction); err != nil {
return err
}
for _, bid := range bids {
bidderAddress, err := sdk.AccAddressFromBech32(bid.BidderAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid bidderAddress address. %v", err))
panic("Invalid bidder address.")
}
if bid.Status == auctiontypes.BidStatusRevealed {
// Send reveal fee back to bidders that've revealed the bid.
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, bidderAddress, sdk.NewCoins(bid.RevealFee))
if sdkErr != nil {
k.Logger(ctx).Error(fmt.Sprintf("Auction error returning reveal fee: %v", sdkErr))
panic(sdkErr)
}
}
}
// Send back any leftover locked amount to auction creator
// All of it in case of no winners
totalLockedAmount := auction.MaxPrice.Amount.Mul(math.NewInt(int64(auction.NumProviders)))
totalAmountPaid := auction.WinningPrice.Amount.Mul(math.NewInt(int64(len(auction.WinnerAddresses))))
creatorLeftOverAmount := sdk.NewCoin(auction.MaxPrice.Denom, totalLockedAmount.Sub(totalAmountPaid))
ownerAccAddress, err := sdk.AccAddressFromBech32(auction.OwnerAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid auction owner address. %v", err))
panic("Invalid auction owner address.")
}
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(
ctx,
auctiontypes.ModuleName,
ownerAccAddress,
sdk.NewCoins(creatorLeftOverAmount),
)
if sdkErr != nil {
k.Logger(ctx).Error(fmt.Sprintf("Auction error returning leftover locked amount: %v", sdkErr))
panic(sdkErr)
}
// Notify other modules (hook).
k.Logger(ctx).Info(fmt.Sprintf("Auction %s notifying %d modules.", auction.Id, len(k.usageKeepers)))
for _, keeper := range k.usageKeepers {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s notifying module %s.", auction.Id, keeper.ModuleName()))
keeper.OnAuctionWinnerSelected(ctx, auction.Id)
}
return nil
}
func (k Keeper) ReleaseFunds(ctx sdk.Context, msg auctiontypes.MsgReleaseFunds) (*auctiontypes.Auction, error) {
auction, err := k.GetAuctionById(ctx, msg.AuctionId)
if err != nil {
return nil, err
}
if auction.Kind != auctiontypes.AuctionKindProvider {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction kind must be provider.")
}
// Only the auction owner can release funds.
if msg.Signer != auction.OwnerAddress {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Only auction owner can release funds.")
}
if auction.Status != auctiontypes.AuctionStatusCompleted {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction is not completed.")
}
if auction.FundsReleased {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction funds already released.")
}
// Mark funds as released in the stored auction
auction.FundsReleased = true
if err = k.SaveAuction(ctx, &auction); err != nil {
return nil, err
}
// Process winner accounts.
for _, winnerAddress := range auction.WinnerAddresses {
winnerAccAddress, err := sdk.AccAddressFromBech32(winnerAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid winner address. %v", err))
panic("Invalid winner address.")
}
// Send winning price to winning bidders
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(
ctx,
auctiontypes.ModuleName,
winnerAccAddress,
sdk.NewCoins(auction.WinningPrice),
)
if sdkErr != nil {
k.Logger(ctx).Error(fmt.Sprintf("Auction error sending funds to winner: %v", sdkErr))
panic(sdkErr)
}
}
return &auction, err
}

View File

@ -3,9 +3,11 @@ package keeper
import (
"context"
errorsmod "cosmossdk.io/errors"
"git.vdb.to/cerc-io/laconicd/utils"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)
var _ auctiontypes.MsgServer = msgServer{}
@ -54,7 +56,6 @@ func (ms msgServer) CreateAuction(c context.Context, msg *auctiontypes.MsgCreate
}
// CommitBid is the command for committing a bid
// nolint: all
func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid) (*auctiontypes.MsgCommitBidResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
@ -92,7 +93,6 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid)
}
// RevealBid is the command for revealing a bid
// nolint: all
func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid) (*auctiontypes.MsgRevealBidResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
@ -128,3 +128,58 @@ func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid)
return &auctiontypes.MsgRevealBidResponse{Auction: resp}, nil
}
// UpdateParams defines a method to perform updation of module params.
func (ms msgServer) UpdateParams(c context.Context, msg *auctiontypes.MsgUpdateParams) (*auctiontypes.MsgUpdateParamsResponse, error) {
if ms.k.authority != msg.Authority {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
}
if err := msg.Params.Validate(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
if err := ms.k.SetParams(ctx, msg.Params); err != nil {
return nil, err
}
return &auctiontypes.MsgUpdateParamsResponse{}, nil
}
// ReleaseFunds is the command to pay the winning amounts to provider auction winners
func (ms msgServer) ReleaseFunds(c context.Context, msg *auctiontypes.MsgReleaseFunds) (*auctiontypes.MsgReleaseFundsResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
return nil, err
}
resp, err := ms.k.ReleaseFunds(ctx, *msg)
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
auctiontypes.EventTypeReleaseFunds,
sdk.NewAttribute(auctiontypes.AttributeKeyAuctionId, msg.AuctionId),
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, auctiontypes.AttributeValueCategory),
sdk.NewAttribute(auctiontypes.AttributeKeySigner, signerAddress.String()),
),
})
utils.LogTxGasConsumed(ctx, ms.k.Logger(ctx), "ReleaseFunds")
return &auctiontypes.MsgReleaseFundsResponse{Auction: resp}, nil
}

View File

@ -81,17 +81,27 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "CreateAuction",
Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid]",
Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee]",
Short: "Create an auction",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "commits_duration"},
{ProtoField: "reveals_duration"},
{ProtoField: "commit_fee"},
{ProtoField: "reveal_fee"},
{ProtoField: "minimum_bid"},
},
FlagOptions: map[string]*autocliv1.FlagOptions{
"kind": {Name: "kind", DefaultValue: "vickrey", Usage: "Auction kind (vickrey|provider) (default: vickrey)"},
"minimum_bid": {Name: "minimum-bid", Usage: "Minimum bid (required for vickrey auctions)"},
"max_price": {Name: "max-price", Usage: "Max price (required for provider auctions)"},
"num_providers": {Name: "num-providers", Usage: "Number of desired providers (required for provider auctions)"},
},
},
{
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
},
EnhanceCustomCommand: true, // Allow additional manual commands
},
}

View File

@ -7,7 +7,9 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
modulev1 "git.vdb.to/cerc-io/laconicd/api/cerc/auction/module/v1"
"git.vdb.to/cerc-io/laconicd/x/auction"
@ -33,6 +35,7 @@ func init() {
type ModuleInputs struct {
depinject.In
Config *modulev1.Module
Cdc codec.Codec
StoreService store.KVStoreService
@ -52,7 +55,13 @@ type ModuleOutputs struct {
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper)
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper, authority.String())
m := NewAppModule(in.Cdc, k)
return ModuleOutputs{Module: m, Keeper: k}

View File

@ -1,6 +1,9 @@
package auction
import (
"fmt"
time "time"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@ -13,13 +16,26 @@ var (
)
// NewMsgCreateAuction is the constructor function for MsgCreateAuction.
func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction {
func NewMsgCreateAuction(
kind string,
commitsDuration time.Duration,
revealsDuration time.Duration,
commitFee sdk.Coin,
revealFee sdk.Coin,
minimumBid sdk.Coin,
maxPrice sdk.Coin,
numProviders int32,
signer sdk.AccAddress,
) MsgCreateAuction {
return MsgCreateAuction{
CommitsDuration: params.CommitsDuration,
RevealsDuration: params.RevealsDuration,
CommitFee: params.CommitFee,
RevealFee: params.RevealFee,
MinimumBid: params.MinimumBid,
CommitsDuration: commitsDuration,
RevealsDuration: revealsDuration,
CommitFee: commitFee,
RevealFee: revealFee,
MinimumBid: minimumBid,
MaxPrice: maxPrice,
Kind: kind,
NumProviders: numProviders,
Signer: signer.String(),
}
}
@ -33,22 +49,53 @@ func NewMsgCommitBid(auctionId string, commitHash string, signer sdk.AccAddress)
}
}
// NewMsgRevealBid is the constructor function for MsgRevealBid.
func NewMsgRevealBid(auctionId string, reveal string, signer sdk.AccAddress) MsgRevealBid {
return MsgRevealBid{
AuctionId: auctionId,
Reveal: reveal,
Signer: signer.String(),
}
}
// NewMsgReleaseFunds is the constructor function for MsgReleaseFunds.
func NewMsgReleaseFunds(auctionId string, signer sdk.AccAddress) MsgReleaseFunds {
return MsgReleaseFunds{
AuctionId: auctionId,
Signer: signer.String(),
}
}
// ValidateBasic Implements Msg.
func (msg MsgCreateAuction) ValidateBasic() error {
if msg.Signer == "" {
return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer)
}
if msg.Kind != AuctionKindVickrey && msg.Kind != AuctionKindProvider {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("auction kind should be one of %s | %s", AuctionKindVickrey, AuctionKindProvider))
}
if msg.CommitsDuration <= 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "commit phase duration invalid.")
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "commit phase duration invalid")
}
if msg.RevealsDuration <= 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "reveal phase duration invalid.")
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "reveal phase duration invalid")
}
if !msg.MinimumBid.IsPositive() {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "minimum bid should be greater than zero.")
if msg.Kind == AuctionKindVickrey && !msg.MinimumBid.IsPositive() {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("minimum bid should be greater than zero for %s auction", AuctionKindVickrey))
}
if msg.Kind == AuctionKindProvider {
if !msg.MaxPrice.IsPositive() {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("max price should be greater than zero for %s auction", AuctionKindProvider))
}
if msg.NumProviders <= 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("num providers should be greater than zero for %s auction", AuctionKindProvider))
}
}
return nil
@ -71,15 +118,6 @@ func (msg MsgCommitBid) ValidateBasic() error {
return nil
}
// NewMsgRevealBid is the constructor function for MsgRevealBid.
func NewMsgRevealBid(auctionId string, reveal string, signer sdk.AccAddress) MsgRevealBid {
return MsgRevealBid{
AuctionId: auctionId,
Reveal: reveal,
Signer: signer.String(),
}
}
// ValidateBasic Implements Msg.
func (msg MsgRevealBid) ValidateBasic() error {
if msg.Signer == "" {
@ -96,3 +134,16 @@ func (msg MsgRevealBid) ValidateBasic() error {
return nil
}
// ValidateBasic Implements Msg.
func (msg MsgReleaseFunds) ValidateBasic() error {
if msg.Signer == "" {
return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer address")
}
if msg.AuctionId == "" {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid auction id")
}
return nil
}

View File

@ -1,143 +1,11 @@
package auction
import (
"errors"
fmt "fmt"
"strings"
time "time"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var (
DefaultCommitsDuration = 5 * time.Minute
DefaultRevealsDuration = 5 * time.Minute
DefaultCommitFee = sdkmath.NewInt(1000) // 10^3 alnt
DefaultRevealFee = sdkmath.NewInt(1000) // 10^3 alnt
DefaultMinimumBid = sdkmath.NewInt(1000000) // 10^6 alnt
)
func NewParams(commitsDuration time.Duration, revealsDuration time.Duration, commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
return Params{
CommitsDuration: commitsDuration,
RevealsDuration: revealsDuration,
CommitFee: commitFee,
RevealFee: revealFee,
MinimumBid: minimumBid,
}
}
// DefaultParams returns a default set of parameters.
func DefaultParams() Params {
return Params{
CommitsDuration: DefaultCommitsDuration,
RevealsDuration: DefaultRevealsDuration,
CommitFee: sdk.NewCoin(sdk.DefaultBondDenom, DefaultCommitFee),
RevealFee: sdk.NewCoin(sdk.DefaultBondDenom, DefaultRevealFee),
MinimumBid: sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinimumBid),
}
}
// String returns a human readable string representation of the parameters.
func (p Params) String() string {
var sb strings.Builder
sb.WriteString("Params: \n")
sb.WriteString(fmt.Sprintf("CommitsDuration: %s\n", p.CommitsDuration.String()))
sb.WriteString(fmt.Sprintf("RevealsDuration: %s\n", p.RevealsDuration.String()))
sb.WriteString(fmt.Sprintf("CommitFee: %s\n", p.CommitFee.String()))
sb.WriteString(fmt.Sprintf("RevealFee: %s\n", p.RevealFee.String()))
sb.WriteString(fmt.Sprintf("MinimumBid: %s\n", p.MinimumBid.String()))
return sb.String()
return Params{}
}
// Validate a set of params.
func (p Params) Validate() error {
if err := validateCommitsDuration(p.CommitsDuration); err != nil {
return err
}
if err := validateRevealsDuration(p.RevealsDuration); err != nil {
return err
}
if err := validateCommitFee(p.CommitFee); err != nil {
return err
}
if err := validateRevealFee(p.RevealFee); err != nil {
return err
}
if err := validateMinimumBid(p.MinimumBid); err != nil {
return err
}
return nil
}
func validateCommitsDuration(i interface{}) error {
v, ok := i.(time.Duration)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v < 0 {
return errors.New("commits duration cannot be negative")
}
return nil
}
func validateRevealsDuration(i interface{}) error {
v, ok := i.(time.Duration)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v < 0 {
return errors.New("reveals duration cannot be negative")
}
return nil
}
func validateCommitFee(i interface{}) error {
v, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Amount.IsNegative() {
return errors.New("commit fee must be positive")
}
return nil
}
func validateRevealFee(i interface{}) error {
v, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Amount.IsNegative() {
return errors.New("reveal fee must be positive")
}
return nil
}
func validateMinimumBid(i interface{}) error {
v, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Amount.IsNegative() {
return errors.New("minimum bid must be positive")
}
return nil
}

File diff suppressed because it is too large Load Diff

View File

@ -141,6 +141,42 @@ func local_request_Msg_RevealBid_0(ctx context.Context, marshaler runtime.Marsha
}
var (
filter_Msg_ReleaseFunds_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Msg_ReleaseFunds_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgReleaseFunds
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReleaseFunds_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ReleaseFunds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Msg_ReleaseFunds_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgReleaseFunds
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReleaseFunds_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ReleaseFunds(ctx, &protoReq)
return msg, metadata, err
}
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
// UnaryRPC :call MsgServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -216,6 +252,29 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
})
mux.Handle("POST", pattern_Msg_ReleaseFunds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Msg_ReleaseFunds_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_ReleaseFunds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -317,6 +376,26 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
})
mux.Handle("POST", pattern_Msg_ReleaseFunds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Msg_ReleaseFunds_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_ReleaseFunds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -326,6 +405,8 @@ var (
pattern_Msg_CommitBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "commit_bid"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Msg_RevealBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "reveal_bid"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Msg_ReleaseFunds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "release_funds"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
@ -334,4 +415,6 @@ var (
forward_Msg_CommitBid_0 = runtime.ForwardResponseMessage
forward_Msg_RevealBid_0 = runtime.ForwardResponseMessage
forward_Msg_ReleaseFunds_0 = runtime.ForwardResponseMessage
)

View File

@ -29,6 +29,12 @@ const (
BidStatusRevealed = "reveal"
)
// Auction kinds
const (
AuctionKindVickrey = "vickrey"
AuctionKindProvider = "provider"
)
// AuctionId simplifies generation of auction ids.
type AuctionId struct {
Address sdk.Address

View File

@ -45,6 +45,8 @@ type Keeper struct {
// Codecs
cdc codec.BinaryCodec
authority string
// External keepers
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
@ -64,10 +66,17 @@ func NewKeeper(
storeService store.KVStoreService,
accountKeeper auth.AccountKeeper,
bankKeeper bank.Keeper,
authority string,
) *Keeper {
// ensure that authority is a valid AccAddress
if _, err := accountKeeper.AddressCodec().StringToBytes(authority); err != nil {
panic("authority is not a valid acc address")
}
sb := collections.NewSchemaBuilder(storeService)
k := Keeper{
cdc: cdc,
authority: authority,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
Params: collections.NewItem(sb, bondtypes.ParamsPrefix, "params", codec.CollValue[bondtypes.Params](cdc)),
@ -355,6 +364,11 @@ func (k Keeper) CancelBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddre
return &bond, nil
}
// GetAuthority returns the x/bond module's authority.
func (k Keeper) GetAuthority() string {
return k.authority
}
// GetParams gets the bond module's parameters.
func (k Keeper) GetParams(ctx sdk.Context) (*bondtypes.Params, error) {
params, err := k.Params.Get(ctx)
@ -365,6 +379,11 @@ func (k Keeper) GetParams(ctx sdk.Context) (*bondtypes.Params, error) {
return &params, nil
}
// SetParams sets the x/bond module parameters.
func (k Keeper) SetParams(ctx sdk.Context, params bondtypes.Params) error {
return k.Params.Set(ctx, params)
}
func (k Keeper) getMaxBondAmount(ctx sdk.Context) (sdk.Coins, error) {
params, err := k.GetParams(ctx)
if err != nil {

View File

@ -3,7 +3,9 @@ package keeper
import (
"context"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"git.vdb.to/cerc-io/laconicd/utils"
"git.vdb.to/cerc-io/laconicd/x/bond"
@ -168,3 +170,22 @@ func (ms msgServer) CancelBond(c context.Context, msg *bond.MsgCancelBond) (*bon
return &bond.MsgCancelBondResponse{}, nil
}
// UpdateParams defines a method to perform updation of module params.
func (ms msgServer) UpdateParams(c context.Context, msg *bond.MsgUpdateParams) (*bond.MsgUpdateParamsResponse, error) {
if ms.k.authority != msg.Authority {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
}
if err := msg.Params.Validate(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
if err := ms.k.SetParams(ctx, msg.Params); err != nil {
return nil, err
}
return &bond.MsgUpdateParamsResponse{}, nil
}

View File

@ -88,6 +88,10 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
{ProtoField: "id"},
},
},
{
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
},
},
}

View File

@ -7,7 +7,9 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
modulev1 "git.vdb.to/cerc-io/laconicd/api/cerc/bond/module/v1"
"git.vdb.to/cerc-io/laconicd/x/bond"
@ -33,6 +35,7 @@ func init() {
type ModuleInputs struct {
depinject.In
Config *modulev1.Module
Cdc codec.Codec
StoreService store.KVStoreService
@ -48,7 +51,13 @@ type ModuleOutputs struct {
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper)
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper, authority.String())
m := NewAppModule(in.Cdc, k)
return ModuleOutputs{Module: m, Keeper: k}

View File

@ -5,11 +5,12 @@ import (
fmt "fmt"
sdkmath "cosmossdk.io/math"
"git.vdb.to/cerc-io/laconicd/app/params"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// DefaultMaxBondAmountTokens are the default parameter values.
var DefaultMaxBondAmountTokens = sdkmath.NewInt(1000000000000) // 10^12 alnt
var DefaultMaxBondAmountTokens = sdkmath.NewInt(1000000000000) // 10^12
func NewParams(maxBondAmount sdk.Coin) Params {
return Params{MaxBondAmount: maxBondAmount}
@ -17,7 +18,7 @@ func NewParams(maxBondAmount sdk.Coin) Params {
// DefaultParams returns default module parameters
func DefaultParams() Params {
return NewParams(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMaxBondAmountTokens))
return NewParams(sdk.NewCoin(params.CoinUnit, DefaultMaxBondAmountTokens))
}
// Validate checks that the parameters have valid values

View File

@ -6,6 +6,7 @@ package bond
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
@ -416,6 +417,102 @@ func (m *MsgCancelBondResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgCancelBondResponse proto.InternalMessageInfo
// MsgUpdateParams is the Msg/UpdateParams request type.
type MsgUpdateParams struct {
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
// params defines the x/bond parameters to update.
//
// NOTE: All parameters must be supplied.
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}
func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_efb1a132c2c5bd62, []int{8}
}
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
}
func (m *MsgUpdateParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
func (m *MsgUpdateParams) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgUpdateParams) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
type MsgUpdateParamsResponse struct {
}
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_efb1a132c2c5bd62, []int{9}
}
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
}
func (m *MsgUpdateParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgCreateBond)(nil), "cerc.bond.v1.MsgCreateBond")
proto.RegisterType((*MsgCreateBondResponse)(nil), "cerc.bond.v1.MsgCreateBondResponse")
@ -425,47 +522,56 @@ func init() {
proto.RegisterType((*MsgWithdrawBondResponse)(nil), "cerc.bond.v1.MsgWithdrawBondResponse")
proto.RegisterType((*MsgCancelBond)(nil), "cerc.bond.v1.MsgCancelBond")
proto.RegisterType((*MsgCancelBondResponse)(nil), "cerc.bond.v1.MsgCancelBondResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "cerc.bond.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cerc.bond.v1.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("cerc/bond/v1/tx.proto", fileDescriptor_efb1a132c2c5bd62) }
var fileDescriptor_efb1a132c2c5bd62 = []byte{
// 548 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x41, 0x6f, 0xd3, 0x30,
0x18, 0x6d, 0x5a, 0x6d, 0x12, 0xde, 0x00, 0xa9, 0x62, 0x6c, 0x6d, 0x59, 0x5a, 0x32, 0x21, 0xaa,
0x49, 0xb3, 0xd5, 0x71, 0x9b, 0x38, 0x75, 0x5c, 0x7b, 0xe9, 0x05, 0x89, 0x0b, 0x72, 0x12, 0xe3,
0x19, 0x1a, 0x7f, 0x25, 0x36, 0xdd, 0x7a, 0x41, 0x68, 0xbf, 0x00, 0x89, 0x7f, 0xc1, 0x69, 0x07,
0x7e, 0x02, 0x42, 0x3b, 0x4e, 0xe2, 0xc2, 0x69, 0x4c, 0x2d, 0xd2, 0xee, 0xfc, 0x02, 0x14, 0x27,
0x4d, 0x93, 0x35, 0x9b, 0xc4, 0x0d, 0x4e, 0x8d, 0xfd, 0x9e, 0xdf, 0xfb, 0xde, 0xe7, 0xcf, 0x45,
0x6b, 0x1e, 0x0b, 0x3d, 0xe2, 0x82, 0xf4, 0xc9, 0xa8, 0x43, 0xf4, 0x11, 0x1e, 0x86, 0xa0, 0xa1,
0xba, 0x1a, 0x6d, 0xe3, 0x68, 0x1b, 0x8f, 0x3a, 0xf5, 0x75, 0x0f, 0x54, 0x00, 0x8a, 0x04, 0x8a,
0x47, 0xac, 0x40, 0xf1, 0x98, 0x56, 0xbf, 0xc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, 0x97, 0x7e, 0x4c, 0xed, 0xd2, 0x0b, 0x87, 0x0b, 0x8d, 0x47,
0xbe, 0x8b, 0x35, 0x18, 0x95, 0x1d, 0x01, 0x64, 0x40, 0x3d, 0x90, 0xc2, 0xf3, 0xc9, 0x91, 0xd1,
0x74, 0x97, 0xcd, 0x5f, 0xe5, 0x93, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x64, 0x49, 0xe0, 0xe1,
0xbe, 0x05, 0x00, 0x00,
// 659 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4d, 0x6b, 0x13, 0x41,
0x18, 0xce, 0xa6, 0x1f, 0xd0, 0x69, 0xad, 0xb0, 0xb4, 0xa6, 0x49, 0xed, 0xb6, 0x6e, 0x11, 0x4b,
0xa1, 0x3b, 0x24, 0x82, 0x87, 0xe2, 0xc5, 0xd4, 0x6b, 0x40, 0xa2, 0x22, 0x78, 0x29, 0x93, 0xdd,
0x71, 0x3a, 0x9a, 0x9d, 0x59, 0x77, 0xa6, 0x69, 0x73, 0x11, 0xe9, 0x5d, 0x10, 0xfc, 0x17, 0x9e,
0x7a, 0x28, 0xfe, 0x02, 0x91, 0x1e, 0x8b, 0x5e, 0x3c, 0x55, 0x69, 0x85, 0xde, 0xfd, 0x05, 0xb2,
0x33, 0xd3, 0xcd, 0x6e, 0xb3, 0x2d, 0x78, 0xd3, 0x53, 0x76, 0xe6, 0x79, 0xf3, 0x3e, 0x1f, 0xfb,
0xce, 0x0e, 0x98, 0xf5, 0x71, 0xec, 0xc3, 0x0e, 0x67, 0x01, 0xec, 0xd5, 0xa1, 0xdc, 0xf5, 0xa2,
0x98, 0x4b, 0x6e, 0x4f, 0x25, 0xdb, 0x5e, 0xb2, 0xed, 0xf5, 0xea, 0xb5, 0x8a, 0xcf, 0x45, 0xc8,
0x05, 0x0c, 0x05, 0x49, 0xaa, 0x42, 0x41, 0x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xf8, 0xaa, 0x72, 0x33, 0x59, 0x26, 0x94, 0x99,
0x43, 0x34, 0x4c, 0x39, 0x00, 0x0b, 0x28, 0x0b, 0x06, 0xf7, 0x12, 0xca, 0x58, 0x55, 0x6a, 0xca,
0x3e, 0x98, 0xca, 0xcd, 0xf5, 0xc2, 0x50, 0xdf, 0x2c, 0x5c, 0xbb, 0x7d, 0x25, 0x9c, 0x12, 0x2f,
0x2b, 0xe2, 0x05, 0x77, 0x3e, 0x4f, 0xbc, 0x63, 0x6a, 0x53, 0xb7, 0x99, 0x79, 0x2b, 0x08, 0x38,
0x05, 0x8b, 0x02, 0x1e, 0x9e, 0xb1, 0xcb, 0x02, 0x56, 0x95, 0x9a, 0xf2, 0x09, 0x98, 0xca, 0x8d,
0xe0, 0xb0, 0xdb, 0x2c, 0x5c, 0xe0, 0xb6, 0x68, 0x62, 0x6a, 0x63, 0x6f, 0xcf, 0xf6, 0x57, 0xad,
0xe6, 0xfd, 0xc3, 0x13, 0xc7, 0x3a, 0x3a, 0x71, 0xac, 0x9f, 0x27, 0x8e, 0xf5, 0xfe, 0xd4, 0x29,
0x1d, 0x9d, 0x3a, 0xa5, 0xef, 0xa7, 0x4e, 0xe9, 0xb9, 0x4b, 0xa8, 0xf4, 0x7a, 0x41, 0xc7, 0x4b,
0xae, 0x0c, 0x1c, 0xfb, 0x6b, 0x94, 0xc3, 0x2e, 0xf2, 0x39, 0xa3, 0x7e, 0x00, 0x77, 0x95, 0xd2,
0xce, 0xb8, 0xba, 0x2b, 0xee, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xef, 0x34, 0xfa, 0x7f, 0xf3,
0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -488,6 +594,9 @@ type MsgClient interface {
WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -534,6 +643,15 @@ func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...g
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/cerc.bond.v1.Msg/UpdateParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// CreateBond defines a method for creating a new bond.
@ -544,6 +662,9 @@ type MsgServer interface {
WithdrawBond(context.Context, *MsgWithdrawBond) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -562,6 +683,9 @@ func (*UnimplementedMsgServer) WithdrawBond(ctx context.Context, req *MsgWithdra
func (*UnimplementedMsgServer) CancelBond(ctx context.Context, req *MsgCancelBond) (*MsgCancelBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelBond not implemented")
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -639,6 +763,24 @@ func _Msg_CancelBond_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cerc.bond.v1.Msg/UpdateParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.bond.v1.Msg",
HandlerType: (*MsgServer)(nil),
@ -659,6 +801,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "CancelBond",
Handler: _Msg_CancelBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/bond/v1/tx.proto",
@ -946,6 +1092,69 @@ func (m *MsgCancelBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -1079,6 +1288,30 @@ func (m *MsgCancelBondResponse) Size() (n int) {
return n
}
func (m *MsgUpdateParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.Params.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1843,6 +2076,171 @@ func (m *MsgCancelBondResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@ -80,7 +80,7 @@ func (k Keeper) OnboardParticipant(
}
if !params.OnboardingEnabled {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Validator onboarding is disabled")
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Onboarding is disabled")
}
message, err := json.Marshal(msg.EthPayload)

View File

@ -30,11 +30,18 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, data *registry.GenesisState) error
return err
}
}
readableRecord := record.ToReadableRecord()
if err := k.processAttributes(ctx, readableRecord.Attributes, record.Id); err != nil {
return err
}
}
for _, authority := range data.Authorities {
// Only import authorities that are marked active.
if authority.Entry.Status == registry.AuthorityActive {
// Reset authority height
authority.Entry.Height = uint64(ctx.BlockHeight())
if err := k.SaveNameAuthority(ctx, authority.Name, authority.Entry); err != nil {
return err
}
@ -62,7 +69,7 @@ func (k *Keeper) ExportGenesis(ctx sdk.Context) (*registry.GenesisState, error)
return nil, err
}
records, err := k.ListRecords(ctx)
records, _, err := k.PaginatedListRecords(ctx, nil)
if err != nil {
return nil, err
}

View File

@ -16,6 +16,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec/legacy"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/gibson042/canonicaljson-go"
@ -94,6 +95,8 @@ func newNameRecordIndexes(sb *collections.SchemaBuilder) NameRecordsIndexes {
type Keeper struct {
cdc codec.BinaryCodec
authority string
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
bondKeeper *bondkeeper.Keeper
@ -118,10 +121,17 @@ func NewKeeper(
bankKeeper bank.Keeper,
bondKeeper *bondkeeper.Keeper,
auctionKeeper *auctionkeeper.Keeper,
authority string,
) Keeper {
// ensure that authority is a valid AccAddress
if _, err := accountKeeper.AddressCodec().StringToBytes(authority); err != nil {
panic("authority is not a valid acc address")
}
sb := collections.NewSchemaBuilder(storeService)
k := Keeper{
cdc: cdc,
authority: authority,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
bondKeeper: bondKeeper,
@ -175,6 +185,16 @@ func logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", registrytypes.ModuleName)
}
// GetAuthority returns the x/registry module's authority.
func (k Keeper) GetAuthority() string {
return k.authority
}
// SetParams sets the x/registry module parameters.
func (k Keeper) SetParams(ctx sdk.Context, params registrytypes.Params) error {
return k.Params.Set(ctx, params)
}
// HasRecord - checks if a record by the given id exists.
func (k Keeper) HasRecord(ctx sdk.Context, id string) (bool, error) {
has, err := k.Records.Has(ctx, id)
@ -185,23 +205,42 @@ func (k Keeper) HasRecord(ctx sdk.Context, id string) (bool, error) {
return has, nil
}
// ListRecords - get all records.
func (k Keeper) ListRecords(ctx sdk.Context) ([]registrytypes.Record, error) {
// PaginatedListRecords - get all records with optional pagination.
func (k Keeper) PaginatedListRecords(ctx sdk.Context, pagination *query.PageRequest) ([]registrytypes.Record, *query.PageResponse, error) {
var records []registrytypes.Record
var pageResp *query.PageResponse
err := k.Records.Walk(ctx, nil, func(key string, value registrytypes.Record) (bool, error) {
if err := k.populateRecordNames(ctx, &value); err != nil {
return true, err
if pagination == nil {
err := k.Records.Walk(ctx, nil, func(key string, value registrytypes.Record) (bool, error) {
if err := k.populateRecordNames(ctx, &value); err != nil {
return true, err
}
records = append(records, value)
return false, nil
})
if err != nil {
return nil, nil, err
}
records = append(records, value)
} else {
var err error
records, pageResp, err = query.CollectionPaginate(
ctx,
k.Records,
pagination,
func(key string, value registrytypes.Record) (registrytypes.Record, error) {
if err := k.populateRecordNames(ctx, &value); err != nil {
return registrytypes.Record{}, err
}
return false, nil
})
if err != nil {
return nil, err
return value, nil
})
if err != nil {
return nil, nil, err
}
}
return records, nil
return records, pageResp, nil
}
// GetRecordById - gets a record from the store.
@ -242,36 +281,47 @@ func (k Keeper) GetRecordsByBondId(ctx sdk.Context, bondId string) ([]registryty
return records, nil
}
// RecordsFromAttributes gets a list of records whose attributes match all provided values
func (k Keeper) RecordsFromAttributes(
// PaginatedRecordsFromAttributes gets a list of records whose attributes match all provided values
// with optional pagination.
func (k Keeper) PaginatedRecordsFromAttributes(
ctx sdk.Context,
attributes []*registrytypes.QueryRecordsRequest_KeyValueInput,
all bool,
) ([]registrytypes.Record, error) {
resultRecordIds := []string{}
pagination *query.PageRequest,
) ([]registrytypes.Record, *query.PageResponse, error) {
var resultRecordIds []string
var pageResp *query.PageResponse
filteredRecordIds := []string{}
for i, attr := range attributes {
suffix, err := QueryValueToJSON(attr.Value)
if err != nil {
return nil, err
return nil, nil, err
}
mapKey := collections.Join(attr.Key, string(suffix))
recordIds, err := k.getAttributeMapping(ctx, mapKey)
if err != nil {
return nil, err
return nil, nil, err
}
if i == 0 {
resultRecordIds = recordIds
filteredRecordIds = recordIds
} else {
resultRecordIds = getIntersection(recordIds, resultRecordIds)
filteredRecordIds = getIntersection(recordIds, filteredRecordIds)
}
}
if pagination != nil {
resultRecordIds, pageResp = paginate(filteredRecordIds, pagination)
} else {
resultRecordIds = filteredRecordIds
}
records := []registrytypes.Record{}
for _, id := range resultRecordIds {
record, err := k.GetRecordById(ctx, id)
if err != nil {
return nil, err
return nil, nil, err
}
if record.Deleted {
continue
@ -282,7 +332,7 @@ func (k Keeper) RecordsFromAttributes(
records = append(records, record)
}
return records, nil
return records, pageResp, nil
}
// TODO not recursive, and only should be if we want to support querying with whole sub-objects,
@ -698,6 +748,38 @@ func (k Keeper) tryTakeRecordRent(ctx sdk.Context, record registrytypes.Record)
return k.SaveRecord(ctx, record)
}
// paginate implements basic pagination over a list of objects
func paginate[T any](data []T, pagination *query.PageRequest) ([]T, *query.PageResponse) {
pageReq := initPageRequestDefaults(pagination)
offset := pageReq.Offset
limit := pageReq.Limit
countTotal := pageReq.CountTotal
totalItems := uint64(len(data))
start := offset
end := offset + limit
if start > totalItems {
if countTotal {
return []T{}, &query.PageResponse{Total: 0}
} else {
return []T{}, nil
}
}
if end > totalItems {
end = totalItems
}
paginatedItems := data[start:end]
if countTotal {
return paginatedItems, &query.PageResponse{Total: totalItems}
} else {
return paginatedItems, nil
}
}
func getIntersection(a []string, b []string) []string {
result := []string{}
if len(a) < len(b) {
@ -724,3 +806,26 @@ func contains(arr []string, str string) bool {
}
return false
}
// https://github.com/cosmos/cosmos-sdk/blob/v0.50.3/types/query/pagination.go#L141
// initPageRequestDefaults initializes a PageRequest's defaults when those are not set.
func initPageRequestDefaults(pageRequest *query.PageRequest) *query.PageRequest {
// if the PageRequest is nil, use default PageRequest
if pageRequest == nil {
pageRequest = &query.PageRequest{}
}
pageRequestCopy := *pageRequest
if len(pageRequestCopy.Key) == 0 {
pageRequestCopy.Key = nil
}
if pageRequestCopy.Limit == 0 {
pageRequestCopy.Limit = query.DefaultLimit
// count total results when the limit is zero/not supplied
pageRequestCopy.CountTotal = true
}
return &pageRequestCopy
}

View File

@ -3,7 +3,9 @@ package keeper
import (
"context"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"git.vdb.to/cerc-io/laconicd/utils"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
@ -395,3 +397,22 @@ func (ms msgServer) ReassociateRecords(c context.Context, msg *registrytypes.Msg
return &registrytypes.MsgReassociateRecordsResponse{}, nil
}
// UpdateParams defines a method to perform updation of module params.
func (ms msgServer) UpdateParams(c context.Context, msg *registrytypes.MsgUpdateParams) (*registrytypes.MsgUpdateParamsResponse, error) {
if ms.k.authority != msg.Authority {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
}
if err := msg.Params.Validate(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
if err := ms.k.SetParams(ctx, msg.Params); err != nil {
return nil, err
}
return &registrytypes.MsgUpdateParamsResponse{}, nil
}

View File

@ -7,12 +7,15 @@ import (
"strings"
"time"
"cosmossdk.io/math"
"cosmossdk.io/collections"
errorsmod "cosmossdk.io/errors"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"git.vdb.to/cerc-io/laconicd/app/params"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
"git.vdb.to/cerc-io/laconicd/x/registry/helpers"
@ -285,16 +288,18 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo
// Reset bond ID if required.
authority.BondId = ""
params := auctiontypes.Params{
CommitsDuration: moduleParams.AuthorityAuctionCommitsDuration,
RevealsDuration: moduleParams.AuthorityAuctionRevealsDuration,
CommitFee: moduleParams.AuthorityAuctionCommitFee,
RevealFee: moduleParams.AuthorityAuctionRevealFee,
MinimumBid: moduleParams.AuthorityAuctionMinimumBid,
}
// Create an auction.
msg := auctiontypes.NewMsgCreateAuction(params, ownerAddress)
msg := auctiontypes.NewMsgCreateAuction(
auctiontypes.AuctionKindVickrey,
moduleParams.AuthorityAuctionCommitsDuration,
moduleParams.AuthorityAuctionRevealsDuration,
moduleParams.AuthorityAuctionCommitFee,
moduleParams.AuthorityAuctionRevealFee,
moduleParams.AuthorityAuctionMinimumBid,
sdk.NewCoin(params.CoinUnit, math.NewInt(0)),
0,
ownerAddress,
)
auction, sdkErr := k.auctionKeeper.CreateAuction(ctx, msg)
if sdkErr != nil {

View File

@ -6,6 +6,7 @@ import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
)
@ -39,20 +40,21 @@ func (qs queryServer) Records(c context.Context, req *registrytypes.QueryRecords
all := req.GetAll()
var records []registrytypes.Record
var pageResp *query.PageResponse
var err error
if len(attributes) > 0 {
records, err = qs.k.RecordsFromAttributes(ctx, attributes, all)
records, pageResp, err = qs.k.PaginatedRecordsFromAttributes(ctx, attributes, all, req.Pagination)
if err != nil {
return nil, err
}
} else {
records, err = qs.k.ListRecords(ctx)
records, pageResp, err = qs.k.PaginatedListRecords(ctx, req.Pagination)
if err != nil {
return nil, err
}
}
return &registrytypes.QueryRecordsResponse{Records: records}, nil
return &registrytypes.QueryRecordsResponse{Records: records, Pagination: pageResp}, nil
}
func (qs queryServer) GetRecord(c context.Context, req *registrytypes.QueryGetRecordRequest) (*registrytypes.QueryGetRecordResponse, error) {

View File

@ -94,9 +94,9 @@ func (rk RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionId string
}
if auctionObj.Status == auctiontypes.AuctionStatusCompleted {
if auctionObj.WinnerAddress != "" {
if len(auctionObj.WinnerAddresses) != 0 {
// Mark authority owner and change status to active.
authority.OwnerAddress = auctionObj.WinnerAddress
authority.OwnerAddress = auctionObj.WinnerAddresses[0]
authority.Status = registrytypes.AuthorityActive
// Reset bond id if required, as owner has changed.

View File

@ -173,6 +173,10 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
{ProtoField: "new_bond_id"},
},
},
{
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
},
EnhanceCustomCommand: true, // Allow additional manual commands
},

View File

@ -7,7 +7,9 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
modulev1 "git.vdb.to/cerc-io/laconicd/api/cerc/registry/module/v1"
"git.vdb.to/cerc-io/laconicd/x/auction"
@ -35,6 +37,7 @@ func init() {
type ModuleInputs struct {
depinject.In
Config *modulev1.Module
Cdc codec.Codec
StoreService store.KVStoreService
@ -56,6 +59,11 @@ type ModuleOutputs struct {
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
k := keeper.NewKeeper(
in.Cdc,
in.StoreService,
@ -63,6 +71,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
in.BankKeeper,
in.BondKeeper,
in.AuctionKeeper,
authority.String(),
)
m := NewAppModule(in.Cdc, k)

View File

@ -6,26 +6,28 @@ import (
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/app/params"
)
// Default parameter values.
var (
// DefaultRecordRent is the default record rent for 1 time period (see expiry time).
DefaultRecordRent = sdkmath.NewInt(1000000) // 10^6 alnt
DefaultRecordRent = sdkmath.NewInt(1000000) // 10^6
// DefaultRecordExpiryTime is the default record expiry time (1 year).
DefaultRecordExpiryTime = time.Hour * 24 * 365
DefaultAuthorityRent = sdkmath.NewInt(1000000) // 10^6 alnt
DefaultAuthorityRent = sdkmath.NewInt(1000000) // 10^6
DefaultAuthorityExpiryTime = time.Hour * 24 * 365
DefaultAuthorityGracePeriod = time.Hour * 24 * 2
DefaultAuthorityAuctionEnabled = false
DefaultCommitsDuration = time.Hour * 24
DefaultRevealsDuration = time.Hour * 24
DefaultCommitFee = sdkmath.NewInt(1000000) // 10^6 alnt
DefaultRevealFee = sdkmath.NewInt(1000000) // 10^6 alnt
DefaultMinimumBid = sdkmath.NewInt(5000000) // 5 * 10^6 alnt
DefaultCommitFee = sdkmath.NewInt(1000000) // 10^6
DefaultRevealFee = sdkmath.NewInt(1000000) // 10^6
DefaultMinimumBid = sdkmath.NewInt(5000000) // 5 * 10^6
)
// NewParams creates a new Params instance
@ -60,13 +62,13 @@ func NewParams(
// DefaultParams returns a default set of parameters.
func DefaultParams() Params {
return NewParams(
sdk.NewCoin(sdk.DefaultBondDenom, DefaultRecordRent), DefaultRecordExpiryTime,
sdk.NewCoin(sdk.DefaultBondDenom, DefaultAuthorityRent),
sdk.NewCoin(params.CoinUnit, DefaultRecordRent), DefaultRecordExpiryTime,
sdk.NewCoin(params.CoinUnit, DefaultAuthorityRent),
DefaultAuthorityExpiryTime, DefaultAuthorityGracePeriod, DefaultAuthorityAuctionEnabled, DefaultCommitsDuration,
DefaultRevealsDuration,
sdk.NewCoin(sdk.DefaultBondDenom, DefaultCommitFee),
sdk.NewCoin(sdk.DefaultBondDenom, DefaultRevealFee),
sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinimumBid),
sdk.NewCoin(params.CoinUnit, DefaultCommitFee),
sdk.NewCoin(params.CoinUnit, DefaultRevealFee),
sdk.NewCoin(params.CoinUnit, DefaultMinimumBid),
)
}

View File

@ -6,6 +6,7 @@ package registry
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
@ -1040,6 +1041,102 @@ func (m *MsgReassociateRecordsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgReassociateRecordsResponse proto.InternalMessageInfo
// MsgUpdateParams is the Msg/UpdateParams request type.
type MsgUpdateParams struct {
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
// params defines the x/registry parameters to update.
//
// NOTE: All parameters must be supplied.
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}
func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_3c6eb2e5a4d8fa03, []int{21}
}
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
}
func (m *MsgUpdateParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
func (m *MsgUpdateParams) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgUpdateParams) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
type MsgUpdateParamsResponse struct {
}
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_3c6eb2e5a4d8fa03, []int{22}
}
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
}
func (m *MsgUpdateParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgSetRecord)(nil), "cerc.registry.v1.MsgSetRecord")
proto.RegisterType((*MsgSetRecordResponse)(nil), "cerc.registry.v1.MsgSetRecordResponse")
@ -1062,77 +1159,86 @@ func init() {
proto.RegisterType((*MsgDissociateRecordsResponse)(nil), "cerc.registry.v1.MsgDissociateRecordsResponse")
proto.RegisterType((*MsgReassociateRecords)(nil), "cerc.registry.v1.MsgReassociateRecords")
proto.RegisterType((*MsgReassociateRecordsResponse)(nil), "cerc.registry.v1.MsgReassociateRecordsResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "cerc.registry.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cerc.registry.v1.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("cerc/registry/v1/tx.proto", fileDescriptor_3c6eb2e5a4d8fa03) }
var fileDescriptor_3c6eb2e5a4d8fa03 = []byte{
// 1036 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0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d, 0xe0, 0xcf, 0xf4, 0x0c, 0x81, 0xf0, 0x13, 0x82, 0x4a, 0xea, 0x1e, 0xd6, 0xc8, 0xab, 0x7a,
0x42, 0x96, 0xc3, 0x95, 0x7b, 0x93, 0x9a, 0xb3, 0x85, 0xfd, 0x2e, 0x09, 0x26, 0x7e, 0xbc, 0xe4,
0x9b, 0x5f, 0xbe, 0x78, 0xba, 0x87, 0x3a, 0xef, 0x3d, 0xbb, 0x50, 0xd0, 0xf3, 0x0b, 0x05, 0xfd,
0x7d, 0xa1, 0xa0, 0xef, 0x2f, 0x95, 0xa5, 0xe7, 0x97, 0xca, 0xd2, 0x5f, 0x97, 0xca, 0xd2, 0x27,
0x4d, 0xcb, 0xf6, 0xda, 0xe7, 0xe6, 0x69, 0xdb, 0xa3, 0x3c, 0xe1, 0x81, 0x4d, 0xb5, 0x81, 0xd1,
0xa7, 0x8e, 0xdd, 0x37, 0xb5, 0xc7, 0x22, 0xfd, 0xe9, 0x32, 0xff, 0x8b, 0xf3, 0xce, 0xbf, 0x01,
0x00, 0x00, 0xff, 0xff, 0x60, 0xd8, 0xf4, 0xdb, 0x7f, 0x0d, 0x00, 0x00,
// 1140 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xcf, 0x6f, 0xdc, 0x44,
0x14, 0xc7, 0xe3, 0x4d, 0x9b, 0xb0, 0x6f, 0xdb, 0x90, 0x9a, 0xd0, 0x6c, 0x9c, 0x64, 0x77, 0x33,
0xc9, 0x6e, 0x7e, 0x91, 0x35, 0x0d, 0x52, 0x25, 0x72, 0x22, 0x2b, 0x84, 0x94, 0xc3, 0xa2, 0xca,
0x51, 0x2f, 0x08, 0x69, 0xe5, 0xac, 0x47, 0xae, 0xd1, 0xae, 0x67, 0xf1, 0xb8, 0x49, 0x57, 0x02,
0x09, 0x7a, 0x03, 0x09, 0x09, 0x84, 0x40, 0xe2, 0xc0, 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x1e, 0x53, 0x68, 0x1b, 0x57, 0x29,
0x24, 0x41, 0x83, 0x11, 0xd4, 0x50, 0x45, 0xcf, 0xb8, 0xe3, 0x04, 0x3d, 0x25, 0x18, 0xbe, 0x51,
0xe0, 0x66, 0x72, 0xcb, 0x42, 0x99, 0x1e, 0x09, 0x8d, 0xb6, 0x75, 0xb5, 0x46, 0x92, 0x6c, 0x30,
0x12, 0x84, 0x6a, 0x69, 0x12, 0xd9, 0x4b, 0xac, 0x2d, 0xd5, 0xef, 0x14, 0x98, 0x19, 0xd9, 0x69,
0x56, 0x33, 0x8d, 0x92, 0x22, 0x6d, 0x7b, 0x0c, 0x91, 0xc4, 0xd9, 0x64, 0x38, 0xab, 0x68, 0x25,
0x8d, 0x63, 0x39, 0x49, 0x9e, 0x5f, 0x14, 0xb8, 0x95, 0xde, 0x5e, 0x1a, 0x57, 0xb8, 0x09, 0x9d,
0xd6, 0x1c, 0x4f, 0x27, 0xc1, 0xde, 0x61, 0x60, 0x0d, 0xb4, 0x76, 0x29, 0x98, 0x27, 0x28, 0x7e,
0x55, 0x40, 0xcd, 0xd8, 0x60, 0xd6, 0x73, 0x1a, 0x64, 0x54, 0xa8, 0xe9, 0x63, 0x0a, 0x25, 0xde,
0x0e, 0xc3, 0x5b, 0x47, 0xf5, 0xac, 0x86, 0x32, 0x53, 0x7c, 0x9f, 0xc3, 0x74, 0x78, 0x3d, 0x5b,
0xca, 0xfb, 0x68, 0x82, 0xa8, 0xb6, 0x76, 0x59, 0x54, 0xba, 0x23, 0xe6, 0xbe, 0x84, 0xb4, 0xec,
0x0f, 0x8a, 0x5d, 0x7b, 0xbe, 0x04, 0x88, 0xdd, 0x39, 0xaa, 0xd9, 0xe5, 0x97, 0x02, 0x6d, 0xfd,
0x0a, 0x81, 0xf4, 0xae, 0x33, 0xef, 0x2a, 0x5a, 0xce, 0x58, 0x18, 0xa6, 0xe6, 0xf6, 0x3f, 0x29,
0x30, 0x9b, 0xba, 0x24, 0xd6, 0x73, 0xca, 0x9c, 0x94, 0x69, 0x3b, 0x63, 0xc9, 0x24, 0xd1, 0x36,
0x23, 0xaa, 0xa3, 0xd5, 0xac, 0xb5, 0x60, 0xef, 0x74, 0xa2, 0xbd, 0xf4, 0x67, 0x05, 0x66, 0x53,
0xd7, 0xc6, 0x7a, 0x5e, 0xd5, 0x13, 0xb2, 0x1c, 0xae, 0xdc, 0x8b, 0xdf, 0x25, 0x2d, 0x1c, 0xac,
0x92, 0x64, 0xe2, 0x9f, 0xd7, 0xa7, 0x70, 0x23, 0x71, 0x58, 0xac, 0x64, 0x9a, 0xc5, 0x25, 0xda,
0xe6, 0x95, 0x92, 0x90, 0x45, 0xbb, 0xfe, 0xd5, 0xcb, 0x27, 0x5b, 0x4a, 0xeb, 0x83, 0xa7, 0x67,
0x15, 0xe5, 0xd9, 0x59, 0x45, 0xf9, 0xe7, 0xac, 0xa2, 0x7c, 0x7f, 0x5e, 0x99, 0x78, 0x76, 0x5e,
0x99, 0xf8, 0xfb, 0xbc, 0x32, 0xf1, 0x49, 0xc3, 0x76, 0xfc, 0xe6, 0xb1, 0x75, 0xd4, 0x0c, 0xfe,
0xd9, 0x61, 0xaf, 0xbb, 0xe3, 0x10, 0xbd, 0x67, 0x76, 0x89, 0xeb, 0x74, 0x2d, 0xfd, 0x91, 0x84,
0x3f, 0x9a, 0x62, 0xff, 0xf7, 0xde, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x1e, 0x96, 0xe1,
0xa7, 0x0e, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1167,6 +1273,9 @@ type MsgClient interface {
ReserveAuthority(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error)
// SetAuthorityBond
SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -1267,6 +1376,15 @@ func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBon
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/cerc.registry.v1.Msg/UpdateParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// SetRecord records a new record with given payload and bond id
@ -1289,6 +1407,9 @@ type MsgServer interface {
ReserveAuthority(context.Context, *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error)
// SetAuthorityBond
SetAuthorityBond(context.Context, *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -1325,6 +1446,9 @@ func (*UnimplementedMsgServer) ReserveAuthority(ctx context.Context, req *MsgRes
func (*UnimplementedMsgServer) SetAuthorityBond(ctx context.Context, req *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetAuthorityBond not implemented")
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -1510,6 +1634,24 @@ func _Msg_SetAuthorityBond_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cerc.registry.v1.Msg/UpdateParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.registry.v1.Msg",
HandlerType: (*MsgServer)(nil),
@ -1554,6 +1696,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "SetAuthorityBond",
Handler: _Msg_SetAuthorityBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/registry/v1/tx.proto",
@ -2260,6 +2406,69 @@ func (m *MsgReassociateRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil
}
func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -2576,6 +2785,30 @@ func (m *MsgReassociateRecordsResponse) Size() (n int) {
return n
}
func (m *MsgUpdateParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.Params.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -4567,6 +4800,171 @@ func (m *MsgReassociateRecordsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

51
x/types/v1/lockup.go Normal file
View File

@ -0,0 +1,51 @@
package v1
import (
"errors"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
var (
_ authtypes.GenesisAccount = (*LockupAccount)(nil)
_ LockupAccountI = (*LockupAccount)(nil)
)
// LockupAccountI defines an account interface for lockup account with token distribution
type LockupAccountI interface {
sdk.ModuleAccountI
GetDistribution() string
}
// Validate checks for errors on the account fields
func (la LockupAccount) Validate() error {
if la.BaseAccount == nil {
return errors.New("uninitialized LockupAccount: BaseAccount is nil")
}
return la.BaseAccount.Validate()
}
// HasPermission returns whether or not the account has permission.
// Return false as the lockup account doesn't have any permissions
func (la LockupAccount) HasPermission(permission string) bool {
return false
}
// GetName returns the name of the holder's module
func (la LockupAccount) GetName() string {
return la.Name
}
// GetPermissions returns permissions granted to the module account
// Return empty as the lockup account doesn't have any permissions
func (la LockupAccount) GetPermissions() []string {
return []string{}
}
// GetDistribution returns the total token distribution
func (la LockupAccount) GetDistribution() string {
return la.Distribution
}

422
x/types/v1/lockup.pb.go Normal file
View File

@ -0,0 +1,422 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/types/v1/lockup.proto
package v1
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
types "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// LockupAccount extends the Cosmos SDK BaseAccount with a name and distribution
// field. It satisfies the ModuleAccountI interface to allow querying it as a
// module account.
type LockupAccount struct {
*types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Distribution string `protobuf:"bytes,3,opt,name=distribution,proto3" json:"distribution,omitempty"`
}
func (m *LockupAccount) Reset() { *m = LockupAccount{} }
func (m *LockupAccount) String() string { return proto.CompactTextString(m) }
func (*LockupAccount) ProtoMessage() {}
func (*LockupAccount) Descriptor() ([]byte, []int) {
return fileDescriptor_8fa58dc19f6348bf, []int{0}
}
func (m *LockupAccount) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LockupAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LockupAccount.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LockupAccount) XXX_Merge(src proto.Message) {
xxx_messageInfo_LockupAccount.Merge(m, src)
}
func (m *LockupAccount) XXX_Size() int {
return m.Size()
}
func (m *LockupAccount) XXX_DiscardUnknown() {
xxx_messageInfo_LockupAccount.DiscardUnknown(m)
}
var xxx_messageInfo_LockupAccount proto.InternalMessageInfo
func init() {
proto.RegisterType((*LockupAccount)(nil), "cerc.types.v1.LockupAccount")
}
func init() { proto.RegisterFile("cerc/types/v1/lockup.proto", fileDescriptor_8fa58dc19f6348bf) }
var fileDescriptor_8fa58dc19f6348bf = []byte{
// 335 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x4e, 0x2d, 0x4a,
0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x33, 0xd4, 0xcf, 0xc9, 0x4f, 0xce, 0x2e, 0x2d,
0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x05, 0xc9, 0xe9, 0x81, 0xe5, 0xf4, 0xca, 0x0c,
0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x85, 0x94, 0x64, 0x72, 0x7e,
0x71, 0x6e, 0x7e, 0x71, 0x3c, 0x98, 0xa7, 0x0f, 0xe1, 0x40, 0xa5, 0xe4, 0x20, 0x3c, 0xfd, 0xc4,
0xd2, 0x92, 0x0c, 0xfd, 0x32, 0xc3, 0xa4, 0xd4, 0x92, 0x44, 0x43, 0x30, 0x07, 0x2a, 0x2f, 0x92,
0x9e, 0x9f, 0x9e, 0x0f, 0xd1, 0x07, 0x62, 0x41, 0x44, 0x95, 0xba, 0x99, 0xb8, 0x78, 0x7d, 0xc0,
0x6e, 0x70, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x11, 0xf2, 0xe4, 0xe2, 0x49, 0x4a, 0x2c, 0x4e,
0x8d, 0x4f, 0x84, 0xf0, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x14, 0xf4, 0xa0, 0x96, 0x81,
0x4d, 0x84, 0x1a, 0xaf, 0xe7, 0x94, 0x58, 0x9c, 0x0a, 0xd5, 0xe7, 0xc4, 0x72, 0xe1, 0x9e, 0x3c,
0x63, 0x10, 0x77, 0x12, 0x42, 0x48, 0x48, 0x88, 0x8b, 0x25, 0x2f, 0x31, 0x37, 0x55, 0x82, 0x49,
0x81, 0x51, 0x83, 0x33, 0x08, 0xcc, 0x16, 0x52, 0xe2, 0xe2, 0x49, 0xc9, 0x2c, 0x2e, 0x29, 0xca,
0x4c, 0x2a, 0x2d, 0xc9, 0xcc, 0xcf, 0x93, 0x60, 0x06, 0xcb, 0xa1, 0x88, 0x59, 0x95, 0x77, 0x2c,
0x90, 0x67, 0x38, 0xb5, 0x45, 0x57, 0x09, 0x9b, 0x9d, 0xbe, 0xf9, 0x29, 0xa5, 0x39, 0x30, 0x2b,
0x3c, 0x4f, 0x6d, 0xd1, 0x95, 0x41, 0x09, 0x35, 0x3d, 0x14, 0xdf, 0x78, 0x76, 0x3d, 0xdf, 0xa0,
0x25, 0x9a, 0x93, 0x98, 0x9c, 0x9f, 0x97, 0x99, 0xac, 0x8f, 0x22, 0x35, 0xe9, 0xf9, 0x06, 0x2d,
0x3e, 0x48, 0xf0, 0xc3, 0xfc, 0xea, 0xe4, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c,
0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72,
0x0c, 0x51, 0x6a, 0xe9, 0x99, 0x25, 0x7a, 0x65, 0x29, 0x49, 0x7a, 0xa0, 0x60, 0x4f, 0x2d, 0x4a,
0xd6, 0xcd, 0xcc, 0xd7, 0x87, 0x1a, 0x9b, 0xa2, 0x5f, 0x01, 0x8f, 0xcf, 0x24, 0x36, 0x70, 0xb0,
0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x89, 0x9d, 0x6b, 0xe7, 0x01, 0x00, 0x00,
}
func (m *LockupAccount) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LockupAccount) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LockupAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Distribution) > 0 {
i -= len(m.Distribution)
copy(dAtA[i:], m.Distribution)
i = encodeVarintLockup(dAtA, i, uint64(len(m.Distribution)))
i--
dAtA[i] = 0x1a
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintLockup(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x12
}
if m.BaseAccount != nil {
{
size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintLockup(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintLockup(dAtA []byte, offset int, v uint64) int {
offset -= sovLockup(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *LockupAccount) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BaseAccount != nil {
l = m.BaseAccount.Size()
n += 1 + l + sovLockup(uint64(l))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovLockup(uint64(l))
}
l = len(m.Distribution)
if l > 0 {
n += 1 + l + sovLockup(uint64(l))
}
return n
}
func sovLockup(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozLockup(x uint64) (n int) {
return sovLockup(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *LockupAccount) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLockup
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LockupAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LockupAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLockup
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthLockup
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthLockup
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BaseAccount == nil {
m.BaseAccount = &types.BaseAccount{}
}
if err := m.BaseAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLockup
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthLockup
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthLockup
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Distribution", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLockup
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthLockup
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthLockup
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Distribution = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipLockup(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthLockup
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipLockup(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLockup
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLockup
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLockup
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthLockup
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupLockup
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthLockup
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthLockup = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowLockup = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupLockup = fmt.Errorf("proto: unexpected end of group")
)