new deployment scripts

This commit is contained in:
JulesCrown 2024-09-17 15:48:59 +02:00
parent 18a57c0ead
commit b4dfb03590
5 changed files with 54 additions and 31 deletions

View file

@ -89,6 +89,8 @@ contract Stake {
/// @dev Internal function to calculate and pay taxes for a position, adjusting shares and handling position liquidation if necessary.
function _payTax(uint256 positionId, StakingPosition storage pos, uint256 taxFloorDuration) private {
// TODO: check if position exits
require(pos.share > 0, "position not found");
// ihet = Implied Holding Expiry Timestamp
uint256 ihet = (block.timestamp - pos.creationTime < taxFloorDuration)
? pos.creationTime + taxFloorDuration
@ -101,6 +103,7 @@ contract Stake {
taxAmountDue = assetsBefore;
}
if (assetsBefore - taxAmountDue > 0) {
require(taxAmountDue > 10**18, "taxAmountDue not worth it");
// if something left over, update storage
uint256 shareAfterTax = assetsToShares(assetsBefore - taxAmountDue);
outstandingStake -= pos.share - shareAfterTax;