23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import { toNano } from '@ton/core';
|
|
import { MainBalance } from '../wrappers/MainBalance';
|
|
import { compile, NetworkProvider } from '@ton/blueprint';
|
|
import contractConfig from '../config/contract.config';
|
|
import { calcPercent, getMainBalanceContract } from './utils';
|
|
|
|
export async function run(provider: NetworkProvider) {
|
|
const ui = provider.ui();
|
|
const mainBalance = await getMainBalanceContract(provider);
|
|
|
|
const currentDepositFunds = await mainBalance.getDepositFunds();
|
|
const { serviceAddr, tokenAddr } = await mainBalance.getServiceAddress();
|
|
|
|
ui.write(`Current contract balance: ${await mainBalance.getBalance()}`);
|
|
ui.write(`Current deposit funds: ${currentDepositFunds}`);
|
|
|
|
// сумма этих двух не должна превышать deposit funds иначе контракт выдаст ошибку
|
|
await mainBalance.sendTransferServiceFee(provider.sender(), toNano(currentDepositFunds / 2), toNano(currentDepositFunds / 2));
|
|
|
|
ui.write(`50% Deposit funds was withdrawn to service address: ${serviceAddr}`);
|
|
ui.write(`50% Deposit funds was withdrawn to token address: ${tokenAddr}`);
|
|
}
|