Add FoundationFunder contract#1
Open
nourharidy wants to merge 5 commits intomainfrom
Open
Conversation
08xmt
reviewed
Mar 3, 2026
wavey0x
reviewed
Mar 8, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Solidity smart contract for rate-limited ERC20 token disbursement. A governance address (
gov) sets per-token quarterly budgets that stream linearly over time. Abeneficiarycan pull tokens up to the accrued budget, and optionally authorizedelegateswith their own independent streaming sub-limits.How It Works
Roles
Streaming Token Buckets
Budgets are not unlocked all at once. They accrue linearly over time using a token bucket model:
Quarterly bucket — Gov sets a
quarterlyLimitper token. The available balance streams from 0 toquarterlyLimitover 90 days. After a pull, the bucket continues accruing from its reduced level. The available balance is capped atquarterlyLimit(no accumulation beyond one quarter).Delegate bucket — The beneficiary configures each delegate with a
limitAmountandinterval. The delegate's available balance streams from 0 tolimitAmountoverintervalseconds, functioning identically to the quarterly bucket but on a custom timescale.When a delegate pulls tokens, both buckets are checked and consumed. The pull succeeds only if the requested amount is within both the quarterly budget and the delegate's own limit.
Pull Mechanism
Tokens are transferred directly from
gov's wallet viatransferFrom— the contract never holds funds. Gov must approve the contract to spend its tokens.Every pull requires a
reasonstring that is emitted in theFundsPulledevent for transparency and auditability.Mid-Stream Configuration Changes
Quarterly limits and delegate configs can be updated at any time. When changed, the contract first accrues any tokens earned under the old parameters, then applies the new config. If the new limit is lower than the current accrued balance, the balance is capped to the new limit.