-
Notifications
You must be signed in to change notification settings - Fork 36
/
basset-burn.ts
32 lines (29 loc) · 906 Bytes
/
basset-burn.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
import { Dec, Int, MsgExecuteContract } from '@terra-money/terra.js';
import { validateInput } from '../../utils/validate-input';
import { validateAddress } from '../../utils/validation/address';
import {
validateIsGreaterThanZero,
validateIsNumber,
} from '../../utils/validation/number';
import { AddressProvider } from '../../address-provider';
interface Option {
address: string;
amount: string;
}
export const fabricatebAssetBurn = ({ address, amount }: Option) => (
addressProvider: AddressProvider,
): MsgExecuteContract[] => {
validateInput([
validateAddress(address),
validateIsNumber(+amount),
validateIsGreaterThanZero(+amount),
]);
const bAssetTokenAddress = addressProvider.bLunaToken();
return [
new MsgExecuteContract(address, bAssetTokenAddress, {
burn: {
amount: new Int(new Dec(amount).mul(1000000)).toString(),
},
}),
];
};