Contract Changes
All Changes can be found here: https://github.com/quic-finance/contracts/commits/main
QuicMasterFarmer
To help reduce the gas needed to deploy the QuicMasterFarmer I have moved some setup out of the constructor.
function setup() public onlyOwner {
for (uint256 i = 0; i < REWARD_MULTIPLIER.length - 1; i++) {
uint256 halvingAtBlock = HALVING_AFTER.add(i + 1).add(START_BLOCK);
HALVING_AT_BLOCK.push(halvingAtBlock);
}
FINISH_BONUS_AT_BLOCK = 26180756;
HALVING_AT_BLOCK.push(uint256(-1));
}QuicMasterTransactions
To reduce the contract size of QuicMasterFarmer below the 24kb limit, I separated out the transaction logic from the QuicMasterFarmer. This transactions contract is referenced at the QuicMasterFarmer creation and can not be upgraded/changed after creation.
I also noticed that I could reduce the complexity of the deposit function by removing the devDepFee, reducing the math needed.
// User amount is the amount deposited and deposit fee is reduced
// from the user and added to the dev
uint256 depositFee = _amount.mul(userDepFee).div(10000);
//Add the Amount less the depositFee to the user
user.amount = user.amount.add(_amount.sub(depositFee));
// Ad the depositFee to the Dev
devr.amount = devr.amount.add(depositFee);QuicMasterStorage
To maintain the same storage structures required when doing delegate calls to the transaction contract I separated the storage into its own contract that the MasterFarmer and MasterTransactions inherit from.
Last updated
Was this helpful?