-
Notifications
You must be signed in to change notification settings - Fork 22
/
MsgUpdateAlliance.ts
166 lines (153 loc) 路 4.15 KB
/
MsgUpdateAlliance.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import { JSONSerializable } from '../../../../util/json';
import { Any } from '@terra-money/legacy.proto/google/protobuf/any';
import { MsgUpdateAlliance as MsgUpdateAlliance_pb } from '@terra-money/terra.proto/alliance/alliance/tx';
import { Duration } from '@terra-money/terra.proto/google/protobuf/duration';
/**
* MsgUpdateAlliance is gov content type to create a new alliance
*/
export class MsgUpdateAlliance extends JSONSerializable<
MsgUpdateAlliance.Amino,
MsgUpdateAlliance.Data,
MsgUpdateAlliance.Proto
> {
/**
* @description Update an existent alliance using the gov module
* @param authority of the proposal
* @param denom of the asset. It could either be a native token or an IBC token
* @param rewardWeight specifies the ratio of rewards that will be given to each alliance asset it does not need to sum to 1. rate = weight / total_weight Native asset is always assumed to have a weight of 1.
* @param takeRate positive take rate is used for liquid staking derivatives. It defines an annualized reward rate that will be redirected to the distribution rewards pool
* @param rewardChangeRate how much the reward weight will change every rewardChangeInterval
* @param rewardChangeInterval how often the reward weight will change
*/
constructor(
public authority: string,
public denom: string,
public rewardWeight: string,
public takeRate: string,
public rewardChangeRate: string,
public rewardChangeInterval?: Duration
) {
super();
}
public static fromAmino(
data: MsgUpdateAlliance.Amino,
_?: boolean
): MsgUpdateAlliance {
_;
data;
throw new Error('not implemented');
}
public toAmino(_?: boolean): MsgUpdateAlliance.Amino {
_;
throw new Error('not implemented');
}
public static fromData(
data: MsgUpdateAlliance.Data,
_?: boolean
): MsgUpdateAlliance {
_;
const {
authority,
denom,
rewardWeight,
takeRate,
rewardChangeRate,
rewardChangeInterval,
} = data;
return new MsgUpdateAlliance(
authority,
denom,
rewardWeight,
takeRate,
rewardChangeRate,
rewardChangeInterval
);
}
public toData(_?: boolean): MsgUpdateAlliance.Data {
_;
const {
authority,
denom,
rewardWeight,
takeRate,
rewardChangeRate,
rewardChangeInterval,
} = this;
return {
'@type': '/alliance.alliance.MsgUpdateAlliance',
authority,
denom,
rewardWeight,
takeRate,
rewardChangeRate,
rewardChangeInterval,
};
}
public static fromProto(
proto: MsgUpdateAlliance.Proto,
_?: boolean
): MsgUpdateAlliance {
_;
return new MsgUpdateAlliance(
proto.authority,
proto.denom,
proto.rewardWeight,
proto.takeRate,
proto.rewardChangeRate,
proto.rewardChangeInterval
);
}
public toProto(_?: boolean): MsgUpdateAlliance.Proto {
_;
const {
authority,
denom,
rewardWeight,
takeRate,
rewardChangeRate,
rewardChangeInterval,
} = this;
return MsgUpdateAlliance_pb.fromPartial({
authority,
denom,
rewardWeight,
takeRate,
rewardChangeRate,
rewardChangeInterval,
});
}
public packAny(_?: boolean): Any {
_;
return Any.fromPartial({
typeUrl: '/alliance.alliance.MsgUpdateAlliance',
value: MsgUpdateAlliance_pb.encode(this.toProto()).finish(),
});
}
public static unpackAny(msgAny: Any, _?: boolean): MsgUpdateAlliance {
_;
return MsgUpdateAlliance.fromProto(
MsgUpdateAlliance_pb.decode(msgAny.value)
);
}
}
export namespace MsgUpdateAlliance {
export interface Amino {
type: 'alliance/MsgUpdateAlliance';
authority: string;
denom: string;
rewardWeight: string;
takeRate: string;
rewardChangeRate: string;
rewardChangeInterval?: Duration;
}
export interface Data {
'@type': '/alliance.alliance.MsgUpdateAlliance';
authority: string;
denom: string;
rewardWeight: string;
takeRate: string;
rewardChangeRate: string;
rewardChangeInterval?: Duration;
}
export type Proto = MsgUpdateAlliance_pb;
}