feat: PIP-12 Community Treasury Wallet and Capital Operations#30
Merged
Conversation
Contributor
Author
Rework checklist (PIP-12 spec updated 2026-03-27)1.
|
| Old | New |
|---|---|
capitalIncrease |
increaseTokenValue |
capitalDecrease |
splitToken |
TREASURY_MANAGER_ROLE |
RATE_MANAGER_ROLE |
grantTreasuryManagerRole |
grantRateManagerRole |
revokeTreasuryManagerRole |
revokeRateManagerRole |
addCapital |
addReserve |
removeCapital |
(remove) |
CapitalIncreased |
TokenValueIncreased |
CapitalDecreased |
TokenSplit |
TreasuryManagerRoleGranted |
RateManagerRoleGranted |
TreasuryManagerRoleRevoked |
RateManagerRoleRevoked |
4. Add tests
addReservereverts without priorapproveaddReservecannot pull from arbitrary third-party addressessplitTokenincreases all holders' display balances proportionallysplitTokenpreserves proportional ownershipsplitTokendoes not changedepositedPCEToken
70dfb3b to
5b926fe
Compare
Add treasury wallet mechanism with two operations on PCECommunityToken: - increaseTokenValue: add PCE reserves to raise exchange rate - splitToken: mint tokens proportionally via rebaseFactor-based stock split New functions on PCECommunityToken: - initializeTreasury, setTreasuryWallet - increaseTokenValue (calls PCEToken.addReserve) - splitToken (calls PCEToken.adjustExchangeRate, adjusts rebaseFactor) - grantRateManagerRole, revokeRateManagerRole, hasRole New functions on PCEToken: - addReserve: transfer PCE from treasury, adjust exchange rate - adjustExchangeRate: update rate without moving PCE (used by splitToken) Bump PCECommunityToken to v1.0.14. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5b926fe to
f764a6b
Compare
5 tasks
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.
Summary
RATE_MANAGER_ROLEwith lightweight role system,initializeTreasury,setTreasuryWallet,increaseTokenValue,splitToken,grantRateManagerRole,revokeRateManagerRole, andhasRolefunctionsaddReservefunction that manages PCE reserves and adjustsexchangeRateviaMath.mulDiv1.0.13This implementation predates the current PIP-12 spec and needs significant rework:
addReserve()must usetransferFrom(currently uses internal_transfer— allows moving PCE without approval)splitToken()must be implemented with rebase factor mechanism (no PCE withdrawal)Changed Files
src/PCECommunityToken.solsrc/PCEToken.soladdReservefunction (needstransferFromfix)test/PCE.t.solTest plan
forge buildsucceedsforge test-- all tests pass日本語版(参考)
概要
PIP-12 (コミュニティ・トレジャリーウォレットとトークン価値操作) の実装。
PCECommunityToken.sol:
treasuryWallet,RATE_MANAGER_ROLE,_roles,rebaseFactorinitializeTreasury,setTreasuryWallet,increaseTokenValue,splitTokenhasRole,grantRateManagerRole,revokeRateManagerRolePCEToken.sol:
addReserve(PCE準備金管理とexchangeRate調整)バージョン: 両コントラクトを
"1.0.13"に更新現在の実装はPIP-12仕様改訂前のものであり、大幅な修正が必要。詳細はPRコメント参照。
🤖 Generated with Claude Code