Skip to content

Commit

Permalink
convert old tokens in sb proxy and transfer the new tokens back
Browse files Browse the repository at this point in the history
  • Loading branch information
treerz committed May 21, 2019
1 parent b24ae03 commit 59babc6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions contracts/SB_scripts/mainnet/Main0027_migrate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "../../TokenAEur.sol";
import "../../AugmintReserves.sol";
import "../../InterestEarnedAccount.sol";
import "../../FeeAccount.sol";
import "../../MonetarySupervisor.sol";
import "../../generic/SystemAccount.sol";

contract Main0027_migrate {
Expand All @@ -25,22 +26,34 @@ contract Main0027_migrate {
FeeAccount public constant OLD_FEE_ACCOUNT = FeeAccount(0xF6B541E1B5e001DCc11827C1A16232759aeA730a);
FeeAccount public constant NEW_FEE_ACCOUNT = FeeAccount(0xE3ED84A163b9EeaF4f69B4890ae45cC52171Aa7E);

address public constant ADDRESS = 0xd97500098672F2636902E41D3928706C27470DF7;
MonetarySupervisor public constant OLD_MONETARY_SUPERVISOR = MonetarySupervisor(0x1Ca4F9d261707aF8A856020a4909B777da218868);
MonetarySupervisor public constant NEW_MONETARY_SUPERVISOR = MonetarySupervisor(0x27484AFe9e6c332fB07F21Fac82d442EBe1D22c3);

function execute(Main0027_migrate /* self, not used */) external {
// called via StabilityBoardProxy
require(address(this) == address(STABILITY_BOARD_PROXY), "only execute via StabilityBoardProxy");

// ===========================
// migrate ETH to new reserve
// ===========================

// function withdraw(AugmintToken tokenAddress, address to, uint tokenAmount, uint weiAmount, string narrative)
OLD_AUGMINT_RESERVES.withdraw(NEW_TOKEN_AEUR, address(NEW_AUGMINT_RESERVES), 0, address(OLD_AUGMINT_RESERVES).balance, "migration");

// migrate old token from new interestearnedaccount
// ==================================================
// convert old tokens in new interestearnedaccount
// ==================================================

OLD_TOKEN_AEUR.grantPermission(STABILITY_BOARD_PROXY, "MonetarySupervisor");
OLD_FEE_ACCOUNT.grantPermission(NEW_INTEREST_EARNED_ACCOUNT, "NoTransferFee");

uint amount = OLD_TOKEN_AEUR.balanceOf(NEW_INTEREST_EARNED_ACCOUNT);
// function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)
NEW_INTEREST_EARNED_ACCOUNT.transferInterest(OLD_TOKEN_AEUR, ADDRESS, OLD_TOKEN_AEUR.balanceOf(NEW_INTEREST_EARNED_ACCOUNT));
NEW_INTEREST_EARNED_ACCOUNT.transferInterest(OLD_TOKEN_AEUR, STABILITY_BOARD_PROXY, amount);
//function transferAndNotify(TokenReceiver target, uint amount, uint data) external {
OLD_TOKEN_AEUR.transferAndNotify(NEW_MONETARY_SUPERVISOR, amount, 0);
// function transfer(address to, uint256 amount) external returns (bool) {
NEW_TOKEN_AEUR.transfer(NEW_INTEREST_EARNED_ACCOUNT, amount);

OLD_FEE_ACCOUNT.revokePermission(NEW_INTEREST_EARNED_ACCOUNT, "NoTransferFee");
OLD_TOKEN_AEUR.revokePermission(STABILITY_BOARD_PROXY, "MonetarySupervisor");
Expand Down

0 comments on commit 59babc6

Please sign in to comment.