Skip to content

Create operating fund #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Create operating fund #67

wants to merge 17 commits into from

Conversation

whoabuddy
Copy link
Contributor

@whoabuddy whoabuddy commented Apr 21, 2025

This PR adds the operating fund contract

This also modifies the treasury to interact solely with the operating fund, creating an extra layer of protection and allowing us to open up core proposals sooner than originally anticipated in #39

Left to do:

  • treasury: set withdrawal amount up to 2% of its own balance (or just 2% flat?)
  • op fund: add code and logic to interact with deployed timed vaults
  • op fund: allow for regular transfer/movement as well? L2 treasury 😆

Notable Changes:

  • treasury: maps and constants added to track a 4,320 BTC block period for withdrawals (30 days)
  • treasury: one withdrawal per period is allowed, separate one for STX, one for FT (DAO token)
  • treasury: read-only functions added: get-current-period, get-stx-claim and get-ft-claim
  • treasury: read-only function added: get-contract-info with constants and config
  • treasury: private functions added: update-stx-claim, update-ft-claim with write-once logic
  • treasury: withdrawal can happen once per period, no way to recover missed/past periods (activity-based)

STX and FT will now automatically go to OP_FUND based on period and logic defined in next commits. NFT stays the same for now.
Need to verify that transfers are not possible outside these funcitons with tests and the treasury is officially locked down on an available 30day drip to the operating fund.
@whoabuddy
Copy link
Contributor Author

So with other contracts we have a pattern of STX, sBTC, and DAO token. In the treasury we have STX, FT, and NFT in a more broad definition.

If we track the claims per period for just FT, then we could only withdraw sBTC or DAO token once per period, no separation.

I think if we focus on the treasury as being the secure place for the DAO token, STX, and sBTC then we can scope it better then just being a general treasury.

The question becomes what if another FT or NFTs get added? Do we need to support that now or introduce something later?

To sum it up in a different way, should we streamline it so that:

  • treasury designed for STX, sBTC, and DAO token only
  • treasury 30day withdrawals allowed to operating fund at (or up to?) 2% of balance
  • operating fund can be tapped for up to 20% of its balance by a timed vault
  • operating fund supports withdraw for STX and any FT on allow list (DAO/sBTC by default)
  • drop NFT support for now, can address with separate extension later (and core proposal)

List support is nice but let's keep this as simple as possible. List can be in the proposal as lines of code instead of a literal list, and we're not expecting a long list of entries that would push the limits anytime soon.
We might end up needing a blank/empty test file like this for each depending on where it was used, updated to just v3 for now to clear clarinet check errors.
Also more specific on print statement contents and consistency to use in other contracts.
Also updates error codes in prep for new extension, groups action errors with action proposals.
Should help with a few checks we're doing in separate contracts.
Considering splitting this into three distinct contracts with a specific purpose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create operating fund for timed vault contracts
1 participant