-
Notifications
You must be signed in to change notification settings - Fork 40
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
daoFeeShare functionality per KIP-33 #34
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,9 +73,16 @@ contract RetireCarbonFacet is ReentrancyGuard { | |
retirementMessage | ||
); | ||
|
||
// Send any aggregator fees to treasury | ||
uint256 daoFee; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can break this out into its own function with |
||
uint256 treasuryFee; | ||
|
||
// Send any aggregator fees to treasury and the DAO wallet | ||
if (totalCarbon - retireAmount > 0) | ||
LibTransfer.sendToken(IERC20(poolToken), totalCarbon - retireAmount, C.treasury(), LibTransfer.To.EXTERNAL); | ||
|
||
daoFee = LibRetire.getFeeShareDAO(totalCarbon - retireAmount); | ||
treasuryFee = totalCarbon - retireAmount - daoFee; | ||
LibTransfer.sendToken(IERC20(poolToken), daoFee, C.dao(), LibTransfer.To.EXTERNAL); | ||
LibTransfer.sendToken(IERC20(poolToken), treasuryFee, C.treasury(), LibTransfer.To.EXTERNAL); | ||
|
||
return LibRetire.getTotalRetirements(beneficiaryAddress); | ||
} | ||
|
@@ -138,9 +145,16 @@ contract RetireCarbonFacet is ReentrancyGuard { | |
retirementMessage | ||
); | ||
|
||
// Send any aggregator fees to treasury | ||
uint256 daoFee; | ||
uint256 treasuryFee; | ||
|
||
// Send any aggregator fees to treasury and the DAO wallet | ||
if (totalCarbon - redeemedPool > 0) | ||
LibTransfer.sendToken(IERC20(poolToken), totalCarbon - redeemedPool, C.treasury(), LibTransfer.To.EXTERNAL); | ||
|
||
daoFee = LibRetire.getFeeShareDAO(totalCarbon - redeemedPool); | ||
treasuryFee = totalCarbon - redeemedPool - daoFee; | ||
LibTransfer.sendToken(IERC20(poolToken), daoFee, C.dao(), LibTransfer.To.EXTERNAL); | ||
LibTransfer.sendToken(IERC20(poolToken), treasuryFee, C.treasury(), LibTransfer.To.EXTERNAL); | ||
|
||
return LibRetire.getTotalRetirements(beneficiaryAddress); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ contract DiamondInit { | |
|
||
// Retirement convenience fee | ||
s.fee = 1000; | ||
s.daoFeeShare = 80000; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should spin up a new init contract with only the changes and args needed for this diamond cut |
||
|
||
// Default BCT Swap setup | ||
s.swap[C.bct()][C.usdc()].swapDexes = [0]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a
feeDivisor
field and remove the magic numbers from the libraries?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, definitely, I was thinking that as well as I was typing it in. I'll add it.