vesting dao mint#404
Conversation
|
is it ready? @andrewnguyen22 as some tests are failing on the CI |
|
Review re-requested @rem1niscence @pablocampogo @ezeike |
rem1niscence
left a comment
There was a problem hiding this comment.
everything looks all right in general, just set it as request changes to enforce the response of the comments. Also in general, I'm pretty sure you did but just to double confirm, as there's a possibly high amount of places where account balances are manipulated in general, did you make sure that all these places have the checks for vesting in place? wether to view those accounts or manipulate them in any way
| ) | ||
|
|
||
| func init() { | ||
| flag.Parse() |
There was a problem hiding this comment.
just to make sure, did you remove this because cobra is being used here? this won't any any other command right?
| locked := s.AccountLockedAmount(account) | ||
| // check for invariant | ||
| if locked >= account.Amount { | ||
| return 0 | ||
| } | ||
| // return spendable amount | ||
| return account.Amount - locked |
There was a problem hiding this comment.
| locked := s.AccountLockedAmount(account) | |
| // check for invariant | |
| if locked >= account.Amount { | |
| return 0 | |
| } | |
| // return spendable amount | |
| return account.Amount - locked | |
| // return spendable amount | |
| return max(0, account.Amount - s.AccountLockedAmount(account)) |
minor refactor to simplify the check, other functions like AccountLockedAmount could have something similar but this could be objected in favour of being explicit on what's happening
| if account == nil { | ||
| return nil | ||
| } | ||
| view := *account |
There was a problem hiding this comment.
warning on my linter here:
assignment copies lock value to view: github.com/canopy-network/canopy/fsm.Account contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (copylocks default)
Summary
This PR adds vesting-aware account support and a mint option for DAO transfer proposals.
What Changed
Vesting accounts
DAO transfer minting
Why
Vesting
The chain needs to distinguish between:
This PR keeps total ownership at the storage layer while enforcing spendability dynamically based on vesting schedule and height.
DAO minting
This gives validators a controlled way to approve exceptional treasury grant events that require new issuance, without creating a separate
governance message type.
Testing
Covered with focused tests for: