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 == 0x0000000000000000000000000000000000000000
. 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;
}
In the case of a default extension, the host can use the extension's
setTreasury
function to pass a new treasury address
; or, in the case of a custom extension, a similar function can be used.
Only the host can update the treasury.function setTreasury(address treasury) public virtual override hostOnly {
_treasury = treasury;
}
Last modified 2yr ago