Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a86e3fe
feat :written keys.go ,codec and keeper methods
vishal-kanna Feb 16, 2023
a17dee9
feat:adding keeper msgs
vishal-kanna Feb 16, 2023
d37586a
added keeper test
vishal-kanna Feb 21, 2023
7b8432c
feat:Writin test files for keeper
vishal-kanna Feb 21, 2023
6dc6ab5
feat:added the test cases for the keeper methods
vishal-kanna Feb 22, 2023
e017f78
Feat:Tried to add AcceptLeave method
vishal-kanna Feb 23, 2023
0225480
Feat:added CLI to the Module
vishal-kanna Feb 27, 2023
030162a
Feat:Changed the msg_server file
vishal-kanna Feb 27, 2023
a79cf42
feat:added module.go and app.go files
vishal-kanna Feb 28, 2023
53b99e8
Feat:Added app.go and module.go
vishal-kanna Feb 28, 2023
7335d6f
feat:added app.go , module.go , built binary
vishal-kanna Mar 1, 2023
b68b2e8
feat:made few transaction and tested manually
vishal-kanna Mar 2, 2023
a9ad122
feat:added one more query and tested manually
vishal-kanna Mar 2, 2023
e72c40a
feat:updated msgs.go and tx.go and query.go
vishal-kanna Mar 6, 2023
98307fc
feat:Changed the tx.go and made some changes
vishal-kanna Mar 6, 2023
4444e8e
error resolved
vishal-kanna Mar 7, 2023
e0aec22
added a query
vishal-kanna Mar 8, 2023
e968dae
made some changes
vishal-kanna Mar 8, 2023
8b898e2
made some changes
vishal-kanna Mar 8, 2023
5cf849a
Updated accept leave method
vishal-kanna Mar 9, 2023
640c037
updated all features
vishal-kanna Mar 9, 2023
04025d0
added event for the applyleave transaction
vishal-kanna Mar 10, 2023
dc85154
feat:intergrated ibc in app.go
vishal-kanna Mar 15, 2023
bdd920e
Feat:added readme file to lms module
vishal-kanna Mar 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
137 changes: 135 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
containerProtoGen=universus-proto-gen-$(protoVer)
containerProtoGen=lms-proto-gen-$(protoVer)
containerProtoGenSwagger=universus-proto-gen-swagger-$(protoVer)
containerProtoFmt=universus-proto-fmt-$(protoVer)

Expand All @@ -9,4 +9,137 @@ proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi
go mod tidy
go mod tidy



#!/usr/bin/make -f

PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')

VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')

TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
BUILDDIR ?= $(CURDIR)/build
APP = ./app
MOCKS_DIR = $(CURDIR)/tests/mocks
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf

export GO111MODULE = on

# process build tags

build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif

ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
build_tags += gcc
endif

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=lms \
-X github.com/cosmos/cosmos-sdk/version.AppName=lms \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION)

