-
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.
deploy a set of legacy contracts for local testing new augminTokens
- Loading branch information
1 parent
d35e1f7
commit 22ead4e
Showing
3 changed files
with
77 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,77 @@ | ||
/* deploy a legacy augmintToken, Locker, LoanManager & Exchange contracts | ||
with test loans , locks & orders for local manual testing */ | ||
const FeeAccount = artifacts.require("./FeeAccount.sol"); | ||
const TokenAEur = artifacts.require("./TokenAEur.sol"); | ||
const Rates = artifacts.require("./Rates.sol"); | ||
const MonetarySupervisor = artifacts.require("./MonetarySupervisor.sol"); | ||
const Locker = artifacts.require("./Locker.sol"); | ||
const LoanManager = artifacts.require("./LoanManager.sol"); | ||
const Exchange = artifacts.require("./Exchange.sol"); | ||
|
||
module.exports = async function(deployer, network, accounts) { | ||
deployer.then(async () => { | ||
const monetarySupervisor = MonetarySupervisor.at(MonetarySupervisor.address); | ||
const feeAccount = FeeAccount.at(FeeAccount.address); | ||
|
||
const oldToken = await TokenAEur.new(FeeAccount.address); | ||
|
||
const [oldLocker, oldLoanManager, oldExchange] = await Promise.all([ | ||
Locker.new(oldToken.address, MonetarySupervisor.address), | ||
LoanManager.new(oldToken.address, MonetarySupervisor.address, Rates.address), | ||
Exchange.new(oldToken.address, Rates.address) | ||
]); | ||
|
||
console.log("create"); | ||
await Promise.all([ | ||
oldToken.grantPermission(MonetarySupervisor.address, "MonetarySupervisorContract"), | ||
|
||
monetarySupervisor.setAcceptedLegacyAugmintToken(oldToken.address, true), | ||
|
||
oldToken.grantPermission(accounts[0], "MonetarySupervisorContract"), // "hack" for test to issue | ||
|
||
/* Locker permissions & products */ | ||
oldLocker.grantPermission(accounts[0], "MonetaryBoard"), | ||
monetarySupervisor.grantPermission(oldLocker.address, "LockerContracts"), | ||
feeAccount.grantPermission(oldLocker.address, "NoFeeTransferContracts"), | ||
oldLocker.addLockProduct(80001, 31536000, 1000, true), // 365 days, 8% p.a. | ||
oldLocker.addLockProduct(1, 60, 1000, true), // 1 minute for testing, ~69.15% p.a. | ||
|
||
/* LoanManager permissions & products */ | ||
oldLoanManager.grantPermission(accounts[0], "MonetaryBoard"), | ||
monetarySupervisor.grantPermission(oldLoanManager.address, "LoanManagerContracts"), | ||
feeAccount.grantPermission(oldLoanManager.address, "NoFeeTransferContracts"), | ||
oldLoanManager.addLoanProduct(1, 999999, 990000, 1000, 50000, true), // defaults in 1 secs for testing ? p.a. | ||
oldLoanManager.addLoanProduct(3600, 999989, 980000, 1000, 50000, true), // due in 1hr for testing repayments ? p.a. | ||
oldLoanManager.addLoanProduct(31536000, 860000, 550000, 1000, 50000, true), // 365d, 14% p.a. | ||
|
||
/* Exchange permissions */ | ||
feeAccount.grantPermission(oldExchange.address, "NoFeeTransferContracts"), | ||
oldExchange.grantPermission(accounts[0], "MonetaryBoard") | ||
]); | ||
console.log("grants"); | ||
|
||
await oldToken.issueTo(accounts[0], 20000); // issue some to account 0 | ||
console.log("issued"); | ||
await Promise.all([ | ||
oldToken.transferAndNotify(oldLocker.address, 1500, 0), | ||
oldToken.transferAndNotify(oldLocker.address, 1600, 1), | ||
|
||
oldLoanManager.newEthBackedLoan(0, { value: web3.toWei(0.1) }), | ||
oldLoanManager.newEthBackedLoan(1, { value: web3.toWei(0.11) }), | ||
oldLoanManager.newEthBackedLoan(2, { value: web3.toWei(0.12) }), | ||
|
||
oldToken.transferAndNotify(oldExchange.address, 2000, 1010000), | ||
oldToken.transferAndNotify(oldExchange.address, 1100, 980000), | ||
oldExchange.placeBuyTokenOrder(990000, { value: web3.toWei(0.01) }), | ||
oldExchange.placeBuyTokenOrder(1020000, { value: web3.toWei(0.011) }) | ||
]); | ||
|
||
console.log( | ||
` *** On local ganache - deployed a set of legacy mock contracts for manual testing: | ||
TokenAEur: ${oldToken.address} | ||
Locker: ${oldLocker.address} | ||
LoanManager: ${oldLoanManager.address} | ||
Exchange: ${oldExchange.address}` | ||
); | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.