-
Notifications
You must be signed in to change notification settings - Fork 36
/
investor-vesting-update-config.ts
39 lines (35 loc) · 1.1 KB
/
investor-vesting-update-config.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
import { MsgExecuteContract } from '@terra-money/terra.js';
import { validateInput } from '../../utils/validate-input';
import { validateAddress } from '../../utils/validation/address';
import { AddressProvider } from '../../address-provider/provider';
import { validateTrue } from '../../utils/validation/true';
import { validateIsNumber } from '../../utils/validation/number';
interface Option {
address: string;
owner?: string;
anchor_token?: string;
genesis_time?: string;
}
export const fabricateInvestorVestingUpdateConfig = ({
address,
owner,
anchor_token,
genesis_time,
}: Option) => (addressProvider: AddressProvider): MsgExecuteContract[] => {
validateInput([
validateAddress(address),
owner ? validateAddress(owner) : validateTrue,
anchor_token ? validateAddress(anchor_token) : validateTrue,
genesis_time ? validateIsNumber(genesis_time) : validateTrue,
]);
const investor = addressProvider.investorLock();
return [
new MsgExecuteContract(address, investor, {
update_config: {
owner,
anchor_token,
genesis_time,
},
}),
];
};