-
Notifications
You must be signed in to change notification settings - Fork 36
/
basset-update-config.ts
40 lines (36 loc) · 1.19 KB
/
basset-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
40
import { MsgExecuteContract } from '@terra-money/terra.js';
import { validateInput } from '../../utils/validate-input';
import { validateAddress } from '../../utils/validation/address';
import { validateTrue } from '../../utils/validation/true';
import { AddressProvider } from '../../address-provider/provider';
interface Option {
address: string;
owner?: string;
reward_contract?: string;
token_contract?: string;
airdrop_registry_contract: string;
}
export const fabricatebAssetUpdateConfig = ({
address,
owner,
reward_contract,
token_contract,
airdrop_registry_contract,
}: Option) => (addressProvider: AddressProvider): MsgExecuteContract[] => {
validateInput([
validateAddress(address),
reward_contract ? validateAddress(reward_contract) : validateTrue,
token_contract ? validateAddress(token_contract) : validateTrue,
]);
const bAssetContractAddress = addressProvider.bLunaHub();
return [
new MsgExecuteContract(address, bAssetContractAddress, {
update_config: {
owner: owner,
reward_contract: reward_contract,
token_contract: token_contract,
airdrop_registry_contract: airdrop_registry_contract,
},
}),
];
};