Skip to content

Instantly share code, notes, and snippets.

@mcchan1
Last active January 23, 2020 15:47
Show Gist options
  • Save mcchan1/f7b1ee1555bf16b9ffdcb0e3320e2963 to your computer and use it in GitHub Desktop.
Save mcchan1/f7b1ee1555bf16b9ffdcb0e3320e2963 to your computer and use it in GitHub Desktop.
take 3 adminFee
pragma solidity 0.5.3;
/*
adminFee = totalLoot+totalShares/adminFeeDenominator
if adminFeeDenominator is greater than or equal to 200, then adminFee will be less than or equal to .5%
-- allows LAO to reduce fees if desired, but not required to reduce .
Using OpenZeppelin's Ownable.sol contract to manage who is the service provider. It will be The LAO at launch.
withdrawAdminFee can direct an amount up to .5% of the assets under management (adminFee)
to any address (laoFund) after 90 days from the last time the function was called.
This function can only be called by the Owner.
HOW:
Summoner as agent and sole member will enter into agreement with LAO as service provider.
LAO will be the "Owner" under the Ownable.sol contract
Trust assumption: (upheld by valid legal documents under Delaware law): if Member's go through voting process to name
a service provider other than LAO, than LAO will step down and transfer Owner to the new named service provider.
LAO - will probably use OpenLaw relayer to automate call every 90 days to ensure adminFee is collected in a timely manner.
*/
//SERGEI - ABILITY TO TRANSFER SERVICE CONTRACT USING OpenZeppelin's OWNABLE.SOL
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract Moloch is ReentrancyGuard, Ownable {
using SafeMath for uint256;
//....REST IS SAME AS MOLOCH DAO CODE.
uint256 paymentPeriod = 90 days; //every quarter.
//uint256 paymentPeriod = 300 seconds; //remix test 5 min, use 90 days for real contract
//SERGEI - solution to call payment in a timely manner.
uint256 public lastPaymentTime = summoningTime;
function withdrawAdminFee (uint256 adminFeeDenominator, address laoFund) public onlyOwner nonReentrant {
//SERGEI - solution to incentivize timely payment.
require (now >= lastPaymentTime.add(paymentPeriod), "90 days have not passed since last withdrawal");
//SERGEI - reset lastPaymentTime : solution to incentivize payment call in a timely manner.
lastPaymentTime =now;
//check admin fee is less than .5%%
//if divide by => 200, admin fee will be .5% or less every 90 days.
//under consideration -- (shares * 5) / 1000 more readable then shares / 200 -- if hardcoding - Sergei.
require(adminFeeDenominator >= 199); //199 to get .5% - Heiko
//.05% or less of all assets
uint256 adminFee = (totalLoot.add(totalShares)).div(adminFeeDenominator);
//SERGEI - add adminFee to laoFund's loot (not shares - don't need voting power)
members[laoFund].loot = members[laoFund].loot.add(adminFee);
//add adminFee to totalLoot
totalLoot = totalLoot.add(adminFee);
///deal with loot increasing to more than max shares.
require(totalShares.add(totalLoot) <= MAX_NUMBER_OF_SHARES_AND_LOOT);
//burn through ragequit immediately
//ragequit(0, adminFee); //ragequit(shares, loot)
_ragequit(laoFund, 0, adminFee, approvedTokens); //_ragequit(shares, loo, approvedTokens)
} //withdrawAdminFee end
}//k end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment