laconicd/x/auction
Thomas E Lackey 072b174c9b
Some checks failed
Pull Request Labeler / triage (push) Successful in 8s
Lint / Run flake8 on python integration tests (push) Failing after 57s
CodeQL / Analyze (go) (push) Failing after 1m2s
Tests / cleanup-runs (push) Has been skipped
Run Gosec / Gosec (push) Failing after 7m16s
Tests / test-unit-cover (push) Failing after 6m50s
Tests / sdk_tests (push) Failing after 2m9s
Tests / test-importer (push) Successful in 9m6s
Tests / test-rpc (push) Failing after 4m10s
Lint / Run golangci-lint (push) Failing after 13m16s
Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord (#113)
See also: WIP: cerc-io/laconic-sdk#44

```
message ApplicationRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string homepage       = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""];
  string license        = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
  string author         = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
  string repository     = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
  string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""];
  string app_version    = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
  string app_type       = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message WebAppDeploymentRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string application    = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
  string url            = 6 [(gogoproto.moretags) = "json:\"\" yaml:\"name\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message GeneralRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string category       = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""];
  string value          = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
```

Reviewed-on: #113
Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to>
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-20 22:01:03 +00:00
..
client Sync from fork (#74) 2023-01-10 10:20:57 +05:30
keeper fix lint (#101) 2023-03-15 11:22:35 -04:00
simulation random auction params 2022-10-27 13:50:12 +05:30
types Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord (#113) 2023-11-20 22:01:03 +00:00
abci.go changed package name from tharsis/ethermint to cerc-io/laconicd 2022-09-07 12:06:11 +05:30
genesis.go ignore gosec 2022-10-18 15:36:34 +05:30
module_test.go migrate: add dxns module 2022-04-05 12:39:27 +05:30
module.go fix lint 2022-10-27 14:49:15 +05:30
README.md chain id (#73) 2023-01-11 10:52:29 +05:30

Auction Module CLI Commands

Build the Chain

The following command builds the Ethermint daemon and places the binary in the build directory

make build

Setup the Chain

The following steps need to be followed only before running the chain for the first time.

  1. Add the root key:
    ./build/laconicd keys add root
    
    Keep a note of the keyring passphrase if you set it.
  2. Init the chain:
    ./build/laconicd init test-moniker --chain-id laconic_9000-1
    
  3. Add genesis account:
    ./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake
    
  4. Make a genesis tx:
    ./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1
    
  5. Collect gentxs:
    ./build/laconicd collect-gentxs
    

The chain can now be started using:

./build/laconicd start

Querying the Params

The following command will dislay the default params for the auction module:

# ./build/laconicd q auction params -o json | jq

{
  "params": {
    "commits_duration": "0s",
    "reveals_duration": "0s",
    "commit_fee": {
      "denom": "",
      "amount": "0"
    },
    "reveal_fee": {
      "denom": "",
      "amount": "0"
    },
    "minimum_bid": {
      "denom": "",
      "amount": "0"
    }
  }
}

Auction TX CLI Commands

Create Auction

# ./build/laconicd tx auction create 100s 100s 10aphoton 10aphoton 1000aphoton --from root --chain-id $(./build/laconicd status | jq .NodeInfo.network -r)

Enter keyring passphrase:

{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgCreateAuction","commits_duration":"100s","reveals_duration":"100s","commit_fee":{"denom":"aphoton","amount":"10"},"reveal_fee":{"denom":"aphoton","amount":"10"},"minimum_bid":{"denom":"aphoton","amount":"1000"},"signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y

code: 0
codespace: ""
data: ""
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: ECAD6DF1ECA763FBD26EB7C2C0B77425FFE2FBEA2BEC57CE0FBC173AE0F45298

Commit Bid

# ./build/laconicd tx auction commit-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d 2000aphoton --from root --chain-id $(./build/laconicd status | jq .NodeInfo.network -r)

Enter keyring passphrase:

{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgCommitBid","auction_id":"e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d","commit_hash":"bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm","signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y

code: 0
codespace: ""
data: ""
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D

Reveal Bid

# ./build/laconicd tx auction reveal-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d root-bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm.json --from root --chain-id $(./build/laconicd status | jq .NodeInfo.network -r)

Enter keyring passphrase:

{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgRevealBid","auction_id":"e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d","reveal":"7b2261756374696f6e4964223a2265376431346337653761366437353337636264623866626536326632326231353533633265663463653337303561646137633238663830666166326662653064222c22626964416d6f756e74223a22323030306170686f746f6e222c2262696464657241646472657373223a226574686d316c37637374777466326c76657632376b613637633233796b376d6d6a38616437746574707163222c22636861696e4964223a2265746865726d696e745f393030302d31222c226e6f697365223a22636c69666620737566666572206472616d6120676f7370656c2077656173656c207061706572206c696272617279206469736f726465722063757276652073706f74206375727461696e207a6562726120696e76657374206465766f74652072656e64657220636c6970207377616c6c6f77206d6f6e6b6579206f62736572766520726573706f6e7365206c696e6b206372616e6520766961626c6520736576656e227d","signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y

code: 0
codespace: ""
data: ""
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 4D1C0B3DDA4050F9BB32240FBD5234229E5C32543C1A0A78033B9531EB0CF8BA

Auction Query CLI Commands

List Auctions

# ./build/laconicd q auction list

auctions:
  auctions:
  - commit_fee:
      amount: "10"
      denom: aphoton
    commits_end_time: "2021-09-30T07:57:07.933412800Z"
    create_time: "2021-09-30T07:55:27.933412800Z"
    id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d
    minimum_bid:
      amount: "1000"
      denom: aphoton
    owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc
    reveal_fee:
      amount: "10"
      denom: aphoton
    reveals_end_time: "2021-09-30T07:58:47.933412800Z"
    status: commit
    winner_address: ""
    winning_bid:
      amount: "0"
      denom: ""
    winning_price:
      amount: "0"
      denom: ""
pagination: null

Get Bid

# ./build/laconicd q auction get-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0e ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc

bid:
  auction_id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d
  bid_amount:
    amount: "0"
    denom: ""
  bidder_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc
  commit_fee:
    amount: "10"
    denom: aphoton
  commit_hash: bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm
  commit_time: "2021-09-30T08:49:48.358878200Z"
  reveal_fee:
    amount: "10"
    denom: aphoton
  reveal_time: "0001-01-01T00:00:00Z"
  status: commit

Get All Bids for an Auction

./build/laconicd q auction get-bids e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d

bids:
- auction_id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d
  bid_amount:
    amount: "0"
    denom: ""
  bidder_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc
  commit_fee:
    amount: "10"
    denom: aphoton
  commit_hash: bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm
  commit_time: "2021-09-30T08:49:48.358878200Z"
  reveal_fee:
    amount: "10"
    denom: aphoton
  reveal_time: "0001-01-01T00:00:00Z"
  status: commit

Get Auction by AuctionID

# ./build/laconicd q auction get e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d

auction:
  commit_fee:
    amount: "10"
    denom: aphoton
  commits_end_time: "2021-09-30T07:57:07.933412800Z"
  create_time: "2021-09-30T07:55:27.933412800Z"
  id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d
  minimum_bid:
    amount: "1000"
    denom: aphoton
  owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc
  reveal_fee:
    amount: "10"
    denom: aphoton
  reveals_end_time: "2021-09-30T07:58:47.933412800Z"
  status: commit
  winner_address: ""
  winning_bid:
    amount: "0"
    denom: ""
  winning_price:
    amount: "0"
    denom: ""

Get Auction by Bidder

# ./build/laconicd q auction query-by-owner ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc

auctions:
  auctions:
  - commit_fee:
      amount: "10"
      denom: aphoton
    commits_end_time: "2021-09-30T07:57:07.933412800Z"
    create_time: "2021-09-30T07:55:27.933412800Z"
    id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d
    minimum_bid:
      amount: "1000"
      denom: aphoton
    owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc
    reveal_fee:
      amount: "10"
      denom: aphoton
    reveals_end_time: "2021-09-30T07:58:47.933412800Z"
    status: commit
    winner_address: ""
    winning_bid:
      amount: "0"
      denom: ""
    winning_price:
      amount: "0"
      denom: ""

Query Account Balance

# ./build/laconicd q auction balance

balance:
- amount: "20"
  denom: aphoton