ElasticDAO.sol

The ElasticDAO contract outlines and defines all of the core functionality for an Elastic DAO. It also serves as the DAO's vault.

Functionality

List of Events

List of Modifiers

List of Functions

Events

ControllerChanged

Emitted after a successful call to setController.

event ControllerChanged(address indexed daoAddress, bytes32 settingName, address value);

ElasticGovernanceTokenDeployed

Emitted after a successful call to initializeToken.

event ElasticGovernanceTokenDeployed(address indexed tokenAddress);

ExitDAO

Emitted after a successful call to exit.

event ExitDAO(
address indexed daoAddress,
address indexed memberAddress,
uint256 shareAmount,
uint256 ethAmount
);

JoinDAO

Emitted after a successful call to join.

event JoinDAO(
address indexed daoAddress,
address indexed memberAddress,
uint256 shareAmount,
uint256 ethAmount
);

MaxVotingLambdaChanged

Emitted after a successful call to setMaxVotingLambda.

event MaxVotingLambdaChanged(address indexed daoAddress, bytes32 settingName, uint256 value);event MaxVotingLambdaChanged(address indexed daoAddress, bytes32 settingName, uint256 value);

SeedDAO

Emitted after a successful call to seedSummoning.

event SeedDAO(address indexed daoAddress, address indexed summonerAddress, uint256 amount);

SummonedDAO

Emitted after a successful call to summon.

event SummonedDAO(address indexed daoAddress, address indexed summonedBy);

Modifiers

onlyAfterSummoning

If the DAO has not yet been summoned, reverts the transaction with the message ElasticDAO: DAO must be summoned.

onlyAfterTokenInitialized

Checks to make sure that an ElasticGovernanceToken has been created and initialized. If not, the transaction is reverted with the message ElasticDAO: Please call initializeToken first.

onlyBeforeSummoning

If the DAO has been summoned, reverts the transaction with the message ElasticDAO: DAO must not be summoned.

onlyController

Ensures that msg.sender is the controller address. If not, reverts the with the message ElasticDAO: Only controller.

onlyDeployer

Ensures that msg.sender is the same address which called initialize. If not, the transaction is reverted with the message ElasticDAO: Only deployer.

onlySummoners

Ensures that msg.sender is one of the summoner addresses passed when initialize was called. If not, reverts with the message ElasticDAO: Only summoners.

onlyWhenOpen

Ensures that the DAO has some balance of ETH in it's vault. If not, reverts with the message ElasticDAO: This DAO is closed.

Functions

initialize

Initializes and builds the ElasticDAO struct by passing and initializing all the required parameters into the Configurator contract.

function initialize(
address _ecosystemModelAddress,
address _controller,
address[] memory _summoners,
string memory _name,
uint256 _maxVotingLambda
) external preventReentry { ... }

parameters

* @param _ecosystemModelAddress - the address of the ecosystem model
* @param _controller the address which can control the core DAO functions
* @param _summoners - an array containing the addresses of the summoners
* @param _name - the name of the DAO
* @param _maxVotingLambda - the maximum amount of lambda that can be used to vote in the DAO

requirements

  • The DAO cannot already be initialized

  • The ecosystem model address cannot be the zero address

  • The DAO must have atleast one summoner to summon the DAO

  • The configurator should be able to successfully build the DAO

initializeToken

Initializes the DAO's ElasticGovernanceToken, using the Configurator contract.

Emits the ElasticGovernanceTokenDeployed event.

function initializeToken(
string memory _name,
string memory _symbol,
uint256 _eByL,
uint256 _elasticity,
uint256 _k,
uint256 _maxLambdaPurchase
) external onlyBeforeSummoning onlyDeployer preventReentry { ... }

parameters

@param _name - name of the token
@param _symbol - symbol of the token
@param _eByL -the amount of lambda a summoner gets(per ETH) during the seeding phase of the DAO
@param _elasticity the value by which the cost of entering the DAO increases ( on every join )
@param _k - is the constant token multiplier
it increases the number of tokens that each member of the DAO has with respect to their lambda
@param _maxLambdaPurchase - is the maximum amount of lambda that can be purchased per wallet

requirements

  • Only the deployer of the DAO can initialize the Token

exit

Allows a member to exit for their underlying ETH. The amount of EGT burned is expressed in it's lambda form as _deltaLambda.

function exit(uint256 _deltaLambda) external onlyAfterSummoning preventReentry { ... }

formula

ΔΛ/ΛEΔΛ / Λ * Ε

parameters

@param _deltaLambda - the amount of lambda the address exits with

requirements

  • ETH transfer must be successful

join

Allows a prospective or current member to join the DAO by minting lambda with ETH. An exact amount of ETH is necessary to successfully mint. Documentation and further math regarding capitalDelta, deltaE, and mDash can be found at ElasticMath.sol.

Emits the JoinDAO event.

function join()
external
payable
onlyAfterSummoning
onlyWhenOpen
preventReentry
{ ... }

parameters

@param _deltaLambda - the amount of lambda minted to the address

requirements

  • The amount of lambdas being purchased has to be lower than maxLambdaPurchase

  • The correct value of ETH, calculated via deltaE(link), must be sent with the transaction

  • The token contract should successfully be able to mint _deltaLambda

penalize

Penalizes _addresses with _amounts respectively.

function penalize(address[] memory _addresses, uint256[] memory _amounts)
external
onlyController
preventReentry
{ ... }

parameters

@param _addresses - an array of addresses
@param _amounts - an array containing the amounts each address has to be penalized respectively

requirements

  • Each address must have a corresponding amount to be penalized with.

reward

Rewards _addresses with _amounts respectively.

function reward(address[] memory _addresses, uint256[] memory _amounts)
external
onlyController
preventReentry
{ ... }

parameters

@param _addresses - an array of addresses
@param _amounts - an array containing the amounts each address has to be rewarded respectively

requirements

  • Each address must have a corresponding amount to be rewarded with.

setController

Sets the controller of the DAO. The controller of the DAO handles various responsibilities of the DAO, such as burning and minting tokens on behalf of the DAO.

Emits the ControllerChanged event.

function setController(address _controller) external onlyController preventReentry { ... }

parameters

@param _controller - the new address of the controller of the DAO

requirements

  • The controller must not be the 0 address

  • The controller of the DAO should successfully be set as the burner of the tokens of the DAO

  • The controller of the DAO should successfully be set as the minter of the tokens of the DAO

setMaxVotingLambda

Sets the maxVotingLambda value for the DAO, which determines the maximum voting capability of a single wallet.

Emits the MaxVotingLambdaChanged event.

function setMaxVotingLambda(uint256 _maxVotingLambda) external onlyController preventReentry { ... }

parameters

@param _maxVotingLambda - the value of the maximum amount of lambda that can be used for voting

seedSummoning

Seeds the DAO. Allows a summoner to transfer ETH in return for lambda at a fixed rate prior to the DAO being summoned.

Emits the SeedDAO event.

function seedSummoning()
external
payable
onlyBeforeSummoning
onlySummoners
onlyAfterTokenInitialized
preventReentry
{ ... }

formula

ΔΛ=E/eByLΔΛ = Ε/eByL

summon

Summons the DAO resulting in each summoner receiving _deltaLambda. Opens the DAO to any wallet, allowing for joining and exiting of the DAO.

Emits the SummonedDAO event.

function summon(uint256 _deltaLambda) external onlyBeforeSummoning onlySummoners preventReentry { ... }

parameters

@param _deltaLambda - the amount of lambda each summoner address receives

requirements

  • The DAO must be seeded with ETH during the seeding phase