diff --git a/abiniser/deployments/1/LoanManager_DEPLOYS.json b/abiniser/deployments/1/LoanManager_DEPLOYS.json index 591f5585..672614da 100644 --- a/abiniser/deployments/1/LoanManager_DEPLOYS.json +++ b/abiniser/deployments/1/LoanManager_DEPLOYS.json @@ -1,6 +1,6 @@ { "contractName": "LoanManager", - "latestAbiHash": "fdf5fde95aa940c6dbfb8353c572c5fb", + "latestAbiHash": "753a73f4b2140507197a8f80bff47b40", "deployedAbis": { "ec709c3341045caa3a75374b8cfc7286": { "latestDeployedAddress": "0xcbefaf199b800deeb9ead61f358ee46e06c54070", @@ -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" + } + } } } } \ No newline at end of file diff --git a/contracts/SB_scripts/mainnet/Main0029_setup_loanmanager_permissions.sol b/contracts/SB_scripts/mainnet/Main0029_setup_loanmanager_permissions.sol new file mode 100644 index 00000000..2d28516d --- /dev/null +++ b/contracts/SB_scripts/mainnet/Main0029_setup_loanmanager_permissions.sol @@ -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"); + } +} \ No newline at end of file diff --git a/contracts/SB_scripts/mainnet/Main0030_setup_loanmanager_products.sol b/contracts/SB_scripts/mainnet/Main0030_setup_loanmanager_products.sol new file mode 100644 index 00000000..ba275220 --- /dev/null +++ b/contracts/SB_scripts/mainnet/Main0030_setup_loanmanager_products.sol @@ -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); + } +} \ No newline at end of file diff --git a/mainnet_migrations/41_deploy_LoanManager.js b/mainnet_migrations/41_deploy_LoanManager.js new file mode 100644 index 00000000..30c19448 --- /dev/null +++ b/mainnet_migrations/41_deploy_LoanManager.js @@ -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); + }); +}; \ No newline at end of file diff --git a/mainnet_migrations/42_deploy_Main0029.js b/mainnet_migrations/42_deploy_Main0029.js new file mode 100644 index 00000000..0d695c33 --- /dev/null +++ b/mainnet_migrations/42_deploy_Main0029.js @@ -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); + }); +}; \ No newline at end of file diff --git a/mainnet_migrations/43_deploy_Main0030.js b/mainnet_migrations/43_deploy_Main0030.js new file mode 100644 index 00000000..9c633b8e --- /dev/null +++ b/mainnet_migrations/43_deploy_Main0030.js @@ -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); + }); +}; \ No newline at end of file diff --git a/package.json b/package.json index 1ca3f8d5..cd4cc792 100644 --- a/package.json +++ b/package.json @@ -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",