Ktv2Factory Contract
This is the central contract responsible for deploying new Burn Bank (Ktv2) instances for any ERC-20 token. It ensures that every staking and donation contract is created with the same verified, secure bytecode. The code for the Ktv2 contract is included within the verified Ktv2Factory contract.
- Contract Addresses: For a list of officially deployed contracts, please see the Official Deployments Addresses page.
Core Functions
The Ktv2Factory
contract is designed for a single, crucial purpose: to deploy new Ktv2
(Burn Bank) contract instances. It has two primary functions:
create(...)
: Deploys a newKtv2
contract instance. This is the main purpose of the factory, and it is detailed further below.count()
: This view function returns the total number ofKtv2
contracts that have been deployed by the factory, serving as a public record of all instances.
The create
Function Explained
The create
function is the heart of the Ktv2Factory
contract. Its purpose is to deploy a new, independent Ktv2
(Burn Bank) contract instance and configure it according to the specified parameters.
function create(address _burnDest,
address _token,
address payable _dest,
address _pool,
address _ocPrcAddr,
address _tp) external
Function Execution
-
Contract Deployment: The
new Ktv2(...)
command deploys a brand newKtv2
contract to the blockchain. The parameters passed tocreate
are forwarded to theKtv2
contract'sconstructor
, configuring its essential settings upon creation. -
Ownership Transfer: The factory is the initial owner of the new contract. The function immediately calls
transferOwnership(msg.sender)
on the new contract, giving the user who calledcreate
full and exclusive administrative control. -
Instance Tracking: The new contract's address is added to a public array named
created
, providing a transparent on-chain record of all deployed instances. -
Event Emission: The function emits a
Created
event, broadcasting the new contract's address. This allows UIs and services to efficiently listen for and identify new Burn Bank instances.
Parameters
Each parameter is an address that defines a core component of the new Burn Bank's configuration:
_burnDest
: The address where burned tokens will be sent (typically a "dead" address)._token
: The address of the specific ERC-20 token that will be used for staking and burning._dest
: Thepayable
address that will receive the ETH donations._pool
: The address of the Uniswap-compatible liquidity pool used by the price oracle._ocPrcAddr
: The address of the first "OC Rewarder" for the rewards voting and distribution process._tp
: The address of the deployedTokenPrice
(TPI) oracle contract.