@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
55 lines (54 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fundInB3TR = exports.fundTreasuryVET = exports.fundTreasuryVTHO = exports.VTHO_CONTRACT_ADDRESS = void 0;
const hardhat_1 = require("hardhat");
const deploy_1 = require("./deploy");
exports.VTHO_CONTRACT_ADDRESS = "0x0000000000000000000000000000456E65726779";
const VTHO_ABI = [
{
inputs: [
{
internalType: "address",
name: "_to",
type: "address",
},
{
internalType: "uint256",
name: "_amount",
type: "uint256",
},
],
name: "transfer",
outputs: [
{
internalType: "bool",
name: "success",
type: "bool",
},
],
stateMutability: "nonpayable",
type: "function",
},
];
const fundTreasuryVTHO = async (address, amount) => {
const contractVtho = await hardhat_1.ethers.getContractAt(VTHO_ABI, exports.VTHO_CONTRACT_ADDRESS);
const tx = await contractVtho.transfer(address, amount);
await tx.wait();
};
exports.fundTreasuryVTHO = fundTreasuryVTHO;
const fundTreasuryVET = async (to, value) => {
const [owner] = await hardhat_1.ethers.getSigners();
await owner.sendTransaction({
to,
value: hardhat_1.ethers.parseEther(value.toString()),
});
};
exports.fundTreasuryVET = fundTreasuryVET;
const fundInB3TR = async (to, value) => {
const [owner] = await hardhat_1.ethers.getSigners();
const instance = await (0, deploy_1.getOrDeployContractInstances)({});
if (!instance?.b3tr)
throw new Error("B3TR contract not found");
await instance.b3tr.connect(owner).transfer(to, hardhat_1.ethers.parseEther(value.toString()));
};
exports.fundInB3TR = fundInB3TR;