Skip to content

Commit

Permalink
margin loanmanager mainnet deploy (#253)
Browse files Browse the repository at this point in the history
* scripts: deploy loanmanager
* scripts: loanmanager permission setup script
* abiniser: deployment info for mainnet loanmanager (manual)
* scripts: loanmanager product setup script
* bump package version to 1.1.1
  • Loading branch information
treerz authored and phraktle committed Sep 16, 2019
1 parent ddde04e commit 24f1b07
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 2 deletions.
19 changes: 18 additions & 1 deletion abiniser/deployments/1/LoanManager_DEPLOYS.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contractName": "LoanManager",
"latestAbiHash": "fdf5fde95aa940c6dbfb8353c572c5fb",
"latestAbiHash": "753a73f4b2140507197a8f80bff47b40",
"deployedAbis": {
"ec709c3341045caa3a75374b8cfc7286": {
"latestDeployedAddress": "0xcbefaf199b800deeb9ead61f358ee46e06c54070",
Expand Down Expand Up @@ -35,6 +35,23 @@
"sourceHash": "234fd5848af85ca2444c888fd6ba61aa"
}
}
},
"753a73f4b2140507197a8f80bff47b40": {
"latestDeployedAddress": "0xEb57c12b1E69b4d10b1eD7a33231d31b811464b7",
"deployments": {
"0xEb57c12b1E69b4d10b1eD7a33231d31b811464b7": {
"generatedAt": "2019-09-13T14:30:00.000Z",
"truffleContractFileUpdatedAt": "2019-09-13T14:30:00.000Z",
"deployTransactionHash": "0xb45487a7a400844d3ee9acff1975eb38229e996835cf9ddc79f6ebdb083afb61",
"compiler": {
"name": "solc",
"version": "0.4.24+commit.e67f0147.Emscripten.clang"
},
"bytecodeHash": "4408d1ad57d708e0d0664838e6f10136",
"deployedBytecodeHash": "05ee93b22e275d2ea639c2fcb1284dfa",
"sourceHash": "78a783ccd39197b8ac7ef2cb49cc243c"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Setup new margin loan manager permissions */

pragma solidity 0.4.24;

import "../../LoanManager.sol";
import "../../StabilityBoardProxy.sol";
import "../../FeeAccount.sol";
import "../../MonetarySupervisor.sol";

contract Main0029_setup_loanmanager_permissions {

StabilityBoardProxy public constant STABILITY_BOARD_PROXY = StabilityBoardProxy(0xde36a8773531406dCBefFdfd3C7b89fCed7A9F84);
LoanManager public constant LOAN_MANAGER = LoanManager(0xEb57c12b1E69b4d10b1eD7a33231d31b811464b7);

FeeAccount public constant FEE_ACCOUNT = FeeAccount(0xE3ED84A163b9EeaF4f69B4890ae45cC52171Aa7E);
MonetarySupervisor public constant MONETARY_SUPERVISOR = MonetarySupervisor(0x27484AFe9e6c332fB07F21Fac82d442EBe1D22c3);

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

// StabilityBoard permission
LOAN_MANAGER.grantPermission(address(STABILITY_BOARD_PROXY), "StabilityBoard");

// NoTransferFee permission
FEE_ACCOUNT.grantPermission(address(LOAN_MANAGER), "NoTransferFee");

// LoanManager permission
MONETARY_SUPERVISOR.grantPermission(address(LOAN_MANAGER), "LoanManager");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* Setup new margin loan manager products, disable old loanamnager products */

pragma solidity 0.4.24;

import "../../LoanManager.sol";
import "../../StabilityBoardProxy.sol";

contract Main0030_setup_loanmanager_products {

StabilityBoardProxy public constant STABILITY_BOARD_PROXY = StabilityBoardProxy(0xde36a8773531406dCBefFdfd3C7b89fCed7A9F84);
LoanManager public constant LOAN_MANAGER = LoanManager(0xEb57c12b1E69b4d10b1eD7a33231d31b811464b7);
LoanManager public constant OLD_LOAN_MANAGER = LoanManager(0x1cABc34618ecf2949F0405A86353e7705E01C38b);

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

/******************************************************************************
* Add loan products
******************************************************************************/
// term (in sec), discountRate, initialCollateralRatio (ppm), minDisbursedAmount (token),
// defaultingFeePt (ppm), isActive, minCollateralRatio (ppm)
// 4.9% => [976406, 988063, 995989, 998125, 999062]

LOAN_MANAGER.addLoanProduct(180 days, 976406, 1600000, 800, 100000, true, 1200000);
LOAN_MANAGER.addLoanProduct(90 days, 988063, 1600000, 800, 100000, true, 1200000);
LOAN_MANAGER.addLoanProduct(30 days, 995989, 1600000, 800, 100000, true, 1200000);
LOAN_MANAGER.addLoanProduct(14 days, 998125, 1600000, 800, 100000, true, 1200000);
LOAN_MANAGER.addLoanProduct(7 days, 999062, 1600000, 800, 100000, true, 1200000);


/******************************************************************************
* Disable previous loan products
******************************************************************************/

OLD_LOAN_MANAGER.setLoanProductActiveState(6, false);
OLD_LOAN_MANAGER.setLoanProductActiveState(7, false);
OLD_LOAN_MANAGER.setLoanProductActiveState(8, false);
OLD_LOAN_MANAGER.setLoanProductActiveState(9, false);
OLD_LOAN_MANAGER.setLoanProductActiveState(10, false);
}
}
13 changes: 13 additions & 0 deletions mainnet_migrations/41_deploy_LoanManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* deploy new (margin) LoanManager contract */
const LoanManager = artifacts.require("./LoanManager.sol");

const STABILITYBOARD_PROXY_ADDRESS = "0xde36a8773531406dCBefFdfd3C7b89fCed7A9F84";
const TOKENAEUR_ADDRESS = "0xc994a2dEb02543Db1f48688438b9903c4b305ce3";
const MONETARY_SUPERVISOR_ADDRESS = "0x27484AFe9e6c332fB07F21Fac82d442EBe1D22c3";
const RATES_ADDRESS = "0x4272dB2EB82068E898588C3D6e4B5D55c3848793";

module.exports = function(deployer) {
deployer.then(async () => {
await deployer.deploy(LoanManager, STABILITYBOARD_PROXY_ADDRESS, TOKENAEUR_ADDRESS, MONETARY_SUPERVISOR_ADDRESS, RATES_ADDRESS);
});
};
7 changes: 7 additions & 0 deletions mainnet_migrations/42_deploy_Main0029.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Main0029_setup_loanmanager_permissions = artifacts.require("./Main0029_setup_loanmanager_permissions.sol");

module.exports = function(deployer) {
deployer.then(async () => {
await deployer.deploy(Main0029_setup_loanmanager_permissions);
});
};
7 changes: 7 additions & 0 deletions mainnet_migrations/43_deploy_Main0030.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Main0030_setup_loanmanager_products = artifacts.require("./Main0030_setup_loanmanager_products.sol");

module.exports = function(deployer) {
deployer.then(async () => {
await deployer.deploy(Main0030_setup_loanmanager_products);
});
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@augmint/contracts",
"version": "1.1.0",
"version": "1.1.1",
"description": "Augmint Stable Tokens - Solidity contract's abi and deployment descriptors",
"author": "“Augmint”",
"homepage": "https://github.com/Augmint/augmint-contracts#readme",
Expand Down

0 comments on commit 24f1b07

Please sign in to comment.