Skip to content

Commit

Permalink
send POL to StakeManager
Browse files Browse the repository at this point in the history
  • Loading branch information
simonDos committed May 8, 2024
1 parent a0d98a8 commit 8b0a0b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/DefaultEmissionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ contract DefaultEmissionManager is Ownable2StepUpgradeable, IDefaultEmissionMana
emit TokenMint(amountToMint, msg.sender);

IPolygonEcosystemToken _token = token;

_token.mint(address(this), amountToMint);

_token.safeTransfer(treasury, treasuryAmt);
// backconvert POL to MATIC before sending to StakeManager
migration.unmigrateTo(stakeManager, stakeManagerAmt);

_token.safeTransfer(stakeManager, stakeManagerAmt);
}

/// @inheritdoc IDefaultEmissionManager
Expand Down
14 changes: 4 additions & 10 deletions test/DefaultEmissionManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ contract DefaultEmissionManagerTest is Test {
emissionManager.mint();
// timeElapsed is zero, so no minting
assertEq(polygon.balanceOf(stakeManager), 0);
assertEq(matic.balanceOf(stakeManager), 0);
assertEq(polygon.balanceOf(treasury), 0);
}

Expand All @@ -145,9 +144,7 @@ contract DefaultEmissionManagerTest is Test {
assertApproxEqAbs(newSupply, polygon.totalSupply(), _MAX_PRECISION_DELTA);
uint256 totalAmtMinted = polygon.totalSupply() - initialTotalSupply;
uint256 totalAmtMintedOneThird = totalAmtMinted / 3;
assertEq(matic.balanceOf(stakeManager), totalAmtMinted - totalAmtMintedOneThird);
assertEq(matic.balanceOf(treasury), 0);
assertEq(polygon.balanceOf(stakeManager), 0);
assertEq(polygon.balanceOf(stakeManager), totalAmtMinted - totalAmtMintedOneThird);
assertEq(polygon.balanceOf(treasury), totalAmtMintedOneThird);
}

Expand All @@ -166,8 +163,7 @@ contract DefaultEmissionManagerTest is Test {
assertApproxEqAbs(newSupply, polygon.totalSupply(), _MAX_PRECISION_DELTA);
uint256 balance = (polygon.totalSupply() - initialTotalSupply) / 3;
uint256 stakeManagerBalance = (polygon.totalSupply() - initialTotalSupply) - balance;
assertEq(matic.balanceOf(stakeManager), stakeManagerBalance);
assertEq(polygon.balanceOf(stakeManager), 0);
assertEq(polygon.balanceOf(stakeManager), stakeManagerBalance);
assertEq(polygon.balanceOf(treasury), balance);

initialTotalSupply = polygon.totalSupply(); // for the new run
Expand All @@ -185,8 +181,7 @@ contract DefaultEmissionManagerTest is Test {
balance += totalAmtMintedOneThird;
stakeManagerBalance += totalAmtMinted - totalAmtMintedOneThird;

assertEq(matic.balanceOf(stakeManager), stakeManagerBalance);
assertEq(polygon.balanceOf(stakeManager), 0);
assertEq(polygon.balanceOf(stakeManager), stakeManagerBalance);
assertEq(polygon.balanceOf(treasury), balance);
}

Expand All @@ -213,8 +208,7 @@ contract DefaultEmissionManagerTest is Test {
balance += totalAmtMintedOneThird;
stakeManagerBalance += totalAmtMinted - totalAmtMintedOneThird;

assertEq(matic.balanceOf(stakeManager), stakeManagerBalance);
assertEq(polygon.balanceOf(stakeManager), 0);
assertEq(polygon.balanceOf(stakeManager), stakeManagerBalance);
assertEq(polygon.balanceOf(treasury), balance);
}
}
Expand Down

0 comments on commit 8b0a0b6

Please sign in to comment.