Last active
January 21, 2020 20:37
-
-
Save mcchan1/10e566ee22fc7a385c80d0b4894df3b1 to your computer and use it in GitHub Desktop.
take 2 on adminFee - using ragequit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
adminFee = totalLoot+totalShares/adminFeeDenominator | |
if adminFeeDenominator is greater than or equal to 200, then adminFee <= .5% -- allows LAO to reduce fees | |
*/ | |
//summoningTime = now/time contract deployed | |
uint256 public lastPaymentTime = summoningTime + paymentPeriod; | |
//uint256 paymentPeriod = 90 days; //every quarter. | |
uint256 paymentPeriod = 300 seconds; //remix test 5 min, use 90 days for real contract | |
function withdrawAdminFee (uint256 adminFeeDenominator) public onlySummoner { | |
//require > 90 days (lastPaymentTime) have passed since last withdrawal | |
require (now >= lastPaymentTime, "90 days have not passed since last withdrawal"); | |
//update and increment lastPaymentTime by 1 paymentPeriod | |
lastPaymentTime = lastPaymentTime.add(paymentPeriod); | |
//check admin fee is less than .5%% | |
//if divide by => 200, admin fee will be .5% or less every 90 days. | |
require(adminFeeDenominator => 200); | |
//.05% or less of all assets | |
uint256 adminFee = (totalLoot.add(totalShares)).div(adminFeeDenominator); | |
//add admin Fee to summoner's loot (not shares - don't need voting power) | |
members[summoner].loot = members[summoner].loot.add(adminFee); | |
//add adminFee to totalLoot | |
totalLoot = totalLoot.add(adminFee); | |
//burn through ragequit immediately | |
//ragequit(shares, loot) | |
ragequit(0, adminFee); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment