@layerzerolabs/hardhat-deploy
Version:
Hardhat Plugin For Replicable Deployments And Tests
54 lines • 3.06 kB
TypeScript
import { TronSigner } from './signer';
import { Contract, ContractFactory, ContractInterface, ethers } from 'ethers';
export { Contract } from 'ethers';
/**
* A contract factory for deploying and interacting with smart contracts on the TRON network.
*
* `TronContractFactory` extends `ContractFactory` from ethers.js to provide functionalities
* specific to the TRON network. It is used for deploying smart contracts and creating contract instances
* with a given ABI and bytecode, signed by a `TronSigner`.
*
* @extends ContractFactory
*
* @constructor
* @param {ContractInterface} abi - The contract's ABI.
* @param {ethers.BytesLike} bytecode - The contract's bytecode.
* @param {TronSigner} signer - The `TronSigner` instance to sign transactions.
* @param {string} [contractName=''] - An optional name for the contract, used in TRON-specific transaction fields.
*/
export declare class TronContractFactory extends ContractFactory {
readonly contractName: string;
default_originEnergyLimit: number;
abi: any;
constructor(abi: ContractInterface, bytecode: ethers.BytesLike, signer: TronSigner, contractName?: string);
/**
* Deploys a smart contract to the TRON network.
*
* This method overrides the `deploy` method from the base contract factory. However, it is not implemented
* for the Tron contract factory and will throw an error if called. Deploying contracts on the TRON network
* requires a different approach and should be handled using the `getDeployTransaction` method.
*
* @param {...any[]} args - Constructor arguments for the smart contract.
* @returns {Promise<Contract>} A promise that resolves to the deployed contract instance.
* @throws {Error} Throws an error indicating that the deploy method is not implemented.
*/
deploy(...args: Array<any>): Promise<Contract>;
/**
* Constructs the deployment transaction for a smart contract on the TRON network.
*
* This method overrides `getDeployTransaction` from the base contract factory to construct
* a transaction specifically tailored for deploying smart contracts on the TRON network.
* It encodes the constructor arguments, sets the necessary TRON-specific fields in the transaction,
* and handles the conversion of values to match TRON's requirements.
*
* Special Considerations:
* - The `name` field of the transaction is derived from the contract's name and truncated to 32 characters.
* - TRON-specific fields like `feeLimit`, `callValue`, `userFeePercentage`, and `originEnergyLimit` are set.
* - The transaction is prepared in a format suitable for TRON, differing from standard Ethereum transactions.
*
* @param {...any[]} args - Constructor arguments for the smart contract.
* @returns {ethers.providers.TransactionRequest} A TRON-specific transaction request object for contract deployment.
*/
getDeployTransaction(...args: any[]): ethers.providers.TransactionRequest;
}
//# sourceMappingURL=contract.d.ts.map