Skip to content
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

Scripts (migrate, convert) #228

Merged
merged 5 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions contracts/SB_scripts/mainnet/Main0027_migrate.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* Migrate stuff */

pragma solidity 0.4.24;

import "../../StabilityBoardProxy.sol";
import "../../TokenAEur.sol";
import "../../AugmintReserves.sol";
import "../../InterestEarnedAccount.sol";
import "../../FeeAccount.sol";
import "../../MonetarySupervisor.sol";
import "../../generic/SystemAccount.sol";

contract Main0027_migrate {

StabilityBoardProxy public constant STABILITY_BOARD_PROXY = StabilityBoardProxy(0xde36a8773531406dCBefFdfd3C7b89fCed7A9F84);

TokenAEur public constant OLD_TOKEN_AEUR = TokenAEur(0x86A635EccEFFfA70Ff8A6DB29DA9C8DB288E40D0);
TokenAEur public constant NEW_TOKEN_AEUR = TokenAEur(0xc994a2dEb02543Db1f48688438b9903c4b305ce3);

SystemAccount public constant OLD_AUGMINT_RESERVES = SystemAccount(0x633cb544b2EF1bd9269B2111fD2B66fC05cd3477);
AugmintReserves public constant NEW_AUGMINT_RESERVES = AugmintReserves(0x65F30f8DD20c707C1938CcAd7416c7381E6eB9C8);

InterestEarnedAccount public constant OLD_INTEREST_EARNED_ACCOUNT = InterestEarnedAccount(0x5C1a44E07541203474D92BDD03f803ea74f6947c);
InterestEarnedAccount public constant NEW_INTEREST_EARNED_ACCOUNT = InterestEarnedAccount(0xf23e0AF0e41341127Bb4e7b203aebCA0185f9EbD);

FeeAccount public constant OLD_FEE_ACCOUNT = FeeAccount(0xF6B541E1B5e001DCc11827C1A16232759aeA730a);
FeeAccount public constant NEW_FEE_ACCOUNT = FeeAccount(0xE3ED84A163b9EeaF4f69B4890ae45cC52171Aa7E);

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");

// ==================================================
// 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, 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");
}
}
7 changes: 7 additions & 0 deletions mainnet_migrations/39_deploy_Main0027_migrate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Main0027 = artifacts.require("./Main0027_migrate.sol");

module.exports = function(deployer) {
deployer.then(async () => {
await deployer.deploy(Main0027);
});
};