I need help understanding 1) what is the purpose of feeReceiver in contract constructors, 2) are they used in deploying contract on Ethereum only or all chains alike (BSC, Polygon, etc)
Jul 18, 2021, 7:59 AM
You can find it as a parameter or a constructor in line 455 of, for example Shiba Inu's contract (https://etherscan.io/address/0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce#code)
I've seen it in many contracts but never understood it's function.
I've seen it in many contracts but never understood it's function.
constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply, address payable feeReceiver, address tokenOwnerAddress) public payable {
_name = name;
_symbol = symbol;
_decimals = decimals;
// set tokenOwnerAddress as owner of all tokens
_mint(tokenOwnerAddress, totalSupply);
// pay the service fee for contract deployment
feeReceiver.transfer(msg.value);
}
_name = name;
_symbol = symbol;
_decimals = decimals;
// set tokenOwnerAddress as owner of all tokens
_mint(tokenOwnerAddress, totalSupply);
// pay the service fee for contract deployment
feeReceiver.transfer(msg.value);
}
here is constructor code for your reference
Jul 18, 2021, 8:04 AM