Skip to content

Commit

Permalink
Merge pull request #56 from persistenceOne/puneet/lsmprotos
Browse files Browse the repository at this point in the history
Puneet/lsmprotos
  • Loading branch information
puneet2019 authored Aug 7, 2023
2 parents 8050d01 + f3d171d commit 23dc30a
Show file tree
Hide file tree
Showing 10 changed files with 579 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Check build

on:
pull_request:
branches:
- main

jobs:
install-build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 16.x ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@

---

## Maintain
- open file to scripts/update-protos.sh and update the commits/ tags
- do `npm run update-protos`
- do `npm run build:telescope`
- update package.json version
- commit and open PR
- tag a release for publishing on npmjs

## Setup

```sh
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "persistenceonejs",
"version": "2.1.1",
"version": "2.2.0-rc0",
"description": "Client side JS libraries for persistenceSDK transaction generation, signing and broadcasting.",
"main": "main/index.js",
"module": "module/index.js",
Expand Down
45 changes: 45 additions & 0 deletions proto/pstake/liquidstakeibc/v1beta1/liquidstakeibc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ message HostChain {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// host chain flags
HostChainFlags flags = 16;
}

message HostChainFlags {
bool lsm = 1;
}

message HostChainLSParams {
Expand Down Expand Up @@ -154,6 +160,45 @@ message Deposit {
string ibc_sequence_id = 5;
}

message LSMDeposit {
enum LSMDepositState {
// no action has been initiated on the deposit
DEPOSIT_PENDING = 0;
// deposit sent to the host chain delegator address
DEPOSIT_SENT = 1;
// deposit received by the host chain delegator address
DEPOSIT_RECEIVED = 2;
// deposit started the untokenization process
DEPOSIT_UNTOKENIZING = 3;
}

// deposit target chain
string chain_id = 1;
// this is calculated when liquid staking [lsm_shares * validator_exchange_rate]
string amount = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// LSM token shares, they are mapped 1:1 with the delegator shares that are tokenized
// https://github.com/iqlusioninc/cosmos-sdk/pull/19
string shares = 3 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// LSM token denom
string denom = 4;
// LSM token ibc denom
string ibc_denom = 5;
// address of the delegator
string delegator_address = 6;
// state o the deposit
LSMDepositState state = 7;
// sequence id of the ibc transaction
string ibc_sequence_id = 8;
}

message Unbonding {
enum UnbondingState {
// no action has been initiated on the unbonding
Expand Down
13 changes: 13 additions & 0 deletions proto/pstake/liquidstakeibc/v1beta1/msgs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ service Msg {
option (google.api.http).post = "/pstake/liquidstakeibc/v1beta1/LiquidStake";
}

rpc LiquidStakeLSM(MsgLiquidStakeLSM) returns (MsgLiquidStakeLSMResponse) {
option (google.api.http).post = "/pstake/liquidstakeibc/v1beta1/LiquidStakeLSM";
}

rpc LiquidUnstake(MsgLiquidUnstake) returns (MsgLiquidUnstakeResponse) {
option (google.api.http).post = "/pstake/liquidstakeibc/v1beta1/LiquidUnstake";
}
Expand Down Expand Up @@ -96,6 +100,15 @@ message MsgLiquidStake {

message MsgLiquidStakeResponse {}

message MsgLiquidStakeLSM {
option (cosmos.msg.v1.signer) = "delegator_address";

string delegator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
repeated cosmos.base.v1beta1.Coin delegations = 2;
}

message MsgLiquidStakeLSMResponse {}

message MsgLiquidUnstake {
option (cosmos.msg.v1.signer) = "delegator_address";

Expand Down
13 changes: 13 additions & 0 deletions proto/pstake/liquidstakeibc/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ service Query {
option (google.api.http).get = "/pstake/liquidstakeibc/v1beta1/deposits/{chain_id}";
}

// Queries for all the deposits for a host chain.
rpc LSMDeposits(QueryLSMDepositsRequest) returns (QueryLSMDepositsResponse) {
option (google.api.http).get = "/pstake/liquidstakeibc/v1beta1/lsm_deposits/{chain_id}";
}

// Queries all unbondings for a host chain.
rpc Unbondings(QueryUnbondingsRequest) returns (QueryUnbondingsResponse) {
option (google.api.http).get = "/pstake/liquidstakeibc/v1beta1/unbondings/{chain_id}";
Expand Down Expand Up @@ -95,6 +100,14 @@ message QueryDepositsResponse {
repeated Deposit deposits = 1;
}

message QueryLSMDepositsRequest {
string chain_id = 1;
}

message QueryLSMDepositsResponse {
repeated LSMDeposit deposits = 1;
}

message QueryUnbondingsRequest {
string chain_id = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ibc_git=https://github.com/persistenceOne/ibc-go.git
ibc_tag=v7.2.0-lsm2

pstake_git=https://github.com/persistenceOne/pstake-native.git
pstake_tag=v2.2.0
pstake_tag=main

persistence_sdk_git=https://github.com/persistenceOne/persistence-sdk.git
persistence_sdk_tag=v2.1.0
Expand Down
Loading

0 comments on commit 23dc30a

Please sign in to comment.