7. Deploy Integration Contract (optional)

Guide to deploy an integration contract and connecting it to a vPool. You can ask Kiln to deploy an integration contract for you or deploy it yourself.

If you want to deploy it yourself ask Kiln to give the right to deploy using the IntegrationFactory and give us the address you want as deployer.

Deploying a new integration contract

You can choose which type of integration to deploy by calling the corresponding function, you can find details on each type in Configuration, if you are not sure what you need you can simply deploy a Native20 to test. This call should be performed by the deployer account

/// @notice Deploy a proxy for the implementation of a Native vPool integration contract
function deployNative20vPoolIntegration(address proxyOwner, Native20Configuration calldata config) external returns (address);

/// @notice Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
function deployLiquid20AvPoolIntegration(address proxyOwner, Native20Configuration calldata config) external returns (address);

/// @notice Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
function deployLiquid20CvPoolIntegration(address proxyOwner, Native20Configuration calldata config) external returns (address);

/// @notice Deploy a proxy for the implementation of a native 1155 vPool integration contract
function deployNative1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config) external returns (address);

/// @notice Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
function deployLiquid1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config) external returns (address);

These function use the following structs:

struct Native1155Configuration {
    string name;
    string symbol;
    address admin;
    address[] pools;
    uint256[] poolFees;
    address[] commissionRecipients;
    uint256[] commissionDistribution;
    string baseUri;
    uint256 maxCommissionBps;
}

struct Native20Configuration {
    string name;
    string symbol;
    address admin;
    address[] pools;
    uint256[] poolFees;
    address[] commissionRecipients;
    uint256[] commissionDistribution;
    uint256[] poolPercentages;
    uint256 maxCommissionBps;
    uint256 monoTicketThreshold;
}

Let's go through all of them one by one:

Common parameters :

  • name : An ERC-20 style display name of the token.

  • symbol : an ERC-20 style display symbol of the token.

  • admin : The address of the admin. This account can change the fees, and commissionRecipient as well as add pools and enable/disable them.

  • pools : List of underlying pools addresses. Those are the pools to which the staked funds will flow to. You must provide at least one pool.

  • poolFees : List of fee for each pool, in basis points. Must be the same length as pools. The fee for a single pool must not exceed maxCommissionBps.

  • commissionRecipients : List of addresses to which the accumulated integrator fee will be dispatched.

  • commissionDistribution : List of the share of the fee each commissionRecipient will receive, in basis points, must add up to 10 000. Must be the the same length as commissionRecipients.

  • maxCommissionBps : A limit on the pool fee given at initialization so the stakers can be sure the fee will never go above a certain level.

20 family specific parameters :

  • poolPercentages : The desired repartitions of ETH between the pools. In basis points, must add up to 10 000. Must be the same length as pools. This can be changed by the admin.

  • monoTicketThreshold : A value that modify the behaviour of requestExit() when the contract is connected to multiple pools, when exiting we want to limit the number of tickets minted for gas efficiency but we also want to limit the imbalance caused by not exiting through all the pools using the the configured poolPercentages. If a user requests the exit of an ETH amount below monoTicketThreshold the code will try to exit through only one pool if possible thus minting only one ticket hence the name monoTicketThreshold. This value can be changed later on by the admin as the TVL grows and the pools can support bigger exit without significant imbalance.

1155 family specific parameters :

  • baseUri : The base URI for all tokens. This url can contains the metadata for the shares of the underlying pools. Can be changed by the admin

Here is the abi of the IntegrationFactory to facilitate the interactions :

cast: deploy a native20

from=DEPLOYER


cast send <factory address> \
"deployNative20vPoolIntegration(address,(string,string,address,address[],uint256[],address[],uint256[],uint256[],uint256,uint256))(address)" \
<proxy admin address> "('TEST ETH','stakedETH',<admin address>,[<pool address>],[1000],[<fee recipient address>],[10000],[10000],2000,1ether)" --rpc-url $RPC-URL
  • You can add the -i flag to interactively provide the private key for the transaction

  • You can add --ledger --from YOUR_ADDRESS to use a Ledger device to perform the transaction

Allow the integration contract to deposit to the pool

If you are using Kiln's pool ask us to allow your contract to deposit to our pool.

If you manage your pool, allow your integration contract to deposit on the vPool by calling this function :

function allowDepositor(address depositorAddress, bool allowed) external
cast : allowDepositor

from=FACTORY_ADMIN

cast send <pool address> "allowDepositor(address,bool)" \
<integration contract address> true  
  • You can add the -i flag to interactively provide the private key for the transaction

  • You can add --ledger --from YOUR_ADDRESS to use a Ledger device to perform the transaction

Last updated