Setting the Treasury Address

The treasury for the default farming extension is set by the host and saved directly in the extension through the init extension function. If a host does not want an external treasury, he or she can instead have the tokens sent directly to himself. In this case, the treasury address is = to the host address. This is done by setting the treasury address as address(0).

 function init(bool byMint, address host, address treasury) public virtual override {
     require(_farmMainContract == address(0), "Already init");
     require((_host = host) != address(0), "blank host");
     _rewardTokenAddress = IFarmMain(_farmMainContract = msg.sender)._rewardTokenAddress();
     _byMint = byMint;
     _treasury = treasury != address(0) ? treasury : host;
}

Update Treasury

To change the treasury address, the host can use the extension's setTreasury function to pass the new treasury address in the case of a default extension, or provide a similar one in the case of a custom extension. Only the host can call this function.

function setTreasury(address treasury) public virtual override hostOnly {
    _treasury = treasury;
    }

Last updated