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.
1
function init(bool byMint, address host, address treasury) public virtual override {
2
require(_farmMainContract == address(0), "Already init");
3
require((_host = host) != address(0), "blank host");
4
_rewardTokenAddress = IFarmMain(_farmMainContract = msg.sender)._rewardTokenAddress();
5
_byMint = byMint;
6
_treasury = treasury != address(0) ? treasury : host;
7
}
Copied!

Update Treasury

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.
1
function setTreasury(address treasury) public virtual override hostOnly {
2
_treasury = treasury;
3
}
Copied!
Copy link
Contents