-
Notifications
You must be signed in to change notification settings - Fork 23
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
fea: add psm #104
fea: add psm #104
Conversation
ff78a68
to
96a5dc8
Compare
ef38c13
to
e6a0b1d
Compare
519ab06
to
fbc04ed
Compare
Every PR should have some description |
contracts/psm/LisUSDPool.sol
Outdated
require( | ||
(amount > totalWeights && costWeight == totalWeights) || | ||
(amount <= totalWeights && costWeight == amount), | ||
"pool weight should be used first" |
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.
what does this error mean?
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.
When withdrawing lisUSD, users should use the stablecoin amout first.
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.
in which case, amount > totalWeights could be true?
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.
when interest accrues
contracts/psm/LisUSDPool.sol
Outdated
if (lastUpdate == block.timestamp) { | ||
return rate; | ||
} | ||
return hMath.rmul(hMath.rpow(duty, block.timestamp - lastUpdate, hMath.ONE), rate); |
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.
how much gas fee does this calculation cost?
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.
20K / 1 days
22k / 365 days
contracts/psm/VaultManager.sol
Outdated
} | ||
|
||
// withdraw token from adapters | ||
for (uint256 i = 0; i < adapters.length; i++) { |
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.
is it better to withdraw multiple source to the VaultMgr first, and then send to user as one shot?
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.
This will reduce the gas of a transfer
87ee9fc
to
7d636c7
Compare
// token => psm | ||
mapping(address => address) public psm; | ||
|
||
address public lisUSDPool; // lisUSD pool address |
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.
If these are not to be updated, then you can make them immutable?
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.
may be updated
|
||
name = "lisUSD Single Staking Pool"; | ||
symbol = "sLisUSD"; | ||
maxDuty = _maxDuty; |
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.
Probably set a upper limit and lowe limit for "maxDuty", so setting should be in range. @ricklista
|
||
contract VaultManager is ReentrancyGuardUpgradeable, AccessControlUpgradeable, UUPSUpgradeable { | ||
using SafeERC20 for IERC20; | ||
address public psm; // PSM address |
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.
Is this token address and token under PSM contract, both will be same? @ricklista
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.
yes
for (uint256 i = 0; i < adapters.length; i++) { | ||
IAdapter(adapters[i].adapter).withdrawAll(); | ||
} | ||
uint256 amount = IERC20(token).balanceOf(address(this)); |
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.
You can do a amount difference here, to avoid any accidental tokens already being on contract.
Check before balance, then withdraw all, then check after balance and finally distribute.
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.
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.
VaultManager may have some tokens.
…s into psm-fix-1.0
Psm audit fix 1.0
fix: blocksec and salus audit fix
chore: update psm deploy scripts
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.
LGTM
No description provided.