carbon-js-sdk 0.2.14-dev.5 → 0.2.14-dev.6
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.
- package/lib/codec/cdp/asset_params.d.ts +1 -1
- package/lib/codec/cdp/asset_params.js +11 -10
- package/lib/codec/cdp/genesis.d.ts +18 -1
- package/lib/codec/cdp/genesis.js +153 -37
- package/lib/codec/cdp/tx.d.ts +0 -1
- package/lib/codec/cdp/tx.js +6 -20
- package/lib/codec/cosmos/authz/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/authz/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/authz/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/authz/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/tx/v1beta1/service.d.ts +1 -1
- package/lib/codec/cosmos/tx/v1beta1/service.js +1 -1
- package/lib/codec/index.d.ts +1 -0
- package/lib/codec/index.js +3 -1
- package/lib/codec/oracle/genesis.d.ts +3 -0
- package/lib/codec/oracle/genesis.js +33 -2
- package/lib/codec/pricing/genesis.d.ts +1 -1
- package/lib/codec/pricing/genesis.js +8 -8
- package/lib/modules/admin.d.ts +1 -1
- package/lib/modules/admin.js +2 -2
- package/lib/modules/cdp.d.ts +10 -1
- package/lib/modules/cdp.js +64 -5
- package/lib/websocket/models.d.ts +1 -2
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ const baseAssetParams = {
|
|
|
15
15
|
allowRepayStablecoinInterestDebt: false,
|
|
16
16
|
loanToValue: "",
|
|
17
17
|
liquidationThreshold: "",
|
|
18
|
-
|
|
18
|
+
liquidationDiscount: "",
|
|
19
19
|
supplyCap: "",
|
|
20
20
|
borrowCap: "",
|
|
21
21
|
};
|
|
@@ -39,8 +39,8 @@ exports.AssetParams = {
|
|
|
39
39
|
if (message.liquidationThreshold !== "") {
|
|
40
40
|
writer.uint32(50).string(message.liquidationThreshold);
|
|
41
41
|
}
|
|
42
|
-
if (message.
|
|
43
|
-
writer.uint32(58).string(message.
|
|
42
|
+
if (message.liquidationDiscount !== "") {
|
|
43
|
+
writer.uint32(58).string(message.liquidationDiscount);
|
|
44
44
|
}
|
|
45
45
|
if (message.supplyCap !== "") {
|
|
46
46
|
writer.uint32(66).string(message.supplyCap);
|
|
@@ -76,7 +76,7 @@ exports.AssetParams = {
|
|
|
76
76
|
message.liquidationThreshold = reader.string();
|
|
77
77
|
break;
|
|
78
78
|
case 7:
|
|
79
|
-
message.
|
|
79
|
+
message.liquidationDiscount = reader.string();
|
|
80
80
|
break;
|
|
81
81
|
case 8:
|
|
82
82
|
message.supplyCap = reader.string();
|
|
@@ -119,9 +119,10 @@ exports.AssetParams = {
|
|
|
119
119
|
object.liquidationThreshold !== null
|
|
120
120
|
? String(object.liquidationThreshold)
|
|
121
121
|
: "";
|
|
122
|
-
message.
|
|
123
|
-
object.
|
|
124
|
-
|
|
122
|
+
message.liquidationDiscount =
|
|
123
|
+
object.liquidationDiscount !== undefined &&
|
|
124
|
+
object.liquidationDiscount !== null
|
|
125
|
+
? String(object.liquidationDiscount)
|
|
125
126
|
: "";
|
|
126
127
|
message.supplyCap =
|
|
127
128
|
object.supplyCap !== undefined && object.supplyCap !== null
|
|
@@ -146,8 +147,8 @@ exports.AssetParams = {
|
|
|
146
147
|
(obj.loanToValue = message.loanToValue);
|
|
147
148
|
message.liquidationThreshold !== undefined &&
|
|
148
149
|
(obj.liquidationThreshold = message.liquidationThreshold);
|
|
149
|
-
message.
|
|
150
|
-
(obj.
|
|
150
|
+
message.liquidationDiscount !== undefined &&
|
|
151
|
+
(obj.liquidationDiscount = message.liquidationDiscount);
|
|
151
152
|
message.supplyCap !== undefined && (obj.supplyCap = message.supplyCap);
|
|
152
153
|
message.borrowCap !== undefined && (obj.borrowCap = message.borrowCap);
|
|
153
154
|
return obj;
|
|
@@ -162,7 +163,7 @@ exports.AssetParams = {
|
|
|
162
163
|
(_d = object.allowRepayStablecoinInterestDebt) !== null && _d !== void 0 ? _d : false;
|
|
163
164
|
message.loanToValue = (_e = object.loanToValue) !== null && _e !== void 0 ? _e : "";
|
|
164
165
|
message.liquidationThreshold = (_f = object.liquidationThreshold) !== null && _f !== void 0 ? _f : "";
|
|
165
|
-
message.
|
|
166
|
+
message.liquidationDiscount = (_g = object.liquidationDiscount) !== null && _g !== void 0 ? _g : "";
|
|
166
167
|
message.supplyCap = (_h = object.supplyCap) !== null && _h !== void 0 ? _h : "";
|
|
167
168
|
message.borrowCap = (_j = object.borrowCap) !== null && _j !== void 0 ? _j : "";
|
|
168
169
|
return message;
|
|
@@ -5,6 +5,7 @@ import { StablecoinDebtInfo } from "./stablecoin_debt_info";
|
|
|
5
5
|
import { RateStrategyParams } from "./rate_strategy_params";
|
|
6
6
|
import { AssetParams } from "./asset_params";
|
|
7
7
|
import { DebtInfo } from "./debt_info";
|
|
8
|
+
import { RewardScheme } from "./reward_scheme";
|
|
8
9
|
export declare const protobufPackage = "Switcheo.carbon.cdp";
|
|
9
10
|
/** GenesisState defines the cdp module's genesis state. */
|
|
10
11
|
export interface GenesisState {
|
|
@@ -12,6 +13,8 @@ export interface GenesisState {
|
|
|
12
13
|
rateStrategies: RateStrategyParams[];
|
|
13
14
|
assets: AssetParams[];
|
|
14
15
|
debtInfos: DebtInfo[];
|
|
16
|
+
rewardSchemes: RewardScheme[];
|
|
17
|
+
sequenceNumber: Long;
|
|
15
18
|
accountToCollateralized: {
|
|
16
19
|
[key: string]: Uint8Array;
|
|
17
20
|
};
|
|
@@ -25,10 +28,13 @@ export interface GenesisState {
|
|
|
25
28
|
accountToPrincipalStablecoinDebt: {
|
|
26
29
|
[key: string]: Uint8Array;
|
|
27
30
|
};
|
|
28
|
-
/** this line is used by starport scaffolding # genesis/proto/state */
|
|
29
31
|
accountToStablecoinInitialCumulativeInterestMultiplier: {
|
|
30
32
|
[key: string]: Uint8Array;
|
|
31
33
|
};
|
|
34
|
+
/** this line is used by starport scaffolding # genesis/proto/state */
|
|
35
|
+
accountToRewardDebt: {
|
|
36
|
+
[key: string]: Uint8Array;
|
|
37
|
+
};
|
|
32
38
|
}
|
|
33
39
|
export interface GenesisState_AccountToCollateralizedEntry {
|
|
34
40
|
key: string;
|
|
@@ -50,6 +56,10 @@ export interface GenesisState_AccountToStablecoinInitialCumulativeInterestMultip
|
|
|
50
56
|
key: string;
|
|
51
57
|
value: Uint8Array;
|
|
52
58
|
}
|
|
59
|
+
export interface GenesisState_AccountToRewardDebtEntry {
|
|
60
|
+
key: string;
|
|
61
|
+
value: Uint8Array;
|
|
62
|
+
}
|
|
53
63
|
export declare const GenesisState: {
|
|
54
64
|
encode(message: GenesisState, writer?: _m0.Writer): _m0.Writer;
|
|
55
65
|
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): GenesisState;
|
|
@@ -92,6 +102,13 @@ export declare const GenesisState_AccountToStablecoinInitialCumulativeInterestMu
|
|
|
92
102
|
toJSON(message: GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry): unknown;
|
|
93
103
|
fromPartial(object: DeepPartial<GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry>): GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry;
|
|
94
104
|
};
|
|
105
|
+
export declare const GenesisState_AccountToRewardDebtEntry: {
|
|
106
|
+
encode(message: GenesisState_AccountToRewardDebtEntry, writer?: _m0.Writer): _m0.Writer;
|
|
107
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): GenesisState_AccountToRewardDebtEntry;
|
|
108
|
+
fromJSON(object: any): GenesisState_AccountToRewardDebtEntry;
|
|
109
|
+
toJSON(message: GenesisState_AccountToRewardDebtEntry): unknown;
|
|
110
|
+
fromPartial(object: DeepPartial<GenesisState_AccountToRewardDebtEntry>): GenesisState_AccountToRewardDebtEntry;
|
|
111
|
+
};
|
|
95
112
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
96
113
|
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 {} ? {
|
|
97
114
|
[K in keyof T]?: DeepPartial<T[K]>;
|
package/lib/codec/cdp/genesis.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry = exports.GenesisState_AccountToPrincipalStablecoinDebtEntry = exports.GenesisState_AccountToInitialCumulativeInterestMultiplierEntry = exports.GenesisState_AccountToPrincipalDebtEntry = exports.GenesisState_AccountToCollateralizedEntry = exports.GenesisState = exports.protobufPackage = void 0;
|
|
6
|
+
exports.GenesisState_AccountToRewardDebtEntry = exports.GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry = exports.GenesisState_AccountToPrincipalStablecoinDebtEntry = exports.GenesisState_AccountToInitialCumulativeInterestMultiplierEntry = exports.GenesisState_AccountToPrincipalDebtEntry = exports.GenesisState_AccountToCollateralizedEntry = exports.GenesisState = 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"));
|
|
@@ -12,8 +12,9 @@ const stablecoin_debt_info_1 = require("./stablecoin_debt_info");
|
|
|
12
12
|
const rate_strategy_params_1 = require("./rate_strategy_params");
|
|
13
13
|
const asset_params_1 = require("./asset_params");
|
|
14
14
|
const debt_info_1 = require("./debt_info");
|
|
15
|
+
const reward_scheme_1 = require("./reward_scheme");
|
|
15
16
|
exports.protobufPackage = "Switcheo.carbon.cdp";
|
|
16
|
-
const baseGenesisState = {};
|
|
17
|
+
const baseGenesisState = { sequenceNumber: long_1.default.UZERO };
|
|
17
18
|
exports.GenesisState = {
|
|
18
19
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
19
20
|
if (message.params !== undefined) {
|
|
@@ -28,23 +29,32 @@ exports.GenesisState = {
|
|
|
28
29
|
for (const v of message.debtInfos) {
|
|
29
30
|
debt_info_1.DebtInfo.encode(v, writer.uint32(34).fork()).ldelim();
|
|
30
31
|
}
|
|
32
|
+
for (const v of message.rewardSchemes) {
|
|
33
|
+
reward_scheme_1.RewardScheme.encode(v, writer.uint32(42).fork()).ldelim();
|
|
34
|
+
}
|
|
35
|
+
if (!message.sequenceNumber.isZero()) {
|
|
36
|
+
writer.uint32(48).uint64(message.sequenceNumber);
|
|
37
|
+
}
|
|
31
38
|
Object.entries(message.accountToCollateralized).forEach(([key, value]) => {
|
|
32
|
-
exports.GenesisState_AccountToCollateralizedEntry.encode({ key: key, value }, writer.uint32(
|
|
39
|
+
exports.GenesisState_AccountToCollateralizedEntry.encode({ key: key, value }, writer.uint32(58).fork()).ldelim();
|
|
33
40
|
});
|
|
34
41
|
Object.entries(message.accountToPrincipalDebt).forEach(([key, value]) => {
|
|
35
|
-
exports.GenesisState_AccountToPrincipalDebtEntry.encode({ key: key, value }, writer.uint32(
|
|
42
|
+
exports.GenesisState_AccountToPrincipalDebtEntry.encode({ key: key, value }, writer.uint32(66).fork()).ldelim();
|
|
36
43
|
});
|
|
37
44
|
Object.entries(message.accountToInitialCumulativeInterestMultiplier).forEach(([key, value]) => {
|
|
38
|
-
exports.GenesisState_AccountToInitialCumulativeInterestMultiplierEntry.encode({ key: key, value }, writer.uint32(
|
|
45
|
+
exports.GenesisState_AccountToInitialCumulativeInterestMultiplierEntry.encode({ key: key, value }, writer.uint32(74).fork()).ldelim();
|
|
39
46
|
});
|
|
40
47
|
if (message.stablecoinDebtInfo !== undefined) {
|
|
41
|
-
stablecoin_debt_info_1.StablecoinDebtInfo.encode(message.stablecoinDebtInfo, writer.uint32(
|
|
48
|
+
stablecoin_debt_info_1.StablecoinDebtInfo.encode(message.stablecoinDebtInfo, writer.uint32(82).fork()).ldelim();
|
|
42
49
|
}
|
|
43
50
|
Object.entries(message.accountToPrincipalStablecoinDebt).forEach(([key, value]) => {
|
|
44
|
-
exports.GenesisState_AccountToPrincipalStablecoinDebtEntry.encode({ key: key, value }, writer.uint32(
|
|
51
|
+
exports.GenesisState_AccountToPrincipalStablecoinDebtEntry.encode({ key: key, value }, writer.uint32(90).fork()).ldelim();
|
|
45
52
|
});
|
|
46
53
|
Object.entries(message.accountToStablecoinInitialCumulativeInterestMultiplier).forEach(([key, value]) => {
|
|
47
|
-
exports.GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry.encode({ key: key, value }, writer.uint32(
|
|
54
|
+
exports.GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry.encode({ key: key, value }, writer.uint32(98).fork()).ldelim();
|
|
55
|
+
});
|
|
56
|
+
Object.entries(message.accountToRewardDebt).forEach(([key, value]) => {
|
|
57
|
+
exports.GenesisState_AccountToRewardDebtEntry.encode({ key: key, value }, writer.uint32(106).fork()).ldelim();
|
|
48
58
|
});
|
|
49
59
|
return writer;
|
|
50
60
|
},
|
|
@@ -55,11 +65,13 @@ exports.GenesisState = {
|
|
|
55
65
|
message.rateStrategies = [];
|
|
56
66
|
message.assets = [];
|
|
57
67
|
message.debtInfos = [];
|
|
68
|
+
message.rewardSchemes = [];
|
|
58
69
|
message.accountToCollateralized = {};
|
|
59
70
|
message.accountToPrincipalDebt = {};
|
|
60
71
|
message.accountToInitialCumulativeInterestMultiplier = {};
|
|
61
72
|
message.accountToPrincipalStablecoinDebt = {};
|
|
62
73
|
message.accountToStablecoinInitialCumulativeInterestMultiplier = {};
|
|
74
|
+
message.accountToRewardDebt = {};
|
|
63
75
|
while (reader.pos < end) {
|
|
64
76
|
const tag = reader.uint32();
|
|
65
77
|
switch (tag >>> 3) {
|
|
@@ -76,37 +88,50 @@ exports.GenesisState = {
|
|
|
76
88
|
message.debtInfos.push(debt_info_1.DebtInfo.decode(reader, reader.uint32()));
|
|
77
89
|
break;
|
|
78
90
|
case 5:
|
|
79
|
-
|
|
80
|
-
if (entry5.value !== undefined) {
|
|
81
|
-
message.accountToCollateralized[entry5.key] = entry5.value;
|
|
82
|
-
}
|
|
91
|
+
message.rewardSchemes.push(reward_scheme_1.RewardScheme.decode(reader, reader.uint32()));
|
|
83
92
|
break;
|
|
84
93
|
case 6:
|
|
85
|
-
|
|
86
|
-
if (entry6.value !== undefined) {
|
|
87
|
-
message.accountToPrincipalDebt[entry6.key] = entry6.value;
|
|
88
|
-
}
|
|
94
|
+
message.sequenceNumber = reader.uint64();
|
|
89
95
|
break;
|
|
90
96
|
case 7:
|
|
91
|
-
const entry7 = exports.
|
|
97
|
+
const entry7 = exports.GenesisState_AccountToCollateralizedEntry.decode(reader, reader.uint32());
|
|
92
98
|
if (entry7.value !== undefined) {
|
|
93
|
-
message.
|
|
94
|
-
entry7.value;
|
|
99
|
+
message.accountToCollateralized[entry7.key] = entry7.value;
|
|
95
100
|
}
|
|
96
101
|
break;
|
|
97
102
|
case 8:
|
|
98
|
-
|
|
103
|
+
const entry8 = exports.GenesisState_AccountToPrincipalDebtEntry.decode(reader, reader.uint32());
|
|
104
|
+
if (entry8.value !== undefined) {
|
|
105
|
+
message.accountToPrincipalDebt[entry8.key] = entry8.value;
|
|
106
|
+
}
|
|
99
107
|
break;
|
|
100
108
|
case 9:
|
|
101
|
-
const entry9 = exports.
|
|
109
|
+
const entry9 = exports.GenesisState_AccountToInitialCumulativeInterestMultiplierEntry.decode(reader, reader.uint32());
|
|
102
110
|
if (entry9.value !== undefined) {
|
|
103
|
-
message.
|
|
111
|
+
message.accountToInitialCumulativeInterestMultiplier[entry9.key] =
|
|
112
|
+
entry9.value;
|
|
104
113
|
}
|
|
105
114
|
break;
|
|
106
115
|
case 10:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
message.stablecoinDebtInfo = stablecoin_debt_info_1.StablecoinDebtInfo.decode(reader, reader.uint32());
|
|
117
|
+
break;
|
|
118
|
+
case 11:
|
|
119
|
+
const entry11 = exports.GenesisState_AccountToPrincipalStablecoinDebtEntry.decode(reader, reader.uint32());
|
|
120
|
+
if (entry11.value !== undefined) {
|
|
121
|
+
message.accountToPrincipalStablecoinDebt[entry11.key] =
|
|
122
|
+
entry11.value;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case 12:
|
|
126
|
+
const entry12 = exports.GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry.decode(reader, reader.uint32());
|
|
127
|
+
if (entry12.value !== undefined) {
|
|
128
|
+
message.accountToStablecoinInitialCumulativeInterestMultiplier[entry12.key] = entry12.value;
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
case 13:
|
|
132
|
+
const entry13 = exports.GenesisState_AccountToRewardDebtEntry.decode(reader, reader.uint32());
|
|
133
|
+
if (entry13.value !== undefined) {
|
|
134
|
+
message.accountToRewardDebt[entry13.key] = entry13.value;
|
|
110
135
|
}
|
|
111
136
|
break;
|
|
112
137
|
default:
|
|
@@ -117,7 +142,7 @@ exports.GenesisState = {
|
|
|
117
142
|
return message;
|
|
118
143
|
},
|
|
119
144
|
fromJSON(object) {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
145
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
121
146
|
const message = Object.assign({}, baseGenesisState);
|
|
122
147
|
message.params =
|
|
123
148
|
object.params !== undefined && object.params !== null
|
|
@@ -126,15 +151,20 @@ exports.GenesisState = {
|
|
|
126
151
|
message.rateStrategies = ((_a = object.rateStrategies) !== null && _a !== void 0 ? _a : []).map((e) => rate_strategy_params_1.RateStrategyParams.fromJSON(e));
|
|
127
152
|
message.assets = ((_b = object.assets) !== null && _b !== void 0 ? _b : []).map((e) => asset_params_1.AssetParams.fromJSON(e));
|
|
128
153
|
message.debtInfos = ((_c = object.debtInfos) !== null && _c !== void 0 ? _c : []).map((e) => debt_info_1.DebtInfo.fromJSON(e));
|
|
129
|
-
message.
|
|
154
|
+
message.rewardSchemes = ((_d = object.rewardSchemes) !== null && _d !== void 0 ? _d : []).map((e) => reward_scheme_1.RewardScheme.fromJSON(e));
|
|
155
|
+
message.sequenceNumber =
|
|
156
|
+
object.sequenceNumber !== undefined && object.sequenceNumber !== null
|
|
157
|
+
? long_1.default.fromString(object.sequenceNumber)
|
|
158
|
+
: long_1.default.UZERO;
|
|
159
|
+
message.accountToCollateralized = Object.entries((_e = object.accountToCollateralized) !== null && _e !== void 0 ? _e : {}).reduce((acc, [key, value]) => {
|
|
130
160
|
acc[key] = bytesFromBase64(value);
|
|
131
161
|
return acc;
|
|
132
162
|
}, {});
|
|
133
|
-
message.accountToPrincipalDebt = Object.entries((
|
|
163
|
+
message.accountToPrincipalDebt = Object.entries((_f = object.accountToPrincipalDebt) !== null && _f !== void 0 ? _f : {}).reduce((acc, [key, value]) => {
|
|
134
164
|
acc[key] = bytesFromBase64(value);
|
|
135
165
|
return acc;
|
|
136
166
|
}, {});
|
|
137
|
-
message.accountToInitialCumulativeInterestMultiplier = Object.entries((
|
|
167
|
+
message.accountToInitialCumulativeInterestMultiplier = Object.entries((_g = object.accountToInitialCumulativeInterestMultiplier) !== null && _g !== void 0 ? _g : {}).reduce((acc, [key, value]) => {
|
|
138
168
|
acc[key] = bytesFromBase64(value);
|
|
139
169
|
return acc;
|
|
140
170
|
}, {});
|
|
@@ -143,15 +173,19 @@ exports.GenesisState = {
|
|
|
143
173
|
object.stablecoinDebtInfo !== null
|
|
144
174
|
? stablecoin_debt_info_1.StablecoinDebtInfo.fromJSON(object.stablecoinDebtInfo)
|
|
145
175
|
: undefined;
|
|
146
|
-
message.accountToPrincipalStablecoinDebt = Object.entries((
|
|
176
|
+
message.accountToPrincipalStablecoinDebt = Object.entries((_h = object.accountToPrincipalStablecoinDebt) !== null && _h !== void 0 ? _h : {}).reduce((acc, [key, value]) => {
|
|
147
177
|
acc[key] = bytesFromBase64(value);
|
|
148
178
|
return acc;
|
|
149
179
|
}, {});
|
|
150
180
|
message.accountToStablecoinInitialCumulativeInterestMultiplier =
|
|
151
|
-
Object.entries((
|
|
181
|
+
Object.entries((_j = object.accountToStablecoinInitialCumulativeInterestMultiplier) !== null && _j !== void 0 ? _j : {}).reduce((acc, [key, value]) => {
|
|
152
182
|
acc[key] = bytesFromBase64(value);
|
|
153
183
|
return acc;
|
|
154
184
|
}, {});
|
|
185
|
+
message.accountToRewardDebt = Object.entries((_k = object.accountToRewardDebt) !== null && _k !== void 0 ? _k : {}).reduce((acc, [key, value]) => {
|
|
186
|
+
acc[key] = bytesFromBase64(value);
|
|
187
|
+
return acc;
|
|
188
|
+
}, {});
|
|
155
189
|
return message;
|
|
156
190
|
},
|
|
157
191
|
toJSON(message) {
|
|
@@ -176,6 +210,14 @@ exports.GenesisState = {
|
|
|
176
210
|
else {
|
|
177
211
|
obj.debtInfos = [];
|
|
178
212
|
}
|
|
213
|
+
if (message.rewardSchemes) {
|
|
214
|
+
obj.rewardSchemes = message.rewardSchemes.map((e) => e ? reward_scheme_1.RewardScheme.toJSON(e) : undefined);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
obj.rewardSchemes = [];
|
|
218
|
+
}
|
|
219
|
+
message.sequenceNumber !== undefined &&
|
|
220
|
+
(obj.sequenceNumber = (message.sequenceNumber || long_1.default.UZERO).toString());
|
|
179
221
|
obj.accountToCollateralized = {};
|
|
180
222
|
if (message.accountToCollateralized) {
|
|
181
223
|
Object.entries(message.accountToCollateralized).forEach(([k, v]) => {
|
|
@@ -212,10 +254,16 @@ exports.GenesisState = {
|
|
|
212
254
|
base64FromBytes(v);
|
|
213
255
|
});
|
|
214
256
|
}
|
|
257
|
+
obj.accountToRewardDebt = {};
|
|
258
|
+
if (message.accountToRewardDebt) {
|
|
259
|
+
Object.entries(message.accountToRewardDebt).forEach(([k, v]) => {
|
|
260
|
+
obj.accountToRewardDebt[k] = base64FromBytes(v);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
215
263
|
return obj;
|
|
216
264
|
},
|
|
217
265
|
fromPartial(object) {
|
|
218
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
266
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
219
267
|
const message = Object.assign({}, baseGenesisState);
|
|
220
268
|
message.params =
|
|
221
269
|
object.params !== undefined && object.params !== null
|
|
@@ -224,19 +272,24 @@ exports.GenesisState = {
|
|
|
224
272
|
message.rateStrategies = ((_a = object.rateStrategies) !== null && _a !== void 0 ? _a : []).map((e) => rate_strategy_params_1.RateStrategyParams.fromPartial(e));
|
|
225
273
|
message.assets = ((_b = object.assets) !== null && _b !== void 0 ? _b : []).map((e) => asset_params_1.AssetParams.fromPartial(e));
|
|
226
274
|
message.debtInfos = ((_c = object.debtInfos) !== null && _c !== void 0 ? _c : []).map((e) => debt_info_1.DebtInfo.fromPartial(e));
|
|
227
|
-
message.
|
|
275
|
+
message.rewardSchemes = ((_d = object.rewardSchemes) !== null && _d !== void 0 ? _d : []).map((e) => reward_scheme_1.RewardScheme.fromPartial(e));
|
|
276
|
+
message.sequenceNumber =
|
|
277
|
+
object.sequenceNumber !== undefined && object.sequenceNumber !== null
|
|
278
|
+
? long_1.default.fromValue(object.sequenceNumber)
|
|
279
|
+
: long_1.default.UZERO;
|
|
280
|
+
message.accountToCollateralized = Object.entries((_e = object.accountToCollateralized) !== null && _e !== void 0 ? _e : {}).reduce((acc, [key, value]) => {
|
|
228
281
|
if (value !== undefined) {
|
|
229
282
|
acc[key] = value;
|
|
230
283
|
}
|
|
231
284
|
return acc;
|
|
232
285
|
}, {});
|
|
233
|
-
message.accountToPrincipalDebt = Object.entries((
|
|
286
|
+
message.accountToPrincipalDebt = Object.entries((_f = object.accountToPrincipalDebt) !== null && _f !== void 0 ? _f : {}).reduce((acc, [key, value]) => {
|
|
234
287
|
if (value !== undefined) {
|
|
235
288
|
acc[key] = value;
|
|
236
289
|
}
|
|
237
290
|
return acc;
|
|
238
291
|
}, {});
|
|
239
|
-
message.accountToInitialCumulativeInterestMultiplier = Object.entries((
|
|
292
|
+
message.accountToInitialCumulativeInterestMultiplier = Object.entries((_g = object.accountToInitialCumulativeInterestMultiplier) !== null && _g !== void 0 ? _g : {}).reduce((acc, [key, value]) => {
|
|
240
293
|
if (value !== undefined) {
|
|
241
294
|
acc[key] = value;
|
|
242
295
|
}
|
|
@@ -247,19 +300,25 @@ exports.GenesisState = {
|
|
|
247
300
|
object.stablecoinDebtInfo !== null
|
|
248
301
|
? stablecoin_debt_info_1.StablecoinDebtInfo.fromPartial(object.stablecoinDebtInfo)
|
|
249
302
|
: undefined;
|
|
250
|
-
message.accountToPrincipalStablecoinDebt = Object.entries((
|
|
303
|
+
message.accountToPrincipalStablecoinDebt = Object.entries((_h = object.accountToPrincipalStablecoinDebt) !== null && _h !== void 0 ? _h : {}).reduce((acc, [key, value]) => {
|
|
251
304
|
if (value !== undefined) {
|
|
252
305
|
acc[key] = value;
|
|
253
306
|
}
|
|
254
307
|
return acc;
|
|
255
308
|
}, {});
|
|
256
309
|
message.accountToStablecoinInitialCumulativeInterestMultiplier =
|
|
257
|
-
Object.entries((
|
|
310
|
+
Object.entries((_j = object.accountToStablecoinInitialCumulativeInterestMultiplier) !== null && _j !== void 0 ? _j : {}).reduce((acc, [key, value]) => {
|
|
258
311
|
if (value !== undefined) {
|
|
259
312
|
acc[key] = value;
|
|
260
313
|
}
|
|
261
314
|
return acc;
|
|
262
315
|
}, {});
|
|
316
|
+
message.accountToRewardDebt = Object.entries((_k = object.accountToRewardDebt) !== null && _k !== void 0 ? _k : {}).reduce((acc, [key, value]) => {
|
|
317
|
+
if (value !== undefined) {
|
|
318
|
+
acc[key] = value;
|
|
319
|
+
}
|
|
320
|
+
return acc;
|
|
321
|
+
}, {});
|
|
263
322
|
return message;
|
|
264
323
|
},
|
|
265
324
|
};
|
|
@@ -552,6 +611,63 @@ exports.GenesisState_AccountToStablecoinInitialCumulativeInterestMultiplierEntry
|
|
|
552
611
|
return message;
|
|
553
612
|
},
|
|
554
613
|
};
|
|
614
|
+
const baseGenesisState_AccountToRewardDebtEntry = { key: "" };
|
|
615
|
+
exports.GenesisState_AccountToRewardDebtEntry = {
|
|
616
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
617
|
+
if (message.key !== "") {
|
|
618
|
+
writer.uint32(10).string(message.key);
|
|
619
|
+
}
|
|
620
|
+
if (message.value.length !== 0) {
|
|
621
|
+
writer.uint32(18).bytes(message.value);
|
|
622
|
+
}
|
|
623
|
+
return writer;
|
|
624
|
+
},
|
|
625
|
+
decode(input, length) {
|
|
626
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
627
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
628
|
+
const message = Object.assign({}, baseGenesisState_AccountToRewardDebtEntry);
|
|
629
|
+
message.value = new Uint8Array();
|
|
630
|
+
while (reader.pos < end) {
|
|
631
|
+
const tag = reader.uint32();
|
|
632
|
+
switch (tag >>> 3) {
|
|
633
|
+
case 1:
|
|
634
|
+
message.key = reader.string();
|
|
635
|
+
break;
|
|
636
|
+
case 2:
|
|
637
|
+
message.value = reader.bytes();
|
|
638
|
+
break;
|
|
639
|
+
default:
|
|
640
|
+
reader.skipType(tag & 7);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return message;
|
|
645
|
+
},
|
|
646
|
+
fromJSON(object) {
|
|
647
|
+
const message = Object.assign({}, baseGenesisState_AccountToRewardDebtEntry);
|
|
648
|
+
message.key =
|
|
649
|
+
object.key !== undefined && object.key !== null ? String(object.key) : "";
|
|
650
|
+
message.value =
|
|
651
|
+
object.value !== undefined && object.value !== null
|
|
652
|
+
? bytesFromBase64(object.value)
|
|
653
|
+
: new Uint8Array();
|
|
654
|
+
return message;
|
|
655
|
+
},
|
|
656
|
+
toJSON(message) {
|
|
657
|
+
const obj = {};
|
|
658
|
+
message.key !== undefined && (obj.key = message.key);
|
|
659
|
+
message.value !== undefined &&
|
|
660
|
+
(obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
|
|
661
|
+
return obj;
|
|
662
|
+
},
|
|
663
|
+
fromPartial(object) {
|
|
664
|
+
var _a, _b;
|
|
665
|
+
const message = Object.assign({}, baseGenesisState_AccountToRewardDebtEntry);
|
|
666
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
|
|
667
|
+
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : new Uint8Array();
|
|
668
|
+
return message;
|
|
669
|
+
},
|
|
670
|
+
};
|
|
555
671
|
var globalThis = (() => {
|
|
556
672
|
if (typeof globalThis !== "undefined")
|
|
557
673
|
return globalThis;
|
package/lib/codec/cdp/tx.d.ts
CHANGED
package/lib/codec/cdp/tx.js
CHANGED
|
@@ -2961,7 +2961,6 @@ const baseMsgLiquidateCollateralWithStablecoin = {
|
|
|
2961
2961
|
minCollateralAmount: "",
|
|
2962
2962
|
debtDenom: "",
|
|
2963
2963
|
debtAmount: "",
|
|
2964
|
-
principalAmount: "",
|
|
2965
2964
|
interestDenom: "",
|
|
2966
2965
|
interestAmount: "",
|
|
2967
2966
|
};
|
|
@@ -2985,14 +2984,11 @@ exports.MsgLiquidateCollateralWithStablecoin = {
|
|
|
2985
2984
|
if (message.debtAmount !== "") {
|
|
2986
2985
|
writer.uint32(50).string(message.debtAmount);
|
|
2987
2986
|
}
|
|
2988
|
-
if (message.principalAmount !== "") {
|
|
2989
|
-
writer.uint32(58).string(message.principalAmount);
|
|
2990
|
-
}
|
|
2991
2987
|
if (message.interestDenom !== "") {
|
|
2992
|
-
writer.uint32(
|
|
2988
|
+
writer.uint32(58).string(message.interestDenom);
|
|
2993
2989
|
}
|
|
2994
2990
|
if (message.interestAmount !== "") {
|
|
2995
|
-
writer.uint32(
|
|
2991
|
+
writer.uint32(66).string(message.interestAmount);
|
|
2996
2992
|
}
|
|
2997
2993
|
return writer;
|
|
2998
2994
|
},
|
|
@@ -3022,12 +3018,9 @@ exports.MsgLiquidateCollateralWithStablecoin = {
|
|
|
3022
3018
|
message.debtAmount = reader.string();
|
|
3023
3019
|
break;
|
|
3024
3020
|
case 7:
|
|
3025
|
-
message.principalAmount = reader.string();
|
|
3026
|
-
break;
|
|
3027
|
-
case 8:
|
|
3028
3021
|
message.interestDenom = reader.string();
|
|
3029
3022
|
break;
|
|
3030
|
-
case
|
|
3023
|
+
case 8:
|
|
3031
3024
|
message.interestAmount = reader.string();
|
|
3032
3025
|
break;
|
|
3033
3026
|
default:
|
|
@@ -3064,10 +3057,6 @@ exports.MsgLiquidateCollateralWithStablecoin = {
|
|
|
3064
3057
|
object.debtAmount !== undefined && object.debtAmount !== null
|
|
3065
3058
|
? String(object.debtAmount)
|
|
3066
3059
|
: "";
|
|
3067
|
-
message.principalAmount =
|
|
3068
|
-
object.principalAmount !== undefined && object.principalAmount !== null
|
|
3069
|
-
? String(object.principalAmount)
|
|
3070
|
-
: "";
|
|
3071
3060
|
message.interestDenom =
|
|
3072
3061
|
object.interestDenom !== undefined && object.interestDenom !== null
|
|
3073
3062
|
? String(object.interestDenom)
|
|
@@ -3088,8 +3077,6 @@ exports.MsgLiquidateCollateralWithStablecoin = {
|
|
|
3088
3077
|
(obj.minCollateralAmount = message.minCollateralAmount);
|
|
3089
3078
|
message.debtDenom !== undefined && (obj.debtDenom = message.debtDenom);
|
|
3090
3079
|
message.debtAmount !== undefined && (obj.debtAmount = message.debtAmount);
|
|
3091
|
-
message.principalAmount !== undefined &&
|
|
3092
|
-
(obj.principalAmount = message.principalAmount);
|
|
3093
3080
|
message.interestDenom !== undefined &&
|
|
3094
3081
|
(obj.interestDenom = message.interestDenom);
|
|
3095
3082
|
message.interestAmount !== undefined &&
|
|
@@ -3097,7 +3084,7 @@ exports.MsgLiquidateCollateralWithStablecoin = {
|
|
|
3097
3084
|
return obj;
|
|
3098
3085
|
},
|
|
3099
3086
|
fromPartial(object) {
|
|
3100
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
3087
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3101
3088
|
const message = Object.assign({}, baseMsgLiquidateCollateralWithStablecoin);
|
|
3102
3089
|
message.creator = (_a = object.creator) !== null && _a !== void 0 ? _a : "";
|
|
3103
3090
|
message.debtor = (_b = object.debtor) !== null && _b !== void 0 ? _b : "";
|
|
@@ -3105,9 +3092,8 @@ exports.MsgLiquidateCollateralWithStablecoin = {
|
|
|
3105
3092
|
message.minCollateralAmount = (_d = object.minCollateralAmount) !== null && _d !== void 0 ? _d : "";
|
|
3106
3093
|
message.debtDenom = (_e = object.debtDenom) !== null && _e !== void 0 ? _e : "";
|
|
3107
3094
|
message.debtAmount = (_f = object.debtAmount) !== null && _f !== void 0 ? _f : "";
|
|
3108
|
-
message.
|
|
3109
|
-
message.
|
|
3110
|
-
message.interestAmount = (_j = object.interestAmount) !== null && _j !== void 0 ? _j : "";
|
|
3095
|
+
message.interestDenom = (_g = object.interestDenom) !== null && _g !== void 0 ? _g : "";
|
|
3096
|
+
message.interestAmount = (_h = object.interestAmount) !== null && _h !== void 0 ? _h : "";
|
|
3111
3097
|
return message;
|
|
3112
3098
|
},
|
|
3113
3099
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
|
-
import { GrantAuthorization } from "
|
|
3
|
+
import { GrantAuthorization } from "../../../cosmos/authz/v1beta1/authz";
|
|
4
4
|
export declare const protobufPackage = "cosmos.authz.v1beta1";
|
|
5
5
|
/** Since: cosmos-sdk 0.43 */
|
|
6
6
|
/** GenesisState defines the authz module's genesis state. */
|
|
@@ -7,7 +7,7 @@ exports.GenesisState = 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 authz_1 = require("
|
|
10
|
+
const authz_1 = require("../../../cosmos/authz/v1beta1/authz");
|
|
11
11
|
exports.protobufPackage = "cosmos.authz.v1beta1";
|
|
12
12
|
const baseGenesisState = {};
|
|
13
13
|
exports.GenesisState = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination";
|
|
4
|
-
import { Grant, GrantAuthorization } from "
|
|
4
|
+
import { Grant, GrantAuthorization } from "../../../cosmos/authz/v1beta1/authz";
|
|
5
5
|
export declare const protobufPackage = "cosmos.authz.v1beta1";
|
|
6
6
|
/** Since: cosmos-sdk 0.43 */
|
|
7
7
|
/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */
|
|
@@ -8,7 +8,7 @@ exports.QueryClientImpl = exports.QueryGranteeGrantsResponse = exports.QueryGran
|
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
10
|
const pagination_1 = require("../../base/query/v1beta1/pagination");
|
|
11
|
-
const authz_1 = require("
|
|
11
|
+
const authz_1 = require("../../../cosmos/authz/v1beta1/authz");
|
|
12
12
|
exports.protobufPackage = "cosmos.authz.v1beta1";
|
|
13
13
|
const baseQueryGrantsRequest = {
|
|
14
14
|
granter: "",
|
|
@@ -2,7 +2,7 @@ import Long from "long";
|
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination";
|
|
4
4
|
import { TxResponse, GasInfo, Result } from "../../base/abci/v1beta1/abci";
|
|
5
|
-
import { Tx } from "
|
|
5
|
+
import { Tx } from "./tx";
|
|
6
6
|
import { BlockID } from "../../../tendermint/types/types";
|
|
7
7
|
import { Block } from "../../../tendermint/types/block";
|
|
8
8
|
export declare const protobufPackage = "cosmos.tx.v1beta1";
|
|
@@ -9,7 +9,7 @@ const long_1 = __importDefault(require("long"));
|
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
10
|
const pagination_1 = require("../../base/query/v1beta1/pagination");
|
|
11
11
|
const abci_1 = require("../../base/abci/v1beta1/abci");
|
|
12
|
-
const tx_1 = require("
|
|
12
|
+
const tx_1 = require("./tx");
|
|
13
13
|
const types_1 = require("../../../tendermint/types/types");
|
|
14
14
|
const block_1 = require("../../../tendermint/types/block");
|
|
15
15
|
exports.protobufPackage = "cosmos.tx.v1beta1";
|
package/lib/codec/index.d.ts
CHANGED
|
@@ -406,4 +406,5 @@ export { MsgSetBackfillTimeInterval, MsgSetBackfillTimeIntervalResponse, MsgSetS
|
|
|
406
406
|
export { Params as PricingParams, PriceSet, TokenPrice } from "./pricing/pricing";
|
|
407
407
|
export { SettlementPriceProposal, SettlementPriceParams } from "./pricing/proposal";
|
|
408
408
|
export { QueryPriceTokenRequest, QueryPriceTokenResponse, QueryPriceSetRequest, QueryPriceSetResponse, QueryAllPriceSetRequest, QueryAllPriceSetResponse, QueryRateRequest, QueryRateResponse, QueryParamsRequest as QueryPricingParamsRequest, QueryParamsResponse as QueryPricingParamsResponse, QueryTokenPriceRequest, QueryTokenPriceResponse, QueryTokenPriceAllRequest, QueryTokenPriceAllResponse } from "./pricing/query";
|
|
409
|
+
export { ParamsV2130 } from "./pricing/legacy";
|
|
409
410
|
export { PriceUpdateEvent, TokenPriceUpdateEvent, SetImpactBandEvent, SetSmoothenBandEvent, SetStaleIndexAllowanceEvent, SetBackfillTimeIntervalEvent } from "./pricing/event";
|
package/lib/codec/index.js
CHANGED
|
@@ -33,7 +33,7 @@ exports.MsgSetLeverageResponse = exports.MsgSetLeverage = exports.MarketLeverage
|
|
|
33
33
|
exports.MarketParams = exports.Market = exports.ControlledParams = exports.MarketDefaultsParams = exports.UpdatePerpetualsFundingIntervalProposal = exports.UpdateMarketProposal = exports.CreateMarketProposal = exports.MsgUpdatePerpetualsFundingIntervalResponse = exports.MsgUpdatePerpetualsFundingInterval = exports.MsgUpdateMarketResponse = exports.MsgUpdateMarket = exports.MsgCreateMarketResponse = exports.MsgCreateMarket = exports.OrderBookEvent = exports.QueryAllBookResponse = exports.QueryAllBookRequest = exports.QueryGetBookResponse = exports.QueryGetBookRequest = exports.StopBook = exports.OrderBook = exports.OrderBookLevel = exports.GenesisSubAccount = exports.SubAccount = exports.QuerySubAccountPowerResponse = exports.QuerySubAccountPowerRequest = exports.QuerySubAccountStatusResponse = exports.QuerySubAccountStatusRequest = exports.QueryAllSubAccountResponse = exports.QueryAllSubAccountRequest = exports.QueryGetSubAccountResponse = exports.QueryGetSubAccountRequest = exports.MsgRemoveSubAccountResponse = exports.MsgRemoveSubAccount = exports.MsgActivateSubAccountResponse = exports.MsgActivateSubAccount = exports.MsgCreateSubAccountResponse = exports.MsgCreateSubAccount = exports.UpdateProfileEvent = exports.QueryAllProfileResponse = exports.QueryAllProfileRequest = exports.QueryGetProfileResponse = exports.QueryGetProfileRequest = exports.Profile = exports.MsgUpdateProfileResponse = exports.MsgUpdateProfile = exports.LeverageEvent = exports.QueryAllLeverageResponse = exports.QueryAllLeverageRequest = exports.QueryGetLeverageResponse = exports.QueryGetLeverageRequest = void 0;
|
|
34
34
|
exports.RewardWeights = exports.RewardWeight = exports.CommitmentCurve = exports.RewardCurve = exports.MsgUpdatePoolResponse = exports.UpdatePoolParams = exports.MsgUpdatePool = exports.MsgSetCommitmentCurveResponse = exports.SetCommitmentCurveParams = exports.MsgSetCommitmentCurve = exports.MsgSetRewardCurveResponse = exports.SetRewardCurveParams = exports.MsgSetRewardCurve = exports.MsgClaimPoolRewardsResponse = exports.MsgClaimPoolRewards = exports.MsgUnstakePoolTokenResponse = exports.MsgUnstakePoolToken = exports.MsgStakePoolTokenResponse = exports.MsgStakePoolToken = exports.MsgSetRewardsWeightsResponse = exports.SetRewardsWeightsParams = exports.MsgSetRewardsWeights = exports.MsgUnlinkPoolResponse = exports.UnlinkPoolParams = exports.MsgUnlinkPool = exports.MsgLinkPoolResponse = exports.LinkPoolParams = exports.MsgLinkPool = exports.MsgRemoveLiquidityResponse = exports.MsgRemoveLiquidity = exports.MsgAddLiquidityResponse = exports.MsgAddLiquidity = exports.MsgCreatePoolWithLiquidityResponse = exports.MsgCreatePoolWithLiquidity = exports.MsgCreatePoolResponse = exports.MsgCreatePool = exports.PageResponse = exports.PageRequest = exports.QueryMintDataResponse = exports.QueryMintDataRequest = exports.MintData = exports.MarketEvent = exports.ParamsV280 = exports.ParamsV270 = exports.QueryMarketParamsResponse = exports.QueryMarketParamsRequest = exports.QueryAllMarketResponse = exports.QueryAllMarketRequest = exports.QueryGetMarketResponse = exports.QueryGetMarketRequest = void 0;
|
|
35
35
|
exports.QueryLiquiditypoolParamsResponse = exports.QueryLiquiditypoolParamsRequest = exports.QueryClaimableRewardsResponse = exports.QueryClaimableRewardsRequest = exports.QueryAllTotalCommitmentResponse = exports.QueryAllTotalCommitmentRequest = exports.QueryTotalCommitmentResponse = exports.QueryTotalCommitmentRequest = exports.QueryRewardCurveResponse = exports.QueryRewardCurveRequest = exports.QueryCommitmentCurveResponse = exports.QueryCommitmentCurveRequest = exports.QueryLastClaimResponse = exports.QueryLastClaimRequest = exports.QueryAllCommitmentResponse = exports.QueryAllCommitmentRequest = exports.QueryCommitmentResponse = exports.QueryCommitmentRequest = exports.QueryRewardHistoryResponse = exports.ExtendedPool = exports.QueryRewardHistoryRequest = exports.QueryAllPoolResponse = exports.QueryAllPoolRequest = exports.QueryGetPoolResponse = exports.QueryGetPoolRequest = exports.UpdatePoolProposal = exports.SetRewardsWeightsProposal = exports.SetCommitmentCurveProposal = exports.SetRewardCurveProposal = exports.UnlinkPoolProposal = exports.LinkPoolProposal = exports.RemoveLiquidities = exports.RemoveLiquidity = exports.AddLiquidities = exports.AddLiquidity = exports.Pools = exports.Pool = exports.LiquiditypoolParams = exports.AllocatedRewards = exports.LastClaimRecord = exports.CommitmentExpiriesRecord = exports.CommitmentExpiries = exports.CommitmentExpiry = exports.RewardHistoryRecord = exports.RewardHistory = exports.CommitmentResponse = exports.TotalCommitmentRecord = exports.TotalCommitment = exports.CommitmentRecord = exports.Commitment = void 0;
|
|
36
|
-
exports.SetBackfillTimeIntervalEvent = exports.SetStaleIndexAllowanceEvent = exports.SetSmoothenBandEvent = exports.SetImpactBandEvent = exports.TokenPriceUpdateEvent = exports.PriceUpdateEvent = exports.QueryTokenPriceAllResponse = exports.QueryTokenPriceAllRequest = exports.QueryTokenPriceResponse = exports.QueryTokenPriceRequest = exports.QueryPricingParamsResponse = exports.QueryPricingParamsRequest = exports.QueryRateResponse = exports.QueryRateRequest = exports.QueryAllPriceSetResponse = exports.QueryAllPriceSetRequest = exports.QueryPriceSetResponse = exports.QueryPriceSetRequest = exports.QueryPriceTokenResponse = exports.QueryPriceTokenRequest = exports.SettlementPriceParams = exports.SettlementPriceProposal = exports.TokenPrice = exports.PriceSet = exports.PricingParams = exports.MsgSetStaleIndexAllowanceResponse = exports.MsgSetStaleIndexAllowance = exports.MsgSetImpactBandResponse = exports.MsgSetImpactBand = exports.MsgSetSmoothenBandResponse = exports.MsgSetSmoothenBand = exports.MsgSetBackfillTimeIntervalResponse = exports.MsgSetBackfillTimeInterval = exports.Fund = exports.FundByMarket = exports.EventDataInsuranceFundTransfer = exports.QueryCoinBalancesResponse = exports.QueryCoinBalancesRequest = exports.CommitmentEvent = exports.CommitmentCurveEvent = exports.RewardsWeightChangeEvent = exports.TotalCommitmentChangeEvent = exports.PoolEvent = void 0;
|
|
36
|
+
exports.SetBackfillTimeIntervalEvent = exports.SetStaleIndexAllowanceEvent = exports.SetSmoothenBandEvent = exports.SetImpactBandEvent = exports.TokenPriceUpdateEvent = exports.PriceUpdateEvent = exports.ParamsV2130 = exports.QueryTokenPriceAllResponse = exports.QueryTokenPriceAllRequest = exports.QueryTokenPriceResponse = exports.QueryTokenPriceRequest = exports.QueryPricingParamsResponse = exports.QueryPricingParamsRequest = exports.QueryRateResponse = exports.QueryRateRequest = exports.QueryAllPriceSetResponse = exports.QueryAllPriceSetRequest = exports.QueryPriceSetResponse = exports.QueryPriceSetRequest = exports.QueryPriceTokenResponse = exports.QueryPriceTokenRequest = exports.SettlementPriceParams = exports.SettlementPriceProposal = exports.TokenPrice = exports.PriceSet = exports.PricingParams = exports.MsgSetStaleIndexAllowanceResponse = exports.MsgSetStaleIndexAllowance = exports.MsgSetImpactBandResponse = exports.MsgSetImpactBand = exports.MsgSetSmoothenBandResponse = exports.MsgSetSmoothenBand = exports.MsgSetBackfillTimeIntervalResponse = exports.MsgSetBackfillTimeInterval = exports.Fund = exports.FundByMarket = exports.EventDataInsuranceFundTransfer = exports.QueryCoinBalancesResponse = exports.QueryCoinBalancesRequest = exports.CommitmentEvent = exports.CommitmentCurveEvent = exports.RewardsWeightChangeEvent = exports.TotalCommitmentChangeEvent = exports.PoolEvent = void 0;
|
|
37
37
|
// GENERATED by scripts/generate-registry.sh
|
|
38
38
|
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
39
39
|
const tx_1 = require("./order/tx");
|
|
@@ -1376,6 +1376,8 @@ Object.defineProperty(exports, "QueryTokenPriceRequest", { enumerable: true, get
|
|
|
1376
1376
|
Object.defineProperty(exports, "QueryTokenPriceResponse", { enumerable: true, get: function () { return query_20.QueryTokenPriceResponse; } });
|
|
1377
1377
|
Object.defineProperty(exports, "QueryTokenPriceAllRequest", { enumerable: true, get: function () { return query_20.QueryTokenPriceAllRequest; } });
|
|
1378
1378
|
Object.defineProperty(exports, "QueryTokenPriceAllResponse", { enumerable: true, get: function () { return query_20.QueryTokenPriceAllResponse; } });
|
|
1379
|
+
var legacy_2 = require("./pricing/legacy");
|
|
1380
|
+
Object.defineProperty(exports, "ParamsV2130", { enumerable: true, get: function () { return legacy_2.ParamsV2130; } });
|
|
1379
1381
|
var event_15 = require("./pricing/event");
|
|
1380
1382
|
Object.defineProperty(exports, "PriceUpdateEvent", { enumerable: true, get: function () { return event_15.PriceUpdateEvent; } });
|
|
1381
1383
|
Object.defineProperty(exports, "TokenPriceUpdateEvent", { enumerable: true, get: function () { return event_15.TokenPriceUpdateEvent; } });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
import { Params, Oracle, Result, Vote } from "./oracle";
|
|
4
|
+
import { OracleVotesWindow, SlashCounter } from "./slashing";
|
|
4
5
|
export declare const protobufPackage = "Switcheo.carbon.oracle";
|
|
5
6
|
/** GenesisState defines the oracle module's genesis state. */
|
|
6
7
|
export interface GenesisState {
|
|
@@ -10,6 +11,8 @@ export interface GenesisState {
|
|
|
10
11
|
votes: Vote[];
|
|
11
12
|
/** this line is used by starport scaffolding # ibc/genesis/proto */
|
|
12
13
|
params?: Params;
|
|
14
|
+
allOracleVotesWindow: OracleVotesWindow[];
|
|
15
|
+
slashCounters: SlashCounter[];
|
|
13
16
|
}
|
|
14
17
|
export declare const GenesisState: {
|
|
15
18
|
encode(message: GenesisState, writer?: _m0.Writer): _m0.Writer;
|
|
@@ -8,6 +8,7 @@ exports.GenesisState = exports.protobufPackage = void 0;
|
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
10
|
const oracle_1 = require("./oracle");
|
|
11
|
+
const slashing_1 = require("./slashing");
|
|
11
12
|
exports.protobufPackage = "Switcheo.carbon.oracle";
|
|
12
13
|
const baseGenesisState = {};
|
|
13
14
|
exports.GenesisState = {
|
|
@@ -24,6 +25,12 @@ exports.GenesisState = {
|
|
|
24
25
|
if (message.params !== undefined) {
|
|
25
26
|
oracle_1.Params.encode(message.params, writer.uint32(42).fork()).ldelim();
|
|
26
27
|
}
|
|
28
|
+
for (const v of message.allOracleVotesWindow) {
|
|
29
|
+
slashing_1.OracleVotesWindow.encode(v, writer.uint32(50).fork()).ldelim();
|
|
30
|
+
}
|
|
31
|
+
for (const v of message.slashCounters) {
|
|
32
|
+
slashing_1.SlashCounter.encode(v, writer.uint32(58).fork()).ldelim();
|
|
33
|
+
}
|
|
27
34
|
return writer;
|
|
28
35
|
},
|
|
29
36
|
decode(input, length) {
|
|
@@ -33,6 +40,8 @@ exports.GenesisState = {
|
|
|
33
40
|
message.oracles = [];
|
|
34
41
|
message.results = [];
|
|
35
42
|
message.votes = [];
|
|
43
|
+
message.allOracleVotesWindow = [];
|
|
44
|
+
message.slashCounters = [];
|
|
36
45
|
while (reader.pos < end) {
|
|
37
46
|
const tag = reader.uint32();
|
|
38
47
|
switch (tag >>> 3) {
|
|
@@ -48,6 +57,12 @@ exports.GenesisState = {
|
|
|
48
57
|
case 5:
|
|
49
58
|
message.params = oracle_1.Params.decode(reader, reader.uint32());
|
|
50
59
|
break;
|
|
60
|
+
case 6:
|
|
61
|
+
message.allOracleVotesWindow.push(slashing_1.OracleVotesWindow.decode(reader, reader.uint32()));
|
|
62
|
+
break;
|
|
63
|
+
case 7:
|
|
64
|
+
message.slashCounters.push(slashing_1.SlashCounter.decode(reader, reader.uint32()));
|
|
65
|
+
break;
|
|
51
66
|
default:
|
|
52
67
|
reader.skipType(tag & 7);
|
|
53
68
|
break;
|
|
@@ -56,7 +71,7 @@ exports.GenesisState = {
|
|
|
56
71
|
return message;
|
|
57
72
|
},
|
|
58
73
|
fromJSON(object) {
|
|
59
|
-
var _a, _b, _c;
|
|
74
|
+
var _a, _b, _c, _d, _e;
|
|
60
75
|
const message = Object.assign({}, baseGenesisState);
|
|
61
76
|
message.oracles = ((_a = object.oracles) !== null && _a !== void 0 ? _a : []).map((e) => oracle_1.Oracle.fromJSON(e));
|
|
62
77
|
message.results = ((_b = object.results) !== null && _b !== void 0 ? _b : []).map((e) => oracle_1.Result.fromJSON(e));
|
|
@@ -65,6 +80,8 @@ exports.GenesisState = {
|
|
|
65
80
|
object.params !== undefined && object.params !== null
|
|
66
81
|
? oracle_1.Params.fromJSON(object.params)
|
|
67
82
|
: undefined;
|
|
83
|
+
message.allOracleVotesWindow = ((_d = object.allOracleVotesWindow) !== null && _d !== void 0 ? _d : []).map((e) => slashing_1.OracleVotesWindow.fromJSON(e));
|
|
84
|
+
message.slashCounters = ((_e = object.slashCounters) !== null && _e !== void 0 ? _e : []).map((e) => slashing_1.SlashCounter.fromJSON(e));
|
|
68
85
|
return message;
|
|
69
86
|
},
|
|
70
87
|
toJSON(message) {
|
|
@@ -89,10 +106,22 @@ exports.GenesisState = {
|
|
|
89
106
|
}
|
|
90
107
|
message.params !== undefined &&
|
|
91
108
|
(obj.params = message.params ? oracle_1.Params.toJSON(message.params) : undefined);
|
|
109
|
+
if (message.allOracleVotesWindow) {
|
|
110
|
+
obj.allOracleVotesWindow = message.allOracleVotesWindow.map((e) => e ? slashing_1.OracleVotesWindow.toJSON(e) : undefined);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
obj.allOracleVotesWindow = [];
|
|
114
|
+
}
|
|
115
|
+
if (message.slashCounters) {
|
|
116
|
+
obj.slashCounters = message.slashCounters.map((e) => e ? slashing_1.SlashCounter.toJSON(e) : undefined);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
obj.slashCounters = [];
|
|
120
|
+
}
|
|
92
121
|
return obj;
|
|
93
122
|
},
|
|
94
123
|
fromPartial(object) {
|
|
95
|
-
var _a, _b, _c;
|
|
124
|
+
var _a, _b, _c, _d, _e;
|
|
96
125
|
const message = Object.assign({}, baseGenesisState);
|
|
97
126
|
message.oracles = ((_a = object.oracles) !== null && _a !== void 0 ? _a : []).map((e) => oracle_1.Oracle.fromPartial(e));
|
|
98
127
|
message.results = ((_b = object.results) !== null && _b !== void 0 ? _b : []).map((e) => oracle_1.Result.fromPartial(e));
|
|
@@ -101,6 +130,8 @@ exports.GenesisState = {
|
|
|
101
130
|
object.params !== undefined && object.params !== null
|
|
102
131
|
? oracle_1.Params.fromPartial(object.params)
|
|
103
132
|
: undefined;
|
|
133
|
+
message.allOracleVotesWindow = ((_d = object.allOracleVotesWindow) !== null && _d !== void 0 ? _d : []).map((e) => slashing_1.OracleVotesWindow.fromPartial(e));
|
|
134
|
+
message.slashCounters = ((_e = object.slashCounters) !== null && _e !== void 0 ? _e : []).map((e) => slashing_1.SlashCounter.fromPartial(e));
|
|
104
135
|
return message;
|
|
105
136
|
},
|
|
106
137
|
};
|
|
@@ -15,7 +15,7 @@ exports.GenesisState = {
|
|
|
15
15
|
for (const v of message.prices) {
|
|
16
16
|
pricing_1.PriceSet.encode(v, writer.uint32(10).fork()).ldelim();
|
|
17
17
|
}
|
|
18
|
-
for (const v of message.
|
|
18
|
+
for (const v of message.tokenPrices) {
|
|
19
19
|
pricing_1.TokenPrice.encode(v, writer.uint32(18).fork()).ldelim();
|
|
20
20
|
}
|
|
21
21
|
if (message.params !== undefined) {
|
|
@@ -28,7 +28,7 @@ exports.GenesisState = {
|
|
|
28
28
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
29
29
|
const message = Object.assign({}, baseGenesisState);
|
|
30
30
|
message.prices = [];
|
|
31
|
-
message.
|
|
31
|
+
message.tokenPrices = [];
|
|
32
32
|
while (reader.pos < end) {
|
|
33
33
|
const tag = reader.uint32();
|
|
34
34
|
switch (tag >>> 3) {
|
|
@@ -36,7 +36,7 @@ exports.GenesisState = {
|
|
|
36
36
|
message.prices.push(pricing_1.PriceSet.decode(reader, reader.uint32()));
|
|
37
37
|
break;
|
|
38
38
|
case 2:
|
|
39
|
-
message.
|
|
39
|
+
message.tokenPrices.push(pricing_1.TokenPrice.decode(reader, reader.uint32()));
|
|
40
40
|
break;
|
|
41
41
|
case 3:
|
|
42
42
|
message.params = pricing_1.Params.decode(reader, reader.uint32());
|
|
@@ -52,7 +52,7 @@ exports.GenesisState = {
|
|
|
52
52
|
var _a, _b;
|
|
53
53
|
const message = Object.assign({}, baseGenesisState);
|
|
54
54
|
message.prices = ((_a = object.prices) !== null && _a !== void 0 ? _a : []).map((e) => pricing_1.PriceSet.fromJSON(e));
|
|
55
|
-
message.
|
|
55
|
+
message.tokenPrices = ((_b = object.tokenPrices) !== null && _b !== void 0 ? _b : []).map((e) => pricing_1.TokenPrice.fromJSON(e));
|
|
56
56
|
message.params =
|
|
57
57
|
object.params !== undefined && object.params !== null
|
|
58
58
|
? pricing_1.Params.fromJSON(object.params)
|
|
@@ -67,11 +67,11 @@ exports.GenesisState = {
|
|
|
67
67
|
else {
|
|
68
68
|
obj.prices = [];
|
|
69
69
|
}
|
|
70
|
-
if (message.
|
|
71
|
-
obj.
|
|
70
|
+
if (message.tokenPrices) {
|
|
71
|
+
obj.tokenPrices = message.tokenPrices.map((e) => e ? pricing_1.TokenPrice.toJSON(e) : undefined);
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
obj.
|
|
74
|
+
obj.tokenPrices = [];
|
|
75
75
|
}
|
|
76
76
|
message.params !== undefined &&
|
|
77
77
|
(obj.params = message.params ? pricing_1.Params.toJSON(message.params) : undefined);
|
|
@@ -81,7 +81,7 @@ exports.GenesisState = {
|
|
|
81
81
|
var _a, _b;
|
|
82
82
|
const message = Object.assign({}, baseGenesisState);
|
|
83
83
|
message.prices = ((_a = object.prices) !== null && _a !== void 0 ? _a : []).map((e) => pricing_1.PriceSet.fromPartial(e));
|
|
84
|
-
message.
|
|
84
|
+
message.tokenPrices = ((_b = object.tokenPrices) !== null && _b !== void 0 ? _b : []).map((e) => pricing_1.TokenPrice.fromPartial(e));
|
|
85
85
|
message.params =
|
|
86
86
|
object.params !== undefined && object.params !== null
|
|
87
87
|
? pricing_1.Params.fromPartial(object.params)
|
package/lib/modules/admin.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ export declare namespace AdminModule {
|
|
|
212
212
|
rateStrategyName: string;
|
|
213
213
|
loanToValue: BigNumber;
|
|
214
214
|
liquidationThreshold: BigNumber;
|
|
215
|
-
|
|
215
|
+
liquidationDiscount: BigNumber;
|
|
216
216
|
supplyCap: BigNumber;
|
|
217
217
|
borrowCap: BigNumber;
|
|
218
218
|
}
|
package/lib/modules/admin.js
CHANGED
|
@@ -452,7 +452,7 @@ class AdminModule extends base_1.default {
|
|
|
452
452
|
rateStrategyName: params.asset.rateStrategyName,
|
|
453
453
|
loanToValue: params.asset.loanToValue.toString(10),
|
|
454
454
|
liquidationThreshold: params.asset.liquidationThreshold.toString(10),
|
|
455
|
-
|
|
455
|
+
liquidationDiscount: params.asset.liquidationDiscount.toString(10),
|
|
456
456
|
supplyCap: params.asset.supplyCap.toString(10),
|
|
457
457
|
borrowCap: params.asset.borrowCap.toString(10),
|
|
458
458
|
}
|
|
@@ -474,7 +474,7 @@ class AdminModule extends base_1.default {
|
|
|
474
474
|
rateStrategyName: params.asset.rateStrategyName,
|
|
475
475
|
loanToValue: params.asset.loanToValue.toString(10),
|
|
476
476
|
liquidationThreshold: params.asset.liquidationThreshold.toString(10),
|
|
477
|
-
|
|
477
|
+
liquidationDiscount: params.asset.liquidationDiscount.toString(10),
|
|
478
478
|
supplyCap: params.asset.supplyCap.toString(10),
|
|
479
479
|
borrowCap: params.asset.borrowCap.toString(10),
|
|
480
480
|
}
|
package/lib/modules/cdp.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare class CDPModule extends BaseModule {
|
|
|
23
23
|
returnStablecoin(params: CDPModule.ReturnStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
24
24
|
updateRateStrategy(params: CDPModule.UpdateRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
25
25
|
claimRewards(opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
26
|
+
createRewardScheme(params: CDPModule.CreateRewardSchemeParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
26
27
|
getAccountData(account: string): Promise<{
|
|
27
28
|
TotalCollateralsUsd: BigNumber;
|
|
28
29
|
AvailableBorrowsUsd: BigNumber;
|
|
@@ -50,6 +51,7 @@ export declare class CDPModule extends BaseModule {
|
|
|
50
51
|
getCdpTokenPrice(cdpDenom: string): Promise<BigNumber>;
|
|
51
52
|
getUnderlyingDenom(cdpDenom: string): string;
|
|
52
53
|
getCollateralReceivableForLiquidation(debtDenom: string, debtAmount: BigNumber, cdpDenom: string): Promise<BigNumber>;
|
|
54
|
+
getCollateralReceivableForStablecoinLiq(cdpDenom: string, stablecoinRepayAmt: BigNumber, interestDenom: string, interestRepayAmt: BigNumber): Promise<BigNumber>;
|
|
53
55
|
}
|
|
54
56
|
export declare namespace CDPModule {
|
|
55
57
|
interface SupplyAssetParams {
|
|
@@ -117,7 +119,6 @@ export declare namespace CDPModule {
|
|
|
117
119
|
minCollateralAmount: BigNumber;
|
|
118
120
|
debtDenom: string;
|
|
119
121
|
debtAmount: BigNumber;
|
|
120
|
-
principalAmount: BigNumber;
|
|
121
122
|
interestDenom: string;
|
|
122
123
|
interestAmount: BigNumber;
|
|
123
124
|
}
|
|
@@ -148,4 +149,12 @@ export declare namespace CDPModule {
|
|
|
148
149
|
principalDebt: string;
|
|
149
150
|
initialCumulativeInterestMultiplier: string;
|
|
150
151
|
}
|
|
152
|
+
interface CreateRewardSchemeParams {
|
|
153
|
+
rewardDenom: string;
|
|
154
|
+
assetDenom: string;
|
|
155
|
+
rewardType: string;
|
|
156
|
+
rewardAmountPerSecond: BigNumber;
|
|
157
|
+
startTime: Date;
|
|
158
|
+
endTime: Date;
|
|
159
|
+
}
|
|
151
160
|
}
|
package/lib/modules/cdp.js
CHANGED
|
@@ -205,7 +205,6 @@ class CDPModule extends base_1.default {
|
|
|
205
205
|
minCollateralAmount: params.minCollateralAmount.toString(10),
|
|
206
206
|
debtDenom: params.debtDenom,
|
|
207
207
|
debtAmount: params.debtAmount.toString(10),
|
|
208
|
-
principalAmount: params.principalAmount.toString(10),
|
|
209
208
|
interestDenom: params.interestDenom,
|
|
210
209
|
interestAmount: params.interestAmount.toString(10),
|
|
211
210
|
});
|
|
@@ -302,6 +301,26 @@ class CDPModule extends base_1.default {
|
|
|
302
301
|
}, opts);
|
|
303
302
|
});
|
|
304
303
|
}
|
|
304
|
+
createRewardScheme(params, opts) {
|
|
305
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
306
|
+
const wallet = this.getWallet();
|
|
307
|
+
const value = tx_1.MsgCreateRewardScheme.fromPartial({
|
|
308
|
+
creator: wallet.bech32Address,
|
|
309
|
+
createRewardSchemeParams: {
|
|
310
|
+
rewardDenom: params.rewardDenom,
|
|
311
|
+
rewardType: params.rewardType,
|
|
312
|
+
assetDenom: params.assetDenom,
|
|
313
|
+
rewardAmountPerSecond: params.rewardAmountPerSecond.toString(10),
|
|
314
|
+
startTime: params.startTime,
|
|
315
|
+
endTime: params.endTime,
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
return yield wallet.sendTx({
|
|
319
|
+
typeUrl: util_1.CarbonTx.Types.MsgCreateRewardScheme,
|
|
320
|
+
value,
|
|
321
|
+
}, opts);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
305
324
|
// start of cdp calculations
|
|
306
325
|
getAccountData(account) {
|
|
307
326
|
var _a;
|
|
@@ -485,7 +504,7 @@ class CDPModule extends base_1.default {
|
|
|
485
504
|
if (!priceResult.tokenPrice)
|
|
486
505
|
throw new Error("unable to retrieve token price for " + denom);
|
|
487
506
|
const twap = (0, number_1.bnOrZero)(priceResult.tokenPrice.twap).shiftedBy(-18);
|
|
488
|
-
return amount.
|
|
507
|
+
return amount.multipliedBy(twap).shiftedBy(-decimals);
|
|
489
508
|
});
|
|
490
509
|
}
|
|
491
510
|
getTotalTokenDebt(denom, debtInfo) {
|
|
@@ -706,17 +725,18 @@ class CDPModule extends base_1.default {
|
|
|
706
725
|
return __awaiter(this, void 0, void 0, function* () {
|
|
707
726
|
const sdk = this.sdkProvider;
|
|
708
727
|
// get the discounted price for the cdp token
|
|
728
|
+
const cdpActualDenom = this.getUnderlyingDenom(cdpDenom);
|
|
709
729
|
const asset = yield sdk.query.cdp.Asset({
|
|
710
|
-
denom:
|
|
730
|
+
denom: cdpActualDenom
|
|
711
731
|
});
|
|
712
732
|
if (!asset.assetParams)
|
|
713
733
|
throw new Error("unable to retrieve asset param for " + debtDenom);
|
|
714
|
-
const bonus = (0, number_1.bnOrZero)(asset.assetParams.
|
|
734
|
+
const bonus = (0, number_1.bnOrZero)(asset.assetParams.liquidationDiscount).div(number_1.BN_10000);
|
|
715
735
|
const cdpTokenPrice = yield this.getCdpTokenPrice(cdpDenom);
|
|
716
736
|
const cdpTokenDiscountedPrice = cdpTokenPrice.multipliedBy(number_1.BN_ONE.minus(bonus));
|
|
717
737
|
// get cdp tokens (discounted) that can be gained from the debt amount
|
|
718
738
|
const debtValue = (_a = yield this.getTokenUsdVal(debtDenom, debtAmount)) !== null && _a !== void 0 ? _a : number_1.BN_ZERO;
|
|
719
|
-
const underlyingDenom =
|
|
739
|
+
const underlyingDenom = this.getUnderlyingDenom(cdpDenom);
|
|
720
740
|
const cdpTokenDecimals = (_b = yield sdk.getTokenClient().getDecimals(underlyingDenom)) !== null && _b !== void 0 ? _b : 0;
|
|
721
741
|
const cdpAmountWithDiscount = debtValue.div(cdpTokenDiscountedPrice).shiftedBy(cdpTokenDecimals);
|
|
722
742
|
// get cdp tokens (not discounted) that can be gained from the debt amount
|
|
@@ -732,6 +752,45 @@ class CDPModule extends base_1.default {
|
|
|
732
752
|
return cdpAmountWithDiscount.minus(feeAmount);
|
|
733
753
|
});
|
|
734
754
|
}
|
|
755
|
+
getCollateralReceivableForStablecoinLiq(cdpDenom, stablecoinRepayAmt, interestDenom, interestRepayAmt) {
|
|
756
|
+
var _a, _b, _c, _d;
|
|
757
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
758
|
+
const sdk = this.sdkProvider;
|
|
759
|
+
// get the discounted price for the cdp token
|
|
760
|
+
const cdpActualDenom = this.getUnderlyingDenom(cdpDenom);
|
|
761
|
+
const asset = yield sdk.query.cdp.Asset({
|
|
762
|
+
denom: cdpActualDenom
|
|
763
|
+
});
|
|
764
|
+
if (!asset.assetParams)
|
|
765
|
+
throw new Error("unable to retrieve asset param for " + cdpActualDenom);
|
|
766
|
+
const bonus = (0, number_1.bnOrZero)(asset.assetParams.liquidationDiscount).div(number_1.BN_10000);
|
|
767
|
+
const cdpTokenPrice = yield this.getCdpTokenPrice(cdpDenom);
|
|
768
|
+
const cdpTokenDiscountedPrice = cdpTokenPrice.multipliedBy(number_1.BN_ONE.minus(bonus));
|
|
769
|
+
// get value of stablecoin repayment + interest repayment
|
|
770
|
+
const debtInfoRsp = (_a = yield sdk.query.cdp.StablecoinDebt({})) !== null && _a !== void 0 ? _a : {};
|
|
771
|
+
if (!debtInfoRsp.stablecoinDebtInfo)
|
|
772
|
+
throw new Error("unable to retrieve stablecoin debt info");
|
|
773
|
+
const stablecoinDebtInfo = debtInfoRsp.stablecoinDebtInfo;
|
|
774
|
+
const stablecoinDecimals = (_b = yield this.sdkProvider.getTokenClient().getDecimals(stablecoinDebtInfo.denom)) !== null && _b !== void 0 ? _b : number_1.BN_ZERO;
|
|
775
|
+
const stablecoinRepaymentValue = stablecoinRepayAmt.shiftedBy(-stablecoinDecimals);
|
|
776
|
+
const interestRepaymentValue = (_c = yield this.getTokenUsdVal(interestDenom, interestRepayAmt)) !== null && _c !== void 0 ? _c : number_1.BN_ZERO;
|
|
777
|
+
const totalRepaymentValue = stablecoinRepaymentValue.plus(interestRepaymentValue);
|
|
778
|
+
// get cdp tokens (discounted) that can be gained from the debt amount
|
|
779
|
+
const cdpTokenDecimals = (_d = yield sdk.getTokenClient().getDecimals(cdpActualDenom)) !== null && _d !== void 0 ? _d : 0;
|
|
780
|
+
const cdpAmountWithDiscount = totalRepaymentValue.div(cdpTokenDiscountedPrice).shiftedBy(cdpTokenDecimals);
|
|
781
|
+
// get cdp tokens (not discounted) that can be gained from the debt amount
|
|
782
|
+
const cdpAmountWithoutDiscount = totalRepaymentValue.div(cdpTokenPrice).shiftedBy(cdpTokenDecimals);
|
|
783
|
+
// get fee amount
|
|
784
|
+
const cdpAmountProfit = cdpAmountWithDiscount.minus(cdpAmountWithoutDiscount);
|
|
785
|
+
const params = yield sdk.query.cdp.Params({});
|
|
786
|
+
if (!params.params)
|
|
787
|
+
throw new Error("unable to retrieve cdp params");
|
|
788
|
+
const feePercentage = (0, number_1.bnOrZero)(params.params.liquidationFee).div(number_1.BN_10000);
|
|
789
|
+
const feeAmount = cdpAmountProfit.multipliedBy(feePercentage);
|
|
790
|
+
// return collateral that can be received by liquidator
|
|
791
|
+
return cdpAmountWithDiscount.minus(feeAmount);
|
|
792
|
+
});
|
|
793
|
+
}
|
|
735
794
|
}
|
|
736
795
|
exports.CDPModule = CDPModule;
|
|
737
796
|
;
|
|
@@ -208,7 +208,7 @@ export interface AssetParams {
|
|
|
208
208
|
allow_repay_stablecoin_interest_debt: boolean;
|
|
209
209
|
loan_to_value: string;
|
|
210
210
|
liquidation_threshold: string;
|
|
211
|
-
|
|
211
|
+
liquidation_discount: string;
|
|
212
212
|
supply_cap: string;
|
|
213
213
|
borrow_cap: string;
|
|
214
214
|
}
|
|
@@ -294,7 +294,6 @@ export interface RewardScheme {
|
|
|
294
294
|
reward_amount_per_second: string;
|
|
295
295
|
start_time: string;
|
|
296
296
|
end_time: string;
|
|
297
|
-
reward_reserve_amount: string;
|
|
298
297
|
reward_per_share_last_updated_at: string;
|
|
299
298
|
reward_per_share: string;
|
|
300
299
|
}
|