-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #226 from Augmint/staging
release v1.0.12
- Loading branch information
Showing
9 changed files
with
203 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
contracts/SB_scripts/mainnet/Main0025_recreateLoanProducts.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Recreate loan products on mainnet (fix for discountRate rounding error) */ | ||
|
||
pragma solidity 0.4.24; | ||
|
||
import "../../StabilityBoardProxy.sol"; | ||
import "../../LoanManager.sol"; | ||
|
||
contract Main0025_recreateLoanProducts { | ||
|
||
StabilityBoardProxy public constant STABILITY_BOARD_PROXY = StabilityBoardProxy(0xde36a8773531406dCBefFdfd3C7b89fCed7A9F84); | ||
LoanManager public constant LOAN_MANAGER = LoanManager(0x1cABc34618ecf2949F0405A86353e7705E01C38b); | ||
|
||
function execute(Main0025_recreateLoanProducts /* self, not used */) external { | ||
// called via StabilityBoardProxy | ||
require(address(this) == address(STABILITY_BOARD_PROXY), "only execute via StabilityBoardProxy"); | ||
|
||
|
||
/****************************************************************************** | ||
* Disable current loan products | ||
******************************************************************************/ | ||
|
||
LOAN_MANAGER.setLoanProductActiveState(1, false); | ||
LOAN_MANAGER.setLoanProductActiveState(2, false); | ||
LOAN_MANAGER.setLoanProductActiveState(3, false); | ||
LOAN_MANAGER.setLoanProductActiveState(4, false); | ||
LOAN_MANAGER.setLoanProductActiveState(5, false); | ||
|
||
|
||
/****************************************************************************** | ||
* Add new loan products | ||
******************************************************************************/ | ||
|
||
// Formulas used for conversion: | ||
|
||
// IRPA: Interest Rate Per Annum : the percentage value on the UI | ||
// LPDR: Loan Product Discount Rate : uint32 discountRate constructor parameter | ||
|
||
// IRPA = (1_000_000 / LPDR - 1) * (365 / termInDays) | ||
// LPDR = 1_000_000 / (IRPA * termInDays / 365 + 1) | ||
|
||
// discountRates: | ||
// [180, 90, 30, 14, 7].map(termInDays => Math.ceil(1000000 / (0.049 * termInDays / 365 + 1))) | ||
// [976406, 988063, 995989, 998125, 999062] | ||
|
||
// addLoanProduct: | ||
// term, discountRate, collateralRatio, minDisbursedAmount, defaultingFeePt, isActive | ||
|
||
LOAN_MANAGER.addLoanProduct(180 days, 976406, 600000, 800, 100000, true); // 4.9% p.a. | ||
LOAN_MANAGER.addLoanProduct(90 days, 988063, 600000, 800, 100000, true); // 4.9% p.a. | ||
LOAN_MANAGER.addLoanProduct(30 days, 995989, 600000, 800, 100000, true); // 4.9% p.a. | ||
LOAN_MANAGER.addLoanProduct(14 days, 998125, 600000, 800, 100000, true); // 4.9% p.a. | ||
LOAN_MANAGER.addLoanProduct(7 days, 999062, 600000, 800, 100000, true); // 4.9% p.a. | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
mainnet_migrations/37_deploy_Main0025_recreateLoanProducts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const Main0025_recreateLoanProducts = artifacts.require("./Main0025_recreateLoanProducts.sol"); | ||
|
||
module.exports = function(deployer) { | ||
deployer.then(async () => { | ||
await deployer.deploy(Main0025_recreateLoanProducts); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.