diff --git a/src/DefaultEmissionManager.sol b/src/DefaultEmissionManager.sol index bc4e9cf..de18ff2 100644 --- a/src/DefaultEmissionManager.sol +++ b/src/DefaultEmissionManager.sol @@ -77,12 +77,10 @@ contract DefaultEmissionManager is Ownable2StepUpgradeable, IDefaultEmissionMana emit TokenMint(amountToMint, msg.sender); IPolygonEcosystemToken _token = token; - _token.mint(address(this), amountToMint); - _token.safeTransfer(treasury, treasuryAmt); - - _token.safeTransfer(stakeManager, stakeManagerAmt); + // backconvert POL to MATIC before sending to StakeManager + migration.unmigrateTo(stakeManager, stakeManagerAmt); } /// @inheritdoc IDefaultEmissionManager diff --git a/test/DefaultEmissionManager.t.sol b/test/DefaultEmissionManager.t.sol index 20081ac..7a5fd59 100644 --- a/test/DefaultEmissionManager.t.sol +++ b/test/DefaultEmissionManager.t.sol @@ -127,6 +127,7 @@ 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); } @@ -146,7 +147,7 @@ contract DefaultEmissionManagerTest is Test { assertApproxEqAbs(newSupply, polygon.totalSupply(), _MAX_PRECISION_DELTA); uint256 totalAmtMinted = polygon.totalSupply() - initialTotalSupply; uint256 totalAmtMintedTwoFifth = totalAmtMinted * 2 / 5; - assertEq(polygon.balanceOf(stakeManager), totalAmtMinted - totalAmtMintedTwoFifth); + assertEq(matic.balanceOf(stakeManager), totalAmtMinted - totalAmtMintedTwoFifth); assertEq(polygon.balanceOf(treasury), totalAmtMintedTwoFifth); } @@ -166,7 +167,8 @@ contract DefaultEmissionManagerTest is Test { assertApproxEqAbs(newSupply, polygon.totalSupply(), _MAX_PRECISION_DELTA); uint256 balance = (polygon.totalSupply() - initialTotalSupply) * 2 / 5; uint256 stakeManagerBalance = (polygon.totalSupply() - initialTotalSupply) - balance; - assertEq(polygon.balanceOf(stakeManager), stakeManagerBalance); + assertEq(matic.balanceOf(stakeManager), stakeManagerBalance); + assertEq(polygon.balanceOf(stakeManager), 0); assertEq(polygon.balanceOf(treasury), balance); skip(delay); @@ -183,7 +185,8 @@ contract DefaultEmissionManagerTest is Test { balance = totalAmtMintedTwoFifth; stakeManagerBalance = totalAmtMinted - totalAmtMintedTwoFifth; - assertEq(polygon.balanceOf(stakeManager), stakeManagerBalance); + assertEq(matic.balanceOf(stakeManager), stakeManagerBalance); + assertEq(polygon.balanceOf(stakeManager), 0); assertEq(polygon.balanceOf(treasury), balance); } @@ -210,7 +213,8 @@ contract DefaultEmissionManagerTest is Test { balance = totalAmtMintedTwoFifth; stakeManagerBalance = totalAmtMinted - totalAmtMintedTwoFifth; - assertEq(polygon.balanceOf(stakeManager), stakeManagerBalance); + assertEq(matic.balanceOf(stakeManager), stakeManagerBalance); + assertEq(polygon.balanceOf(stakeManager), 0); assertEq(polygon.balanceOf(treasury), balance); } }