carbon-js-sdk 0.6.0-rc8 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { PlPool, MarketConfig } from "./pool";
3
+ import { PlPool } from "./pool";
4
+ import { MarketConfig } from "./market";
4
5
  export declare const protobufPackage = "Switcheo.carbon.perpsliquidity";
5
6
  export interface SetPoolEvent {
6
7
  pool?: PlPool;
@@ -8,6 +8,7 @@ exports.WithdrawFromPoolEvent = exports.DepositToPoolEvent = exports.SetMarketCo
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
10
  const pool_1 = require("./pool");
11
+ const market_1 = require("./market");
11
12
  exports.protobufPackage = "Switcheo.carbon.perpsliquidity";
12
13
  const baseSetPoolEvent = { type: "" };
13
14
  exports.SetPoolEvent = {
@@ -295,7 +296,7 @@ const baseSetMarketConfigEvent = {};
295
296
  exports.SetMarketConfigEvent = {
296
297
  encode(message, writer = minimal_1.default.Writer.create()) {
297
298
  if (message.marketConfig !== undefined) {
298
- pool_1.MarketConfig.encode(message.marketConfig, writer.uint32(10).fork()).ldelim();
299
+ market_1.MarketConfig.encode(message.marketConfig, writer.uint32(10).fork()).ldelim();
299
300
  }
300
301
  return writer;
301
302
  },
@@ -307,7 +308,7 @@ exports.SetMarketConfigEvent = {
307
308
  const tag = reader.uint32();
308
309
  switch (tag >>> 3) {
309
310
  case 1:
310
- message.marketConfig = pool_1.MarketConfig.decode(reader, reader.uint32());
311
+ message.marketConfig = market_1.MarketConfig.decode(reader, reader.uint32());
311
312
  break;
312
313
  default:
313
314
  reader.skipType(tag & 7);
@@ -320,7 +321,7 @@ exports.SetMarketConfigEvent = {
320
321
  const message = Object.assign({}, baseSetMarketConfigEvent);
321
322
  message.marketConfig =
322
323
  object.marketConfig !== undefined && object.marketConfig !== null
323
- ? pool_1.MarketConfig.fromJSON(object.marketConfig)
324
+ ? market_1.MarketConfig.fromJSON(object.marketConfig)
324
325
  : undefined;
325
326
  return message;
326
327
  },
@@ -328,7 +329,7 @@ exports.SetMarketConfigEvent = {
328
329
  const obj = {};
329
330
  message.marketConfig !== undefined &&
330
331
  (obj.marketConfig = message.marketConfig
331
- ? pool_1.MarketConfig.toJSON(message.marketConfig)
332
+ ? market_1.MarketConfig.toJSON(message.marketConfig)
332
333
  : undefined);
333
334
  return obj;
334
335
  },
@@ -336,7 +337,7 @@ exports.SetMarketConfigEvent = {
336
337
  const message = Object.assign({}, baseSetMarketConfigEvent);
337
338
  message.marketConfig =
338
339
  object.marketConfig !== undefined && object.marketConfig !== null
339
- ? pool_1.MarketConfig.fromPartial(object.marketConfig)
340
+ ? market_1.MarketConfig.fromPartial(object.marketConfig)
340
341
  : undefined;
341
342
  return message;
342
343
  },
@@ -1,7 +1,8 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
3
  import { Params } from "./params";
4
- import { MarketConfig, PlPool } from "./pool";
4
+ import { MarketConfig } from "./market";
5
+ import { PlPool } from "./pool";
5
6
  export declare const protobufPackage = "Switcheo.carbon.perpsliquidity";
6
7
  /** GenesisState defines the perpsliquidity module's genesis state. */
7
8
  export interface GenesisState {
@@ -8,6 +8,7 @@ exports.MarketConfigWithPoolId = exports.GenesisState = exports.protobufPackage
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
10
  const params_1 = require("./params");
11
+ const market_1 = require("./market");
11
12
  const pool_1 = require("./pool");
12
13
  exports.protobufPackage = "Switcheo.carbon.perpsliquidity";
13
14
  const baseGenesisState = {};
@@ -97,7 +98,7 @@ exports.MarketConfigWithPoolId = {
97
98
  writer.uint32(8).uint64(message.poolId);
98
99
  }
99
100
  if (message.marketConfig !== undefined) {
100
- pool_1.MarketConfig.encode(message.marketConfig, writer.uint32(18).fork()).ldelim();
101
+ market_1.MarketConfig.encode(message.marketConfig, writer.uint32(18).fork()).ldelim();
101
102
  }
102
103
  return writer;
103
104
  },
@@ -112,7 +113,7 @@ exports.MarketConfigWithPoolId = {
112
113
  message.poolId = reader.uint64();
113
114
  break;
114
115
  case 2:
115
- message.marketConfig = pool_1.MarketConfig.decode(reader, reader.uint32());
116
+ message.marketConfig = market_1.MarketConfig.decode(reader, reader.uint32());
116
117
  break;
117
118
  default:
118
119
  reader.skipType(tag & 7);
@@ -129,7 +130,7 @@ exports.MarketConfigWithPoolId = {
129
130
  : long_1.default.UZERO;
130
131
  message.marketConfig =
131
132
  object.marketConfig !== undefined && object.marketConfig !== null
132
- ? pool_1.MarketConfig.fromJSON(object.marketConfig)
133
+ ? market_1.MarketConfig.fromJSON(object.marketConfig)
133
134
  : undefined;
134
135
  return message;
135
136
  },
@@ -139,7 +140,7 @@ exports.MarketConfigWithPoolId = {
139
140
  (obj.poolId = (message.poolId || long_1.default.UZERO).toString());
140
141
  message.marketConfig !== undefined &&
141
142
  (obj.marketConfig = message.marketConfig
142
- ? pool_1.MarketConfig.toJSON(message.marketConfig)
143
+ ? market_1.MarketConfig.toJSON(message.marketConfig)
143
144
  : undefined);
144
145
  return obj;
145
146
  },
@@ -151,7 +152,7 @@ exports.MarketConfigWithPoolId = {
151
152
  : long_1.default.UZERO;
152
153
  message.marketConfig =
153
154
  object.marketConfig !== undefined && object.marketConfig !== null
154
- ? pool_1.MarketConfig.fromPartial(object.marketConfig)
155
+ ? market_1.MarketConfig.fromPartial(object.marketConfig)
155
156
  : undefined;
156
157
  return message;
157
158
  },
@@ -1,5 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
+ import { Duration } from "../google/protobuf/duration";
3
4
  export declare const protobufPackage = "Switcheo.carbon.perpsliquidity";
4
5
  /** Params defines the parameters for the module. */
5
6
  export interface Params {
@@ -7,6 +8,10 @@ export interface Params {
7
8
  quoteIndexPriceFluctuationToleranceRatio: string;
8
9
  /** requotes after orders are x seconds old */
9
10
  quoteExpirySeconds: Long;
11
+ /** interval to take market utilization snapshot, e.g. every 60 seconds */
12
+ marketUtilizationSnapshotInterval?: Duration;
13
+ /** time duration window used to calculate the TWA market utilization e.g. last 24 hours */
14
+ maxMarketUtilizationSnapshotWindow?: Duration;
10
15
  }
11
16
  export declare const Params: {
12
17
  encode(message: Params, writer?: _m0.Writer): _m0.Writer;
@@ -7,6 +7,7 @@ exports.Params = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
+ const duration_1 = require("../google/protobuf/duration");
10
11
  exports.protobufPackage = "Switcheo.carbon.perpsliquidity";
11
12
  const baseParams = {
12
13
  quoteIndexPriceFluctuationToleranceRatio: "",
@@ -22,6 +23,12 @@ exports.Params = {
22
23
  if (!message.quoteExpirySeconds.isZero()) {
23
24
  writer.uint32(16).uint64(message.quoteExpirySeconds);
24
25
  }
26
+ if (message.marketUtilizationSnapshotInterval !== undefined) {
27
+ duration_1.Duration.encode(message.marketUtilizationSnapshotInterval, writer.uint32(26).fork()).ldelim();
28
+ }
29
+ if (message.maxMarketUtilizationSnapshotWindow !== undefined) {
30
+ duration_1.Duration.encode(message.maxMarketUtilizationSnapshotWindow, writer.uint32(34).fork()).ldelim();
31
+ }
25
32
  return writer;
26
33
  },
27
34
  decode(input, length) {
@@ -37,6 +44,12 @@ exports.Params = {
37
44
  case 2:
38
45
  message.quoteExpirySeconds = reader.uint64();
39
46
  break;
47
+ case 3:
48
+ message.marketUtilizationSnapshotInterval = duration_1.Duration.decode(reader, reader.uint32());
49
+ break;
50
+ case 4:
51
+ message.maxMarketUtilizationSnapshotWindow = duration_1.Duration.decode(reader, reader.uint32());
52
+ break;
40
53
  default:
41
54
  reader.skipType(tag & 7);
42
55
  break;
@@ -56,6 +69,16 @@ exports.Params = {
56
69
  object.quoteExpirySeconds !== null
57
70
  ? long_1.default.fromString(object.quoteExpirySeconds)
58
71
  : long_1.default.UZERO;
72
+ message.marketUtilizationSnapshotInterval =
73
+ object.marketUtilizationSnapshotInterval !== undefined &&
74
+ object.marketUtilizationSnapshotInterval !== null
75
+ ? duration_1.Duration.fromJSON(object.marketUtilizationSnapshotInterval)
76
+ : undefined;
77
+ message.maxMarketUtilizationSnapshotWindow =
78
+ object.maxMarketUtilizationSnapshotWindow !== undefined &&
79
+ object.maxMarketUtilizationSnapshotWindow !== null
80
+ ? duration_1.Duration.fromJSON(object.maxMarketUtilizationSnapshotWindow)
81
+ : undefined;
59
82
  return message;
60
83
  },
61
84
  toJSON(message) {
@@ -65,6 +88,16 @@ exports.Params = {
65
88
  message.quoteIndexPriceFluctuationToleranceRatio);
66
89
  message.quoteExpirySeconds !== undefined &&
67
90
  (obj.quoteExpirySeconds = (message.quoteExpirySeconds || long_1.default.UZERO).toString());
91
+ message.marketUtilizationSnapshotInterval !== undefined &&
92
+ (obj.marketUtilizationSnapshotInterval =
93
+ message.marketUtilizationSnapshotInterval
94
+ ? duration_1.Duration.toJSON(message.marketUtilizationSnapshotInterval)
95
+ : undefined);
96
+ message.maxMarketUtilizationSnapshotWindow !== undefined &&
97
+ (obj.maxMarketUtilizationSnapshotWindow =
98
+ message.maxMarketUtilizationSnapshotWindow
99
+ ? duration_1.Duration.toJSON(message.maxMarketUtilizationSnapshotWindow)
100
+ : undefined);
68
101
  return obj;
69
102
  },
70
103
  fromPartial(object) {
@@ -77,6 +110,16 @@ exports.Params = {
77
110
  object.quoteExpirySeconds !== null
78
111
  ? long_1.default.fromValue(object.quoteExpirySeconds)
79
112
  : long_1.default.UZERO;
113
+ message.marketUtilizationSnapshotInterval =
114
+ object.marketUtilizationSnapshotInterval !== undefined &&
115
+ object.marketUtilizationSnapshotInterval !== null
116
+ ? duration_1.Duration.fromPartial(object.marketUtilizationSnapshotInterval)
117
+ : undefined;
118
+ message.maxMarketUtilizationSnapshotWindow =
119
+ object.maxMarketUtilizationSnapshotWindow !== undefined &&
120
+ object.maxMarketUtilizationSnapshotWindow !== null
121
+ ? duration_1.Duration.fromPartial(object.maxMarketUtilizationSnapshotWindow)
122
+ : undefined;
80
123
  return message;
81
124
  },
82
125
  };
@@ -1,5 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
+ import { MarketConfig } from "./market";
3
4
  export declare const protobufPackage = "Switcheo.carbon.perpsliquidity";
4
5
  /** main store holding each Pool */
5
6
  export interface PlPool {
@@ -9,69 +10,38 @@ export interface PlPool {
9
10
  name: string;
10
11
  /** deposit_denom for underlying token that will be used to provide liquidity */
11
12
  depositDenom: string;
12
- /** denom for the share token that can be used to redeem underlying deposited token */
13
+ /** auto-generated denom for the share token that can be used to redeem underlying deposited token */
13
14
  shareDenom: string;
14
15
  /** auto-created address of the vault that stores the tokens */
15
16
  vaultAddress: string;
16
17
  /** supply cap to limit amount of tokens that can go into the pool */
17
18
  supplyCap: string;
18
- /** deposit fee to charge on a successful deposit to PLP in bps */
19
- depositFeeBps: string;
20
- /** withdrawal fee to charge on a successful withdrawal from PLP in bps */
21
- withdrawalFeeBps: string;
22
- /** borrow fee in bps per time period to charge on use of liquidity in pool */
23
- borrowFeeBps: string;
19
+ /** deposit fee to charge on a successful deposit to PLP in decimal */
20
+ depositFee: string;
21
+ /** withdrawal fee to charge on a successful withdrawal from PLP in decimal */
22
+ withdrawalFee: string;
23
+ /** borrow fee in decimal per time period to charge on use of liquidity in pool */
24
+ borrowFee: string;
24
25
  }
25
26
  export interface UpdatePlPoolParams {
26
27
  name?: string;
27
28
  supplyCap: string;
28
- depositFeeBps?: Long;
29
- withdrawalFeeBps?: Long;
30
- borrowFeeBps?: Long;
29
+ depositFee: string;
30
+ withdrawalFee: string;
31
+ borrowFee: string;
31
32
  }
32
33
  /** PoolDetails used for for querying. same as Pool but appended with registered_markets */
33
34
  export interface PoolDetails {
34
35
  pool?: PlPool;
35
36
  registeredMarkets: MarketConfig[];
36
37
  }
37
- export interface Quote {
38
- quotePriceType: string;
39
- quotePriceValue: string;
40
- quoteAmountRatio: string;
41
- }
42
- /** MarketConfig config for each market in the Pool */
43
- export interface MarketConfig {
44
- /** unique id representing the market */
45
- marketId: string;
46
- /**
47
- * ratio of the pool liquidity that can be used for the market
48
- * ratio where 0 < max_liquidity_ratio <= 1
49
- */
50
- maxLiquidityRatio: string;
51
- /** borrow_fee_multiplier controls the multiplier for the base borrow fee charged on the pool. riskier markets should have a higher multiplier */
52
- borrowFeeMultiplier: string;
53
- /**
54
- * Available modes:
55
- * active - market is active for quoting
56
- * paused - open quotes are cancelled, current positions are held, no new quotes
57
- * close_only - quotes will be open only on the closing side. borrow fees are increased?
58
- */
59
- mode: string;
60
- /** represents the shape of quoting for each side against [0] index price, [1+] prev quotes */
61
- quoteShape: Quote[];
62
- }
63
- export interface UpdateMarketConfigParams {
64
- maxLiquidityRatio: string;
65
- borrowFeeMultiplier: string;
66
- mode?: string;
67
- quoteShape: Quote[];
68
- }
69
38
  /** DepositParams params required for enqueuing into deposit transient store */
70
39
  export interface DepositToPoolParams {
71
40
  poolId: Long;
72
41
  fromAccount: string;
73
42
  depositAmount: string;
74
43
  minSharesToReceive: string;
44
+ processingId: Long;
75
45
  }
76
46
  /** WithdrawParams params required for enqueuing into withdraw transient store */
77
47
  export interface WithdrawFromPoolParams {
@@ -79,11 +49,19 @@ export interface WithdrawFromPoolParams {
79
49
  toAccount: string;
80
50
  shareAmount: string;
81
51
  minWithdrawAmount: string;
52
+ processingId: Long;
82
53
  }
83
54
  /** DepositToBonusContractParams params required for enqueuing into deposit transient store */
84
55
  export interface DepositToBonusContractParams {
85
56
  bonusVaultId: Long;
86
57
  isLongUnbond: boolean;
58
+ fluoDistributorAddress: Uint8Array;
59
+ bonusFluoDistributorAddress: Uint8Array;
60
+ }
61
+ /** MarketUtilizationRateSnapshot represents the utilization rate of a market at a given timestamp */
62
+ export interface MarketUtilizationRateSnapshot {
63
+ timestamp?: Date;
64
+ utilizationRate: string;
87
65
  }
88
66
  export declare const PlPool: {
89
67
  encode(message: PlPool, writer?: _m0.Writer): _m0.Writer;
@@ -106,27 +84,6 @@ export declare const PoolDetails: {
106
84
  toJSON(message: PoolDetails): unknown;
107
85
  fromPartial(object: DeepPartial<PoolDetails>): PoolDetails;
108
86
  };
109
- export declare const Quote: {
110
- encode(message: Quote, writer?: _m0.Writer): _m0.Writer;
111
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): Quote;
112
- fromJSON(object: any): Quote;
113
- toJSON(message: Quote): unknown;
114
- fromPartial(object: DeepPartial<Quote>): Quote;
115
- };
116
- export declare const MarketConfig: {
117
- encode(message: MarketConfig, writer?: _m0.Writer): _m0.Writer;
118
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MarketConfig;
119
- fromJSON(object: any): MarketConfig;
120
- toJSON(message: MarketConfig): unknown;
121
- fromPartial(object: DeepPartial<MarketConfig>): MarketConfig;
122
- };
123
- export declare const UpdateMarketConfigParams: {
124
- encode(message: UpdateMarketConfigParams, writer?: _m0.Writer): _m0.Writer;
125
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): UpdateMarketConfigParams;
126
- fromJSON(object: any): UpdateMarketConfigParams;
127
- toJSON(message: UpdateMarketConfigParams): unknown;
128
- fromPartial(object: DeepPartial<UpdateMarketConfigParams>): UpdateMarketConfigParams;
129
- };
130
87
  export declare const DepositToPoolParams: {
131
88
  encode(message: DepositToPoolParams, writer?: _m0.Writer): _m0.Writer;
132
89
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): DepositToPoolParams;
@@ -148,6 +105,13 @@ export declare const DepositToBonusContractParams: {
148
105
  toJSON(message: DepositToBonusContractParams): unknown;
149
106
  fromPartial(object: DeepPartial<DepositToBonusContractParams>): DepositToBonusContractParams;
150
107
  };
108
+ export declare const MarketUtilizationRateSnapshot: {
109
+ encode(message: MarketUtilizationRateSnapshot, writer?: _m0.Writer): _m0.Writer;
110
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MarketUtilizationRateSnapshot;
111
+ fromJSON(object: any): MarketUtilizationRateSnapshot;
112
+ toJSON(message: MarketUtilizationRateSnapshot): unknown;
113
+ fromPartial(object: DeepPartial<MarketUtilizationRateSnapshot>): MarketUtilizationRateSnapshot;
114
+ };
151
115
  declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
152
116
  export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
153
117
  [K in keyof T]?: DeepPartial<T[K]>;