-
Notifications
You must be signed in to change notification settings - Fork 36
/
overseer-whitelist.ts
47 lines (43 loc) · 1.09 KB
/
overseer-whitelist.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
import { MsgExecuteContract } from '@terra-money/terra.js';
import { validateInput } from '../../utils/validate-input';
import { validateAddress } from '../../utils/validation/address';
import {
AddressProvider,
MARKET_DENOMS,
} from '../../address-provider/provider';
interface Option {
address: string;
overseer: MARKET_DENOMS;
name: string;
symbol: string;
collateral_token: string;
custody_contract: string;
max_ltv?: string;
}
export const fabricateOverseerWhitelist = ({
address,
overseer,
name,
symbol,
collateral_token,
custody_contract,
max_ltv,
}: Option) => (addressProvider: AddressProvider): MsgExecuteContract[] => {
validateInput([
validateAddress(address),
validateAddress(collateral_token),
validateAddress(custody_contract),
]);
const mmOverseer = addressProvider.overseer(overseer);
return [
new MsgExecuteContract(address, mmOverseer, {
whitelist: {
name: name,
symbol: symbol,
collateral_token: collateral_token,
custody_contract: custody_contract,
max_ltv: max_ltv,
},
}),
];
};