# DB backend selection
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
endif
ifeq (badgerdb,$(findstring badgerdb,$(COSMOS_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=badgerdb
BUILD_TAGS += badgerdb
endif
# handle rocksdb
ifeq (rocksdb,$(findstring rocksdb,$(COSMOS_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += rocksdb
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=rocksdb
endif
# handle boltdb
ifeq (boltdb,$(findstring boltdb,$(COSMOS_BUILD_OPTIONS)))
BUILD_TAGS += boltdb
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=boltdb
endif

ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
ldflags += -w -s
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
# check for nostrip option
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
endif

all: tools build lint test


###############################################################################
### Build ###
###############################################################################

BUILD_TARGETS := build install

build: BUILD_ARGS=-o $(BUILDDIR)/
build-linux:
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build

$(BUILD_TARGETS): go.sum $(BUILDDIR)/
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...

$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/



.PHONY: build build-linux


distclean: clean tools-clean
clean:
rm -rf \
$(BUILDDIR)/ \
artifacts/ \
tmp-swagger-gen/

.PHONY: distclean clean
217 changes: 217 additions & 0 deletions Readme.Md
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
# X/leave

## Abstract

This document specifies the leave management system module.

This leave module is responsible for the students to apply the leaves and admin to accept the leaves.
It helps the admin to accept the leaves and query all the leaves.
It also helps the students to do the transaction and query the transaction


## Client

## CLI

A user can interact with the `lms` using CLI.

## Query
The `query` commands allows users to `lms` module.
```
lmsd query lms --help
```

### admin

The `admin` command helps the query the admin registered.

```
lmsd query lms admin
```
Example:

```
lmsd query lms admin
```

Example Output:

admins:
- address: cosmos12f70wvzjtwlyrralxat3xqc86fz7rjvuk3jrvx
name: vishal
signer: cosmos12f70wvzjtwlyrralxat3xqc86fz7rjvuk3jrvx



### list-all-leaves

The `list-all-leaves` command helps the admin to query the all the leaves.


```
lmsd query lms list-all-leaves
```

Example:
```
lmsd query lms list-all-leaves

```
Example Output:

leaves:
Id: b172118
from: "2025-03-01T00:00:00Z"
leaveid: "1"
reason: fever
signer: cosmos12f70wvzjtwlyrralxat3xqc86fz7rjvuk3jrvx
status: STATUS_UNDEFINED
to: "2027-03-01T00:00:00Z"



### list-all-students

The `list-all-students `command helps the admin to get all the students details present in the store.

```
lmsd query lms listallstudents
```

Example:
```
lmsd query lms listallstudents

```
Example Output:

students:
- address: cosmos19hgll56xm2c5pj4y5rra6ms67e30dxvwg72xkw
id: b172118
name: student1




### studentleavestatus

The `studentleavestatus` command helps the user or student to get the status of the applied leave.

```
lmsd query lms studentleavestatus [studentid] [leaveid]
```

Example:
```
lmsd query lms studentleavestatus b172118 1

```
Example Output:

Before the accepting the leave
status:
Id: b172118
from: "2025-03-01T00:00:00Z"
leaveid: "1"
reason: fever
signer: cosmos12f70wvzjtwlyrralxat3xqc86fz7rjvuk3jrvx
status: STATUS_UNDEFINED
to: "2027-03-01T00:00:00Z"

After accepting the leave


status:
Id: b172118
from: "2025-03-01T00:00:00Z"
leaveid: "1"
reason: fever
signer: cosmos12f70wvzjtwlyrralxat3xqc86fz7rjvuk3jrvx
status: STATUS_ACCEPTED
to: "2027-03-01T00:00:00Z"




## Transactions

The `tx` command allows user to interact with `lms` module.
```
lmsd tx lms --help

```
### registeradmin

The `registeradmin ` allows the user to register as a admin and make other transactions like adding students and accepting leaves.



```
lmsd tx lms registeradmin [adminname] --from validator-key --chain-id testnet
```

Example:
```
lmsd tx lms registeradmin vishal --from validator-key --chain-id testnet

```




### addstudent
The `addstudent` command allows admin to add the students.

```
lmsd tx lms addstudent [studentname] [studentid] [studentaddress] --from validator-key --chain-id testnet
```


Example:
```
lmsd tx lms addstudent student1 b172118 bec32address --from validator-key --chain-id testnet

```



### applyleave

The `applyleave` command allows the user to apply leaves.

```
lmsd tx lms applyleave [studentid] [reason] [from] [to] --from validator-key --chain-id testnet
```


Example:
```
lmsd tx lms applyleave b172118 fever 2023-mar-1 2023-mar-4 --from validator-key --chain-id testnet

```
Example output:
it is event triggered when leave is applied.Leaveid is used to check the status of the leave.

```
raw_log: '[{"msg_index":0,"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmos.lms.v1beta1.ApplyLeaveRequest"},{"key":"leaveid:","value":"1"}]}]}]'
```





### acceptleave

The` acceptleave` command allows the admin to accept the leaves based on the studentid and leaveid.

```
lmsd tx lms acceptleave [studentid] [leaveid] --from validator-key --chain-id testnet
```


Example:
```
lmsd tx lms applyleave b172118 1 --from validator-key --chain-id testnet

```

Empty file removed app.go
Empty file.
Binary file added build/lmsd
Binary file not shown.
Empty file removed cmd/lmscli/main.go
Empty file.
Empty file removed cmd/lmsd/main.go
Empty file.
Loading