Ecosystem
Last updated
Last updated
Inherits:, Initializable, PausableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, UUPSUpgradeable
Ecosystem contract handles airdrops, rewards, burning, and partnerships
Implements a secure and upgradeable DAO ecosystem
Notes:
security-contact: security@nebula-labs.xyz
copyright: Copyright (c) 2025 Nebula Holding Inc. All rights reserved.
AccessControl Burner Role
AccessControl Pauser Role
AccessControl Upgrader Role
AccessControl Rewarder Role
AccessControl Manager Role
Minimum required vesting duration (30 days)
Maximum allowed vesting duration (10 years)
Upgrade timelock duration (3 days)
governance token instance
starting reward supply
maximal one time reward amount
issued reward
burned reward amount (tracked separately for transparency)
maximum one time burn amount
starting airdrop supply
total amount airdropped so far
starting partnership supply
partnership tokens issued so far
number of UUPS upgrades - packed with other variables to save gas
timelock address for partner vesting cancellations
Addresses of vesting contracts issued to partners
Pending upgrade information
Modifier to check for non-zero amounts
Parameters
amount
uint256
The amount to validate
Modifier to check for non-zero addresses
Parameters
addr
address
The address to validate
Note: oz-upgrades-unsafe-allow: constructor
Prevents receiving Ether. This contract doesn't handle ETH.
Initializes the Ecosystem contract with core dependencies and configurations
Sets up the contract with initial token allocations, roles, and limits
Notes:
security: Uses initializer modifier to prevent multiple initializations
security-roles: Grants the following roles:
DEFAULT_ADMIN_ROLE to timelock
MANAGER_ROLE to timelock
PAUSER_ROLE to timelock
UPGRADER_ROLE to both timelock and multisig
allocation: Configures token allocations as follows:
26% for rewards
10% for airdrops
8% for partnerships
limits: Sets initial limits:
maxReward: 0.1% of reward supply
maxBurn: 2% of reward supply
events-emits: {Initialized} when initialization is complete
throws: ZeroAddressDetected if any input address is zero
Parameters
token
address
Address of the LENDEFI token contract
timelockAddr
address
Address of the timelock contract that will have admin control
multisig
address
Address of the multisig wallet that will have upgrade rights
Pauses all contract operations.
Pause contract.
Notes:
requires-role: PAUSER_ROLE
events-emits: {Paused} event from PausableUpgradeable
Resumes all contract operations.
Unpause contract.
Notes:
requires-role: PAUSER_ROLE
events-emits: {Unpaused} event from PausableUpgradeable
Only callable by an address with UPGRADER_ROLE
Schedules an upgrade to a new implementation
Parameters
newImplementation
address
Address of the new implementation
Only callable by addresses with MANAGER_ROLE
Always sends all available tokens to the timelock controller
Emergency function to withdraw all tokens to the timelock
Notes:
throws: ZeroAddress if token address is zero
throws: ZeroBalance if contract has no token balance
Parameters
token
address
The ERC20 token to withdraw
Distributes a specified amount of tokens to each address in the recipients array.
Performs an airdrop to a list of recipients.
Notes:
requires-role: MANAGER_ROLE
requires: Contract must not be paused
requires: Amount must be at least 1 ether
requires: Total airdropped amount must not exceed the airdrop supply
requires: Number of recipients must not exceed 4000 to avoid gas limit issues
events-emits: {AirDrop} event
throws: InvalidAmount if the amount is less than 1 ether
throws: AirdropSupplyLimit if the total airdropped amount exceeds the airdrop supply
throws: GasLimit if the number of recipients exceeds 4000
Parameters
recipients
address[]
An array of addresses to receive the airdrop.
amount
uint256
The amount of tokens to be airdropped to each address.
Distributes a specified amount of tokens to a beneficiary address.
Reward functionality for the Nebula Protocol.
Notes:
requires-role: REWARDER_ROLE
requires: Contract must not be paused
requires: Amount must be greater than 0
requires: Amount must not exceed the maximum reward limit
requires: Total rewarded amount must not exceed the reward supply
events-emits: {Reward} event
throws: InvalidAmount if the amount is 0
throws: InvalidAddress if the recipient address is 0
throws: RewardLimit if the amount exceeds the maximum reward limit
throws: RewardSupplyLimit if the total rewarded amount exceeds the reward supply
Parameters
to
address
The address that will receive the reward.
amount
uint256
The amount of tokens to be rewarded.
Burns a specified amount of tokens from the reward supply.
Enables burn functionality for the DAO.
Notes:
requires-role: BURNER_ROLE
requires: Contract must not be paused
requires: Amount must be greater than 0
requires: Amount must not exceed the maximum burn limit
requires: Total burned amount must not exceed the reward supply
events-emits: {Burn} event
throws: InvalidAmount if the amount is 0
throws: MaxBurnLimit if the amount exceeds the maximum burn limit
throws: BurnSupplyLimit if the amount exceeds available supply
Parameters
amount
uint256
The amount of tokens to be burned.
Adds a new partner by creating a cancellable vesting contract and transferring the specified amount of tokens.
Creates and funds a new vesting contract for a new partner.
Notes:
requires-role: MANAGER_ROLE
requires: Contract must not be paused
requires: Partner address must not be zero and must be a valid contract or EOA
requires: Amount must be between 100 ether and half of the partnership supply
requires: Duration must be within reasonable bounds
requires: Total issued partnership tokens must not exceed the partnership supply
events-emits: {AddPartner} event
throws: InvalidAddress if the partner address is zero
throws: PartnerExists if the partner already has a vesting contract
throws: InvalidAmount if the amount is not within the valid range
throws: InvalidVestingSchedule if duration is not within reasonable bounds
throws: AmountExceedsSupply if the total issued partnership tokens exceed the partnership supply
Parameters
partner
address
The address of the partner to receive the vesting contract.
amount
uint256
The amount of tokens to be vested.
cliff
uint256
The duration in seconds of the cliff period.
duration
uint256
The duration in seconds of the vesting period.
This can only be called by the timelock (governance)
Cancels a partner vesting contract
Notes:
requires: The caller must be the timelock
requires: The partner must have a valid vesting contract
emits: CancelPartnership event on successful cancellation
throws: CallerNotAllowed if the caller is not the timelock
throws: InvalidAddress if the partner has no vesting contract
Parameters
partner
address
The address of the partner whose vesting should be cancelled
Cancels a previously scheduled upgrade
Only callable by addresses with UPGRADER_ROLE
Allows updating the maximum reward that can be issued in a single transaction.
Updates the maximum one-time reward amount.
Notes:
requires-role: MANAGER_ROLE
requires: Contract must not be paused
requires: New max reward must be greater than 0
requires: New max reward must not exceed 5% of remaining reward supply
events-emits: {MaxRewardUpdated} event
throws: InvalidAmount if the amount is 0
throws: ExcessiveMaxValue if the amount exceeds 5% of remaining reward supply
Parameters
newMaxReward
uint256
The new maximum reward amount.
Allows updating the maximum amount that can be burned in a single transaction.
Updates the maximum one-time burn amount.
Notes:
requires-role: MANAGER_ROLE
requires: Contract must not be paused
requires: New max burn must be greater than 0
requires: New max burn must not exceed 10% of remaining reward supply
events-emits: {MaxBurnUpdated} event
throws: InvalidAmount if the amount is 0
throws: ExcessiveMaxValue if the amount exceeds 10% of remaining reward supply
Parameters
newMaxBurn
uint256
The new maximum burn amount.
Returns the remaining time before a scheduled upgrade can be executed
Returns
<none>
uint256
The time remaining in seconds, or 0 if no upgrade is scheduled or timelock has passed
Returns the effective available reward supply considering burns.
Returns
<none>
uint256
The current available reward supply.
Returns the effective available airdrop supply.
Returns
<none>
uint256
The current available airdrop supply.
Returns the effective available partnership supply.
Returns
<none>
uint256
The current available partnership supply.
Authorizes an upgrade to a new implementation with timelock enforcement
Parameters
newImplementation
address
The address of the new implementation contract