From da88f8b80bb272fa4807a47312d4a5d33ca51434 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 17:04:19 +0100 Subject: [PATCH 01/46] rename matchMultipleOrdersTx to getMatchMultipleOrdersTx (and no async) --- src/MatchMaker/MatchMaker.js | 2 +- src/augmintjs/Exchange.Matching.test.js | 2 +- src/augmintjs/Exchange.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index 4aacbd9..2052383 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -118,7 +118,7 @@ class MatchMaker extends EventEmitter { ); if (matchingOrders.buyIds.length > 0) { - const matchMultipleOrdersTx = await this.exchange.matchMultipleOrdersTx( + const matchMultipleOrdersTx = this.exchange.getMatchMultipleOrdersTx( matchingOrders.buyIds, matchingOrders.sellIds ); diff --git a/src/augmintjs/Exchange.Matching.test.js b/src/augmintjs/Exchange.Matching.test.js index ceb27e0..d456548 100644 --- a/src/augmintjs/Exchange.Matching.test.js +++ b/src/augmintjs/Exchange.Matching.test.js @@ -3,7 +3,7 @@ const exchange = new (require("./Exchange.js"))(); const BigNumber = require("bignumber.js"); const { cost } = require("./gas.js"); -describe("matchMultipleOrdersTx", () => { +describe("getMatchMultipleOrdersTx", () => { it("should match orders on chain"); }); diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index 7a4936e..891afa0 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -5,7 +5,7 @@ Exchange contract class Methods: async getMatchingOrders(web3, exchangeInstance, bn_ethFiatRate, gasLimit) Fetches current OrderBook and returns as many matching orderIds as fits into the provided gas limit. - The returned orderids can be passed to matchMultipleOrdersTx + The returned orderids can be passed to getMatchMultipleOrdersTx Input: web3: an already connected web3 instance @@ -30,7 +30,7 @@ Methods: sellOrders: [{id, maker, direction, bn_amount (wtihout decimals), amount (in AEUR), bn_price (in PPM)}] } - matchMultipleOrdersTx(exchangeInstance, buyIds, sellIds) + getMatchMultipleOrdersTx(exchangeInstance, buyIds, sellIds) Returns a web3 transaction to match the passed buyIds and sellIds. Call .send() on the returned tx. Input: @@ -201,7 +201,7 @@ class Exchange extends Contract { return o1.price * dir > o2.price * dir || (o1.price === o2.price && o1.id > o2.id) ? 1 : -1; } - async matchMultipleOrdersTx(buyIds, sellIds) { + getMatchMultipleOrdersTx(buyIds, sellIds) { if (sellIds.length === 0 || sellIds.length !== buyIds.length) { throw new Error("invalid buyIds/sellIds recevied - no ids or the the params are not equal."); } From 079634a04799d03f0f7f18a5c36f754dd0f4ace1 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 18:28:15 +0100 Subject: [PATCH 02/46] new augmintjs Rates class --- src/MatchMaker/MatchMaker.js | 9 +--- src/RatesFeeder.js | 58 +++++++++------------ src/augmintjs/Exchange.js | 19 ++++--- src/augmintjs/Exchange.test.js | 2 +- src/augmintjs/Rates.js | 56 +++++++++++++++++++++ src/augmintjs/Rates.test.js | 92 ++++++++++++++++++++++++++++++++++ test/ratesfeeder.js | 64 ++++++++++------------- 7 files changed, 215 insertions(+), 85 deletions(-) create mode 100644 src/augmintjs/Rates.js create mode 100644 src/augmintjs/Rates.test.js diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index 2052383..21b91a7 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -7,9 +7,8 @@ emmitted events: require("src/augmintjs/helpers/env.js"); const log = require("src/augmintjs/helpers/log.js")("MatchMaker"); const EventEmitter = require("events"); -const BigNumber = require("bignumber.js"); const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); -const { constants } = require("src/augmintjs/constants.js"); + const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); const Exchange = require("src/augmintjs/Exchange.js"); @@ -106,11 +105,7 @@ class MatchMaker extends EventEmitter { } async _checkAndMatchOrders() { - const bn_ethFiatRate = new BigNumber( - (await this.exchange.ratesInstance.methods - .convertFromWei(this.web3.utils.asciiToHex(CCY), constants.ONE_ETH_IN_WEI.toString()) - .call()) / constants.DECIMALS_DIV - ); + const bn_ethFiatRate = await this.exchange.rates.getBnEthFiatRate(CCY); const matchingOrders = await this.exchange.getMatchingOrders( bn_ethFiatRate, diff --git a/src/RatesFeeder.js b/src/RatesFeeder.js index 83e465a..f051a1f 100644 --- a/src/RatesFeeder.js +++ b/src/RatesFeeder.js @@ -21,10 +21,11 @@ const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); const contractConnection = require("src/augmintjs/helpers/contractConnection.js"); const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); const TokenAEur = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); -const Rates = require("src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json"); +const Rates = require("src/augmintjs/Rates.js"); const { cost } = require("src/augmintjs/gas.js"); const CCY = "EUR"; // only EUR is suported by TickerProvider providers ATM +const LIVE_PRICE_DIFFERENCE_DECIMALS = 4; // rounding live price % difference to 2 decimals const median = values => { values.sort((a, b) => a - b); @@ -52,9 +53,8 @@ class RatesFeeder { this.web3 = ethereumConnection.web3; this.isInitialised = false; this.isStopping = false; - this.decimalsDiv = null; this.decimals = null; - this.augmintRatesInstance = null; + this.rates = null; this.augmintTokenInstance = null; this.checkTickerPriceTimer = null; this.account = null; @@ -73,13 +73,14 @@ class RatesFeeder { throw new Error("Invalid RATESFEEDER_ETHEREUM_ACCOUNT: " + this.account); } - [this.augmintRatesInstance, this.augmintTokenInstance] = await Promise.all([ - contractConnection.connectLatest(this.ethereumConnection, Rates), + this.rates = new Rates(); + + [, this.augmintTokenInstance] = await Promise.all([ + this.rates.connect(this.ethereumConnection), contractConnection.connectLatest(this.ethereumConnection, TokenAEur) ]); this.decimals = await this.augmintTokenInstance.methods.decimals().call(); - this.decimalsDiv = 10 ** this.decimals; // Schedule first check this.checkTickerPriceTimer = @@ -100,7 +101,7 @@ class RatesFeeder { RATESFEEDER_CHECK_TICKER_PRICE_INTERVAL: ${process.env.RATESFEEDER_CHECK_TICKER_PRICE_INTERVAL} Ticker providers: ${this.tickerNames} AugmintToken contract: ${this.augmintTokenInstance._address} - Rates contract: ${this.augmintRatesInstance._address}` + Rates contract: ${this.rates.address}` ); } @@ -122,19 +123,21 @@ class RatesFeeder { if (!(await this.ethereumConnection.isConnected())) { log.debug("checkTickerPrice() - Ethereum is not connected. Skipping Augmint price check. "); } else { - const currentAugmintRate = await this.getAugmintRate(CCY); + const currentAugmintRate = await this.rates.getAugmintRate(CCY); const livePrice = this.calculateAugmintPrice(this.tickers); const livePriceDifference = livePrice > 0 - ? Math.round( - (Math.abs(livePrice - currentAugmintRate.price) / currentAugmintRate.price) * 10000 - ) / 10000 + ? parseFloat( + (Math.abs(livePrice - currentAugmintRate.rate) / currentAugmintRate.rate).toFixed( + LIVE_PRICE_DIFFERENCE_DECIMALS + ) + ) : null; log.debug( ` checkTickerPrice() currentAugmintRate[${CCY}]: ${ - currentAugmintRate.price + currentAugmintRate.rate } livePrice: ${livePrice} livePriceDifference: ${(livePriceDifference * 100).toFixed(2)} %` ); @@ -191,35 +194,22 @@ class RatesFeeder { .filter(ticker => ticker.lastTicker && ticker.lastTicker.price > 0) .map(t => t.lastTicker.price); let augmintPrice = median(prices); - augmintPrice = Math.round(augmintPrice * this.decimalsDiv) / this.decimalsDiv; - return augmintPrice === 0 ? null : augmintPrice; - } + augmintPrice = parseFloat(augmintPrice.toFixed(this.decimals)); - async getAugmintRate(currency) { - const bytesCCY = this.web3.utils.asciiToHex(currency); - const storedRateInfo = await this.augmintRatesInstance.methods.rates(bytesCCY).call(); - return { - price: parseInt(storedRateInfo.rate) / this.decimalsDiv, - lastUpdated: new Date(parseInt(storedRateInfo.lastUpdated) * 1000) - }; + return augmintPrice === 0 ? null : augmintPrice; } /* Update price on chain. price provided rounded to AugmintToken.decimals first */ async updatePrice(currency, price) { try { - // Send data back contract on-chain - //process.stdout.write("Sending to the Augmint Contracts using Rates.setRate() ... "); // should be logged into a file - const bytes_ccy = this.web3.utils.asciiToHex(currency); - const priceToSend = Math.round(price * this.decimalsDiv); - - const setRateTx = this.augmintRatesInstance.methods.setRate(bytes_ccy, priceToSend); + const setRateTx = this.rates.getSetRateTx(currency, price); const encodedABI = setRateTx.encodeABI(); const txToSign = { from: this.account, - to: this.augmintRatesInstance._address, + to: this.rates.address, gas: cost.SET_RATE_GAS_LIMIT, data: encodedABI }; @@ -230,8 +220,8 @@ class RatesFeeder { ]); log.log( - `==> updatePrice() nonce: ${nonce} sending setRate(${currency}, ${priceToSend}). currentAugmintRate[${CCY}]: ${ - this.lastTickerCheckResult[CCY] ? this.lastTickerCheckResult[CCY].currentAugmintRate.price : "null" + `==> updatePrice() nonce: ${nonce} sending setRate(${currency}, ${price}). currentAugmintRate[${CCY}]: ${ + this.lastTickerCheckResult[CCY] ? this.lastTickerCheckResult[CCY].currentAugmintRate.rate : "null" } livePrice: ${this.lastTickerCheckResult[CCY] ? this.lastTickerCheckResult[CCY].livePrice : "null"}` ); @@ -253,7 +243,7 @@ class RatesFeeder { log.log( ` \u2713 updatePrice() nonce: ${nonce} txHash: ${ receipt.transactionHash - } confirmed: setRate(${currency}, ${priceToSend}) - received ${confirmationNumber} confirmations ` + } confirmed: setRate(${currency}, ${price}) - received ${confirmationNumber} confirmations ` ); } else { log.debug( @@ -273,7 +263,7 @@ class RatesFeeder { if (!receipt.status) { log.error(`updatePrice() ERROR. setRate failed, returned status: ${receipt.status} - augmintRatesInstance.setRate(${currency}, ${priceToSend}, {nonce: ${nonce}}) + rates.setRate(${currency}, ${price}, {nonce: ${nonce}}) receipt: ${JSON.stringify(receipt, 3, null)}`); } @@ -298,7 +288,7 @@ class RatesFeeder { const status = { isInitialised: this.isInitialised, account: this.account, - ratesContract: this.augmintRatesInstance ? this.augmintRatesInstance._address : "null", + ratesContract: this.rates ? this.rates.address : "null", augmintTokenContract: this.augmintTokenInstance ? this.augmintTokenInstance._address : "null", lastTickerCheckResult: this.lastTickerCheckResult }; diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index 891afa0..627e08b 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -51,14 +51,15 @@ const { cost } = require("./gas.js"); const { constants } = require("./constants.js"); const contractConnection = require("src/augmintjs/helpers/contractConnection.js"); const Contract = require("src/augmintjs/Contract.js"); +const Rates = require("src/augmintjs/Rates.js"); const ExchangeArtifact = require("src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json"); -const RatesArtifact = require("src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json"); + const AugmintTokenArtifact = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); class Exchange extends Contract { constructor() { super(); - this.ratesInstance = null; + this.rates = null; this.tokenInstance = null; } @@ -69,7 +70,8 @@ class Exchange extends Contract { exchangeAddress ); - this.ratesInstance = contractConnection.connectLatest(this.ethereumConnection, RatesArtifact); + this.rates = new Rates(); + await this.rates.connect(this.ethereumConnection); this.tokenInstance = contractConnection.connectLatest(this.ethereumConnection, AugmintTokenArtifact); const [tokenAddressAtExchange, ratesAddressAtExchange] = await Promise.all([ @@ -77,15 +79,20 @@ class Exchange extends Contract { this.instance.methods.rates().call() ]); - if (ratesAddressAtExchange !== this.ratesInstance._address) { + if (ratesAddressAtExchange !== this.rates.address) { throw new Error( - " Exchange: latest Rates contract deployment address with provided ABI doesn't match rates contract address at deployed Exchange contract's" + `Exchange: latest Rates contract deployment address ${ + this.rates.address + } for provided ABI doesn't match rates contract address ${ratesAddressAtExchange} at deployed Exchange contract` ); } + // TODO: replace instance reference with augmintToken.address when AugmintToken class is done if (tokenAddressAtExchange !== this.tokenInstance._address) { throw new Error( - " Exchange: latest AugmintToken contract deployment address with provided ABI doesn't match AugmintToken contract address at deployed Exchange contract's" + `Exchange: latest AugmintToken contract deployment address ${ + this.tokenInstance.options.address + } for provided ABI doesn't match AugmintToken contract address ${tokenAddressAtExchange} at deployed Exchange contract` ); } diff --git a/src/augmintjs/Exchange.test.js b/src/augmintjs/Exchange.test.js index fc40e1c..2657556 100644 --- a/src/augmintjs/Exchange.test.js +++ b/src/augmintjs/Exchange.test.js @@ -15,7 +15,7 @@ describe("connection", () => { assert.isNull(exchange.address); await exchange.connect(ethereumConnection); assert.equal(exchange.address, "0xFAceA53a04bEfCC6C9246eb3951814cfEE2A1415"); - assert.equal(exchange.ratesInstance._address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); // TODO when rates is a class: assert.equal(exchange.rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); + assert.equal(exchange.rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); assert.equal(exchange.tokenInstance._address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); // when augmintToken is a class: assert.equal(exchange.augmintToken.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); }); diff --git a/src/augmintjs/Rates.js b/src/augmintjs/Rates.js new file mode 100644 index 0000000..815a210 --- /dev/null +++ b/src/augmintjs/Rates.js @@ -0,0 +1,56 @@ +const BigNumber = require("bignumber.js"); +const { constants } = require("./constants.js"); +const Contract = require("src/augmintjs/Contract.js"); +const RatesArtifact = require("src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json"); + +class Rates extends Contract { + constructor() { + super(); + } + + async getBnEthFiatRate(currency) { + return new BigNumber( + (await this.instance.methods + .convertFromWei(this.web3.utils.asciiToHex(currency), constants.ONE_ETH_IN_WEI.toString()) + .call()) / constants.DECIMALS_DIV // // TODO: change to augmintToken.decimalsDiv + ); + } + + async getEthFiatRate(currency) { + return parseFloat((await this.getBnEthFiatRate(currency)).toString()); + } + + async getAugmintRate(currency) { + const bytesCCY = this.web3.utils.asciiToHex(currency); + const storedRateInfo = await this.instance.methods.rates(bytesCCY).call(); + return { + rate: parseInt(storedRateInfo.rate) / constants.DECIMALS_DIV, // TODO: change to augmintToken.decimalsDiv + lastUpdated: new Date(parseInt(storedRateInfo.lastUpdated) * 1000) + }; + } + + getSetRateTx(currency, price) { + const rateToSend = price * constants.DECIMALS_DIV; + if (Math.round(rateToSend) !== rateToSend) { + throw new Error( + ` getSetRateTx error: provided price of ${price} has more decimals than allowed by AugmintToken decimals of ${ + constants.DECIMALS + }` + ); + } + const bytesCCY = this.web3.utils.asciiToHex(currency); + const tx = this.instance.methods.setRate(bytesCCY, rateToSend); + + return tx; + } + + async connect(ethereumConnection, ratesAddress) { + return await super.connect( + ethereumConnection, + RatesArtifact, + ratesAddress + ); + } +} + +module.exports = Rates; diff --git a/src/augmintjs/Rates.test.js b/src/augmintjs/Rates.test.js new file mode 100644 index 0000000..ae0437d --- /dev/null +++ b/src/augmintjs/Rates.test.js @@ -0,0 +1,92 @@ +const { assert } = require("chai"); +const BigNumber = require("bignumber.js"); +const EthereumConnection = require("./EthereumConnection.js"); +const Rates = require("./Rates.js"); + +const { takeSnapshot, revertSnapshot } = require("src/augmintjs/testHelpers/ganache.js"); +const CCY = "EUR"; +const DECIMALS_DIV = 100; + +describe("Rates connection", () => { + const ethereumConnection = new EthereumConnection(); + const rates = new Rates(); + + it("should connect to latest contract", async () => { + await ethereumConnection.connect(); + + assert.isNull(rates.address); + await rates.connect(ethereumConnection); + assert.equal(rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); + }); + + it("should connect to legacy Rates contract"); +}); + +describe("Rates getters", () => { + const ethereumConnection = new EthereumConnection(); + const rates = new Rates(); + const EXPECTED_RATE = 213.14; + let snapshotId; + + before(async () => { + await ethereumConnection.connect(); + + snapshotId = await takeSnapshot(ethereumConnection.web3); + + await rates.connect(ethereumConnection); + const BYTES_CCY = ethereumConnection.web3.utils.asciiToHex(CCY); + + await rates.instance.methods.setRate(BYTES_CCY, EXPECTED_RATE * DECIMALS_DIV).send({ + from: ethereumConnection.accounts[0] + }); + }); + + after(async () => { + await revertSnapshot(ethereumConnection.web3, snapshotId); + }); + + it("getBnEthFiatRate", async () => { + const bnEthFiatRate = await rates.getBnEthFiatRate(CCY); + assert.deepEqual(bnEthFiatRate, new BigNumber(EXPECTED_RATE)); + }); + + it("getEthFiatRate", async () => { + const ethFiatRate = await rates.getEthFiatRate(CCY); + assert.equal(ethFiatRate, EXPECTED_RATE); + }); + + it("getBnEthFiatRate - invalid ccy"); + + it("getAugmintRate", async () => { + const augmintRate = await rates.getAugmintRate(CCY); + assert.equal(augmintRate.rate, EXPECTED_RATE); + assert.instanceOf(augmintRate.lastUpdated, Date); + }); + + it("getAugmintRate - invalid ccy"); +}); + +describe("Rates txs", () => { + const ethereumConnection = new EthereumConnection(); + const rates = new Rates(); + let snapshotId; + + before(async () => { + await ethereumConnection.connect(); + await rates.connect(ethereumConnection); + }); + + beforeEach(async () => { + snapshotId = await takeSnapshot(ethereumConnection.web3); + }); + + afterEach(async () => { + await revertSnapshot(ethereumConnection.web3, snapshotId); + }); + + it("setRate"); + + it("setRate - invalid ccy"); + + it("setRate - invalid price"); +}); diff --git a/test/ratesfeeder.js b/test/ratesfeeder.js index bfb4a7f..5505f14 100644 --- a/test/ratesfeeder.js +++ b/test/ratesfeeder.js @@ -83,7 +83,7 @@ describe("RatesFeeder: real exchange rate tests", () => { ]; const expectedPrice = 659.2; - const prevStoredRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); + const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); // test sanity checks: assert.notEqual(prevStoredRate.rate, expectedPrice); @@ -94,30 +94,27 @@ describe("RatesFeeder: real exchange rate tests", () => { await ratesFeeder.checkTickerPrice(); - await baseHelpers.assertEvent(ratesFeeder.augmintRatesInstance, "RateChanged", { + await baseHelpers.assertEvent(ratesFeeder.rates.instance, "RateChanged", { symbol: BYTES_CCY.padEnd(66, "0"), - newRate: (expectedPrice * ratesFeeder.decimalsDiv).toString() + newRate: (expectedPrice * 10 ** ratesFeeder.decimals).toString() }); - const newStoredRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); + const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePrice, expectedPrice); // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated // only after tx confirmation when checkTickerPrice called again) - assert.equal( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.price, - prevStoredRate.rate / ratesFeeder.decimalsDiv - ); - assert.equal( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated / 1000, + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); + assert.deepEqual( + new Date(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated), prevStoredRate.lastUpdated ); assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); - assert.equal(newStoredRate.rate, expectedPrice * ratesFeeder.decimalsDiv); + assert.equal(newStoredRate.rate, expectedPrice); ratesFeeder.tickers = origtickers; }); @@ -125,11 +122,10 @@ describe("RatesFeeder: real exchange rate tests", () => { it("ratesFeeder should NOT set the price on-chain from tickers when diff < threshold ", async () => { const origtickers = ratesFeeder.tickers; const expectedCheckedAt = new Date(); - const prevStoredRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); - const expectedLivePriceDifference = (process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT - 0.1) / 100; - const newLivePrice = parseFloat( - ((prevStoredRate.rate / ratesFeeder.decimalsDiv) * (1 + expectedLivePriceDifference)).toFixed(2) - ); + const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + + const expectedLivePriceDifference = process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT / 100 - 0.0001; + const newLivePrice = parseFloat((prevStoredRate.rate * (1 + expectedLivePriceDifference)).toFixed(2)); ratesFeeder.tickers = [ { name: "testTicker1", lastTicker: { price: newLivePrice, receivedAt: expectedCheckedAt }, getStatus }, @@ -139,7 +135,7 @@ describe("RatesFeeder: real exchange rate tests", () => { await ratesFeeder.checkTickerPrice(); - const newStoredRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); + const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); // events from previous tests are clashing with it - wether change helper funciotn or create and restore ganache snapshot after each test // await baseHelpers.assertNoEvents(ratesFeeder.augmintRatesInstance, "RateChanged"); @@ -148,12 +144,9 @@ describe("RatesFeeder: real exchange rate tests", () => { // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated // only after tx confirmation when checkTickerPrice called again) - assert.equal( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.price, - prevStoredRate.rate / ratesFeeder.decimalsDiv - ); - assert.equal( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated / 1000, + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); + assert.deepEqual( + ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated, prevStoredRate.lastUpdated ); @@ -161,7 +154,7 @@ describe("RatesFeeder: real exchange rate tests", () => { assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); assert.equal(newStoredRate.rate, prevStoredRate.rate); - assert.equal(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); + assert.deepEqual(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); ratesFeeder.tickers = origtickers; }); @@ -176,11 +169,11 @@ describe("RatesFeeder: real exchange rate tests", () => { { name: "testTicker3", lastTicker: { price: null, receivedAt: expectedCheckedAt }, getStatus } ]; - const prevStoredRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); + const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); await ratesFeeder.checkTickerPrice(); - const newStoredRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); + const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); // events from previous tests are clashing with it - wether change helper funciotn or create and restore ganache snapshot after each test // await baseHelpers.assertNoEvents(ratesFeeder.augmintRatesInstance, "RateChanged"); @@ -189,12 +182,9 @@ describe("RatesFeeder: real exchange rate tests", () => { // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated // only after tx confirmation when checkTickerPrice called again) - assert.equal( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.price, - prevStoredRate.rate / ratesFeeder.decimalsDiv - ); - assert.equal( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated / 1000, + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); + assert.deepEqual( + ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated, prevStoredRate.lastUpdated ); @@ -202,7 +192,7 @@ describe("RatesFeeder: real exchange rate tests", () => { assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); assert.equal(newStoredRate.rate, prevStoredRate.rate); - assert.equal(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); + assert.deepEqual(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); ratesFeeder.tickers = origtickers; }); @@ -212,14 +202,14 @@ describe("RatesFeeder: real exchange rate tests", () => { await ratesFeeder.updatePrice(CCY, price); - await baseHelpers.assertEvent(ratesFeeder.augmintRatesInstance, "RateChanged", { + await baseHelpers.assertEvent(ratesFeeder.rates.instance, "RateChanged", { symbol: BYTES_CCY.padEnd(66, "0"), - newRate: (price * ratesFeeder.decimalsDiv).toString() + newRate: (price * 10 ** ratesFeeder.decimals).toString() }); - const storedRate = await ratesFeeder.augmintRatesInstance.methods.rates(BYTES_CCY).call(); + const storedRate = await ratesFeeder.rates.getAugmintRate(CCY); - assert.equal(storedRate.rate, Math.round(price * ratesFeeder.decimalsDiv)); + assert.equal(storedRate.rate, price); }); it("should recover after web3 connection lost"); From 3eb49b3d377fa7851846bdf3c8ba7b2c62213baa Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 18:38:16 +0100 Subject: [PATCH 03/46] EthereumConnection props initial values + test --- src/augmintjs/EthereumConnection.js | 3 +++ src/augmintjs/EthereumConnection.test.js | 22 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/augmintjs/EthereumConnection.js b/src/augmintjs/EthereumConnection.js index 3cbb78e..8500da6 100644 --- a/src/augmintjs/EthereumConnection.js +++ b/src/augmintjs/EthereumConnection.js @@ -55,6 +55,9 @@ class EthereumConnection extends EventEmitter { this.networkId = null; this.blockGasLimit = null; + this.safeBlockGasLimit = null; + + this.accounts = null; this.CONNECTION_CHECK_INTERVAL = process.env.ETHEREUM_CONNECTION_CHECK_INTERVAL || DEFAULT_CONNECTION_CHECK_INTERVAL; diff --git a/src/augmintjs/EthereumConnection.test.js b/src/augmintjs/EthereumConnection.test.js index c22e376..d38a74e 100644 --- a/src/augmintjs/EthereumConnection.test.js +++ b/src/augmintjs/EthereumConnection.test.js @@ -1,10 +1,28 @@ const assert = require("chai").assert; const EthereumConnection = require("./EthereumConnection.js"); -const ethereumConnection = new EthereumConnection(); + const sinon = require("sinon"); describe("EthereumConnection", () => { + it("should have an initial state", async () => { + const ethereumConnection = new EthereumConnection(); + + assert.isNull(ethereumConnection.web3); + assert.isNull(ethereumConnection.provider); + + assert(!(await ethereumConnection.isConnected())); + assert(!ethereumConnection.isStopping); + assert(!ethereumConnection.isTryingToReconnect); + + assert.isNull(ethereumConnection.networkId); + assert.isNull(ethereumConnection.blockGasLimit); + assert.isNull(ethereumConnection.safeBlockGasLimit); + assert.isNull(ethereumConnection.accounts); + }); + it("should connect & disconnect (local)", async () => { + const ethereumConnection = new EthereumConnection(); + const connectedSpy = sinon.spy(); const disconnectedSpy = sinon.spy(); const connectionLostSpy = sinon.spy(); @@ -13,8 +31,6 @@ describe("EthereumConnection", () => { ethereumConnection.on("disconnected", disconnectedSpy); ethereumConnection.on("connectionLost", connectionLostSpy); - assert(!(await ethereumConnection.isConnected())); - await ethereumConnection.connect(); const expNetworkId = parseInt(await ethereumConnection.web3.eth.net.getId(), 10); From 7dcd016234ae09de90c4866431e665cd4afcafea Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 18:49:13 +0100 Subject: [PATCH 04/46] ethereumConnection getAccountNonce fx + test --- src/MatchMaker/MatchMaker.js | 2 +- src/RatesFeeder.js | 2 +- src/augmintjs/EthereumConnection.js | 4 ++++ src/augmintjs/EthereumConnection.test.js | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index 21b91a7..dcda4f3 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -129,7 +129,7 @@ class MatchMaker extends EventEmitter { const [signedTx, nonce] = await Promise.all([ this.web3.eth.accounts.signTransaction(txToSign, process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY), - this.web3.eth.getTransactionCount(this.account) + this.ethereumConnection.getAccountNonce(this.account) ]); log.log( diff --git a/src/RatesFeeder.js b/src/RatesFeeder.js index f051a1f..574c8f6 100644 --- a/src/RatesFeeder.js +++ b/src/RatesFeeder.js @@ -216,7 +216,7 @@ class RatesFeeder { const [signedTx, nonce] = await Promise.all([ this.web3.eth.accounts.signTransaction(txToSign, process.env.RATESFEEDER_ETHEREUM_PRIVATE_KEY), - this.web3.eth.getTransactionCount(this.account) + this.ethereumConnection.getAccountNonce(this.account) ]); log.log( diff --git a/src/augmintjs/EthereumConnection.js b/src/augmintjs/EthereumConnection.js index 8500da6..6d0bba2 100644 --- a/src/augmintjs/EthereumConnection.js +++ b/src/augmintjs/EthereumConnection.js @@ -94,6 +94,10 @@ class EthereumConnection extends EventEmitter { return result; } + async getAccountNonce(account) { + return await this.web3.eth.getTransactionCount(account); + } + async connect() { this.isStopping = false; diff --git a/src/augmintjs/EthereumConnection.test.js b/src/augmintjs/EthereumConnection.test.js index d38a74e..32a7031 100644 --- a/src/augmintjs/EthereumConnection.test.js +++ b/src/augmintjs/EthereumConnection.test.js @@ -61,5 +61,20 @@ describe("EthereumConnection", () => { sinon.assert.calledOnce(disconnectedSpy); }); + it("should return account nonce", async () => { + const ethereumConnection = new EthereumConnection(); + await ethereumConnection.connect(); + const expectedNonce = await ethereumConnection.web3.eth.getTransactionCount(ethereumConnection.accounts[0]); + + let nonce = await ethereumConnection.getAccountNonce(ethereumConnection.accounts[0]); + + assert.equal(nonce, expectedNonce); + + // with a zero nonce acc, assuming randomAcc has no tx-s from migration subscriptions + const randomAccount = "0x107af532e6f828da6fe79699123c9a5ea0123d16"; + nonce = await ethereumConnection.getAccountNonce(randomAccount); + assert.equal(nonce, 0); + }); + it("should reconnect after connection lost"); }); From 397e971cb8f07d6a39cc9708005f3e942ed45758 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 21:34:37 +0100 Subject: [PATCH 05/46] remove bnEthFiatRate param from getMatching orders (use current rates) --- src/MatchMaker/MatchMaker.js | 7 +------ src/augmintjs/Exchange.Matching.test.js | 2 +- src/augmintjs/Exchange.js | 13 +++++++++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index dcda4f3..f494f6f 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -105,12 +105,7 @@ class MatchMaker extends EventEmitter { } async _checkAndMatchOrders() { - const bn_ethFiatRate = await this.exchange.rates.getBnEthFiatRate(CCY); - - const matchingOrders = await this.exchange.getMatchingOrders( - bn_ethFiatRate, - this.ethereumConnection.safeBlockGasLimit - ); + const matchingOrders = await this.exchange.getMatchingOrders(this.ethereumConnection.safeBlockGasLimit); if (matchingOrders.buyIds.length > 0) { const matchMultipleOrdersTx = this.exchange.getMatchMultipleOrdersTx( diff --git a/src/augmintjs/Exchange.Matching.test.js b/src/augmintjs/Exchange.Matching.test.js index d456548..4e126f6 100644 --- a/src/augmintjs/Exchange.Matching.test.js +++ b/src/augmintjs/Exchange.Matching.test.js @@ -7,7 +7,7 @@ describe("getMatchMultipleOrdersTx", () => { it("should match orders on chain"); }); -describe("getMatchingOrders", () => { +describe("calculateMatchingOrders", () => { const ETHEUR_RATE = new BigNumber(500); const BN_ONE = new BigNumber(1); const GAS_LIMIT = Number.MAX_SAFE_INTEGER; diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index 627e08b..4622613 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -99,8 +99,17 @@ class Exchange extends Contract { return this.instance; } - async getMatchingOrders(bn_ethFiatRate, gasLimit) { - const orderBook = await this.fetchOrderBook(); + /** + * Fetches current OrderBook and returns as many matching orderIds (at current ETHFiat rate) + * as fits into the provided gas limit. + * The returned orderids can be passed to getMatchMultipleOrdersTx + * @param {number} gasLimit return as many matches as it fits to gasLimit based on gas cost estimate. + * @return {Promise} pairs of matching order id , ordered by execution sequence + { buyIds: [], sellIds: [], gasEstimate } + */ + async getMatchingOrders(gasLimit) { + const [orderBook, bn_ethFiatRate] = await Promise.all([this.fetchOrderBook(), this.rates.getBnEthFiatRate()]); + const matches = this.calculateMatchingOrders( orderBook.buyOrders, orderBook.sellOrders, From c1c9d5331e7ebb173ae0fc0bc5016164ecc24cd3 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 22:15:02 +0100 Subject: [PATCH 06/46] some comment to JSDoc format (first pass) --- src/augmintjs/Contract.js | 32 +++++----- src/augmintjs/EthereumConnection.js | 64 ++++++++++--------- src/augmintjs/Exchange.js | 97 ++++++++++------------------- 3 files changed, 82 insertions(+), 111 deletions(-) diff --git a/src/augmintjs/Contract.js b/src/augmintjs/Contract.js index c1b993b..eb607c4 100644 --- a/src/augmintjs/Contract.js +++ b/src/augmintjs/Contract.js @@ -1,23 +1,15 @@ -/**************** - Generic Contract super class - Methods: - connect(ethereumConnection, abiFile [, address]) - connects to latest deployment or if address provided then at that address - NB: connect by address is not implemented tyet - Input: - abiFile: abiniser generated JSON file - Returns: web3 contract instance - - Properties: - ethereumConnection: where the contract connected to - web3: === ethereumConnection.web3 - address: conected contract instance address - -****/ const contractConnection = require("src/augmintjs/helpers/contractConnection.js"); +/** + * Generic Contract super class + */ class Contract { constructor() { + /** + * @prop {object} ethereumConnection the EthereumConnection instance this contract instance is connected to + * @prop {object} web3 shorthand for ethereumConnection.web3 + * @prop {string} [address] Ethereum address of the contract instance + */ this.ethereumConnection = null; this.web3 = null; this.instance = null; @@ -27,6 +19,14 @@ class Contract { return this.instance ? this.instance._address : null; } + /** + * connects to latest deployment or if address provided then at that address + * NB: connect by address is not implemented tyet + * @param {object} ethereumConnection a connected EthereumConnection instance + * @param {string} abiFile path to the JSON abifile generated by abiniser + * @param {string} address contract address if y (not yet implemented) + * @return {Promise} the web3 contract instance + */ async connect(ethereumConnection, abiFile, address) { if (address) { throw new Error( diff --git a/src/augmintjs/EthereumConnection.js b/src/augmintjs/EthereumConnection.js index 6d0bba2..803979a 100644 --- a/src/augmintjs/EthereumConnection.js +++ b/src/augmintjs/EthereumConnection.js @@ -1,32 +1,3 @@ -/********************************************************************************* - Connect to Ethereum network via web3 - maintains connection state, network properties - reconnects in case of connection dropped. NB: each consumer has to resubscribe atm after reconnection (on "connected" event) - - usage: - ethereumConnection = new EthereumConnection(); - await ethereumConnection.connect().catch( e => {..} ) - - Methods: - async isConnected() ==> web3.eth.net.isListening() - - Emits: - connected(EthereumConnection) - disconnected(EthereumConnection, error, EthereumConnection) NB: it's only error code 1000, normal end - connectionLost(error, EthereumConnection) - - Properties: - web3 - provider (=== web3.currentProvider) - accounts: array of available accounts received from web3.eth.getAccounts(); - blockGasLimit - safeBlockGasLimit: as blockGasLimit read on startup and it can change later we provide a "safe" estimate - isTryingToReconnect - isStopping - when shutting down because stop() has been called (e.g. SIGTERM/SIGSTOP/SIGINT ) - - -********************************************************************************/ - require("src/augmintjs/helpers/env.js"); const log = require("src/augmintjs/helpers/log.js")("EthereumConnection"); const EventEmitter = require("events"); @@ -39,11 +10,33 @@ const CONNECTION_CLOSE_TIMEOUT = 10000; const ISLISTENING_TIMEOUT = 1000; // used at isConnected() for web3.eth.net.isListening() timeout. TODO: check if we still need with newer web3 or better way? const DEFAULT_CONNECTION_CHECK_INTERVAL = 10000; - +/** + * Connect to Ethereum network via web3 + * Maintains connection state, network properties + * Reconnects in case of connection dropped. NB: each consumer has to resubscribe atm after reconnection (on "connected" event) + * Usage: + * const ethereumConnection = new EthereumConnection(); + * await ethereumConnection.connect().catch( e => {..} ) + * @fires EthereumConnection#connected + * @fires EthereumConnection#disconnected NB: it's only in case of error code 1000, normal end + * @fires EthereumConnection#connectionLost + * @extends EventEmitter + */ class EthereumConnection extends EventEmitter { constructor() { super(); - + /** + * @namespace + * @prop {object} web3 web3.js object + * @prop {object} provider shorthand for web3.currentProvider + * @prop {boolean} isStopping indicates if the connection is being shut down (ie. via stop()) + * @prop {number} networkId + * @prop {array} accounts array of available accounts received from web3.eth.getAccounts() + * @prop {number} blockGasLimit the block gas limit when the connection was estabilished + * @prop {number} safeBlockGasLimit as blockGasLimit read on startup and it can change later so we provide a "safe" estimate which is 90% of the gasLimit + * @prop {boolean} isStopping true when shutting down because stop() has been called (e.g. SIGTERM/SIGSTOP/SIGINT + * @prop {boolean} isTryingToReconnect true while trying to reconnect because of connection loss detected + */ this.web3 = null; this.provider = null; @@ -81,6 +74,10 @@ class EthereumConnection extends EventEmitter { this.projectId = process.env.INFURA_PROJECT_ID || ""; } + /** + * Get connection state + * @return {Promise} result from web3.eth.net.isListening() + */ async isConnected() { let result = false; if (this.web3) { @@ -94,6 +91,11 @@ class EthereumConnection extends EventEmitter { return result; } + /** + * next nonce for the account + * @param {string} account Ethereum account with leading 0x + * @return {Promise} The result web3.eth.getTransactionCount(account) which is essentially the nonce for the next tx + */ async getAccountNonce(account) { return await this.web3.eth.getTransactionCount(account); } diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index 4622613..47f80ec 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -1,51 +1,3 @@ -/********************************************************************************** -Exchange contract class - - -Methods: - async getMatchingOrders(web3, exchangeInstance, bn_ethFiatRate, gasLimit) - Fetches current OrderBook and returns as many matching orderIds as fits into the provided gas limit. - The returned orderids can be passed to getMatchMultipleOrdersTx - - Input: - web3: an already connected web3 instance - exchangeInstance: a web3 Contract instance pointing to the Exchange contract - bn_ethFiatRate: - current ETHEUR rate in bignumber.js format - gasLimit: - return as many matches as it fits to gasLimit based on gas cost estimate. - - Returns: pairs of matching order id , ordered by execution sequence - { buyIds: [], sellIds: [], gasEstimate } - - async fetchOrderBook(web3, exchangeInstance) - Fetches, parses and orders the current, full orderBook from Exchange - - Input: - web3: an already connected web3js instance - exchangeInstance: a web3 Contract instance pointing to the Exchange contract - - Returns: the current, ordered orderBook in the format of: - { buyOrders: [{id, maker, direction, bn_amount (in Wei), bn_ethAmount, amount (in eth), bn_price (in PPM)], - sellOrders: [{id, maker, direction, bn_amount (wtihout decimals), amount (in AEUR), bn_price (in PPM)}] - } - - getMatchMultipleOrdersTx(exchangeInstance, buyIds, sellIds) - Returns a web3 transaction to match the passed buyIds and sellIds. Call .send() on the returned tx. - - Input: - exchangeInstance: a web3 Contract instance pointing to the Exchange contract - buyIds: array with a list of BUY order IDs (ordered) - sellIds: array with a list of SELL order IDs (ordered) - - Returns: web3 transaction which can be executed with .send({account, gas}) - - - isOrderBetter(o1, o2) - - calculateMatchingOrders(buyOrders, sellOrders, gasLimit) -*********************************************************************************/ - const BigNumber = require("bignumber.js"); const { cost } = require("./gas.js"); const { constants } = require("./constants.js"); @@ -56,6 +8,10 @@ const ExchangeArtifact = require("src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f const AugmintTokenArtifact = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); +/** + * Augmint Exchange contract class + * @extends Contract + */ class Exchange extends Contract { constructor() { super(); @@ -120,6 +76,12 @@ class Exchange extends Contract { return matches; } + /** + * Fetches, parses and orders the current, full orderBook from Exchange + * @return {Promise} the current, ordered orderBook in the format of: + * { buyOrders: [{id, maker, direction, bn_amount (in Wei), bn_ethAmount, amount (in eth), bn_price (in PPM)], + * sellOrders: [{id, maker, direction, bn_amount (wtihout decimals), amount (in AEUR), bn_price (in PPM)}] + */ async fetchOrderBook() { // TODO: handle when order changes while iterating const isLegacyExchangeContract = typeof this.instance.methods.CHUNK_SIZE === "function"; @@ -217,6 +179,21 @@ class Exchange extends Contract { return o1.price * dir > o2.price * dir || (o1.price === o2.price && o1.id > o2.id) ? 1 : -1; } + /** + * Returns a signed MatchMultiple transaction, ready to be sent with EthereumConnection.sendSignedTransaction + * @param {string} privateKey Private key of the Ethereum account to sign the tx with. Include leading 0x + * @param {array} buyIds a list of buy order id numners + * @param {array} sellIds list of matching sell order numbers + * @return {object} A web3 transaction object which can be sent using EthereumConnection.sendSignedTransaction + */ + getSignedMultipleOrdersTx(privateKey, buyIds, sellIds) {} + + /** + * Returns a web3 transaction to match the passed buyIds and sellIds. Call .send() on the returned tx. + * @param {array} buyIds array with a list of BUY order IDs (ordered) + * @param {array} sellIds array with a list of SELL order IDs (ordered) + * @return {object} web3 transaction which can be executed with .send({account, gas}) + */ getMatchMultipleOrdersTx(buyIds, sellIds) { if (sellIds.length === 0 || sellIds.length !== buyIds.length) { throw new Error("invalid buyIds/sellIds recevied - no ids or the the params are not equal."); @@ -227,22 +204,14 @@ class Exchange extends Contract { return tx; } - /********************************************************************************* -calculateMatchingOrders(_buyOrders, _sellOrders, bn_ethFiatRate, gasLimit) - returns matching pairs from ordered ordebook for sending in Exchange.matchMultipleOrders ethereum tx - input: - buyOrders[ { id, price, bn_ethAmount }] - must be ordered by price descending then by id ascending - sellOrders[ {id, price, amount }] - must be ordered by price ascending then by id ascending - bn_ethFiatRate: - current ETHEUR rate - gasLimit: - return as many matches as it fits to gasLimit based on gas cost estimate. - - returns: pairs of matching order id , ordered by execution sequence - { buyIds: [], sellIds: [], gasEstimate } -*********************************************************************************/ + /** + * calculate matching pairs from ordered ordebook for sending in Exchange.matchMultipleOrders ethereum tx + * @param {object} _buyOrders must be ordered by price descending then by id ascending + * @param {[type]} _sellOrders must be ordered by price ascending then by id ascending + * @param {[type]} bn_ethFiatRate current ETHFiat rate to use for calculation + * @param {[type]} gasLimit return as many matches as it fits to gasLimit based on gas cost estimate. + * @return {object} pairs of matching order id , ordered by execution sequence { buyIds: [], sellIds: [], gasEstimate } + */ calculateMatchingOrders(_buyOrders, _sellOrders, bn_ethFiatRate, gasLimit) { const sellIds = []; const buyIds = []; From b00e30661ce9019d779583c96cfb9b356537f3ea Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 22:40:54 +0100 Subject: [PATCH 07/46] [tests] ratesfeeder test split & simplified basehelpers --- test/RatesFeeder.onchain.js | 204 ++++++++++++++++++++++++++++++++++++ test/helpers/base.js | 32 ------ test/ratesfeeder.js | 193 ++-------------------------------- 3 files changed, 211 insertions(+), 218 deletions(-) create mode 100644 test/RatesFeeder.onchain.js diff --git a/test/RatesFeeder.onchain.js b/test/RatesFeeder.onchain.js new file mode 100644 index 0000000..9b58b59 --- /dev/null +++ b/test/RatesFeeder.onchain.js @@ -0,0 +1,204 @@ +/* test of RatesFeeder onchain transactions + */ +const assert = require("chai").assert; +const baseHelpers = require("./helpers/base.js"); +const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); +const ethereumConnection = new EthereumConnection(); +const RatesFeeder = require("src/RatesFeeder.js"); + +const CCY = "EUR"; +let BYTES_CCY; + +const getStatus = () => "tickerProvider mock getStatus for test"; + +let ratesFeeder; + +describe("RatesFeeder: onchain tests", () => { + before(async () => { + await ethereumConnection.connect(); + + ratesFeeder = new RatesFeeder(ethereumConnection, []); + + await ratesFeeder.init(); + + BYTES_CCY = ethereumConnection.web3.utils.asciiToHex(CCY); + }); + + it("ratesFeeder should set the price on-chain from tickers when diff > threshold ", async () => { + const origtickers = ratesFeeder.tickers; + const expectedCheckedAt = new Date(); + + ratesFeeder.tickers = [ + { + name: "testTicker1", + lastTicker: { lastTradePrice: 657.62, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + }, + { + name: "testTicker2", + lastTicker: { lastTradePrice: 659.52, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + }, + { + name: "testTicker3", + lastTicker: { lastTradePrice: 659.2, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + } + ]; + + const expectedPrice = 659.2; + const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + + // test sanity checks: + assert.notEqual(prevStoredRate.rate, expectedPrice); + assert( + (Math.abs(expectedPrice - prevStoredRate.rate) / prevStoredRate.rate) * 100 > + process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT + ); + + await ratesFeeder.checkTickerPrice(); + + await baseHelpers.assertEvent(ratesFeeder.rates.instance, "RateChanged", { + symbol: BYTES_CCY.padEnd(66, "0"), + newRate: (expectedPrice * 10 ** ratesFeeder.decimals).toString() + }); + + const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePrice, expectedPrice); + // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; + // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated + // only after tx confirmation when checkTickerPrice called again) + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); + assert.deepEqual( + new Date(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated), + prevStoredRate.lastUpdated + ); + + assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); + assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); + + assert.equal(newStoredRate.rate, expectedPrice); + + ratesFeeder.tickers = origtickers; + }); + + it("ratesFeeder should NOT set the price on-chain from tickers when diff < threshold ", async () => { + const origtickers = ratesFeeder.tickers; + const expectedCheckedAt = new Date(); + const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + + const expectedLivePriceDifference = process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT / 100 - 0.0001; + const newLivePrice = parseFloat((prevStoredRate.rate * (1 + expectedLivePriceDifference)).toFixed(2)); + + ratesFeeder.tickers = [ + { + name: "testTicker1", + lastTicker: { lastTradePrice: newLivePrice, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + }, + { + name: "testTicker2", + lastTicker: { lastTradePrice: newLivePrice, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + }, + { + name: "testTicker3", + lastTicker: { lastTradePrice: newLivePrice, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + } + ]; + + await ratesFeeder.checkTickerPrice(); + + const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + // events from previous tests are clashing with it - wether change helper funciotn or create and restore ganache snapshot after each test + // await baseHelpers.assertNoEvents(ratesFeeder.augmintRatesInstance, "RateChanged"); + + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePrice, newLivePrice); + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePriceDifference, expectedLivePriceDifference); + // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; + // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated + // only after tx confirmation when checkTickerPrice called again) + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); + assert.deepEqual( + ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated, + prevStoredRate.lastUpdated + ); + + assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); + assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); + + assert.equal(newStoredRate.rate, prevStoredRate.rate); + assert.deepEqual(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); + + ratesFeeder.tickers = origtickers; + }); + + it("ratesFeeder should NOT set the price on-chain from tickers when all tickers are down", async () => { + const origtickers = ratesFeeder.tickers; + const expectedCheckedAt = new Date(); + + ratesFeeder.tickers = [ + { + name: "testTicker1", + lastTicker: { lastTradePrice: null, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + }, + { + name: "testTicker2", + lastTicker: { lastTradePrice: 0, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + }, + { + name: "testTicker3", + lastTicker: { lastTradePrice: null, vwap: 13, receivedAt: expectedCheckedAt }, + getStatus + } + ]; + + const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + + await ratesFeeder.checkTickerPrice(); + + const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); + // events from previous tests are clashing with it - wether change helper funciotn or create and restore ganache snapshot after each test + // await baseHelpers.assertNoEvents(ratesFeeder.augmintRatesInstance, "RateChanged"); + + assert.isNull(ratesFeeder.lastTickerCheckResult[CCY].livePrice); + assert.isNull(ratesFeeder.lastTickerCheckResult[CCY].livePriceDifference); + // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; + // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated + // only after tx confirmation when checkTickerPrice called again) + assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); + assert.deepEqual( + ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated, + prevStoredRate.lastUpdated + ); + + assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); + assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); + + assert.equal(newStoredRate.rate, prevStoredRate.rate); + assert.deepEqual(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); + + ratesFeeder.tickers = origtickers; + }); + + it("set on-chain rate and should be the same", async () => { + const price = 213.14; + + await ratesFeeder.updatePrice(CCY, price); + + await baseHelpers.assertEvent(ratesFeeder.rates.instance, "RateChanged", { + symbol: BYTES_CCY.padEnd(66, "0"), + newRate: (price * 10 ** ratesFeeder.decimals).toString() + }); + + const storedRate = await ratesFeeder.rates.getAugmintRate(CCY); + + assert.equal(storedRate.rate, price); + }); + + it("should recover after web3 connection lost"); +}); diff --git a/test/helpers/base.js b/test/helpers/base.js index ae0f19b..d7da9b2 100644 --- a/test/helpers/base.js +++ b/test/helpers/base.js @@ -1,29 +1,7 @@ /* Generic test helper functions */ -const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); -const RatesFeeder = require("src/RatesFeeder.js"); -const ethereumConnection = new EthereumConnection(); -let ratesFeeder = null; - const assert = require("chai").assert; module.exports = { - get web3() { - return ethereumConnection.web3; - }, - ratesFeeder: async function() { - if (!(await ethereumConnection.isConnected())) { - await ethereumConnection.connect(); - } - - if (!ratesFeeder) { - ratesFeeder = new RatesFeeder(ethereumConnection, []); - } - - if (!ratesFeeder.isInitialised) { - await ratesFeeder.init(); - } - return ratesFeeder; - }, getEvents, assertEvent, assertNoEvents @@ -31,16 +9,6 @@ module.exports = { function getEvents(contractInstance, eventName) { return contractInstance.getPastEvents(eventName); - // console.log(contractInstance.events) - // return new Promise((resolve, reject) => { - // contractInstance.events[eventName]().get((err, res) => { - // if (err) { - // return reject(err); - // } - // - // resolve(res); - // }); - // }); } async function assertEvent(contractInstance, eventName, _expectedArgs) { diff --git a/test/ratesfeeder.js b/test/ratesfeeder.js index b8637c7..8a58eb8 100644 --- a/test/ratesfeeder.js +++ b/test/ratesfeeder.js @@ -1,10 +1,9 @@ /* test of RatesFeeder with mocked ratesProviders */ const assert = require("chai").assert; -const baseHelpers = require("./helpers/base.js"); - -const CCY = "EUR"; -let BYTES_CCY; +const RatesFeeder = require("src/RatesFeeder.js"); +const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); +const ethereumConnection = new EthereumConnection(); const getStatus = () => "tickerProvider mock getStatus for test"; @@ -12,9 +11,9 @@ let ratesFeeder; describe("RatesFeeder: real exchange rate tests", () => { before(async () => { - ratesFeeder = await baseHelpers.ratesFeeder(); - - BYTES_CCY = baseHelpers.web3.utils.asciiToHex(CCY); + await ethereumConnection.connect(); + ratesFeeder = new RatesFeeder(ethereumConnection, []); + await ratesFeeder.init(); }); it("ratesFeeder should return the median price of all tickers", () => { @@ -65,7 +64,7 @@ describe("RatesFeeder: real exchange rate tests", () => { assert.equal(price, expectedPrice); }); - it("ratesFeeder should return null median price when all tickers null or zero )", () => { + it("ratesFeeder should return null median price when all tickers null or zero", () => { const tickers = [ { lastTicker: { lastTradePrice: 0, vwap: 13 } }, { lastTicker: { lastTradePrice: null, vwap: 13 } }, @@ -75,182 +74,4 @@ describe("RatesFeeder: real exchange rate tests", () => { const price = ratesFeeder.calculateAugmintPrice(tickers); assert.equal(price, expectedPrice); }); - - it("ratesFeeder should set the price on-chain from tickers when diff > threshold ", async () => { - const origtickers = ratesFeeder.tickers; - const expectedCheckedAt = new Date(); - - ratesFeeder.tickers = [ - { - name: "testTicker1", - lastTicker: { lastTradePrice: 657.62, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - }, - { - name: "testTicker2", - lastTicker: { lastTradePrice: 659.52, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - }, - { - name: "testTicker3", - lastTicker: { lastTradePrice: 659.2, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - } - ]; - - const expectedPrice = 659.2; - const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); - - // test sanity checks: - assert.notEqual(prevStoredRate.rate, expectedPrice); - assert( - (Math.abs(expectedPrice - prevStoredRate.rate) / prevStoredRate.rate) * 100 > - process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT - ); - - await ratesFeeder.checkTickerPrice(); - - await baseHelpers.assertEvent(ratesFeeder.rates.instance, "RateChanged", { - symbol: BYTES_CCY.padEnd(66, "0"), - newRate: (expectedPrice * 10 ** ratesFeeder.decimals).toString() - }); - - const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); - - assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePrice, expectedPrice); - // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; - // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated - // only after tx confirmation when checkTickerPrice called again) - assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); - assert.deepEqual( - new Date(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated), - prevStoredRate.lastUpdated - ); - - assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); - assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); - - assert.equal(newStoredRate.rate, expectedPrice); - - ratesFeeder.tickers = origtickers; - }); - - it("ratesFeeder should NOT set the price on-chain from tickers when diff < threshold ", async () => { - const origtickers = ratesFeeder.tickers; - const expectedCheckedAt = new Date(); - const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); - - const expectedLivePriceDifference = process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT / 100 - 0.0001; - const newLivePrice = parseFloat((prevStoredRate.rate * (1 + expectedLivePriceDifference)).toFixed(2)); - - ratesFeeder.tickers = [ - { - name: "testTicker1", - lastTicker: { lastTradePrice: newLivePrice, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - }, - { - name: "testTicker2", - lastTicker: { lastTradePrice: newLivePrice, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - }, - { - name: "testTicker3", - lastTicker: { lastTradePrice: newLivePrice, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - } - ]; - - await ratesFeeder.checkTickerPrice(); - - const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); - // events from previous tests are clashing with it - wether change helper funciotn or create and restore ganache snapshot after each test - // await baseHelpers.assertNoEvents(ratesFeeder.augmintRatesInstance, "RateChanged"); - - assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePrice, newLivePrice); - assert.equal(ratesFeeder.lastTickerCheckResult[CCY].livePriceDifference, expectedLivePriceDifference); - // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; - // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated - // only after tx confirmation when checkTickerPrice called again) - assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); - assert.deepEqual( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated, - prevStoredRate.lastUpdated - ); - - assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); - assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); - - assert.equal(newStoredRate.rate, prevStoredRate.rate); - assert.deepEqual(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); - - ratesFeeder.tickers = origtickers; - }); - - it("ratesFeeder should NOT set the price on-chain from tickers when all tickers are down", async () => { - const origtickers = ratesFeeder.tickers; - const expectedCheckedAt = new Date(); - - ratesFeeder.tickers = [ - { - name: "testTicker1", - lastTicker: { lastTradePrice: null, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - }, - { - name: "testTicker2", - lastTicker: { lastTradePrice: 0, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - }, - { - name: "testTicker3", - lastTicker: { lastTradePrice: null, vwap: 13, receivedAt: expectedCheckedAt }, - getStatus - } - ]; - - const prevStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); - - await ratesFeeder.checkTickerPrice(); - - const newStoredRate = await ratesFeeder.rates.getAugmintRate(CCY); - // events from previous tests are clashing with it - wether change helper funciotn or create and restore ganache snapshot after each test - // await baseHelpers.assertNoEvents(ratesFeeder.augmintRatesInstance, "RateChanged"); - - assert.isNull(ratesFeeder.lastTickerCheckResult[CCY].livePrice); - assert.isNull(ratesFeeder.lastTickerCheckResult[CCY].livePriceDifference); - // lastTickerCheckResult format: { CCY: { currentAugmintRate: {price, lastUpdated}, livePrice, livePriceDifference, [tickersInfo] } }; - // currentAugmintRate shouldn't be updated yet (checkTickerPrice sends setRate async, currentAugmintRate updated - // only after tx confirmation when checkTickerPrice called again) - assert.equal(ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.rate, prevStoredRate.rate); - assert.deepEqual( - ratesFeeder.lastTickerCheckResult[CCY].currentAugmintRate.lastUpdated, - prevStoredRate.lastUpdated - ); - - assert.isAtLeast(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 0); - assert.isAtMost(ratesFeeder.lastTickerCheckResult.checkedAt - expectedCheckedAt, 1000); - - assert.equal(newStoredRate.rate, prevStoredRate.rate); - assert.deepEqual(newStoredRate.lastUpdated, prevStoredRate.lastUpdated); - - ratesFeeder.tickers = origtickers; - }); - - it("set on-chain rate and should be the same", async () => { - const price = 213.14; - - await ratesFeeder.updatePrice(CCY, price); - - await baseHelpers.assertEvent(ratesFeeder.rates.instance, "RateChanged", { - symbol: BYTES_CCY.padEnd(66, "0"), - newRate: (price * 10 ** ratesFeeder.decimals).toString() - }); - - const storedRate = await ratesFeeder.rates.getAugmintRate(CCY); - - assert.equal(storedRate.rate, price); - }); - - it("should recover after web3 connection lost"); }); From 77aa79b144f9c5b98d0e6c43647220382c7dc069 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 6 Apr 2019 22:44:07 +0100 Subject: [PATCH 08/46] [tests] make ratesfeeder test independent - ganache snapshots --- test/RatesFeeder.onchain.js | 9 +++++++ test/helpers/base.js | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/test/RatesFeeder.onchain.js b/test/RatesFeeder.onchain.js index 9b58b59..68474e3 100644 --- a/test/RatesFeeder.onchain.js +++ b/test/RatesFeeder.onchain.js @@ -11,6 +11,7 @@ let BYTES_CCY; const getStatus = () => "tickerProvider mock getStatus for test"; +let snapshotId; let ratesFeeder; describe("RatesFeeder: onchain tests", () => { @@ -24,6 +25,14 @@ describe("RatesFeeder: onchain tests", () => { BYTES_CCY = ethereumConnection.web3.utils.asciiToHex(CCY); }); + beforeEach(async () => { + snapshotId = baseHelpers.takeSnapshot(ethereumConnection.web3); + }); + + afterEach(async () => { + baseHelpers.revertSnapshot(ethereumConnection.web3, snapshotId); + }); + it("ratesFeeder should set the price on-chain from tickers when diff > threshold ", async () => { const origtickers = ratesFeeder.tickers; const expectedCheckedAt = new Date(); diff --git a/test/helpers/base.js b/test/helpers/base.js index d7da9b2..bd5e094 100644 --- a/test/helpers/base.js +++ b/test/helpers/base.js @@ -2,11 +2,61 @@ const assert = require("chai").assert; module.exports = { + takeSnapshot, + revertSnapshot, getEvents, assertEvent, assertNoEvents }; +function takeSnapshot(web3) { + //dirty hack for web3@1.0.0 support for localhost testrpc, see https://github.com/trufflesuite/truffle-contract/issues/56#issuecomment-331084530 + if (typeof web3.currentProvider.sendAsync !== "function") { + web3.currentProvider.sendAsync = function() { + return web3.currentProvider.send.apply(web3.currentProvider, arguments); + }; + } + + return new Promise(function(resolve, reject) { + web3.currentProvider.sendAsync( + { + method: "evm_snapshot", + params: [], + jsonrpc: "2.0", + id: new Date().getTime() + }, + function(error, res) { + if (error) { + reject(new Error("Can't take snapshot with web3\n" + error)); + } else { + resolve(res.result); + } + } + ); + }); +} + +function revertSnapshot(web3, snapshotId) { + return new Promise(function(resolve, reject) { + web3.currentProvider.sendAsync( + { + method: "evm_revert", + params: [snapshotId], + jsonrpc: "2.0", + id: new Date().getTime() + }, + function(error, res) { + if (error) { + // TODO: this error is not bubbling up to truffle test run :/ + reject(new Error("Can't revert snapshot with web3. snapshotId: " + snapshotId + "\n" + error)); + } else { + resolve(res); + } + } + ); + }); +} + function getEvents(contractInstance, eventName) { return contractInstance.getPastEvents(eventName); } From bf8555f860343c82508c1de7091819b89e07a8d1 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 10:42:45 +0100 Subject: [PATCH 09/46] prettier reformatting --- src/.eslintrc | 12 ++++++------ src/.prettierrc | 4 ++-- src/augmintjs/Exchange.js | 6 +----- src/augmintjs/Rates.js | 6 +----- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/.eslintrc b/src/.eslintrc index 98bc0de..c3d00c9 100644 --- a/src/.eslintrc +++ b/src/.eslintrc @@ -1,7 +1,7 @@ { - "extends": ['eslint:recommended'], + "extends": ["eslint:recommended"], "parserOptions": { - "ecmaVersion": 2017, + "ecmaVersion": 2017 }, "env": { "mocha": true, @@ -10,9 +10,9 @@ }, "rules": { "indent": ["warn", 4], - max-len: "off", - radix: "off", - no-unused-vars: "warn", + "max-len": "off", + "radix": "off", + "no-unused-vars": "warn", "no-console": "off" }, "globals": { @@ -20,5 +20,5 @@ "assert": false, "artifacts": false, "contract": false - } + } } diff --git a/src/.prettierrc b/src/.prettierrc index e8980d1..f41a05d 100644 --- a/src/.prettierrc +++ b/src/.prettierrc @@ -1,4 +1,4 @@ { - "printWidth": 120, - "tabWidth": 4 + "printWidth": 120, + "tabWidth": 4 } diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index 47f80ec..dedabfe 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -20,11 +20,7 @@ class Exchange extends Contract { } async connect(ethereumConnection, exchangeAddress) { - await super.connect( - ethereumConnection, - ExchangeArtifact, - exchangeAddress - ); + await super.connect(ethereumConnection, ExchangeArtifact, exchangeAddress); this.rates = new Rates(); await this.rates.connect(this.ethereumConnection); diff --git a/src/augmintjs/Rates.js b/src/augmintjs/Rates.js index 815a210..949eb48 100644 --- a/src/augmintjs/Rates.js +++ b/src/augmintjs/Rates.js @@ -45,11 +45,7 @@ class Rates extends Contract { } async connect(ethereumConnection, ratesAddress) { - return await super.connect( - ethereumConnection, - RatesArtifact, - ratesAddress - ); + return await super.connect(ethereumConnection, RatesArtifact, ratesAddress); } } From a83597be79a25028095427d523f9641ac6ecae1a Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 12:30:46 +0100 Subject: [PATCH 10/46] add eslint to devdeps --- package.json | 3 +- yarn.lock | 500 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 484 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index e78765c..b8a56d2 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "devDependencies": { "chai": "4.2.0", + "eslint": "5.16.0", "mocha": "6.0.2", "nock": "10.0.6", "sinon": "7.3.1" @@ -60,4 +61,4 @@ "url": "https://github.com/Augmint/augmint-ratesfeeder/issues" }, "homepage": "https://github.com/Augmint/augmint-ratesfeeder#readme" -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 5fc8121..08455df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,22 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + "@sinonjs/commons@^1", "@sinonjs/commons@^1.0.2", "@sinonjs/commons@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.4.0.tgz#7b3ec2d96af481d7a0321252e7b1c94724ec5a78" @@ -44,12 +60,22 @@ accepts@~1.3.5: mime-types "~2.1.18" negotiator "0.6.1" +acorn-jsx@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" + integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== + +acorn@^6.0.7: + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" + integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== + aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= -ajv@^6.5.5: +ajv@^6.5.5, ajv@^6.9.1: version "6.10.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== @@ -64,6 +90,11 @@ ansi-colors@3.2.3: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== +ansi-escapes@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -74,7 +105,12 @@ ansi-regex@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-styles@^3.2.1: +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -154,6 +190,11 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" @@ -434,6 +475,11 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + camelcase@^5.0.0: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" @@ -456,7 +502,7 @@ chai@4.2.0, chai@^4.1.2: pathval "^1.1.0" type-detect "^4.0.5" -chalk@^2.0.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -465,6 +511,11 @@ chalk@^2.0.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + check-error@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" @@ -488,6 +539,18 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + cliui@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" @@ -682,7 +745,7 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@^4.1.0: +debug@^4.0.1, debug@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -771,6 +834,11 @@ deep-equal@^1.0.0: resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" @@ -842,6 +910,13 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dom-walk@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" @@ -893,6 +968,11 @@ elliptic@^6.0.0, elliptic@^6.4.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -936,11 +1016,104 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +eslint-scope@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + +eslint@5.16.0: + version "5.16.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" + integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.9.1" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^4.0.3" + eslint-utils "^1.3.1" + eslint-visitor-keys "^1.0.0" + espree "^5.0.1" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^6.2.2" + js-yaml "^3.13.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.11" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^5.5.1" + strip-ansi "^4.0.0" + strip-json-comments "^2.0.1" + table "^5.2.3" + text-table "^0.2.0" + +espree@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" + integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== + dependencies: + acorn "^6.0.7" + acorn-jsx "^5.0.0" + eslint-visitor-keys "^1.0.0" + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= + etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" @@ -1102,6 +1275,15 @@ extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== +external-editor@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + integrity sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -1136,6 +1318,11 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + faye-websocket@0.9.4: version "0.9.4" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.9.4.tgz#885934c79effb0409549e0c0a3801ed17a40cdad" @@ -1150,6 +1337,20 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + file-type@^3.8.0: version "3.9.0" resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9" @@ -1205,6 +1406,15 @@ findup-sync@2.0.0: micromatch "^3.0.4" resolve-dir "^1.0.1" +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + flat@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2" @@ -1212,6 +1422,11 @@ flat@^4.1.0: dependencies: is-buffer "~2.0.3" +flatted@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" + integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -1298,6 +1513,11 @@ function-bind@^1.0.2, function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" @@ -1340,7 +1560,7 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob@7.1.3, glob@^7.1.3: +glob@7.1.3, glob@^7.1.2, glob@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== @@ -1380,6 +1600,11 @@ global@~4.3.0: min-document "^2.19.0" process "~0.5.1" +globals@^11.7.0: + version "11.11.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.11.0.tgz#dcf93757fa2de5486fbeed7118538adf789e9c2e" + integrity sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw== + got@7.1.0, got@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" @@ -1580,6 +1805,13 @@ iconv-lite@0.4.23: dependencies: safer-buffer ">= 2.1.2 < 3" +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + idna-uts46-hx@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" @@ -1592,6 +1824,24 @@ ieee754@^1.1.4: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +import-fresh@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" + integrity sha512-pOnA9tfM3Uwics+SaBLCNyZZZbK+4PTu0OPZtLlMIrv17EdBoC15S9Kn8ckJ9TZTyKb3ywNE5y1yeDxxGA7nTQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1610,6 +1860,25 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== +inquirer@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" + integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.11" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.0.0" + through "^2.3.6" + invert-kv@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" @@ -1761,6 +2030,11 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -1845,6 +2119,11 @@ js-sha3@^0.6.1: resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.6.1.tgz#5b89f77a7477679877f58c4a075240934b1f95c0" integrity sha1-W4n3enR3Z5h39YxKB1JAk0sflcA= +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" @@ -1853,6 +2132,14 @@ js-yaml@3.12.0: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.13.0: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -1868,6 +2155,11 @@ json-schema@0.2.3: resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -1934,6 +2226,14 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -2072,6 +2372,11 @@ mime@1.4.1: resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + mimic-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -2126,7 +2431,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0: +mkdirp@*, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -2193,6 +2498,11 @@ ms@2.1.1, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + mz@^2.6.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -2234,6 +2544,11 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" @@ -2327,9 +2642,9 @@ object-copy@^0.1.0: kind-of "^3.0.3" object-keys@^1.0.11, object-keys@^1.0.12: - version "1.1.0" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.0.tgz#11bd22348dd2e096a045ab06f6c85bcc340fa032" - integrity sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg== + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== object-visit@^1.0.0: version "1.0.1" @@ -2389,6 +2704,25 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + os-locale@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" @@ -2398,6 +2732,11 @@ os-locale@^3.0.0: lcid "^2.0.0" mem "^4.0.0" +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + p-cancelable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" @@ -2414,9 +2753,9 @@ p-finally@^1.0.0: integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= p-is-promise@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.0.0.tgz#7554e3d572109a87e1f3f53f6a7d85d1b194f4c5" - integrity sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== p-limit@^2.0.0: version "2.2.0" @@ -2444,6 +2783,13 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-asn1@^5.0.0: version "5.1.4" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.4.tgz#37f6628f823fbdeb2273b4d540434a22f3ef1fcc" @@ -2489,6 +2835,11 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= +path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= + path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -2559,6 +2910,11 @@ posix-character-classes@^0.1.0: resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + prepend-http@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" @@ -2574,6 +2930,11 @@ process@~0.5.1: resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" integrity sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8= +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + propagate@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/propagate/-/propagate-1.0.0.tgz#00c2daeedda20e87e3782b344adba1cddd6ad709" @@ -2712,6 +3073,11 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + repeat-element@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" @@ -2766,17 +3132,30 @@ resolve-dir@^1.0.0, resolve-dir@^1.0.1: expand-tilde "^2.0.0" global-modules "^1.0.0" +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@2: +rimraf@2, rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -2791,6 +3170,20 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +rxjs@^6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" + integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -2842,7 +3235,7 @@ seek-bzip@^1.0.5: dependencies: commander "~2.8.1" -semver@^5.5.0: +semver@^5.5.0, semver@^5.5.1: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== @@ -2959,7 +3352,7 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= -signal-exit@^3.0.0: +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= @@ -2991,6 +3384,15 @@ sinon@7.3.1: nise "^1.4.10" supports-color "^5.5.0" +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" @@ -3101,7 +3503,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -3109,6 +3511,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + string.prototype.trim@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" @@ -3139,6 +3550,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.0.0, strip-ansi@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-dirs@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-2.1.0.tgz#4987736264fc344cf20f6c34aca9d13d1d4ed6c5" @@ -3158,7 +3576,7 @@ strip-hex-prefix@1.0.0: dependencies: is-hex-prefixed "1.0.0" -strip-json-comments@2.0.1: +strip-json-comments@2.0.1, strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= @@ -3196,6 +3614,16 @@ swarm-js@0.1.37: tar.gz "^1.0.5" xhr-request-promise "^0.1.2" +table@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/table/-/table-5.2.3.tgz#cde0cc6eb06751c009efab27e8c820ca5b67b7f2" + integrity sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ== + dependencies: + ajv "^6.9.1" + lodash "^4.17.11" + slice-ansi "^2.1.0" + string-width "^3.0.0" + tar-stream@^1.5.2: version "1.6.2" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555" @@ -3229,6 +3657,11 @@ tar@^2.1.1: fstream "^1.0.2" inherits "2" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + thenify-all@^1.0.0, thenify-all@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" @@ -3243,7 +3676,7 @@ thenify-all@^1.0.0, thenify-all@^1.6.0: dependencies: any-promise "^1.0.0" -through@^2.3.8: +through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -3253,6 +3686,13 @@ timed-out@^4.0.0, timed-out@^4.0.1: resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + to-buffer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" @@ -3296,6 +3736,11 @@ tough-cookie@~2.4.3: psl "^1.1.24" punycode "^1.4.1" +tslib@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" + integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -3318,6 +3763,13 @@ tweetnacl@^1.0.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A== +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" @@ -3734,6 +4186,11 @@ wide-align@1.1.3: dependencies: string-width "^1.0.2 || 2" +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -3747,6 +4204,13 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + ws@^3.0.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" From 4ff5b0471c39d254d98256d5dbdbbf5a3fce2295 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 12:39:58 +0100 Subject: [PATCH 11/46] remove globals from eslintrc --- src/.eslintrc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/.eslintrc b/src/.eslintrc index c3d00c9..d37b705 100644 --- a/src/.eslintrc +++ b/src/.eslintrc @@ -1,5 +1,7 @@ { - "extends": ["eslint:recommended"], + "extends": [ + "eslint:recommended" + ], "parserOptions": { "ecmaVersion": 2017 }, @@ -9,16 +11,13 @@ "es6": true }, "rules": { - "indent": ["warn", 4], + "indent": [ + "warn", + 4 + ], "max-len": "off", "radix": "off", "no-unused-vars": "warn", "no-console": "off" - }, - "globals": { - "web3": false, - "assert": false, - "artifacts": false, - "contract": false } -} +} \ No newline at end of file From 21322fe04530079a76e1a30d27a80e73b4d9f9ac Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 13:09:16 +0100 Subject: [PATCH 12/46] add currency prop to Exchange class --- src/MatchMaker/MatchMaker.js | 6 ++---- src/augmintjs/Exchange.js | 14 +++++++++++--- src/augmintjs/Exchange.test.js | 4 ++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index f494f6f..d5e69d2 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -12,8 +12,6 @@ const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); const Exchange = require("src/augmintjs/Exchange.js"); -const CCY = "EUR"; // only EUR is suported by MatchMaker ATM - class MatchMaker extends EventEmitter { constructor(ethereumConnection) { super(); @@ -57,8 +55,8 @@ class MatchMaker extends EventEmitter { `** MatchMaker started with settings: MATCHMAKER_ETHEREUM_ACCOUNT: ${process.env.MATCHMAKER_ETHEREUM_ACCOUNT} MATCHMAKER_ETHEREUM_PRIVATE_KEY: ${ - process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY ? "[secret]" : "not provided" -} + process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY ? "[secret]" : "not provided" + } Exchange contract: ${this.exchange.address}` ); } diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index dedabfe..8b8d796 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -17,6 +17,7 @@ class Exchange extends Contract { super(); this.rates = null; this.tokenInstance = null; + this.currency = null; } async connect(ethereumConnection, exchangeAddress) { @@ -26,11 +27,15 @@ class Exchange extends Contract { await this.rates.connect(this.ethereumConnection); this.tokenInstance = contractConnection.connectLatest(this.ethereumConnection, AugmintTokenArtifact); - const [tokenAddressAtExchange, ratesAddressAtExchange] = await Promise.all([ + const [tokenAddressAtExchange, ratesAddressAtExchange, bytes32_peggedSymbol] = await Promise.all([ this.instance.methods.augmintToken().call(), - this.instance.methods.rates().call() + this.instance.methods.rates().call(), + this.tokenInstance.methods.peggedSymbol().call() ]); + const currencyWithTrailing = this.web3.utils.toAscii(bytes32_peggedSymbol); + this.currency = currencyWithTrailing.substr(0, currencyWithTrailing.indexOf("\0")); // remove trailling \u0000s + if (ratesAddressAtExchange !== this.rates.address) { throw new Error( `Exchange: latest Rates contract deployment address ${ @@ -60,7 +65,10 @@ class Exchange extends Contract { { buyIds: [], sellIds: [], gasEstimate } */ async getMatchingOrders(gasLimit) { - const [orderBook, bn_ethFiatRate] = await Promise.all([this.fetchOrderBook(), this.rates.getBnEthFiatRate()]); + const [orderBook, bn_ethFiatRate] = await Promise.all([ + this.fetchOrderBook(), + this.rates.getBnEthFiatRate(this.currency) + ]); const matches = this.calculateMatchingOrders( orderBook.buyOrders, diff --git a/src/augmintjs/Exchange.test.js b/src/augmintjs/Exchange.test.js index 2657556..c2d93d9 100644 --- a/src/augmintjs/Exchange.test.js +++ b/src/augmintjs/Exchange.test.js @@ -7,16 +7,20 @@ const { constants } = require("./constants.js"); const { takeSnapshot, revertSnapshot } = require("src/augmintjs/testHelpers/ganache.js"); describe("connection", () => { + const CCY = "EUR"; const ethereumConnection = new EthereumConnection(); const exchange = new Exchange(); + it("should connect to latest contract", async () => { await ethereumConnection.connect(); assert.isNull(exchange.address); + assert.isNull(exchange.currency); await exchange.connect(ethereumConnection); assert.equal(exchange.address, "0xFAceA53a04bEfCC6C9246eb3951814cfEE2A1415"); assert.equal(exchange.rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); assert.equal(exchange.tokenInstance._address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); // when augmintToken is a class: assert.equal(exchange.augmintToken.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); + assert.equal(exchange.currency, CCY); }); it("should connect to legacy Excahnge contract"); From bce18f39f72358c5d51a7c489a5de22c764b3d50 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 14:28:21 +0100 Subject: [PATCH 13/46] getMatchingOrders default to safeBlockGasLimit --- src/MatchMaker/MatchMaker.js | 2 +- src/augmintjs/Exchange.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index d5e69d2..ab6c76a 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -103,7 +103,7 @@ class MatchMaker extends EventEmitter { } async _checkAndMatchOrders() { - const matchingOrders = await this.exchange.getMatchingOrders(this.ethereumConnection.safeBlockGasLimit); + const matchingOrders = await this.exchange.getMatchingOrders(); // default gaslimit ethereumConnection.safeBlockGasLimit if (matchingOrders.buyIds.length > 0) { const matchMultipleOrdersTx = this.exchange.getMatchMultipleOrdersTx( diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index 8b8d796..f5c699b 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -57,14 +57,14 @@ class Exchange extends Contract { } /** - * Fetches current OrderBook and returns as many matching orderIds (at current ETHFiat rate) - * as fits into the provided gas limit. - * The returned orderids can be passed to getMatchMultipleOrdersTx - * @param {number} gasLimit return as many matches as it fits to gasLimit based on gas cost estimate. + * Fetches current OrderBook and returns as many matching orderIds (at current ETHFiat rate) as fits into the provided gas limit. + * if no gasLimit provided then ethereumConnection.safeBlockGasLimit is used + * The returned matchingOrders can be passed to signAndSendMatchMultiple or matchMultiple functions + * @param {number} [gasLimit=EthereumConnection.safeBlockGasLimit] return as many matches as it fits to gasLimit based on gas cost estimate. * @return {Promise} pairs of matching order id , ordered by execution sequence { buyIds: [], sellIds: [], gasEstimate } */ - async getMatchingOrders(gasLimit) { + async getMatchingOrders(gasLimit = this.ethereumConnection.safeBlockGasLimit) { const [orderBook, bn_ethFiatRate] = await Promise.all([ this.fetchOrderBook(), this.rates.getBnEthFiatRate(this.currency) From 4fa481528032afdaea9aabae3088b2136e6d775a Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 14:28:56 +0100 Subject: [PATCH 14/46] let prettier to do indent --- src/.eslintrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/.eslintrc b/src/.eslintrc index d37b705..db6f7e6 100644 --- a/src/.eslintrc +++ b/src/.eslintrc @@ -11,10 +11,7 @@ "es6": true }, "rules": { - "indent": [ - "warn", - 4 - ], + "indent": "off", "max-len": "off", "radix": "off", "no-unused-vars": "warn", From 77fb3ebbc1929b1b8e8dfc6a722463ce259e5d80 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 14:42:32 +0100 Subject: [PATCH 15/46] signAndSendMatchMultipleOrders and matchMultipleOrders --- src/MatchMaker/MatchMaker.js | 25 ++--- .../Exchange.Matching.onchain.test.js | 99 +++++++++++++++++++ src/augmintjs/Exchange.js | 58 ++++++++--- 3 files changed, 152 insertions(+), 30 deletions(-) create mode 100644 src/augmintjs/Exchange.Matching.onchain.test.js diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index ab6c76a..a3a6e62 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -106,24 +106,13 @@ class MatchMaker extends EventEmitter { const matchingOrders = await this.exchange.getMatchingOrders(); // default gaslimit ethereumConnection.safeBlockGasLimit if (matchingOrders.buyIds.length > 0) { - const matchMultipleOrdersTx = this.exchange.getMatchMultipleOrdersTx( - matchingOrders.buyIds, - matchingOrders.sellIds - ); - - const encodedABI = matchMultipleOrdersTx.encodeABI(); - - const txToSign = { - from: this.account, - to: this.exchange.address, - gasLimit: matchingOrders.gasEstimate, - data: encodedABI - }; + const nonce = await this.ethereumConnection.getAccountNonce(this.account); - const [signedTx, nonce] = await Promise.all([ - this.web3.eth.accounts.signTransaction(txToSign, process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY), - this.ethereumConnection.getAccountNonce(this.account) - ]); + const tx = await this.exchange.signAndSendMatchMultipleOrders( + this.account, + process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY, + matchingOrders + ); log.log( `==> checkAndMatchOrders() sending matchMultipleOrdersTx. nonce: ${nonce} matching Orders: ${ @@ -131,8 +120,6 @@ class MatchMaker extends EventEmitter { }` ); - const tx = this.web3.eth.sendSignedTransaction(signedTx.rawTransaction, { from: this.account }); - const receipt = await tx .once("transactionHash", hash => { log.debug(` checkAndMatchOrders() nonce: ${nonce} txHash: ${hash} hash received`); diff --git a/src/augmintjs/Exchange.Matching.onchain.test.js b/src/augmintjs/Exchange.Matching.onchain.test.js new file mode 100644 index 0000000..de59c2b --- /dev/null +++ b/src/augmintjs/Exchange.Matching.onchain.test.js @@ -0,0 +1,99 @@ +const assert = require("chai").assert; +const Exchange = require("./Exchange.js"); +const ganache = require("./testHelpers/ganache.js"); +const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); + +describe("MatchMultipleOrders onchain", () => { + const ethereumConnection = new EthereumConnection(); + let exchange; + let snapshotId; + let accounts; + let web3; + + before(async () => { + await ethereumConnection.connect(); + web3 = ethereumConnection.web3; + accounts = ethereumConnection.accounts; + exchange = new Exchange(ethereumConnection, []); + + await exchange.connect(ethereumConnection); + }); + + beforeEach(async () => { + snapshotId = await ganache.takeSnapshot(ethereumConnection.web3); + }); + + afterEach(async () => { + await ganache.revertSnapshot(ethereumConnection.web3, snapshotId); + }); + + it("getMatchingOrders", async () => { + await exchange.instance.methods.placeBuyTokenOrder("1000000").send({ + from: accounts[1], + value: web3.utils.toWei("0.1"), + gas: 1000000 + }); + await exchange.tokenInstance.methods.transferAndNotify(exchange.address, "1000", "1000000").send({ + from: accounts[0], + gas: 1000000 + }); + + const expGasEstimate = 200000; + + // No gasLimit (defaults to safeBlockGasLimit) + let matchingOrders = await exchange.getMatchingOrders(); + + assert.deepEqual(matchingOrders, { buyIds: [1], sellIds: [2], gasEstimate: expGasEstimate }); + + // passed gaslimit not enough to match any + matchingOrders = await exchange.getMatchingOrders(expGasEstimate - 1); + assert.deepEqual(matchingOrders, { buyIds: [], sellIds: [], gasEstimate: 0 }); + }); + + it("signAndSendMatchMultipleOrders", async () => { + await Promise.all([ + exchange.instance.methods + .placeBuyTokenOrder("1000000") + .send({ from: accounts[1], value: web3.utils.toWei("0.1"), gas: 1000000 }), + + exchange.tokenInstance.methods + .transferAndNotify(exchange.address, "1000", "1000000") + .send({ from: accounts[0], gas: 1000000 }) + ]); + + let matchingOrders = await exchange.getMatchingOrders(); + + // ganache account[0] private key, generated with mnemonic fixed in ganache launch script + const privateKey = "0x85b3d743fbe4ec4e2b58947fa5484da7b2f5538b0ae8e655646f94c95d5fb949"; + + const receipt = await exchange.signAndSendMatchMultipleOrders( + ethereumConnection.accounts[0], + privateKey, + matchingOrders + ); + + assert(receipt.status); + matchingOrders = await exchange.getMatchingOrders(); + assert.deepEqual(matchingOrders, { buyIds: [], sellIds: [], gasEstimate: 0 }); + }); + + it("matchMultipleOrders", async () => { + await Promise.all([ + exchange.instance.methods + .placeBuyTokenOrder("1000000") + .send({ from: accounts[1], value: web3.utils.toWei("0.1"), gas: 1000000 }), + + exchange.tokenInstance.methods + .transferAndNotify(exchange.address, "1000", "1000000") + .send({ from: accounts[0], gas: 1000000 }) + ]); + + let matchingOrders = await exchange.getMatchingOrders(); + + const receipt = await exchange.matchMultipleOrders(ethereumConnection.accounts[0], matchingOrders); + + assert(receipt.status); + matchingOrders = await exchange.getMatchingOrders(); + assert.deepEqual(matchingOrders, { buyIds: [], sellIds: [], gasEstimate: 0 }); + }); +}); diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index f5c699b..a17da7c 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -10,6 +10,7 @@ const AugmintTokenArtifact = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_ /** * Augmint Exchange contract class + * @class Exchange * @extends Contract */ class Exchange extends Contract { @@ -140,7 +141,7 @@ class Exchange extends Contract { // result format: [id, maker, price, amount] const orders = result.reduce( - (res, order, idx) => { + (res, order) => { const bn_amount = new BigNumber(order[3]); if (!bn_amount.eq(0)) { const parsed = { @@ -184,19 +185,54 @@ class Exchange extends Contract { } /** - * Returns a signed MatchMultiple transaction, ready to be sent with EthereumConnection.sendSignedTransaction + * Sends a matchMultipleOrders transaction + * Intended to use when account wallet is available (e.g. MetamMask) * @param {string} account tx sender account + * @param {string} account tx sender account + * @param {*} matchingOrders + * @returns {Promise} A web3.js Promi event object sent to the network. Resolves when mined and you can subscribe to events, eg. .on("confirmation") + * @memberof Exchange + */ + async matchMultipleOrders(account, matchingOrders) { + const matchMultipleOrdersTx = this.getMatchMultipleOrdersTx(matchingOrders.buyIds, matchingOrders.sellIds); + + return matchMultipleOrdersTx.send({ from: account, gas: matchingOrders.gasEstimate }); + } + + /** + * Signs a matchMultipleOrders transaction with a private key and sends it (with web3.js sendSignedTransaction) * + * Intended to use when private key is available, e.g. backend services + * @param {string} account tx signer ethereum account * @param {string} privateKey Private key of the Ethereum account to sign the tx with. Include leading 0x - * @param {array} buyIds a list of buy order id numners - * @param {array} sellIds list of matching sell order numbers - * @return {object} A web3 transaction object which can be sent using EthereumConnection.sendSignedTransaction + * @param {object} matchingOrders Returned by getMatchingOrders in format of {buyIds:[], sellIds: [], gasEstimate} + * @return {Promise} A web3.js Promi event object sent to the network. Resolves when mined and you can subscribe to events, eg. .on("confirmation") + * @memberof Exchange */ - getSignedMultipleOrdersTx(privateKey, buyIds, sellIds) {} + async signAndSendMatchMultipleOrders(account, privateKey, matchingOrders) { + const matchMultipleOrdersTx = this.getMatchMultipleOrdersTx(matchingOrders.buyIds, matchingOrders.sellIds); + + const encodedABI = matchMultipleOrdersTx.encodeABI(); + + const txToSign = { + from: account, + to: this.address, + gasLimit: matchingOrders.gasEstimate, + data: encodedABI + }; + + const signedTx = await this.web3.eth.accounts.signTransaction( + txToSign, + process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY + ); + + return this.web3.eth.sendSignedTransaction(signedTx.rawTransaction); + } /** - * Returns a web3 transaction to match the passed buyIds and sellIds. Call .send() on the returned tx. + * Returns a web3 transaction to match the passed buyIds and sellIds. Call .send() or sign it on the returned tx. * @param {array} buyIds array with a list of BUY order IDs (ordered) * @param {array} sellIds array with a list of SELL order IDs (ordered) - * @return {object} web3 transaction which can be executed with .send({account, gas}) + * @return {Promise} web3 transaction which can be executed with .send({account, gas}) + * @memberof Exchange */ getMatchMultipleOrdersTx(buyIds, sellIds) { if (sellIds.length === 0 || sellIds.length !== buyIds.length) { @@ -211,9 +247,9 @@ class Exchange extends Contract { /** * calculate matching pairs from ordered ordebook for sending in Exchange.matchMultipleOrders ethereum tx * @param {object} _buyOrders must be ordered by price descending then by id ascending - * @param {[type]} _sellOrders must be ordered by price ascending then by id ascending - * @param {[type]} bn_ethFiatRate current ETHFiat rate to use for calculation - * @param {[type]} gasLimit return as many matches as it fits to gasLimit based on gas cost estimate. + * @param {array} _sellOrders must be ordered by price ascending then by id ascending + * @param {BigNumber} bn_ethFiatRate current ETHFiat rate to use for calculation + * @param {number} gasLimit return as many matches as it fits to gasLimit based on gas cost estimate. * @return {object} pairs of matching order id , ordered by execution sequence { buyIds: [], sellIds: [], gasEstimate } */ calculateMatchingOrders(_buyOrders, _sellOrders, bn_ethFiatRate, gasLimit) { From edd1af05d75a3b49c267caa6f29587ab53565024 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 16:29:49 +0100 Subject: [PATCH 16/46] [test] snapshot fix --- test/RatesFeeder.onchain.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/RatesFeeder.onchain.js b/test/RatesFeeder.onchain.js index 68474e3..276a162 100644 --- a/test/RatesFeeder.onchain.js +++ b/test/RatesFeeder.onchain.js @@ -26,11 +26,11 @@ describe("RatesFeeder: onchain tests", () => { }); beforeEach(async () => { - snapshotId = baseHelpers.takeSnapshot(ethereumConnection.web3); + snapshotId = await baseHelpers.takeSnapshot(ethereumConnection.web3); }); afterEach(async () => { - baseHelpers.revertSnapshot(ethereumConnection.web3, snapshotId); + await baseHelpers.revertSnapshot(ethereumConnection.web3, snapshotId); }); it("ratesFeeder should set the price on-chain from tickers when diff > threshold ", async () => { From 0c212a13d21fe85c1d8658abbcb76ae088d844ed Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sun, 7 Apr 2019 16:38:19 +0100 Subject: [PATCH 17/46] AugmintToken class --- src/RatesFeeder.js | 28 ++++++------- src/augmintjs/AugmintToken.js | 42 +++++++++++++++++++ src/augmintjs/AugmintToken.test.js | 35 ++++++++++++++++ .../Exchange.Matching.onchain.test.js | 6 +-- src/augmintjs/Exchange.js | 42 ++++++++++--------- src/augmintjs/Exchange.test.js | 12 ++++-- 6 files changed, 124 insertions(+), 41 deletions(-) create mode 100644 src/augmintjs/AugmintToken.js create mode 100644 src/augmintjs/AugmintToken.test.js diff --git a/src/RatesFeeder.js b/src/RatesFeeder.js index 61ecc3a..0e96efc 100644 --- a/src/RatesFeeder.js +++ b/src/RatesFeeder.js @@ -18,9 +18,8 @@ TODO: require("src/augmintjs/helpers/env.js"); const log = require("src/augmintjs/helpers/log.js")("ratesFeeder"); const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); -const contractConnection = require("src/augmintjs/helpers/contractConnection.js"); const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); -const TokenAEur = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); +const AugmintToken = require("src/augmintjs/AugmintToken.js"); const Rates = require("src/augmintjs/Rates.js"); const { cost } = require("src/augmintjs/gas.js"); @@ -55,7 +54,7 @@ class RatesFeeder { this.isStopping = false; this.decimals = null; this.rates = null; - this.augmintTokenInstance = null; + this.augmintToken = null; this.checkTickerPriceTimer = null; this.account = null; this.lastTickerCheckResult = {}; @@ -74,13 +73,14 @@ class RatesFeeder { } this.rates = new Rates(); + this.augmintToken = new AugmintToken(); - [, this.augmintTokenInstance] = await Promise.all([ + await Promise.all([ this.rates.connect(this.ethereumConnection), - contractConnection.connectLatest(this.ethereumConnection, TokenAEur) + this.augmintToken.connect(this.ethereumConnection) ]); - this.decimals = await this.augmintTokenInstance.methods.decimals().call(); + this.decimals = this.augmintToken.decimals; // Schedule first check this.checkTickerPriceTimer = @@ -94,13 +94,13 @@ class RatesFeeder { `** RatesFeedeer started with settings: RATESFEEDER_ETHEREUM_ACCOUNT: ${process.env.RATESFEEDER_ETHEREUM_ACCOUNT} RATESFEEDER_ETHEREUM_PRIVATE_KEY: ${ - process.env.RATESFEEDER_ETHEREUM_PRIVATE_KEY ? "[secret]" : "not provided" -} + process.env.RATESFEEDER_ETHEREUM_PRIVATE_KEY ? "[secret]" : "not provided" + } RATESFEEDER_LIVE_PRICE_THRESHOLD_PT: ${process.env.RATESFEEDER_LIVE_PRICE_THRESHOLD_PT} RATESFEEDER_SETRATE_TX_TIMEOUT: ${process.env.RATESFEEDER_SETRATE_TX_TIMEOUT} RATESFEEDER_CHECK_TICKER_PRICE_INTERVAL: ${process.env.RATESFEEDER_CHECK_TICKER_PRICE_INTERVAL} Ticker providers: ${this.tickerNames} - AugmintToken contract: ${this.augmintTokenInstance._address} + AugmintToken contract: ${this.augmintToken.address} Rates contract: ${this.rates.address}` ); } @@ -130,10 +130,10 @@ class RatesFeeder { const livePriceDifference = livePrice > 0 ? parseFloat( - (Math.abs(livePrice - currentAugmintRate.rate) / currentAugmintRate.rate).toFixed( - LIVE_PRICE_DIFFERENCE_DECIMALS - ) - ) + (Math.abs(livePrice - currentAugmintRate.rate) / currentAugmintRate.rate).toFixed( + LIVE_PRICE_DIFFERENCE_DECIMALS + ) + ) : null; log.debug( @@ -290,7 +290,7 @@ class RatesFeeder { isInitialised: this.isInitialised, account: this.account, ratesContract: this.rates ? this.rates.address : "null", - augmintTokenContract: this.augmintTokenInstance ? this.augmintTokenInstance._address : "null", + augmintTokenContract: this.augmintToken ? this.augmintToken.address : "null", lastTickerCheckResult: this.lastTickerCheckResult }; return status; diff --git a/src/augmintjs/AugmintToken.js b/src/augmintjs/AugmintToken.js new file mode 100644 index 0000000..f65ade4 --- /dev/null +++ b/src/augmintjs/AugmintToken.js @@ -0,0 +1,42 @@ +const Contract = require("src/augmintjs/Contract.js"); +const TokenAEurArtifact = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); + +class AugmintToken extends Contract { + constructor() { + super(); + + this.peggedSymbol = null; + this.symbol = null; + this.name = null; + this.decimals = null; + this.decimalsDiv = null; + + this.feeAccountAddress = null; + + this.contractArtifact = TokenAEurArtifact; + } + + async connect(ethereumConnection, augmintTokenAddress) { + await super.connect(ethereumConnection, this.contractArtifact, augmintTokenAddress); + + const [bytes32PeggedSymbol, symbol, name, decimals, feeAccountAddress] = await Promise.all([ + this.instance.methods.peggedSymbol().call(), + this.instance.methods.symbol().call(), + this.instance.methods.name().call(), + this.instance.methods.decimals().call(), + this.instance.methods.feeAccount().call() + ]); + + const peggedSymbolWithTrailing = this.web3.utils.toAscii(bytes32PeggedSymbol); + this.peggedSymbol = peggedSymbolWithTrailing.substr(0, peggedSymbolWithTrailing.indexOf("\0")); + + this.name = name; + (this.symbol = symbol), (this.decimals = decimals); + this.decimalsDiv = 10 ** decimals; + this.feeAccountAddress = feeAccountAddress; + + return this.instance; + } +} + +module.exports = AugmintToken; diff --git a/src/augmintjs/AugmintToken.test.js b/src/augmintjs/AugmintToken.test.js new file mode 100644 index 0000000..4b53a72 --- /dev/null +++ b/src/augmintjs/AugmintToken.test.js @@ -0,0 +1,35 @@ +const { assert } = require("chai"); + +const EthereumConnection = require("./EthereumConnection.js"); +const AugmintToken = require("./AugmintToken.js"); + +const CCY = "EUR"; + +describe("AugmintToken connection", () => { + const ethereumConnection = new EthereumConnection(); + + it("should connect to latest contract", async () => { + await ethereumConnection.connect(); + const tokenAEur = new AugmintToken(); + + assert.isNull(tokenAEur.peggedSymbol); + assert.isNull(tokenAEur.symbol); + assert.isNull(tokenAEur.name); + assert.isNull(tokenAEur.address); + assert.isNull(tokenAEur.decimals); + assert.isNull(tokenAEur.decimalsDiv); + assert.isNull(tokenAEur.feeAccountAddress); + + await tokenAEur.connect(ethereumConnection); + + assert.equal(tokenAEur.peggedSymbol, CCY); + assert.equal(tokenAEur.symbol, "AEUR"); + assert.equal(tokenAEur.name, "Augmint Euro"); + assert.equal(tokenAEur.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); + assert.equal(tokenAEur.decimals, 2); + assert.equal(tokenAEur.decimalsDiv, 100); + assert.equal(tokenAEur.feeAccountAddress, "0xf5EfCaA78f5656F7Ddc971BC5d51a08b5F161573"); + }); + + it("should connect to legacy AugmintToken contract"); +}); diff --git a/src/augmintjs/Exchange.Matching.onchain.test.js b/src/augmintjs/Exchange.Matching.onchain.test.js index de59c2b..1cb35ec 100644 --- a/src/augmintjs/Exchange.Matching.onchain.test.js +++ b/src/augmintjs/Exchange.Matching.onchain.test.js @@ -33,7 +33,7 @@ describe("MatchMultipleOrders onchain", () => { value: web3.utils.toWei("0.1"), gas: 1000000 }); - await exchange.tokenInstance.methods.transferAndNotify(exchange.address, "1000", "1000000").send({ + await exchange.augmintToken.instance.methods.transferAndNotify(exchange.address, "1000", "1000000").send({ from: accounts[0], gas: 1000000 }); @@ -56,7 +56,7 @@ describe("MatchMultipleOrders onchain", () => { .placeBuyTokenOrder("1000000") .send({ from: accounts[1], value: web3.utils.toWei("0.1"), gas: 1000000 }), - exchange.tokenInstance.methods + exchange.augmintToken.instance.methods .transferAndNotify(exchange.address, "1000", "1000000") .send({ from: accounts[0], gas: 1000000 }) ]); @@ -83,7 +83,7 @@ describe("MatchMultipleOrders onchain", () => { .placeBuyTokenOrder("1000000") .send({ from: accounts[1], value: web3.utils.toWei("0.1"), gas: 1000000 }), - exchange.tokenInstance.methods + exchange.augmintToken.instance.methods .transferAndNotify(exchange.address, "1000", "1000000") .send({ from: accounts[0], gas: 1000000 }) ]); diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js index a17da7c..db0492e 100644 --- a/src/augmintjs/Exchange.js +++ b/src/augmintjs/Exchange.js @@ -1,12 +1,12 @@ const BigNumber = require("bignumber.js"); const { cost } = require("./gas.js"); const { constants } = require("./constants.js"); -const contractConnection = require("src/augmintjs/helpers/contractConnection.js"); const Contract = require("src/augmintjs/Contract.js"); + +const AugmintToken = require("src/augmintjs/AugmintToken.js"); const Rates = require("src/augmintjs/Rates.js"); -const ExchangeArtifact = require("src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json"); -const AugmintTokenArtifact = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); +const ExchangeArtifact = require("src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json"); /** * Augmint Exchange contract class @@ -17,8 +17,9 @@ class Exchange extends Contract { constructor() { super(); this.rates = null; - this.tokenInstance = null; - this.currency = null; + this.augmintToken = null; + this.tokenPeggedSymbol = null; /** fiat symbol this exchange is linked to (via Exchange.augmintToken) */ + this.tokenSymbol = null; /** token symbol this exchange contract instance is linked to */ } async connect(ethereumConnection, exchangeAddress) { @@ -26,17 +27,12 @@ class Exchange extends Contract { this.rates = new Rates(); await this.rates.connect(this.ethereumConnection); - this.tokenInstance = contractConnection.connectLatest(this.ethereumConnection, AugmintTokenArtifact); - const [tokenAddressAtExchange, ratesAddressAtExchange, bytes32_peggedSymbol] = await Promise.all([ + const [tokenAddressAtExchange, ratesAddressAtExchange] = await Promise.all([ this.instance.methods.augmintToken().call(), - this.instance.methods.rates().call(), - this.tokenInstance.methods.peggedSymbol().call() + this.instance.methods.rates().call() ]); - const currencyWithTrailing = this.web3.utils.toAscii(bytes32_peggedSymbol); - this.currency = currencyWithTrailing.substr(0, currencyWithTrailing.indexOf("\0")); // remove trailling \u0000s - if (ratesAddressAtExchange !== this.rates.address) { throw new Error( `Exchange: latest Rates contract deployment address ${ @@ -45,15 +41,21 @@ class Exchange extends Contract { ); } - // TODO: replace instance reference with augmintToken.address when AugmintToken class is done - if (tokenAddressAtExchange !== this.tokenInstance._address) { + this.augmintToken = new AugmintToken(); + await this.augmintToken.connect(this.ethereumConnection); + + if (tokenAddressAtExchange !== this.augmintToken.address) { throw new Error( - `Exchange: latest AugmintToken contract deployment address ${ - this.tokenInstance.options.address - } for provided ABI doesn't match AugmintToken contract address ${tokenAddressAtExchange} at deployed Exchange contract` + `Exchange: latest AugmintToken contract deployment address at ${ + this.augmintToken.address + } doesn't match AugmintToken contract address set at latest deployed Exchange contract: ${tokenAddressAtExchange}. + Connecting to legacy Exchanges is not supported yet` ); } + this.tokenPeggedSymbol = this.augmintToken.peggedSymbol; + this.tokenSymbol = this.augmintToken.symbol; + return this.instance; } @@ -68,7 +70,7 @@ class Exchange extends Contract { async getMatchingOrders(gasLimit = this.ethereumConnection.safeBlockGasLimit) { const [orderBook, bn_ethFiatRate] = await Promise.all([ this.fetchOrderBook(), - this.rates.getBnEthFiatRate(this.currency) + this.rates.getBnEthFiatRate(this.tokenPeggedSymbol) ]); const matches = this.calculateMatchingOrders( @@ -85,7 +87,7 @@ class Exchange extends Contract { * Fetches, parses and orders the current, full orderBook from Exchange * @return {Promise} the current, ordered orderBook in the format of: * { buyOrders: [{id, maker, direction, bn_amount (in Wei), bn_ethAmount, amount (in eth), bn_price (in PPM)], - * sellOrders: [{id, maker, direction, bn_amount (wtihout decimals), amount (in AEUR), bn_price (in PPM)}] + * sellOrders: [{id, maker, direction, bn_amount (without decimals), amount (in AEUR), bn_price (in PPM)}] */ async fetchOrderBook() { // TODO: handle when order changes while iterating @@ -161,7 +163,7 @@ class Exchange extends Contract { res.buyOrders.push(parsed); } else { parsed.direction = constants.TOKEN_SELL; - parsed.amount = parseFloat((parsed.bn_amount / constants.DECIMALS_DIV).toFixed(2)); + parsed.amount = parseFloat((parsed.bn_amount / this.augmintToken.decimalsDiv).toFixed(2)); res.sellOrders.push(parsed); } diff --git a/src/augmintjs/Exchange.test.js b/src/augmintjs/Exchange.test.js index c2d93d9..444ecee 100644 --- a/src/augmintjs/Exchange.test.js +++ b/src/augmintjs/Exchange.test.js @@ -15,12 +15,16 @@ describe("connection", () => { await ethereumConnection.connect(); assert.isNull(exchange.address); - assert.isNull(exchange.currency); + assert.isNull(exchange.tokenPeggedSymbol); + assert.isNull(exchange.tokenSymbol); + await exchange.connect(ethereumConnection); + assert.equal(exchange.address, "0xFAceA53a04bEfCC6C9246eb3951814cfEE2A1415"); assert.equal(exchange.rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); - assert.equal(exchange.tokenInstance._address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); // when augmintToken is a class: assert.equal(exchange.augmintToken.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); - assert.equal(exchange.currency, CCY); + assert.equal(exchange.augmintToken.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); + assert.equal(exchange.tokenPeggedSymbol, CCY); + assert.equal(exchange.tokenSymbol, "AEUR"); }); it("should connect to legacy Excahnge contract"); @@ -66,7 +70,7 @@ describe("fetchOrderBook", () => { .placeBuyTokenOrder(bn_buyPrice.toString()) .send({ from: buyMaker, value: bn_buyWeiAmount.toString(), gas: 1000000 }); - await exchange.tokenInstance.methods + await exchange.augmintToken.instance.methods .transferAndNotify(exchange.address, bn_sellTokenAmount.toString(), bn_sellPrice.toString()) .send({ from: sellMaker, gas: 1000000 }); From c700b64dbd57d0797b80e66c2d8b231743938685 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Mon, 8 Apr 2019 17:55:36 +0100 Subject: [PATCH 18/46] have a global eslintrc and prettierrc --- src/.eslintrc => .eslintrc | 0 src/.prettierrc => .prettierrc | 0 test/.eslintrc | 24 ------------------------ test/.prettierrc | 4 ---- 4 files changed, 28 deletions(-) rename src/.eslintrc => .eslintrc (100%) rename src/.prettierrc => .prettierrc (100%) delete mode 100644 test/.eslintrc delete mode 100644 test/.prettierrc diff --git a/src/.eslintrc b/.eslintrc similarity index 100% rename from src/.eslintrc rename to .eslintrc diff --git a/src/.prettierrc b/.prettierrc similarity index 100% rename from src/.prettierrc rename to .prettierrc diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index 98bc0de..0000000 --- a/test/.eslintrc +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": ['eslint:recommended'], - "parserOptions": { - "ecmaVersion": 2017, - }, - "env": { - "mocha": true, - "node": true, - "es6": true - }, - "rules": { - "indent": ["warn", 4], - max-len: "off", - radix: "off", - no-unused-vars: "warn", - "no-console": "off" - }, - "globals": { - "web3": false, - "assert": false, - "artifacts": false, - "contract": false - } -} diff --git a/test/.prettierrc b/test/.prettierrc deleted file mode 100644 index e8980d1..0000000 --- a/test/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "printWidth": 120, - "tabWidth": 4 -} From 42cd750c275f831cbc8555b275aa2c76e89ba2bc Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Mon, 8 Apr 2019 18:06:23 +0100 Subject: [PATCH 19/46] eslint directive --- src/runFeeder.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runFeeder.js b/src/runFeeder.js index aedb2d6..e0a562e 100644 --- a/src/runFeeder.js +++ b/src/runFeeder.js @@ -62,6 +62,7 @@ ethereumConnection }); /********* EthereumConnection event handlers (for logging)*****************/ +/* eslint-disable no-unused-vars */ function onNewOrder(event, matchMaker) { log.debug("New order id:", event.returnValues.orderId); } From 49dda20865532ee0f4005d01ae67d64325c0bdfe Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 8 Apr 2019 18:41:46 +0000 Subject: [PATCH 20/46] chore(package): update mocha to version 6.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 086489e..2bd4f6c 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "devDependencies": { "chai": "4.2.0", - "mocha": "6.1.1", + "mocha": "6.1.2", "nock": "10.0.6", "sinon": "7.3.1" }, From 0246a257262a9a40a654ef47c3dac0d50b3f74e4 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 8 Apr 2019 18:41:56 +0000 Subject: [PATCH 21/46] chore(package): update lockfile yarn.lock --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index bb46170..7b50991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1706,10 +1706,10 @@ mkdirp@*, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0: dependencies: minimist "0.0.8" -mocha@6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.1.tgz#b4f81a9b673649ef72098cb56bfddbfd39da5127" - integrity sha512-ayfr68s4kyDnCU0hjkTk5Z8J8dqr1iPUuVjmd+dLFgaGKOPlgx1XrOGn5k3H1LlXNnLBb8voZMYMKxchiA4Ujg== +mocha@6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.2.tgz#31e960580ef709ef5f26bbe760547cf5207b44df" + integrity sha512-BgD2/RozoSC3uQK5R0isDcxjqaWw2n5HWdk8njYUyZf2NC79ErO5FtYVX52+rfqGoEgMfJf4fuG0IWh2TMzFoA== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" From 2a5b854f0b46dd0da875d8669d8bed861fc327e5 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Thu, 11 Apr 2019 19:25:57 +0100 Subject: [PATCH 22/46] update to contracts v1.0.5 --- augmint-contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/augmint-contracts b/augmint-contracts index 4b055a9..34af567 160000 --- a/augmint-contracts +++ b/augmint-contracts @@ -1 +1 @@ -Subproject commit 4b055a96ce9f080749b3a4d5fad62d4120d361dd +Subproject commit 34af567ef85fec99aec900668de6653a0b8ba979 From 82b641371f4381c3a6178022a3ad786ec866ab03 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Thu, 11 Apr 2019 20:06:13 +0100 Subject: [PATCH 23/46] bump yarn version to match travis' --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index afec361..673b16d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "engines": { "node": "10.15.3", - "yarn": "1.13.0" + "yarn": "^1.15.2" }, "dependencies": { "bignumber.js": "5.0.0", From a4089291f697c684b6e5ea4037e3718f3e4c7c4f Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Thu, 11 Apr 2019 20:06:42 +0100 Subject: [PATCH 24/46] remove pusher-js --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 673b16d..2b0a741 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "http-errors": "1.7.2", "morgan": "1.9.1", "node-fetch": "2.3.0", - "pusher-js": "4.4.0", "ulog": "2.0.0-beta.6", "web3": "1.0.0-beta.36" }, From f43b8ac3010a12436d365d4a2b736690809b09c2 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Thu, 11 Apr 2019 20:07:10 +0100 Subject: [PATCH 25/46] add augmint-js package --- package.json | 1 + yarn.lock | 57 ++++++++++------------------------------------------ 2 files changed, 12 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index 2b0a741..03808d8 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "yarn": "^1.15.2" }, "dependencies": { + "@augmint/js": "0.0.2", "bignumber.js": "5.0.0", "cross-env": "5.2.0", "dotenv": "7.0.0", diff --git a/yarn.lock b/yarn.lock index b966b5b..5ce74e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,16 @@ # yarn lockfile v1 +"@augmint/js@0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@augmint/js/-/js-0.0.2.tgz#f62dc4224b2b9827a67453e21ddcd24958cf3e07" + integrity sha512-JMqYtp5BnYHgoj+AnpN5vUzl9n7n3io0Rtox3kwdfOLhjl6V+3yg8LSv3ywicfLWQ9Y9N/yFPQZDEcTJnpu7MQ== + dependencies: + bignumber.js "5.0.0" + dotenv "7.0.0" + ulog "2.0.0-beta.6" + web3 "1.0.0-beta.36" + "@babel/code-frame@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" @@ -1145,13 +1155,6 @@ fast-levenshtein@~2.0.4: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -faye-websocket@0.9.4: - version "0.9.4" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.9.4.tgz#885934c79effb0409549e0c0a3801ed17a40cdad" - integrity sha1-iFk0x57/sECVSeDAo4Ae0XpAza0= - dependencies: - websocket-driver ">=0.5.1" - fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -1516,11 +1519,6 @@ http-https@^1.0.0: resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" integrity sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs= -http-parser-js@>=0.4.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.0.tgz#d65edbede84349d0dc30320815a15d39cc3cbbd8" - integrity sha512-cZdEF7r4gfRIq7ezX9J0T+kQmJNOub71dWbgAXVHDct80TKP4MCETtZQ31xyv38UwgzkWPYF/Xc0ge55dW9Z9w== - http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -2496,16 +2494,6 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -pusher-js@4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/pusher-js/-/pusher-js-4.4.0.tgz#c52e758c418f8ff9b3221b22291865ffbbc56e32" - integrity sha512-oxSEG764hqeGAqW9Ryq5KdGQrbM/2sBy5L6Jsh62GyRbRO4z0qI9EjQ6IfQSDhR59b/tY0ANuXD8+ZOZY9AOyg== - dependencies: - faye-websocket "0.9.4" - tweetnacl "^1.0.0" - tweetnacl-util "^0.15.0" - xmlhttprequest "^1.8.0" - qs@6.5.2, qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" @@ -3107,21 +3095,11 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tweetnacl-util@^0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.0.tgz#4576c1cee5e2d63d207fee52f1ba02819480bc75" - integrity sha1-RXbBzuXi1j0gf+5S8boCgZSAvHU= - tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= -tweetnacl@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" - integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A== - type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -3476,19 +3454,6 @@ web3@1.0.0-beta.36: web3-shh "1.0.0-beta.36" web3-utils "1.0.0-beta.36" -websocket-driver@>=0.5.1: - version "0.7.0" - resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.0.tgz#0caf9d2d755d93aee049d4bdd0d3fe2cca2a24eb" - integrity sha1-DK+dLXVdk67gSdS90NP+LMoqJOs= - dependencies: - http-parser-js ">=0.4.0" - websocket-extensions ">=0.1.1" - -websocket-extensions@>=0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" - integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== - "websocket@git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible": version "1.0.26" resolved "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" @@ -3588,7 +3553,7 @@ xhr@^2.0.4, xhr@^2.3.3: parse-headers "^2.0.0" xtend "^4.0.0" -xmlhttprequest@1.8.0, xmlhttprequest@^1.8.0: +xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw= From a8f166bc921a5d0d36c4bfad9566f7577a571553 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Thu, 11 Apr 2019 20:07:54 +0100 Subject: [PATCH 26/46] remove local augmint-js and point to new package --- src/MatchMaker/MatchMaker.js | 10 +- src/RatesFeeder.js | 15 +- src/augmintjs/AugmintToken.js | 42 - src/augmintjs/AugmintToken.test.js | 35 - src/augmintjs/Contract.js | 52 -- src/augmintjs/Contract.test.js | 27 - src/augmintjs/EthereumConnection.js | 298 ------- src/augmintjs/EthereumConnection.test.js | 166 ---- .../Exchange.Matching.onchain.test.js | 99 --- src/augmintjs/Exchange.Matching.test.js | 147 ---- src/augmintjs/Exchange.js | 341 -------- src/augmintjs/Exchange.test.js | 150 ---- src/augmintjs/Rates.js | 52 -- src/augmintjs/Rates.test.js | 92 -- ..._ABI_024b81d1a1f75241167a8a0f6e62326f.json | 205 ----- ..._ABI_33995f203f6c629e9916d82dd78e875f.json | 221 ----- ..._ABI_dfbca9f4d0da7a3517b2832dc1c04d9a.json | 185 ---- ..._ABI_fe74b7986dafb00f221486e790fc70ec.json | 232 ----- ..._ABI_3aa2aedd2972391a12570ba4bfca2f72.json | 412 --------- ..._ABI_3c157a5256a2093da587f166d4dbd537.json | 595 ------------- ..._ABI_7595b255e567ae1d0eeef4460d0b0c16.json | 412 --------- ..._ABI_a1dd11684e0aba7b453b7dbae42b2edb.json | 585 ------------- ..._ABI_b2a23202a9a0f04755a186896c2b56eb.json | 599 ------------- ..._ABI_c28de2392aea85ef2aa1b108fce6568c.json | 594 ------------- ..._ABI_d3e7f8a261b756f9c40da097608b21cd.json | 588 ------------- ..._ABI_3bf67cdfa9f7a16596598e19aeb06b39.json | 162 ---- ..._ABI_67db260db12738df3cced3511d34c65c.json | 338 -------- ..._ABI_dd4594a936e439aa46ed5b06cb69eafa.json | 334 ------- ..._ABI_11b039ce783db308e1a9b5f46f05824f.json | 231 ----- ..._ABI_2282749a57fa5c7d61cf33b2f04daf2b.json | 184 ---- ..._ABI_72a73972d565bb24463e7368fd263af4.json | 220 ----- ..._ABI_291572b8d2ffe95dca1733ebc1472e08.json | 696 --------------- ..._ABI_d72d3bd9689dba0d1a8cd4ec23757257.json | 679 --------------- ..._ABI_dd8d5ec97e0a22b6f9e63b04d4e11e09.json | 601 ------------- ..._ABI_ec709c3341045caa3a75374b8cfc7286.json | 700 --------------- ..._ABI_fdf5fde95aa940c6dbfb8353c572c5fb.json | 698 --------------- ..._ABI_6055e2cba8c8e9cb7e04b10e4c56ab9a.json | 548 ------------ ..._ABI_619ff7809b73aead28176fe6317953c3.json | 631 -------------- ..._ABI_66e3e89133d9bbd91baac5552f21f7e1.json | 627 -------------- ..._ABI_c95c1ab8f11cd983deebbe203f4d49be.json | 606 ------------- ..._ABI_f59526398823aef0f0c1454d0b6b4eac.json | 629 -------------- ..._ABI_78141a323f4a8416891b06a0a2b90065.json | 69 -- ..._ABI_066c2220b91befd25691fefd91684117.json | 430 --------- ..._ABI_54d27fedd8bf3010ad5509866a42c053.json | 693 --------------- ..._ABI_7f500b43397413e97de925528187f9cd.json | 693 --------------- ..._ABI_a552ee1f90ae83cb91d07311ae8eab1e.json | 689 --------------- ..._ABI_df21702119818bc90918a2ffe5f87b2d.json | 679 --------------- ..._ABI_19ab69b650e28b2dd211d3851893f91f.json | 338 -------- ..._ABI_dd40c0d39ea8bad8a388522667a84687.json | 332 ------- ..._ABI_10eebbb51a771cfd3473475169a569f1.json | 500 ----------- ..._ABI_771887af92db4b4330d700538df6e490.json | 485 ----------- ..._ABI_7f69e33e7b345c780ac9e43f391437d9.json | 490 ----------- ..._ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json | 269 ------ ..._ABI_aad689098442fe73d35b427a36786f06.json | 258 ------ ..._ABI_cc8bc64cd780f047eca819e6cd3b8af9.json | 258 ------ ..._ABI_d751713988987e9331980363e24189ce.json | 6 - ..._ABI_19ab69b650e28b2dd211d3851893f91f.json | 338 -------- ..._ABI_dd40c0d39ea8bad8a388522667a84687.json | 332 ------- ..._ABI_19ab69b650e28b2dd211d3851893f91f.json | 338 -------- ..._ABI_1bf228e8c50681d2a93b6723af2144a7.json | 791 ----------------- ..._ABI_1d30184837b8c27bcac847509ab146a1.json | 714 --------------- ..._ABI_27721a2c77dc40da7639abd46791c3d7.json | 748 ---------------- ..._ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json | 809 ----------------- ..._ABI_303ed8bcda6fb3c3119cf273797961ef.json | 801 ----------------- ..._ABI_4b49e7e6d1a9a2de81a4d2d088acbc04.json | 787 ----------------- ..._ABI_6b1597192b36a746724929ec9ee7b6b8.json | 795 ----------------- ..._ABI_962b41ca272a86b1f556fc47e0f7954f.json | 805 ----------------- ..._ABI_9aa81519ec45a52d3f8f1a1a83d25c74.json | 805 ----------------- ..._ABI_d7dd02520f2d92b2ca237f066cf2488d.json | 684 --------------- ..._ABI_d96bcadc59c7b9c8b1db01a11a021eef.json | 819 ------------------ .../1/AugmintReserves_DEPLOYS.json | 42 - .../deployments/1/Exchange_DEPLOYS.json | 73 -- .../deployments/1/FeeAccount_DEPLOYS.json | 37 - .../1/InterestEarnedAccount_DEPLOYS.json | 37 - .../deployments/1/LoanManager_DEPLOYS.json | 42 - .../deployments/1/Locker_DEPLOYS.json | 55 -- .../deployments/1/Migrations_DEPLOYS.json | 37 - .../1/MonetarySupervisor_DEPLOYS.json | 42 - .../deployments/1/PreTokenProxy_DEPLOYS.json | 42 - .../deployments/1/PreToken_DEPLOYS.json | 42 - .../abiniser/deployments/1/Rates_DEPLOYS.json | 37 - .../1/StabilityBoardProxy_DEPLOYS.json | 42 - .../deployments/1/TokenAEur_DEPLOYS.json | 42 - .../4/AugmintReserves_DEPLOYS.json | 37 - .../deployments/4/Exchange_DEPLOYS.json | 37 - .../deployments/4/FeeAccount_DEPLOYS.json | 37 - .../4/InterestEarnedAccount_DEPLOYS.json | 37 - .../deployments/4/LoanManager_DEPLOYS.json | 37 - .../deployments/4/Locker_DEPLOYS.json | 37 - .../deployments/4/Migrations_DEPLOYS.json | 24 - .../4/MonetarySupervisor_DEPLOYS.json | 37 - .../deployments/4/PreTokenProxy_DEPLOYS.json | 24 - .../deployments/4/PreToken_DEPLOYS.json | 24 - .../abiniser/deployments/4/Rates_DEPLOYS.json | 37 - .../deployments/4/SafeMath_DEPLOYS.json | 48 - .../4/StabilityBoardProxy_DEPLOYS.json | 37 - .../4/StabilityBoardSigner_DEPLOYS.json | 24 - .../deployments/4/TokenAEur_DEPLOYS.json | 37 - .../999/AugmintReserves_DEPLOYS.json | 24 - .../deployments/999/Exchange_DEPLOYS.json | 182 ---- .../deployments/999/FeeAccount_DEPLOYS.json | 85 -- .../999/InterestEarnedAccount_DEPLOYS.json | 97 --- .../deployments/999/LoanManager_DEPLOYS.json | 133 --- .../deployments/999/Locker_DEPLOYS.json | 133 --- .../deployments/999/Migrations_DEPLOYS.json | 37 - .../999/MonetarySupervisor_DEPLOYS.json | 128 --- .../999/PreTokenProxy_DEPLOYS.json | 42 - .../deployments/999/PreToken_DEPLOYS.json | 60 -- .../deployments/999/Rates_DEPLOYS.json | 85 -- .../deployments/999/SafeMath_DEPLOYS.json | 24 - .../999/StabilityBoardProxy_DEPLOYS.json | 42 - .../999/StabilityBoardSigner_DEPLOYS.json | 37 - .../deployments/999/TokenAEur_DEPLOYS.json | 202 ----- src/augmintjs/constants.js | 22 - src/augmintjs/gas.js | 38 - src/augmintjs/helpers/contractConnection.js | 35 - src/augmintjs/helpers/env.js | 40 - src/augmintjs/helpers/log.js | 5 - src/augmintjs/helpers/promiseTimeout.js | 20 - src/augmintjs/helpers/sigintHandler.js | 22 - src/augmintjs/testHelpers/ganache.js | 53 -- src/runFeeder.js | 6 +- src/statusApi/app.js | 2 +- src/statusApi/server.js | 28 +- src/tickerProviders/BaseHttpTickerProvider.js | 4 +- src/tickerProviders/BaseTickerProvider.js | 4 +- src/tickerProviders/KrakenHttpTicker.js | 1 - test/RatesFeeder.onchain.js | 2 +- test/ratesfeeder.js | 2 +- 129 files changed, 36 insertions(+), 32436 deletions(-) delete mode 100644 src/augmintjs/AugmintToken.js delete mode 100644 src/augmintjs/AugmintToken.test.js delete mode 100644 src/augmintjs/Contract.js delete mode 100644 src/augmintjs/Contract.test.js delete mode 100644 src/augmintjs/EthereumConnection.js delete mode 100644 src/augmintjs/EthereumConnection.test.js delete mode 100644 src/augmintjs/Exchange.Matching.onchain.test.js delete mode 100644 src/augmintjs/Exchange.Matching.test.js delete mode 100644 src/augmintjs/Exchange.js delete mode 100644 src/augmintjs/Exchange.test.js delete mode 100644 src/augmintjs/Rates.js delete mode 100644 src/augmintjs/Rates.test.js delete mode 100644 src/augmintjs/abiniser/abis/AugmintReserves_ABI_024b81d1a1f75241167a8a0f6e62326f.json delete mode 100644 src/augmintjs/abiniser/abis/AugmintReserves_ABI_33995f203f6c629e9916d82dd78e875f.json delete mode 100644 src/augmintjs/abiniser/abis/AugmintReserves_ABI_dfbca9f4d0da7a3517b2832dc1c04d9a.json delete mode 100644 src/augmintjs/abiniser/abis/AugmintReserves_ABI_fe74b7986dafb00f221486e790fc70ec.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_3aa2aedd2972391a12570ba4bfca2f72.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_3c157a5256a2093da587f166d4dbd537.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_7595b255e567ae1d0eeef4460d0b0c16.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_a1dd11684e0aba7b453b7dbae42b2edb.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_b2a23202a9a0f04755a186896c2b56eb.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_c28de2392aea85ef2aa1b108fce6568c.json delete mode 100644 src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json delete mode 100644 src/augmintjs/abiniser/abis/FeeAccount_ABI_3bf67cdfa9f7a16596598e19aeb06b39.json delete mode 100644 src/augmintjs/abiniser/abis/FeeAccount_ABI_67db260db12738df3cced3511d34c65c.json delete mode 100644 src/augmintjs/abiniser/abis/FeeAccount_ABI_dd4594a936e439aa46ed5b06cb69eafa.json delete mode 100644 src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_11b039ce783db308e1a9b5f46f05824f.json delete mode 100644 src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_2282749a57fa5c7d61cf33b2f04daf2b.json delete mode 100644 src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_72a73972d565bb24463e7368fd263af4.json delete mode 100644 src/augmintjs/abiniser/abis/LoanManager_ABI_291572b8d2ffe95dca1733ebc1472e08.json delete mode 100644 src/augmintjs/abiniser/abis/LoanManager_ABI_d72d3bd9689dba0d1a8cd4ec23757257.json delete mode 100644 src/augmintjs/abiniser/abis/LoanManager_ABI_dd8d5ec97e0a22b6f9e63b04d4e11e09.json delete mode 100644 src/augmintjs/abiniser/abis/LoanManager_ABI_ec709c3341045caa3a75374b8cfc7286.json delete mode 100644 src/augmintjs/abiniser/abis/LoanManager_ABI_fdf5fde95aa940c6dbfb8353c572c5fb.json delete mode 100644 src/augmintjs/abiniser/abis/Locker_ABI_6055e2cba8c8e9cb7e04b10e4c56ab9a.json delete mode 100644 src/augmintjs/abiniser/abis/Locker_ABI_619ff7809b73aead28176fe6317953c3.json delete mode 100644 src/augmintjs/abiniser/abis/Locker_ABI_66e3e89133d9bbd91baac5552f21f7e1.json delete mode 100644 src/augmintjs/abiniser/abis/Locker_ABI_c95c1ab8f11cd983deebbe203f4d49be.json delete mode 100644 src/augmintjs/abiniser/abis/Locker_ABI_f59526398823aef0f0c1454d0b6b4eac.json delete mode 100644 src/augmintjs/abiniser/abis/Migrations_ABI_78141a323f4a8416891b06a0a2b90065.json delete mode 100644 src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_066c2220b91befd25691fefd91684117.json delete mode 100644 src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_54d27fedd8bf3010ad5509866a42c053.json delete mode 100644 src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_7f500b43397413e97de925528187f9cd.json delete mode 100644 src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_a552ee1f90ae83cb91d07311ae8eab1e.json delete mode 100644 src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_df21702119818bc90918a2ffe5f87b2d.json delete mode 100644 src/augmintjs/abiniser/abis/PreTokenProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json delete mode 100644 src/augmintjs/abiniser/abis/PreTokenProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json delete mode 100644 src/augmintjs/abiniser/abis/PreToken_ABI_10eebbb51a771cfd3473475169a569f1.json delete mode 100644 src/augmintjs/abiniser/abis/PreToken_ABI_771887af92db4b4330d700538df6e490.json delete mode 100644 src/augmintjs/abiniser/abis/PreToken_ABI_7f69e33e7b345c780ac9e43f391437d9.json delete mode 100644 src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json delete mode 100644 src/augmintjs/abiniser/abis/Rates_ABI_aad689098442fe73d35b427a36786f06.json delete mode 100644 src/augmintjs/abiniser/abis/Rates_ABI_cc8bc64cd780f047eca819e6cd3b8af9.json delete mode 100644 src/augmintjs/abiniser/abis/SafeMath_ABI_d751713988987e9331980363e24189ce.json delete mode 100644 src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json delete mode 100644 src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json delete mode 100644 src/augmintjs/abiniser/abis/StabilityBoardSigner_ABI_19ab69b650e28b2dd211d3851893f91f.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_1bf228e8c50681d2a93b6723af2144a7.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_1d30184837b8c27bcac847509ab146a1.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_27721a2c77dc40da7639abd46791c3d7.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_303ed8bcda6fb3c3119cf273797961ef.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_4b49e7e6d1a9a2de81a4d2d088acbc04.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_6b1597192b36a746724929ec9ee7b6b8.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_962b41ca272a86b1f556fc47e0f7954f.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_9aa81519ec45a52d3f8f1a1a83d25c74.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_d7dd02520f2d92b2ca237f066cf2488d.json delete mode 100644 src/augmintjs/abiniser/abis/TokenAEur_ABI_d96bcadc59c7b9c8b1db01a11a021eef.json delete mode 100644 src/augmintjs/abiniser/deployments/1/AugmintReserves_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/Exchange_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/FeeAccount_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/InterestEarnedAccount_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/LoanManager_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/Locker_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/Migrations_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/MonetarySupervisor_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/PreTokenProxy_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/PreToken_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/Rates_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/StabilityBoardProxy_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/1/TokenAEur_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/AugmintReserves_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/Exchange_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/FeeAccount_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/InterestEarnedAccount_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/LoanManager_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/Locker_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/Migrations_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/MonetarySupervisor_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/PreTokenProxy_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/PreToken_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/Rates_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/SafeMath_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/StabilityBoardProxy_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/StabilityBoardSigner_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/4/TokenAEur_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/AugmintReserves_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/Exchange_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/FeeAccount_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/InterestEarnedAccount_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/LoanManager_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/Locker_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/Migrations_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/MonetarySupervisor_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/PreTokenProxy_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/PreToken_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/Rates_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/SafeMath_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/StabilityBoardProxy_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/StabilityBoardSigner_DEPLOYS.json delete mode 100644 src/augmintjs/abiniser/deployments/999/TokenAEur_DEPLOYS.json delete mode 100644 src/augmintjs/constants.js delete mode 100644 src/augmintjs/gas.js delete mode 100644 src/augmintjs/helpers/contractConnection.js delete mode 100644 src/augmintjs/helpers/env.js delete mode 100644 src/augmintjs/helpers/log.js delete mode 100644 src/augmintjs/helpers/promiseTimeout.js delete mode 100644 src/augmintjs/helpers/sigintHandler.js delete mode 100644 src/augmintjs/testHelpers/ganache.js diff --git a/src/MatchMaker/MatchMaker.js b/src/MatchMaker/MatchMaker.js index a3a6e62..1335bdb 100644 --- a/src/MatchMaker/MatchMaker.js +++ b/src/MatchMaker/MatchMaker.js @@ -4,13 +4,13 @@ calls matchMultiple tx every time a new Order event received emmitted events: */ -require("src/augmintjs/helpers/env.js"); -const log = require("src/augmintjs/helpers/log.js")("MatchMaker"); +require("@augmint/js/src/helpers/env.js"); +const log = require("@augmint/js/src/helpers/log.js")("MatchMaker"); const EventEmitter = require("events"); -const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); +const promiseTimeout = require("@augmint/js/src/helpers/promiseTimeout.js"); -const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); -const Exchange = require("src/augmintjs/Exchange.js"); +const setExitHandler = require("@augmint/js/src/helpers/sigintHandler.js"); +const Exchange = require("@augmint/js/src/Exchange.js"); class MatchMaker extends EventEmitter { constructor(ethereumConnection) { diff --git a/src/RatesFeeder.js b/src/RatesFeeder.js index 0e96efc..6a19a38 100644 --- a/src/RatesFeeder.js +++ b/src/RatesFeeder.js @@ -14,14 +14,13 @@ TODO: web3.eth.transactionConfirmationBlocks: ${web3.eth.transactionConfirmationBlocks} web3.eth.transactionPollingTimeout: ${web3.eth.transactionPollingTimeout} */ - -require("src/augmintjs/helpers/env.js"); -const log = require("src/augmintjs/helpers/log.js")("ratesFeeder"); -const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); -const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); -const AugmintToken = require("src/augmintjs/AugmintToken.js"); -const Rates = require("src/augmintjs/Rates.js"); -const { cost } = require("src/augmintjs/gas.js"); +require("@augmint/js/src/helpers/env.js"); +const log = require("@augmint/js/src/helpers/log.js")("ratesFeeder"); +const setExitHandler = require("@augmint/js/src/helpers/sigintHandler.js"); +const promiseTimeout = require("@augmint/js/src/helpers/promiseTimeout.js"); +const AugmintToken = require("@augmint/js/src/AugmintToken.js"); +const Rates = require("@augmint/js/src/Rates.js"); +const { cost } = require("@augmint/js/src/gas.js"); const CCY = "EUR"; // only EUR is suported by TickerProvider providers ATM const LIVE_PRICE_DIFFERENCE_DECIMALS = 4; // rounding live price % difference to 2 decimals diff --git a/src/augmintjs/AugmintToken.js b/src/augmintjs/AugmintToken.js deleted file mode 100644 index f65ade4..0000000 --- a/src/augmintjs/AugmintToken.js +++ /dev/null @@ -1,42 +0,0 @@ -const Contract = require("src/augmintjs/Contract.js"); -const TokenAEurArtifact = require("src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json"); - -class AugmintToken extends Contract { - constructor() { - super(); - - this.peggedSymbol = null; - this.symbol = null; - this.name = null; - this.decimals = null; - this.decimalsDiv = null; - - this.feeAccountAddress = null; - - this.contractArtifact = TokenAEurArtifact; - } - - async connect(ethereumConnection, augmintTokenAddress) { - await super.connect(ethereumConnection, this.contractArtifact, augmintTokenAddress); - - const [bytes32PeggedSymbol, symbol, name, decimals, feeAccountAddress] = await Promise.all([ - this.instance.methods.peggedSymbol().call(), - this.instance.methods.symbol().call(), - this.instance.methods.name().call(), - this.instance.methods.decimals().call(), - this.instance.methods.feeAccount().call() - ]); - - const peggedSymbolWithTrailing = this.web3.utils.toAscii(bytes32PeggedSymbol); - this.peggedSymbol = peggedSymbolWithTrailing.substr(0, peggedSymbolWithTrailing.indexOf("\0")); - - this.name = name; - (this.symbol = symbol), (this.decimals = decimals); - this.decimalsDiv = 10 ** decimals; - this.feeAccountAddress = feeAccountAddress; - - return this.instance; - } -} - -module.exports = AugmintToken; diff --git a/src/augmintjs/AugmintToken.test.js b/src/augmintjs/AugmintToken.test.js deleted file mode 100644 index 4b53a72..0000000 --- a/src/augmintjs/AugmintToken.test.js +++ /dev/null @@ -1,35 +0,0 @@ -const { assert } = require("chai"); - -const EthereumConnection = require("./EthereumConnection.js"); -const AugmintToken = require("./AugmintToken.js"); - -const CCY = "EUR"; - -describe("AugmintToken connection", () => { - const ethereumConnection = new EthereumConnection(); - - it("should connect to latest contract", async () => { - await ethereumConnection.connect(); - const tokenAEur = new AugmintToken(); - - assert.isNull(tokenAEur.peggedSymbol); - assert.isNull(tokenAEur.symbol); - assert.isNull(tokenAEur.name); - assert.isNull(tokenAEur.address); - assert.isNull(tokenAEur.decimals); - assert.isNull(tokenAEur.decimalsDiv); - assert.isNull(tokenAEur.feeAccountAddress); - - await tokenAEur.connect(ethereumConnection); - - assert.equal(tokenAEur.peggedSymbol, CCY); - assert.equal(tokenAEur.symbol, "AEUR"); - assert.equal(tokenAEur.name, "Augmint Euro"); - assert.equal(tokenAEur.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); - assert.equal(tokenAEur.decimals, 2); - assert.equal(tokenAEur.decimalsDiv, 100); - assert.equal(tokenAEur.feeAccountAddress, "0xf5EfCaA78f5656F7Ddc971BC5d51a08b5F161573"); - }); - - it("should connect to legacy AugmintToken contract"); -}); diff --git a/src/augmintjs/Contract.js b/src/augmintjs/Contract.js deleted file mode 100644 index eb607c4..0000000 --- a/src/augmintjs/Contract.js +++ /dev/null @@ -1,52 +0,0 @@ -const contractConnection = require("src/augmintjs/helpers/contractConnection.js"); - -/** - * Generic Contract super class - */ -class Contract { - constructor() { - /** - * @prop {object} ethereumConnection the EthereumConnection instance this contract instance is connected to - * @prop {object} web3 shorthand for ethereumConnection.web3 - * @prop {string} [address] Ethereum address of the contract instance - */ - this.ethereumConnection = null; - this.web3 = null; - this.instance = null; - } - - get address() { - return this.instance ? this.instance._address : null; - } - - /** - * connects to latest deployment or if address provided then at that address - * NB: connect by address is not implemented tyet - * @param {object} ethereumConnection a connected EthereumConnection instance - * @param {string} abiFile path to the JSON abifile generated by abiniser - * @param {string} address contract address if y (not yet implemented) - * @return {Promise} the web3 contract instance - */ - async connect(ethereumConnection, abiFile, address) { - if (address) { - throw new Error( - "Connecting to a contract at arbitary address is not supported yet. Pass no address to connect latest contract deployment at network" - ); - } - - if (!(await ethereumConnection.isConnected())) { - throw new Error( - "Contract: not connected to web3 at passed ethereumConnection. call ethereumConnection.connect first" - ); - } - - this.ethereumConnection = ethereumConnection; - this.web3 = this.ethereumConnection.web3; - - this.instance = contractConnection.connectLatest(this.ethereumConnection, abiFile); - - return this.instance; - } -} - -module.exports = Contract; diff --git a/src/augmintjs/Contract.test.js b/src/augmintjs/Contract.test.js deleted file mode 100644 index 7b886cb..0000000 --- a/src/augmintjs/Contract.test.js +++ /dev/null @@ -1,27 +0,0 @@ -const assert = require("chai").assert; -const nodeAssert = require("assert"); -const Contract = require("./Contract.js"); -const EthereumConnection = require("./EthereumConnection.js"); -const ethereumConnection = new EthereumConnection(); - -describe("constructor", () => { - it("should be created", () => { - const contract = new Contract(); - assert.isNull(contract.instance); - assert.isNull(contract.web3); - assert.isNull(contract.ethereumConnection); - assert.isNull(contract.address); - }); - - it("should throw trying to connect without ethereumConnection", async () => { - const contract = new Contract(); - - nodeAssert.rejects( - contract.connect( - ethereumConnection, - {} - ), - /not connected to web3/ - ); - }); -}); diff --git a/src/augmintjs/EthereumConnection.js b/src/augmintjs/EthereumConnection.js deleted file mode 100644 index bfb1762..0000000 --- a/src/augmintjs/EthereumConnection.js +++ /dev/null @@ -1,298 +0,0 @@ -require("src/augmintjs/helpers/env.js"); -const log = require("src/augmintjs/helpers/log.js")("EthereumConnection"); -const EventEmitter = require("events"); -const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); -const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); -const Web3 = require("web3"); - -// TODO: make these a DEFAULT_OPTIONS = {...} object and all options to EthereumConnection.options = { ...} -const DEFAULT_ETHEREUM_CONNECTION_TIMEOUT = 10000; -const DEFAULT_ETHEREUM_CONNECTION_CLOSE_TIMEOUT = 10000; -const DEFAULT_ETHEREUM_ISLISTENING_TIMEOUT = 1000; // used at isConnected() for web3.eth.net.isListening() timeout. TODO: check if we still need with newer web3 or better way? -const DEFAULT_ETHEREUM_CONNECTION_CHECK_INTERVAL = 1000; - -/** - * Connect to Ethereum network via web3 - * Maintains connection state, network properties - * Reconnects in case of connection dropped. NB: each consumer has to resubscribe atm after reconnection (on "connected" event) - * Usage: - * const ethereumConnection = new EthereumConnection(); - * await ethereumConnection.connect().catch( e => {..} ) - * @fires EthereumConnection#connected - * @fires EthereumConnection#disconnected NB: it's only in case of error code 1000, normal end - * @fires EthereumConnection#connectionLost - * @extends EventEmitter - */ -class EthereumConnection extends EventEmitter { - constructor(options = {}) { - super(); - /** - * @namespace - * @prop {object} web3 web3.js object - * @prop {object} provider shorthand for web3.currentProvider - * @prop {boolean} isStopping indicates if the connection is being shut down (ie. via stop()) - * @prop {number} networkId - * @prop {array} accounts array of available accounts received from web3.eth.getAccounts() - * @prop {number} blockGasLimit the block gas limit when the connection was estabilished - * @prop {number} safeBlockGasLimit as blockGasLimit read on startup and it can change later so we provide a "safe" estimate which is 90% of the gasLimit - * @prop {boolean} isStopping true when shutting down because stop() has been called (e.g. SIGTERM/SIGSTOP/SIGINT - * @prop {boolean} isTryingToReconnect true while trying to reconnect because of connection loss detected - */ - this.web3 = null; - this.provider = null; - - this.isStopping = false; /** internal flag to avoid retrying connection when stop() called intentionally */ - this.isTryingToReconnect = false; /** internal flag to avoid */ - this.wasConnected = false; /** internal flag used to supress repeating connection lost logging */ - this.connectionCheckTimer = null; - - this.networkId = null; - this.blockGasLimit = null; - this.safeBlockGasLimit = null; - - this.accounts = null; - - this.ETHEREUM_CONNECTION_CHECK_INTERVAL = - options.ETHEREUM_CONNECTION_CHECK_INTERVAL || - process.env.ETHEREUM_CONNECTION_CHECK_INTERVAL || - DEFAULT_ETHEREUM_CONNECTION_CHECK_INTERVAL; - - this.ETHEREUM_CONNECTION_TIMEOUT = - options.ETHEREUM_CONNECTION_TIMEOUT || - process.env.ETHEREUM_CONNECTION_TIMEOUT || - DEFAULT_ETHEREUM_CONNECTION_TIMEOUT; - - this.ETHEREUM_ISLISTENING_TIMEOUT = - options.ETHEREUM_ISLISTENING_TIMEOUT || - process.env.ETHEREUM_ISLISTENING_TIMEOUT || - DEFAULT_ETHEREUM_ISLISTENING_TIMEOUT; - - this.ETHEREUM_CONNECTION_CLOSE_TIMEOUT = - options.ETHEREUM_CONNECTION_CLOSE_TIMEOUT || - process.env.ETHEREUM_CONNECTION_CLOSE_TIMEOUT || - DEFAULT_ETHEREUM_CONNECTION_CLOSE_TIMEOUT; - - this.PROVIDER_TYPE = options.PROVIDER_TYPE || process.env.PROVIDER_TYPE; - this.PROVIDER_URL = options.PROVIDER_URL || process.env.PROVIDER_URL; - this.INFURA_PROJECT_ID = options.INFURA_PROJECT_ID || process.env.INFURA_PROJECT_ID || ""; - - setExitHandler(this._exit.bind(this), "ethereumConnection", this.ETHEREUM_CONNECTION_CLOSE_TIMEOUT + 1000); - - log.info( - // IMPORTANT: NEVER expose keys even not in logs! - `** EthereumConnection loaded with settings: - PROVIDER_TYPE: ${this.PROVIDER_TYPE} - PROVIDER_URL: ${this.PROVIDER_URL} - INFURA_PROJECT_ID: ${ - this.INFURA_PROJECT_ID ? this.INFURA_PROJECT_ID.substring(0, 4) + "... rest hidden" : "not provided" - } - ETHEREUM_CONNECTION_CHECK_INTERVAL: ${this.ETHEREUM_CONNECTION_CHECK_INTERVAL} - LOG_AS_SUCCESS_AFTER_N_CONFIRMATION: ${process.env.LOG_AS_SUCCESS_AFTER_N_CONFIRMATION}` - ); - } - - /** - * Get connection state - * @return {Promise} result from web3.eth.net.isListening() - */ - async isConnected() { - let result = false; - if (this.web3) { - result = await promiseTimeout(this.ETHEREUM_ISLISTENING_TIMEOUT, this.web3.eth.net.isListening()).catch( - e => { - // Need timeout b/c listening pending forever when called after a connection.close() TODO: test if needed in newer web3 than beta 33 - // log.debug("isConnected isListening ERROR (returning false)", e); - return false; - } - ); - } - - return result; - } - - /** - * next nonce for the account - * @param {string} account Ethereum account with leading 0x - * @return {Promise} The result web3.eth.getTransactionCount(account) which is essentially the nonce for the next tx - */ - async getAccountNonce(account) { - return await this.web3.eth.getTransactionCount(account); - } - - async connect() { - this.isStopping = false; - - switch (this.PROVIDER_TYPE) { - case "http": { - // provider.on is not a function with web3js beta 33 - maybe newer release? or shall we make it work without it? - //this.provider = new Web3.providers.HttpProvider(this.PROVIDER_URL + this.INFURA_PROJECT_ID); - //break; - throw new Error(this.PROVIDER_TYPE + " is not supported yet"); - } - case "websocket": { - this.provider = new Web3.providers.WebsocketProvider(this.PROVIDER_URL + this.INFURA_PROJECT_ID); - break; - } - default: - throw new Error(this.PROVIDER_TYPE + " is not supported yet"); - } - - this.provider.on("error", this.onProviderError.bind(this)); - this.provider.on("end", this.onProviderEnd.bind(this)); - this.provider.on("connect", this.onProviderConnect.bind(this)); - - if (this.web3) { - // it's a reconnect - this.web3.setProvider(this.provider); - } else { - this.web3 = new Web3(this.provider); - } - - const connectedEventPromise = new Promise((resolve, reject) => { - const tempOnConnected = () => { - this.removeListener("providerError", tempOnproviderError); - this.removeListener("connectionLost", tempOnConnectionLost); - resolve(); // we wait for our custom setup to finish before we resolve connect() - }; - - const tempOnproviderError = () => { - this.removeListener("connected", tempOnConnected); - this.removeListener("connectionLost", tempOnConnectionLost); - reject(new Error("EthereumConnection connect failed. Provider error received instead of connect")); - }; - - const tempOnConnectionLost = e => { - this.removeListener("connected", tempOnConnected); - this.removeListener("providerError", tempOnproviderError); - reject( - new Error( - `EthereumConnection connect failed. connectionLost received instead of connect. Code: ${ - e.code - } Reason: ${e.reason}` - ) - ); - }; - - this.once("connectionLost", tempOnConnectionLost); - this.once("connected", tempOnConnected); - this.once("providerError", tempOnproviderError); // this would be better: this.provider.once("end", e => { .. but web3js has a bug subscrbuing the same event multiple times. - }); - - await promiseTimeout(this.ETHEREUM_CONNECTION_TIMEOUT, connectedEventPromise); - } - - async onProviderConnect() { - clearTimeout(this.connectionCheckTimer); - - let lastBlock; - [this.networkId, lastBlock, this.accounts] = await Promise.all([ - this.web3.eth.net.getId().then(res => parseInt(res, 10)), - this.web3.eth.getBlock("latest"), - this.web3.eth.getAccounts() - ]); - this.blockGasLimit = lastBlock.gasLimit; - this.safeBlockGasLimit = Math.round(this.blockGasLimit * 0.9); - - if (this.isTryingToReconnect) { - this.isTryingToReconnect = false; - log.warn(" EthereumConnection - provider connection recovered"); - } else { - log.debug(" EthereumConnection - provider connected"); - } - - this.wasConnected = true; - if (this.ETHEREUM_CONNECTION_CHECK_INTERVAL > 0) { - this.connectionCheckTimer = setInterval( - this._checkConnection.bind(this), - this.ETHEREUM_CONNECTION_CHECK_INTERVAL - ); - } - - this.emit("connected", this); - } - - onProviderEnd(e) { - if (e.code === 1000) { - // Normal connection closure (currentProvider.close() was called from stop()) - log.debug(" EthereumConnection - Websocket ended with normal end code:", e.code, e.reason); - this.emit("disconnected", e, this); - } else { - if (!this.isTryingToReconnect && !this.isStopping) { - // Unexpected connection loss - _checkConnection() will try to reconnect in every RECONNECT_INTERVAL - log.warn(" EthereumConnection - Websocket connection ended with code:", e.code, e.reason); - this.emit("connectionLost", e, this); - } - } - } - - onProviderError(event) { - // NB: This is triggered with every isConnected() call too when not connected - // Supressing repeating logs while reconnecting - common due to infura dropping web3 connection ca. in every 1-2 hours) - // TODO: check if we should implement web3 keepalive pings or if newever versions on web3js are supporting it - if (!this.isTryingToReconnect && !this.isStopping && this.wasConnected) { - this.emit("providerError", event, this); - log.warn( - " EthereumConnection - provider error. Trying to reconnect. Logging provider errors are supressed until sucessfull reconnect." - ); - } - } - - async stop(/*signal*/) { - this.isStopping = true; - clearTimeout(this.connectionCheckTimer); - - if (this.web3 && (await this.isConnected())) { - const disconnectedEventPromise = new Promise(resolve => { - this.once("disconnected", () => { - resolve(); - }); - }); - - await this.web3.currentProvider.connection.close(); - - await promiseTimeout(this.ETHEREUM_CONNECTION_CLOSE_TIMEOUT, disconnectedEventPromise); - } - } - - async _exit(signal) { - await this.stop(signal); - } - - async _checkConnection() { - // subscriptions are starting not to arrive on Infura websocket after a while and provider end is not always triggered - // TODO: - check if newer versions of web3 (newer than beta33) are handling webscoket connection drops correclty - if (!this.isStopping && !(await this.isConnected())) { - if (this.wasConnected) { - // emit connectionLost (and log) only first reconnect attempt - log.debug( - " EthereumConnection _checkConnection() - ethereumConnection.isConnected() returned false. trying to reconnect" - ); - this.emit("connectionLost", { reason: "checkConnection detected connectionloss" }, this); // triggering this so modules can handle event - this.wasConnected = false; - } - - this._tryToReconnect(); - } - } - - async _tryToReconnect() { - if (!this.isStopping && !this.isTryingToReconnect) { - // we won't try to reconnect if previous is still running (this.isTryingToReconnect) - // i.e the prev connect() will errror or worst case timeout in ETHEREUM_CONNECTION_TIMEOUT ms and _checkConnection is called in every x ms - if (this.wasConnected) { - log.warn( - " EthereumConnection connnection lost to web3 provider. Keep trying to reconnect. Logging of further warnings supressed until connection recovers" - ); - } - - this.isTryingToReconnect = true; - await this.connect().catch(e => { - // we ignore error and wait for next attempt to be triggered in ETHEREUM_CONNECTION_CHECK_INTERVAL ms - log.debug(" EthereumConnection reconnection attempt error:", e); - }); - this.isTryingToReconnect = false; - } - } -} - -module.exports = EthereumConnection; diff --git a/src/augmintjs/EthereumConnection.test.js b/src/augmintjs/EthereumConnection.test.js deleted file mode 100644 index da14019..0000000 --- a/src/augmintjs/EthereumConnection.test.js +++ /dev/null @@ -1,166 +0,0 @@ -const assert = require("chai").assert; -const EthereumConnection = require("./EthereumConnection.js"); -const sinon = require("sinon"); - -let ethereumConnection; -const providers = [ - { name: "local websocket", PROVIDER_URL: "ws://localhost:8545", PROVIDER_TYPE: "websocket" }, - { - name: "infura websocket", - PROVIDER_URL: "wss://rinkeby.infura.io/ws/v3/", - PROVIDER_TYPE: "websocket", - INFURA_PROJECT_ID: "cb1b0d436be24b0fa654ca34ae6a3645" - } -]; - -describe("EthereumConnection", () => { - it("should have an initial state", async () => { - const ethereumConnection = new EthereumConnection(); - - assert.isNull(ethereumConnection.web3); - assert.isNull(ethereumConnection.provider); - - assert(!(await ethereumConnection.isConnected())); - assert(!ethereumConnection.isStopping); - assert(!ethereumConnection.isTryingToReconnect); - - assert.isNull(ethereumConnection.networkId); - assert.isNull(ethereumConnection.blockGasLimit); - assert.isNull(ethereumConnection.safeBlockGasLimit); - assert.isNull(ethereumConnection.accounts); - }); - - providers.forEach(providerOptions => { - describe("EthereumConnection -" + providerOptions.name, () => { - it("should connect & disconnect", async () => { - ethereumConnection = new EthereumConnection(providerOptions); - const connectedSpy = sinon.spy(); - const disconnectedSpy = sinon.spy(); - const connectionLostSpy = sinon.spy(); - - ethereumConnection.on("connected", connectedSpy); - ethereumConnection.on("disconnected", disconnectedSpy); - ethereumConnection.on("connectionLost", connectionLostSpy); - - assert(!(await ethereumConnection.isConnected())); - - await ethereumConnection.connect(); - - const expNetworkId = parseInt(await ethereumConnection.web3.eth.net.getId(), 10); - - assert(await ethereumConnection.isConnected()); - assert.equal(ethereumConnection.networkId, expNetworkId); - assert(ethereumConnection.blockGasLimit > 0); - assert(ethereumConnection.safeBlockGasLimit, Math.round(ethereumConnection.blockGasLimit * 0.9)); - - assert.isArray(ethereumConnection.accounts); - ethereumConnection.accounts.forEach(acc => assert(ethereumConnection.web3.utils.isAddress(acc))); - - assert(!ethereumConnection.isStopping); - assert(!ethereumConnection.isTryingToReconnect); - - sinon.assert.calledOnce(connectedSpy); - sinon.assert.notCalled(disconnectedSpy); - sinon.assert.notCalled(connectionLostSpy); - - await ethereumConnection.stop(); - - assert(!(await ethereumConnection.isConnected())); - assert(ethereumConnection.isStopping); - assert(!ethereumConnection.isTryingToReconnect); - - sinon.assert.calledOnce(connectedSpy); // 1 event left from initial connect on spy - sinon.assert.notCalled(connectionLostSpy); - sinon.assert.calledOnce(disconnectedSpy); - }); - - it("should get options as constructor parameters too", async () => { - const options = { - ETHEREUM_CONNECTION_CHECK_INTERVAL: 9999, - ETHEREUM_CONNECTION_TIMEOUT: 99, - ETHEREUM_ISLISTENING_TIMEOUT: 99, - ETHEREUM_CONNECTION_CLOSE_TIMEOUT: 99, - PROVIDER_TYPE: "test", - PROVIDER_URL: "hoops", - INFURA_PROJECT_ID: "bingo" - }; - - Object.assign(options, providerOptions); - - ethereumConnection = new EthereumConnection(options); - - assert( - ethereumConnection.ETHEREUM_CONNECTION_CHECK_INTERVAL, - options.ETHEREUM_CONNECTION_CHECK_INTERVAL - ); - assert.equal(ethereumConnection.PROVIDER_TYPE, options.PROVIDER_TYPE); - assert.equal(ethereumConnection.PROVIDER_URL, options.PROVIDER_URL); - assert.equal(ethereumConnection.INFURA_PROJECT_ID, options.INFURA_PROJECT_ID); - assert.equal(ethereumConnection.ETHEREUM_CONNECTION_TIMEOUT, options.ETHEREUM_CONNECTION_TIMEOUT); - assert.equal( - ethereumConnection.ETHEREUM_CONNECTION_CLOSE_TIMEOUT, - options.ETHEREUM_CONNECTION_CLOSE_TIMEOUT - ); - }); - - it("should return account nonce", async () => { - const ethereumConnection = new EthereumConnection(); - await ethereumConnection.connect(); - const expectedNonce = await ethereumConnection.web3.eth.getTransactionCount( - ethereumConnection.accounts[0] - ); - - let nonce = await ethereumConnection.getAccountNonce(ethereumConnection.accounts[0]); - - assert.equal(nonce, expectedNonce); - - // with a zero nonce acc, assuming randomAcc has no tx-s from migration subscriptions - const randomAccount = "0x107af532e6f828da6fe79699123c9a5ea0123d16"; - nonce = await ethereumConnection.getAccountNonce(randomAccount); - assert.equal(nonce, 0); - }); - - it("should reconnect after connection lost", done => { - const connectionLostSpy = sinon.spy(); - const disconnectedSpy = sinon.spy(); - const checkInterval = 100; - const options = { - ETHEREUM_CONNECTION_CHECK_INTERVAL: checkInterval, - ETHEREUM_CONNECTION_TIMEOUT: 10000 - }; - Object.assign(options, providerOptions); - - ethereumConnection = new EthereumConnection(options); - - const onConnectionLoss = async (event, eConnObj) => { - connectionLostSpy(event, eConnObj); - assert.equal(event.reason, "checkConnection detected connectionloss"); - }; - - const onConnected = async () => { - // this is only set up for the reconnection we expect - assert(await ethereumConnection.isConnected()); - assert(connectionLostSpy.calledOnce); - assert(disconnectedSpy.calledOnce); - done(); - }; - - ethereumConnection - .connect() - .then(async () => { - assert(await ethereumConnection.isConnected()); - - ethereumConnection.on("disconnected", disconnectedSpy); - ethereumConnection.on("connectionLost", onConnectionLoss); - ethereumConnection.on("connected", onConnected); // we only setup connected here - - ethereumConnection.web3.currentProvider.connection.close(); // simulate connection drop - assert(!(await ethereumConnection.isConnected())); - }) - .catch(error => { - throw error; - }); - }); - }); - }); -}); diff --git a/src/augmintjs/Exchange.Matching.onchain.test.js b/src/augmintjs/Exchange.Matching.onchain.test.js deleted file mode 100644 index 1cb35ec..0000000 --- a/src/augmintjs/Exchange.Matching.onchain.test.js +++ /dev/null @@ -1,99 +0,0 @@ -const assert = require("chai").assert; -const Exchange = require("./Exchange.js"); -const ganache = require("./testHelpers/ganache.js"); -const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); - -describe("MatchMultipleOrders onchain", () => { - const ethereumConnection = new EthereumConnection(); - let exchange; - let snapshotId; - let accounts; - let web3; - - before(async () => { - await ethereumConnection.connect(); - web3 = ethereumConnection.web3; - accounts = ethereumConnection.accounts; - exchange = new Exchange(ethereumConnection, []); - - await exchange.connect(ethereumConnection); - }); - - beforeEach(async () => { - snapshotId = await ganache.takeSnapshot(ethereumConnection.web3); - }); - - afterEach(async () => { - await ganache.revertSnapshot(ethereumConnection.web3, snapshotId); - }); - - it("getMatchingOrders", async () => { - await exchange.instance.methods.placeBuyTokenOrder("1000000").send({ - from: accounts[1], - value: web3.utils.toWei("0.1"), - gas: 1000000 - }); - await exchange.augmintToken.instance.methods.transferAndNotify(exchange.address, "1000", "1000000").send({ - from: accounts[0], - gas: 1000000 - }); - - const expGasEstimate = 200000; - - // No gasLimit (defaults to safeBlockGasLimit) - let matchingOrders = await exchange.getMatchingOrders(); - - assert.deepEqual(matchingOrders, { buyIds: [1], sellIds: [2], gasEstimate: expGasEstimate }); - - // passed gaslimit not enough to match any - matchingOrders = await exchange.getMatchingOrders(expGasEstimate - 1); - assert.deepEqual(matchingOrders, { buyIds: [], sellIds: [], gasEstimate: 0 }); - }); - - it("signAndSendMatchMultipleOrders", async () => { - await Promise.all([ - exchange.instance.methods - .placeBuyTokenOrder("1000000") - .send({ from: accounts[1], value: web3.utils.toWei("0.1"), gas: 1000000 }), - - exchange.augmintToken.instance.methods - .transferAndNotify(exchange.address, "1000", "1000000") - .send({ from: accounts[0], gas: 1000000 }) - ]); - - let matchingOrders = await exchange.getMatchingOrders(); - - // ganache account[0] private key, generated with mnemonic fixed in ganache launch script - const privateKey = "0x85b3d743fbe4ec4e2b58947fa5484da7b2f5538b0ae8e655646f94c95d5fb949"; - - const receipt = await exchange.signAndSendMatchMultipleOrders( - ethereumConnection.accounts[0], - privateKey, - matchingOrders - ); - - assert(receipt.status); - matchingOrders = await exchange.getMatchingOrders(); - assert.deepEqual(matchingOrders, { buyIds: [], sellIds: [], gasEstimate: 0 }); - }); - - it("matchMultipleOrders", async () => { - await Promise.all([ - exchange.instance.methods - .placeBuyTokenOrder("1000000") - .send({ from: accounts[1], value: web3.utils.toWei("0.1"), gas: 1000000 }), - - exchange.augmintToken.instance.methods - .transferAndNotify(exchange.address, "1000", "1000000") - .send({ from: accounts[0], gas: 1000000 }) - ]); - - let matchingOrders = await exchange.getMatchingOrders(); - - const receipt = await exchange.matchMultipleOrders(ethereumConnection.accounts[0], matchingOrders); - - assert(receipt.status); - matchingOrders = await exchange.getMatchingOrders(); - assert.deepEqual(matchingOrders, { buyIds: [], sellIds: [], gasEstimate: 0 }); - }); -}); diff --git a/src/augmintjs/Exchange.Matching.test.js b/src/augmintjs/Exchange.Matching.test.js deleted file mode 100644 index 4e126f6..0000000 --- a/src/augmintjs/Exchange.Matching.test.js +++ /dev/null @@ -1,147 +0,0 @@ -const expect = require("chai").expect; -const exchange = new (require("./Exchange.js"))(); -const BigNumber = require("bignumber.js"); -const { cost } = require("./gas.js"); - -describe("getMatchMultipleOrdersTx", () => { - it("should match orders on chain"); -}); - -describe("calculateMatchingOrders", () => { - const ETHEUR_RATE = new BigNumber(500); - const BN_ONE = new BigNumber(1); - const GAS_LIMIT = Number.MAX_SAFE_INTEGER; - - it("should return no match if no orders", () => { - const matches = exchange.calculateMatchingOrders([], [], ETHEUR_RATE, GAS_LIMIT); - expect(matches.buyIds).to.have.lengthOf(0); - expect(matches.sellIds).to.have.lengthOf(0); - expect(matches.gasEstimate).to.be.equal(0); - }); - - it("should return empty arrays if no matching orders", () => { - const buyOrders = [ - { id: 2, price: 0.9999, bn_ethAmount: BN_ONE }, - { id: 3, price: 0.97, bn_ethAmount: BN_ONE }, - { id: 1, price: 0.9, bn_ethAmount: BN_ONE } - ]; - const sellOrders = [ - { id: 4, price: 1, amount: 10 }, // - { id: 5, price: 1.01, amount: 10 } // - ]; - - const matches = exchange.calculateMatchingOrders(buyOrders, sellOrders, ETHEUR_RATE, GAS_LIMIT); - - expect(matches.buyIds).to.have.lengthOf(0); - expect(matches.sellIds).to.have.lengthOf(0); - expect(matches.gasEstimate).to.be.equal(0); - }); - - it("should return matching orders (two matching)", () => { - const buyOrders = [ - { id: 2, price: 1, bn_ethAmount: BN_ONE }, - { id: 3, price: 0.97, bn_ethAmount: BN_ONE }, - { id: 1, price: 0.9, bn_ethAmount: BN_ONE } - ]; - const sellOrders = [ - { id: 4, price: 1, amount: 10 }, // - { id: 5, price: 1.05, amount: 10 } // - ]; - - const matches = exchange.calculateMatchingOrders(buyOrders, sellOrders, ETHEUR_RATE, GAS_LIMIT); - - expect(matches.buyIds).to.deep.equal([2]); - expect(matches.sellIds).to.deep.equal([4]); - expect(matches.gasEstimate).to.be.equal(cost.MATCH_MULTIPLE_FIRST_MATCH_GAS); - }); - - it("should return matching orders (1 buy filled w/ 2 sells)", () => { - const buyOrders = [ - { id: 2, price: 1.1, bn_ethAmount: BN_ONE }, // maker. tokenValue = 1ETH x 500 ETHEUER / 1.1 = 454.55AEUR - { id: 3, price: 0.97, bn_ethAmount: BN_ONE }, - { id: 1, price: 0.9, bn_ethAmount: BN_ONE } - ]; - const sellOrders = [ - { id: 4, price: 1.05, amount: 400 }, // fully filled from id 2 - { id: 5, price: 1.04, amount: 54.55 }, // fully filled from id 2 and no leftover in id 2 - { id: 6, price: 1.04, amount: 10 } // no fill... - ]; - - const matches = exchange.calculateMatchingOrders(buyOrders, sellOrders, ETHEUR_RATE, GAS_LIMIT); - - expect(matches.buyIds).to.deep.equal([2, 2]); - expect(matches.sellIds).to.deep.equal([4, 5]); - expect(matches.gasEstimate).to.be.equal( - cost.MATCH_MULTIPLE_FIRST_MATCH_GAS + cost.MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS - ); - }); - - it("should return matching orders (2 buys filled w/ 3 sells)", () => { - const buyOrders = [ - { id: 11, price: 1.1, bn_ethAmount: new BigNumber(0.659715) }, // fully filled with id 9 as taker - { id: 3, price: 1.09, bn_ethAmount: BN_ONE }, // partially filled from id 4 as maker (leftover 0.9854812) and fully filled from id 2 as taker - { id: 5, price: 0.9, bn_ethAmount: BN_ONE } // no fill (not matched) - ]; - - const sellOrders = [ - { id: 9, price: 1.05, amount: 314.15 }, // maker. ethValue = 314.15 / 500 ETHEUR * 1.05 = 0.659715 ETH - { id: 4, price: 1.06, amount: 6.66 }, // taker in match with id 3, so ethValue = 6.66 / 500 ETHEUR * 1.09 (maker price) = 0.0145188 ETH - { id: 2, price: 1.07, amount: 460.51 }, // maker in match with id 3 (full fill) ethValue = 0.9854812 - { id: 6, price: 1.08, amount: 10 } // no matching because no more left in matching buy orders.. - ]; - - const matches = exchange.calculateMatchingOrders(buyOrders, sellOrders, ETHEUR_RATE, GAS_LIMIT); - - expect(matches.buyIds).to.deep.equal([11, 3, 3]); - expect(matches.sellIds).to.deep.equal([9, 4, 2]); - expect(matches.gasEstimate).to.be.equal( - cost.MATCH_MULTIPLE_FIRST_MATCH_GAS + 2 * cost.MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS - ); - }); - - it("should return as many matches as fits to gasLimit passed (exact)", () => { - const buyOrders = [ - { id: 1, price: 1, bn_ethAmount: BN_ONE }, - { id: 2, price: 1, bn_ethAmount: BN_ONE }, - { id: 3, price: 1, bn_ethAmount: BN_ONE } - ]; - - const sellOrders = [ - { id: 5, price: 1, amount: 500 }, - { id: 6, price: 1, amount: 500 }, - { id: 7, price: 1, amount: 500 } - ]; - - const gasLimit = cost.MATCH_MULTIPLE_FIRST_MATCH_GAS + cost.MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS; - - const matches = exchange.calculateMatchingOrders(buyOrders, sellOrders, ETHEUR_RATE, gasLimit); - - expect(matches.buyIds).to.deep.equal([1, 2]); - expect(matches.sellIds).to.deep.equal([5, 6]); - expect(matches.gasEstimate).to.be.equal(gasLimit); - }); - - it("should return as many matches as fits to gasLimit passed (almost)", () => { - const buyOrders = [ - { id: 1, price: 1, bn_ethAmount: BN_ONE }, - { id: 2, price: 1, bn_ethAmount: BN_ONE }, - { id: 3, price: 1, bn_ethAmount: BN_ONE } - ]; - - const sellOrders = [ - { id: 5, price: 1, amount: 500 }, - { id: 6, price: 1, amount: 500 }, - { id: 7, price: 1, amount: 500 } - ]; - - const gasLimit = cost.MATCH_MULTIPLE_FIRST_MATCH_GAS + 2 * cost.MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS - 1; - - const matches = exchange.calculateMatchingOrders(buyOrders, sellOrders, ETHEUR_RATE, gasLimit); - - expect(matches.buyIds).to.deep.equal([1, 2]); - expect(matches.sellIds).to.deep.equal([5, 6]); - expect(matches.gasEstimate).to.be.equal( - cost.MATCH_MULTIPLE_FIRST_MATCH_GAS + cost.MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS - ); - }); -}); diff --git a/src/augmintjs/Exchange.js b/src/augmintjs/Exchange.js deleted file mode 100644 index db0492e..0000000 --- a/src/augmintjs/Exchange.js +++ /dev/null @@ -1,341 +0,0 @@ -const BigNumber = require("bignumber.js"); -const { cost } = require("./gas.js"); -const { constants } = require("./constants.js"); -const Contract = require("src/augmintjs/Contract.js"); - -const AugmintToken = require("src/augmintjs/AugmintToken.js"); -const Rates = require("src/augmintjs/Rates.js"); - -const ExchangeArtifact = require("src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json"); - -/** - * Augmint Exchange contract class - * @class Exchange - * @extends Contract - */ -class Exchange extends Contract { - constructor() { - super(); - this.rates = null; - this.augmintToken = null; - this.tokenPeggedSymbol = null; /** fiat symbol this exchange is linked to (via Exchange.augmintToken) */ - this.tokenSymbol = null; /** token symbol this exchange contract instance is linked to */ - } - - async connect(ethereumConnection, exchangeAddress) { - await super.connect(ethereumConnection, ExchangeArtifact, exchangeAddress); - - this.rates = new Rates(); - await this.rates.connect(this.ethereumConnection); - - const [tokenAddressAtExchange, ratesAddressAtExchange] = await Promise.all([ - this.instance.methods.augmintToken().call(), - this.instance.methods.rates().call() - ]); - - if (ratesAddressAtExchange !== this.rates.address) { - throw new Error( - `Exchange: latest Rates contract deployment address ${ - this.rates.address - } for provided ABI doesn't match rates contract address ${ratesAddressAtExchange} at deployed Exchange contract` - ); - } - - this.augmintToken = new AugmintToken(); - await this.augmintToken.connect(this.ethereumConnection); - - if (tokenAddressAtExchange !== this.augmintToken.address) { - throw new Error( - `Exchange: latest AugmintToken contract deployment address at ${ - this.augmintToken.address - } doesn't match AugmintToken contract address set at latest deployed Exchange contract: ${tokenAddressAtExchange}. - Connecting to legacy Exchanges is not supported yet` - ); - } - - this.tokenPeggedSymbol = this.augmintToken.peggedSymbol; - this.tokenSymbol = this.augmintToken.symbol; - - return this.instance; - } - - /** - * Fetches current OrderBook and returns as many matching orderIds (at current ETHFiat rate) as fits into the provided gas limit. - * if no gasLimit provided then ethereumConnection.safeBlockGasLimit is used - * The returned matchingOrders can be passed to signAndSendMatchMultiple or matchMultiple functions - * @param {number} [gasLimit=EthereumConnection.safeBlockGasLimit] return as many matches as it fits to gasLimit based on gas cost estimate. - * @return {Promise} pairs of matching order id , ordered by execution sequence - { buyIds: [], sellIds: [], gasEstimate } - */ - async getMatchingOrders(gasLimit = this.ethereumConnection.safeBlockGasLimit) { - const [orderBook, bn_ethFiatRate] = await Promise.all([ - this.fetchOrderBook(), - this.rates.getBnEthFiatRate(this.tokenPeggedSymbol) - ]); - - const matches = this.calculateMatchingOrders( - orderBook.buyOrders, - orderBook.sellOrders, - bn_ethFiatRate, - gasLimit - ); - - return matches; - } - - /** - * Fetches, parses and orders the current, full orderBook from Exchange - * @return {Promise} the current, ordered orderBook in the format of: - * { buyOrders: [{id, maker, direction, bn_amount (in Wei), bn_ethAmount, amount (in eth), bn_price (in PPM)], - * sellOrders: [{id, maker, direction, bn_amount (without decimals), amount (in AEUR), bn_price (in PPM)}] - */ - async fetchOrderBook() { - // TODO: handle when order changes while iterating - const isLegacyExchangeContract = typeof this.instance.methods.CHUNK_SIZE === "function"; - const chunkSize = isLegacyExchangeContract ? constants.LEGACY_CONTRACTS_CHUNK_SIZE : constants.CHUNK_SIZE; - - const orderCounts = await this.instance.methods.getActiveOrderCounts().call({ gas: 4000000 }); - const buyCount = parseInt(orderCounts.buyTokenOrderCount, 10); - const sellCount = parseInt(orderCounts.sellTokenOrderCount, 10); - - // retreive all orders - let buyOrders = []; - let queryCount = Math.ceil(buyCount / constants.LEGACY_CONTRACTS_CHUNK_SIZE); - - for (let i = 0; i < queryCount; i++) { - const fetchedOrders = isLegacyExchangeContract - ? await this.getOrders(constants.TOKEN_BUY, i * chunkSize) - : await this.getOrders(constants.TOKEN_BUY, i * chunkSize, chunkSize); - buyOrders = buyOrders.concat(fetchedOrders.buyOrders); - } - - let sellOrders = []; - queryCount = Math.ceil(sellCount / chunkSize); - for (let i = 0; i < queryCount; i++) { - const fetchedOrders = isLegacyExchangeContract - ? await this.getOrders(constants.TOKEN_SELL, i * chunkSize) - : await this.getOrders(constants.TOKEN_SELL, i * chunkSize, chunkSize); - sellOrders = sellOrders.concat(fetchedOrders.sellOrders); - } - - buyOrders.sort(this.isOrderBetter); - sellOrders.sort(this.isOrderBetter); - - return { buyOrders, sellOrders }; - } - - async getOrders(orderDirection, offset) { - const blockGasLimit = this.ethereumConnection.safeGasLimit; - - const isLegacyExchangeContract = typeof this.instance.methods.CHUNK_SIZE === "function"; - const chunkSize = isLegacyExchangeContract ? constants.LEGACY_CONTRACTS_CHUNK_SIZE : constants.CHUNK_SIZE; - - let result; - if (orderDirection === constants.TOKEN_BUY) { - result = isLegacyExchangeContract - ? await this.instance.methods.getActiveBuyOrders(offset).call({ gas: blockGasLimit }) - : await this.instance.methods.getActiveBuyOrders(offset, chunkSize).call({ gas: blockGasLimit }); - } else { - result = isLegacyExchangeContract - ? await this.instance.methods.getActiveSellOrders(offset).call({ gas: blockGasLimit }) - : await this.instance.methods.getActiveSellOrders(offset, chunkSize).call({ gas: blockGasLimit }); - } - - // result format: [id, maker, price, amount] - const orders = result.reduce( - (res, order) => { - const bn_amount = new BigNumber(order[3]); - if (!bn_amount.eq(0)) { - const parsed = { - id: parseInt(order[0], 10), - maker: "0x" + new BigNumber(order[1]).toString(16).padStart(40, "0"), // leading 0s if address starts with 0 - bn_price: new BigNumber(order[2]), - bn_amount - }; - - parsed.price = parsed.bn_price / constants.PPM_DIV; - - if (orderDirection === constants.TOKEN_BUY) { - parsed.direction = constants.TOKEN_BUY; - parsed.bn_ethAmount = parsed.bn_amount.div(constants.ONE_ETH_IN_WEI); - parsed.amount = parseFloat(parsed.bn_ethAmount); - - res.buyOrders.push(parsed); - } else { - parsed.direction = constants.TOKEN_SELL; - parsed.amount = parseFloat((parsed.bn_amount / this.augmintToken.decimalsDiv).toFixed(2)); - - res.sellOrders.push(parsed); - } - } - return res; - }, - { buyOrders: [], sellOrders: [] } - ); - - return orders; - } - - isOrderBetter(o1, o2) { - if (o1.direction !== o2.direction) { - throw new Error("isOrderBetter(): order directions must be the same" + o1 + o2); - } - - const dir = o1.direction === constants.TOKEN_SELL ? 1 : -1; - - return o1.price * dir > o2.price * dir || (o1.price === o2.price && o1.id > o2.id) ? 1 : -1; - } - - /** - * Sends a matchMultipleOrders transaction - * Intended to use when account wallet is available (e.g. MetamMask) * @param {string} account tx sender account - * @param {string} account tx sender account - * @param {*} matchingOrders - * @returns {Promise} A web3.js Promi event object sent to the network. Resolves when mined and you can subscribe to events, eg. .on("confirmation") - * @memberof Exchange - */ - async matchMultipleOrders(account, matchingOrders) { - const matchMultipleOrdersTx = this.getMatchMultipleOrdersTx(matchingOrders.buyIds, matchingOrders.sellIds); - - return matchMultipleOrdersTx.send({ from: account, gas: matchingOrders.gasEstimate }); - } - - /** - * Signs a matchMultipleOrders transaction with a private key and sends it (with web3.js sendSignedTransaction) * - * Intended to use when private key is available, e.g. backend services - * @param {string} account tx signer ethereum account - * @param {string} privateKey Private key of the Ethereum account to sign the tx with. Include leading 0x - * @param {object} matchingOrders Returned by getMatchingOrders in format of {buyIds:[], sellIds: [], gasEstimate} - * @return {Promise} A web3.js Promi event object sent to the network. Resolves when mined and you can subscribe to events, eg. .on("confirmation") - * @memberof Exchange - */ - async signAndSendMatchMultipleOrders(account, privateKey, matchingOrders) { - const matchMultipleOrdersTx = this.getMatchMultipleOrdersTx(matchingOrders.buyIds, matchingOrders.sellIds); - - const encodedABI = matchMultipleOrdersTx.encodeABI(); - - const txToSign = { - from: account, - to: this.address, - gasLimit: matchingOrders.gasEstimate, - data: encodedABI - }; - - const signedTx = await this.web3.eth.accounts.signTransaction( - txToSign, - process.env.MATCHMAKER_ETHEREUM_PRIVATE_KEY - ); - - return this.web3.eth.sendSignedTransaction(signedTx.rawTransaction); - } - - /** - * Returns a web3 transaction to match the passed buyIds and sellIds. Call .send() or sign it on the returned tx. - * @param {array} buyIds array with a list of BUY order IDs (ordered) - * @param {array} sellIds array with a list of SELL order IDs (ordered) - * @return {Promise} web3 transaction which can be executed with .send({account, gas}) - * @memberof Exchange - */ - getMatchMultipleOrdersTx(buyIds, sellIds) { - if (sellIds.length === 0 || sellIds.length !== buyIds.length) { - throw new Error("invalid buyIds/sellIds recevied - no ids or the the params are not equal."); - } - - const tx = this.instance.methods.matchMultipleOrders(buyIds, sellIds); - - return tx; - } - - /** - * calculate matching pairs from ordered ordebook for sending in Exchange.matchMultipleOrders ethereum tx - * @param {object} _buyOrders must be ordered by price descending then by id ascending - * @param {array} _sellOrders must be ordered by price ascending then by id ascending - * @param {BigNumber} bn_ethFiatRate current ETHFiat rate to use for calculation - * @param {number} gasLimit return as many matches as it fits to gasLimit based on gas cost estimate. - * @return {object} pairs of matching order id , ordered by execution sequence { buyIds: [], sellIds: [], gasEstimate } - */ - calculateMatchingOrders(_buyOrders, _sellOrders, bn_ethFiatRate, gasLimit) { - const sellIds = []; - const buyIds = []; - - if (_buyOrders.length === 0 || _sellOrders.length === 0) { - return { buyIds, sellIds, gasEstimate: 0 }; - } - const lowestSellPrice = _sellOrders[0].price; - const highestBuyPrice = _buyOrders[0].price; - - const buyOrders = _buyOrders - .filter(o => o.price >= lowestSellPrice) - .map(o => ({ id: o.id, price: o.price, bn_ethAmount: o.bn_ethAmount })); - const sellOrders = _sellOrders - .filter(o => o.price <= highestBuyPrice) - .map(o => ({ id: o.id, price: o.price, bn_tokenAmount: new BigNumber(o.amount) })); - - let buyIdx = 0; - let sellIdx = 0; - let gasEstimate = 0; - let nextGasEstimate = cost.MATCH_MULTIPLE_FIRST_MATCH_GAS; - - while (buyIdx < buyOrders.length && sellIdx < sellOrders.length && nextGasEstimate <= gasLimit) { - const sellOrder = sellOrders[sellIdx]; - const buyOrder = buyOrders[buyIdx]; - sellIds.push(sellOrder.id); - buyIds.push(buyOrder.id); - - let tradedEth; - let tradedTokens; - - const matchPrice = buyOrder.id > sellOrder.id ? sellOrder.price : buyOrder.price; - - buyOrder.bn_tokenValue = bn_ethFiatRate - .div(matchPrice) - .mul(buyOrder.bn_ethAmount) - .round(2); - - sellOrder.bn_ethValue = sellOrder.bn_tokenAmount - .mul(matchPrice) - .div(bn_ethFiatRate) - .round(18); - - if (sellOrder.bn_tokenAmount.lt(buyOrder.bn_tokenValue)) { - tradedEth = sellOrder.bn_ethValue; - tradedTokens = sellOrder.bn_tokenAmount; - } else { - tradedEth = buyOrder.bn_ethAmount; - tradedTokens = buyOrder.bn_tokenValue; - } - - // console.debug( - // `MATCH: BUY: id: ${buyOrder.id} price: ${ - // buyOrder.price - // } Amount: ${buyOrder.bn_ethAmount.toString()} ETH tokenValue: ${buyOrder.bn_tokenValue.toString()} - // SELL: id: ${sellOrder.id} price: ${ - // sellOrder.price - // } Amount: ${sellOrder.bn_tokenAmount.toString()} AEUR ethValue: ${sellOrder.bn_ethValue.toString()} - // Traded: ${tradedEth.toString()} ETH <-> ${tradedTokens.toString()} AEUR @${(matchPrice * 100).toFixed( - // 2 - // )}% on ${bn_ethFiatRate.toString()} ETHEUR` - // ); - - buyOrder.bn_ethAmount = buyOrder.bn_ethAmount.sub(tradedEth); - buyOrder.bn_tokenValue = buyOrder.bn_tokenValue.sub(tradedTokens); - - if (buyOrder.bn_ethAmount.eq(0)) { - buyIdx++; - } - - sellOrder.bn_ethValue = sellOrder.bn_ethValue.sub(tradedEth); - sellOrder.bn_tokenAmount = sellOrder.bn_tokenAmount.sub(tradedTokens); - if (sellOrder.bn_tokenAmount.eq(0)) { - sellIdx++; - } - - gasEstimate = nextGasEstimate; - nextGasEstimate += cost.MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS; - } - - return { buyIds, sellIds, gasEstimate }; - } -} - -module.exports = Exchange; diff --git a/src/augmintjs/Exchange.test.js b/src/augmintjs/Exchange.test.js deleted file mode 100644 index 444ecee..0000000 --- a/src/augmintjs/Exchange.test.js +++ /dev/null @@ -1,150 +0,0 @@ -const { expect, assert } = require("chai"); -const BigNumber = require("bignumber.js"); -const EthereumConnection = require("./EthereumConnection.js"); -const Exchange = require("./Exchange.js"); - -const { constants } = require("./constants.js"); -const { takeSnapshot, revertSnapshot } = require("src/augmintjs/testHelpers/ganache.js"); - -describe("connection", () => { - const CCY = "EUR"; - const ethereumConnection = new EthereumConnection(); - const exchange = new Exchange(); - - it("should connect to latest contract", async () => { - await ethereumConnection.connect(); - - assert.isNull(exchange.address); - assert.isNull(exchange.tokenPeggedSymbol); - assert.isNull(exchange.tokenSymbol); - - await exchange.connect(ethereumConnection); - - assert.equal(exchange.address, "0xFAceA53a04bEfCC6C9246eb3951814cfEE2A1415"); - assert.equal(exchange.rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); - assert.equal(exchange.augmintToken.address, "0xBbEcfF5Db2F9cCcc936895121802FC15053344c6"); - assert.equal(exchange.tokenPeggedSymbol, CCY); - assert.equal(exchange.tokenSymbol, "AEUR"); - }); - - it("should connect to legacy Excahnge contract"); -}); - -describe("fetchOrderBook", () => { - const ethereumConnection = new EthereumConnection(); - const exchange = new Exchange(); - let snapshotId; - - before(async () => { - await ethereumConnection.connect(); - await exchange.connect(ethereumConnection); - }); - - beforeEach(async () => { - snapshotId = await takeSnapshot(ethereumConnection.web3); - }); - - afterEach(async () => { - await revertSnapshot(ethereumConnection.web3, snapshotId); - }); - - it("should return empty orderbook when no orders", async () => { - const orderBook = await exchange.fetchOrderBook(); - assert.deepEqual(orderBook, { buyOrders: [], sellOrders: [] }); - }); - - it("should return orderbook with orders", async () => { - const buyMaker = ethereumConnection.accounts[1]; - const sellMaker = ethereumConnection.accounts[0]; - const buyPrice = 1.01; - const bn_buyPrice = new BigNumber(buyPrice * constants.PPM_DIV); - const sellPrice = 1.05; - const bn_sellPrice = new BigNumber(sellPrice * constants.PPM_DIV); - - const bn_buyEthAmount = new BigNumber(0.1); - const bn_buyWeiAmount = new BigNumber(ethereumConnection.web3.utils.toWei(bn_buyEthAmount.toString())); - const sellTokenAmount = 10; - const bn_sellTokenAmount = new BigNumber(sellTokenAmount * constants.DECIMALS_DIV); - - await exchange.instance.methods - .placeBuyTokenOrder(bn_buyPrice.toString()) - .send({ from: buyMaker, value: bn_buyWeiAmount.toString(), gas: 1000000 }); - - await exchange.augmintToken.instance.methods - .transferAndNotify(exchange.address, bn_sellTokenAmount.toString(), bn_sellPrice.toString()) - .send({ from: sellMaker, gas: 1000000 }); - - const orderBook = await exchange.fetchOrderBook(); - - assert.deepEqual(orderBook, { - buyOrders: [ - { - id: 1, - maker: buyMaker.toLowerCase(), - bn_price: bn_buyPrice, - bn_amount: bn_buyWeiAmount, - price: buyPrice, - direction: constants.TOKEN_BUY, - bn_ethAmount: bn_buyEthAmount, - amount: bn_buyEthAmount.toNumber() - } - ], - sellOrders: [ - { - id: 2, - maker: sellMaker.toLowerCase(), - bn_price: bn_sellPrice, - bn_amount: bn_sellTokenAmount, - price: sellPrice, - direction: constants.TOKEN_SELL, - amount: sellTokenAmount - } - ] - }); - }); -}); - -describe("isOrderBetter", () => { - const exchange = new Exchange(); - it("o2 should be better (SELL price)", () => { - const o1 = { direction: constants.TOKEN_SELL, price: 2, id: 1 }; - const o2 = { direction: constants.TOKEN_SELL, price: 1, id: 2 }; - const result = exchange.isOrderBetter(o1, o2); - expect(result).to.be.equal(1); - }); - - it("o1 should be better (BUY price)", () => { - const o1 = { direction: constants.TOKEN_BUY, price: 2, id: 2 }; - const o2 = { direction: constants.TOKEN_BUY, price: 1, id: 1 }; - const result = exchange.isOrderBetter(o1, o2); - expect(result).to.be.equal(-1); - }); - - it("o2 should be better (SELL id)", () => { - const o1 = { direction: constants.TOKEN_SELL, price: 1, id: 2 }; - const o2 = { direction: constants.TOKEN_SELL, price: 1, id: 1 }; - const result = exchange.isOrderBetter(o1, o2); - expect(result).to.be.equal(1); - }); - - it("o2 should be better (BUY id)", () => { - const o1 = { direction: constants.TOKEN_BUY, price: 1, id: 2 }; - const o2 = { direction: constants.TOKEN_BUY, price: 1, id: 1 }; - const result = exchange.isOrderBetter(o1, o2); - expect(result).to.be.equal(1); - }); - - it("o1 should be better when o1 same as o2", () => { - // same id for two orders, it shouldn't happen - const o1 = { direction: constants.TOKEN_SELL, price: 1, id: 1 }; - const o2 = { direction: constants.TOKEN_SELL, price: 1, id: 1 }; - const result = exchange.isOrderBetter(o1, o2); - expect(result).to.be.equal(-1); - }); - - it("the direction of the two orders should be same", () => { - const o1 = { direction: constants.TOKEN_SELL, price: 2, id: 2 }; - const o2 = { direction: constants.TOKEN_BUY, price: 1, id: 1 }; - expect(() => exchange.isOrderBetter(o1, o2)).to.throw(/order directions must be the same/); - }); -}); diff --git a/src/augmintjs/Rates.js b/src/augmintjs/Rates.js deleted file mode 100644 index 949eb48..0000000 --- a/src/augmintjs/Rates.js +++ /dev/null @@ -1,52 +0,0 @@ -const BigNumber = require("bignumber.js"); -const { constants } = require("./constants.js"); -const Contract = require("src/augmintjs/Contract.js"); -const RatesArtifact = require("src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json"); - -class Rates extends Contract { - constructor() { - super(); - } - - async getBnEthFiatRate(currency) { - return new BigNumber( - (await this.instance.methods - .convertFromWei(this.web3.utils.asciiToHex(currency), constants.ONE_ETH_IN_WEI.toString()) - .call()) / constants.DECIMALS_DIV // // TODO: change to augmintToken.decimalsDiv - ); - } - - async getEthFiatRate(currency) { - return parseFloat((await this.getBnEthFiatRate(currency)).toString()); - } - - async getAugmintRate(currency) { - const bytesCCY = this.web3.utils.asciiToHex(currency); - const storedRateInfo = await this.instance.methods.rates(bytesCCY).call(); - return { - rate: parseInt(storedRateInfo.rate) / constants.DECIMALS_DIV, // TODO: change to augmintToken.decimalsDiv - lastUpdated: new Date(parseInt(storedRateInfo.lastUpdated) * 1000) - }; - } - - getSetRateTx(currency, price) { - const rateToSend = price * constants.DECIMALS_DIV; - if (Math.round(rateToSend) !== rateToSend) { - throw new Error( - ` getSetRateTx error: provided price of ${price} has more decimals than allowed by AugmintToken decimals of ${ - constants.DECIMALS - }` - ); - } - const bytesCCY = this.web3.utils.asciiToHex(currency); - const tx = this.instance.methods.setRate(bytesCCY, rateToSend); - - return tx; - } - - async connect(ethereumConnection, ratesAddress) { - return await super.connect(ethereumConnection, RatesArtifact, ratesAddress); - } -} - -module.exports = Rates; diff --git a/src/augmintjs/Rates.test.js b/src/augmintjs/Rates.test.js deleted file mode 100644 index ae0437d..0000000 --- a/src/augmintjs/Rates.test.js +++ /dev/null @@ -1,92 +0,0 @@ -const { assert } = require("chai"); -const BigNumber = require("bignumber.js"); -const EthereumConnection = require("./EthereumConnection.js"); -const Rates = require("./Rates.js"); - -const { takeSnapshot, revertSnapshot } = require("src/augmintjs/testHelpers/ganache.js"); -const CCY = "EUR"; -const DECIMALS_DIV = 100; - -describe("Rates connection", () => { - const ethereumConnection = new EthereumConnection(); - const rates = new Rates(); - - it("should connect to latest contract", async () => { - await ethereumConnection.connect(); - - assert.isNull(rates.address); - await rates.connect(ethereumConnection); - assert.equal(rates.address, "0xb0a2a8e846b66C7384F52635CECEf5280F766C8B"); - }); - - it("should connect to legacy Rates contract"); -}); - -describe("Rates getters", () => { - const ethereumConnection = new EthereumConnection(); - const rates = new Rates(); - const EXPECTED_RATE = 213.14; - let snapshotId; - - before(async () => { - await ethereumConnection.connect(); - - snapshotId = await takeSnapshot(ethereumConnection.web3); - - await rates.connect(ethereumConnection); - const BYTES_CCY = ethereumConnection.web3.utils.asciiToHex(CCY); - - await rates.instance.methods.setRate(BYTES_CCY, EXPECTED_RATE * DECIMALS_DIV).send({ - from: ethereumConnection.accounts[0] - }); - }); - - after(async () => { - await revertSnapshot(ethereumConnection.web3, snapshotId); - }); - - it("getBnEthFiatRate", async () => { - const bnEthFiatRate = await rates.getBnEthFiatRate(CCY); - assert.deepEqual(bnEthFiatRate, new BigNumber(EXPECTED_RATE)); - }); - - it("getEthFiatRate", async () => { - const ethFiatRate = await rates.getEthFiatRate(CCY); - assert.equal(ethFiatRate, EXPECTED_RATE); - }); - - it("getBnEthFiatRate - invalid ccy"); - - it("getAugmintRate", async () => { - const augmintRate = await rates.getAugmintRate(CCY); - assert.equal(augmintRate.rate, EXPECTED_RATE); - assert.instanceOf(augmintRate.lastUpdated, Date); - }); - - it("getAugmintRate - invalid ccy"); -}); - -describe("Rates txs", () => { - const ethereumConnection = new EthereumConnection(); - const rates = new Rates(); - let snapshotId; - - before(async () => { - await ethereumConnection.connect(); - await rates.connect(ethereumConnection); - }); - - beforeEach(async () => { - snapshotId = await takeSnapshot(ethereumConnection.web3); - }); - - afterEach(async () => { - await revertSnapshot(ethereumConnection.web3, snapshotId); - }); - - it("setRate"); - - it("setRate - invalid ccy"); - - it("setRate - invalid price"); -}); diff --git a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_024b81d1a1f75241167a8a0f6e62326f.json b/src/augmintjs/abiniser/abis/AugmintReserves_ABI_024b81d1a1f75241167a8a0f6e62326f.json deleted file mode 100644 index e1fb58d..0000000 --- a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_024b81d1a1f75241167a8a0f6e62326f.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "contractName": "AugmintReserves", - "abiHash": "024b81d1a1f75241167a8a0f6e62326f", - "generatedAt": "2018-10-18T13:35:02.346Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "ReserveMigration", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "migrate", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_33995f203f6c629e9916d82dd78e875f.json b/src/augmintjs/abiniser/abis/AugmintReserves_ABI_33995f203f6c629e9916d82dd78e875f.json deleted file mode 100644 index c4c9531..0000000 --- a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_33995f203f6c629e9916d82dd78e875f.json +++ /dev/null @@ -1,221 +0,0 @@ -{ - "contractName": "AugmintReserves", - "abiHash": "33995f203f6c629e9916d82dd78e875f", - "generatedAt": "2018-04-24T15:49:38.614Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "weiAmount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - } - ], - "name": "WithdrawFromSystemAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_dfbca9f4d0da7a3517b2832dc1c04d9a.json b/src/augmintjs/abiniser/abis/AugmintReserves_ABI_dfbca9f4d0da7a3517b2832dc1c04d9a.json deleted file mode 100644 index fc95014..0000000 --- a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_dfbca9f4d0da7a3517b2832dc1c04d9a.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "contractName": "AugmintReserves", - "abiHash": "dfbca9f4d0da7a3517b2832dc1c04d9a", - "generatedAt": "2018-04-24T15:43:19.777Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdrawTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_fe74b7986dafb00f221486e790fc70ec.json b/src/augmintjs/abiniser/abis/AugmintReserves_ABI_fe74b7986dafb00f221486e790fc70ec.json deleted file mode 100644 index 5535690..0000000 --- a/src/augmintjs/abiniser/abis/AugmintReserves_ABI_fe74b7986dafb00f221486e790fc70ec.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "contractName": "AugmintReserves", - "abiHash": "fe74b7986dafb00f221486e790fc70ec", - "generatedAt": "2018-06-04T12:49:52.496Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "weiAmount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - } - ], - "name": "WithdrawFromSystemAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_3aa2aedd2972391a12570ba4bfca2f72.json b/src/augmintjs/abiniser/abis/Exchange_ABI_3aa2aedd2972391a12570ba4bfca2f72.json deleted file mode 100644 index c723c26..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_3aa2aedd2972391a12570ba4bfca2f72.json +++ /dev/null @@ -1,412 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "3aa2aedd2972391a12570ba4bfca2f72", - "generatedAt": "2018-04-24T15:43:19.996Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_3c157a5256a2093da587f166d4dbd537.json b/src/augmintjs/abiniser/abis/Exchange_ABI_3c157a5256a2093da587f166d4dbd537.json deleted file mode 100644 index 337777d..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_3c157a5256a2093da587f166d4dbd537.json +++ /dev/null @@ -1,595 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "3c157a5256a2093da587f166d4dbd537", - "generatedAt": "2018-05-01T20:24:25.541Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "publishedRate", - "type": "uint256" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "fillRate", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - } - ], - "name": "RatesContractChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - } - ], - "name": "setRatesContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_7595b255e567ae1d0eeef4460d0b0c16.json b/src/augmintjs/abiniser/abis/Exchange_ABI_7595b255e567ae1d0eeef4460d0b0c16.json deleted file mode 100644 index c556069..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_7595b255e567ae1d0eeef4460d0b0c16.json +++ /dev/null @@ -1,412 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "7595b255e567ae1d0eeef4460d0b0c16", - "generatedAt": "2018-04-24T15:49:38.911Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_a1dd11684e0aba7b453b7dbae42b2edb.json b/src/augmintjs/abiniser/abis/Exchange_ABI_a1dd11684e0aba7b453b7dbae42b2edb.json deleted file mode 100644 index 4654336..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_a1dd11684e0aba7b453b7dbae42b2edb.json +++ /dev/null @@ -1,585 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "a1dd11684e0aba7b453b7dbae42b2edb", - "generatedAt": "2018-04-28T20:33:26.403Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - } - ], - "name": "RatesContractChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - } - ], - "name": "setRatesContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_b2a23202a9a0f04755a186896c2b56eb.json b/src/augmintjs/abiniser/abis/Exchange_ABI_b2a23202a9a0f04755a186896c2b56eb.json deleted file mode 100644 index 3bba104..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_b2a23202a9a0f04755a186896c2b56eb.json +++ /dev/null @@ -1,599 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "b2a23202a9a0f04755a186896c2b56eb", - "generatedAt": "2018-06-04T12:49:52.698Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "publishedRate", - "type": "uint256" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "fillRate", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - } - ], - "name": "RatesContractChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - } - ], - "name": "setRatesContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_c28de2392aea85ef2aa1b108fce6568c.json b/src/augmintjs/abiniser/abis/Exchange_ABI_c28de2392aea85ef2aa1b108fce6568c.json deleted file mode 100644 index 7028cea..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_c28de2392aea85ef2aa1b108fce6568c.json +++ /dev/null @@ -1,594 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "c28de2392aea85ef2aa1b108fce6568c", - "generatedAt": "2018-08-14T17:38:01.618Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "publishedRate", - "type": "uint256" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - } - ], - "name": "RatesContractChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - } - ], - "name": "setRatesContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "response", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json b/src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json deleted file mode 100644 index 292be5e..0000000 --- a/src/augmintjs/abiniser/abis/Exchange_ABI_d3e7f8a261b756f9c40da097608b21cd.json +++ /dev/null @@ -1,588 +0,0 @@ -{ - "contractName": "Exchange", - "abiHash": "d3e7f8a261b756f9c40da097608b21cd", - "generatedAt": "2018-10-18T13:35:02.437Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "buyTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "orderCount", - "outputs": [ - { - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint64" - } - ], - "name": "sellTokenOrders", - "outputs": [ - { - "name": "index", - "type": "uint64" - }, - { - "name": "maker", - "type": "address" - }, - { - "name": "price", - "type": "uint32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "NewOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "tokenBuyer", - "type": "address" - }, - { - "indexed": true, - "name": "tokenSeller", - "type": "address" - }, - { - "indexed": false, - "name": "buyTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "sellTokenOrderId", - "type": "uint64" - }, - { - "indexed": false, - "name": "publishedRate", - "type": "uint256" - }, - { - "indexed": false, - "name": "price", - "type": "uint32" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "OrderFill", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "orderId", - "type": "uint64" - }, - { - "indexed": true, - "name": "maker", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "CancelledOrder", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - } - ], - "name": "RatesContractChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - } - ], - "name": "setRatesContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - } - ], - "name": "placeBuyTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint64" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "price", - "type": "uint32" - }, - { - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "placeSellTokenOrder", - "outputs": [ - { - "name": "orderId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "maker", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "price", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - } - ], - "name": "cancelBuyTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "cancelSellTokenOrder", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenId", - "type": "uint64" - }, - { - "name": "sellTokenId", - "type": "uint64" - } - ], - "name": "matchOrders", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "buyTokenIds", - "type": "uint64[]" - }, - { - "name": "sellTokenIds", - "type": "uint64[]" - } - ], - "name": "matchMultipleOrders", - "outputs": [ - { - "name": "matchCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getActiveOrderCounts", - "outputs": [ - { - "name": "buyTokenOrderCount", - "type": "uint256" - }, - { - "name": "sellTokenOrderCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getActiveBuyOrders", - "outputs": [ - { - "name": "", - "type": "uint256[4][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getActiveSellOrders", - "outputs": [ - { - "name": "", - "type": "uint256[4][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/FeeAccount_ABI_3bf67cdfa9f7a16596598e19aeb06b39.json b/src/augmintjs/abiniser/abis/FeeAccount_ABI_3bf67cdfa9f7a16596598e19aeb06b39.json deleted file mode 100644 index 81ec0bd..0000000 --- a/src/augmintjs/abiniser/abis/FeeAccount_ABI_3bf67cdfa9f7a16596598e19aeb06b39.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "contractName": "FeeAccount", - "abiHash": "3bf67cdfa9f7a16596598e19aeb06b39", - "generatedAt": "2018-04-24T15:43:19.793Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdrawTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/FeeAccount_ABI_67db260db12738df3cced3511d34c65c.json b/src/augmintjs/abiniser/abis/FeeAccount_ABI_67db260db12738df3cced3511d34c65c.json deleted file mode 100644 index b6658f3..0000000 --- a/src/augmintjs/abiniser/abis/FeeAccount_ABI_67db260db12738df3cced3511d34c65c.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "contractName": "FeeAccount", - "abiHash": "67db260db12738df3cced3511d34c65c", - "generatedAt": "2018-06-04T12:49:52.507Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "weiAmount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "transferFee", - "outputs": [ - { - "name": "pt", - "type": "uint256" - }, - { - "name": "min", - "type": "uint256" - }, - { - "name": "max", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "transferFeePt", - "type": "uint256" - }, - { - "name": "transferFeeMin", - "type": "uint256" - }, - { - "name": "transferFeeMax", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - } - ], - "name": "WithdrawFromSystemAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "transferFeePt", - "type": "uint256" - }, - { - "name": "transferFeeMin", - "type": "uint256" - }, - { - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "setTransferFees", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "calculateTransferFee", - "outputs": [ - { - "name": "fee", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "calculateExchangeFee", - "outputs": [ - { - "name": "weiFee", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/FeeAccount_ABI_dd4594a936e439aa46ed5b06cb69eafa.json b/src/augmintjs/abiniser/abis/FeeAccount_ABI_dd4594a936e439aa46ed5b06cb69eafa.json deleted file mode 100644 index 78d0970..0000000 --- a/src/augmintjs/abiniser/abis/FeeAccount_ABI_dd4594a936e439aa46ed5b06cb69eafa.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "contractName": "FeeAccount", - "abiHash": "dd4594a936e439aa46ed5b06cb69eafa", - "generatedAt": "2018-04-24T15:49:38.625Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "weiAmount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "transferFee", - "outputs": [ - { - "name": "pt", - "type": "uint256" - }, - { - "name": "min", - "type": "uint256" - }, - { - "name": "max", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "transferFeePt", - "type": "uint256" - }, - { - "name": "transferFeeMin", - "type": "uint256" - }, - { - "name": "transferFeeMax", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - } - ], - "name": "WithdrawFromSystemAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "transferFeePt", - "type": "uint256" - }, - { - "name": "transferFeeMin", - "type": "uint256" - }, - { - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "setTransferFees", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "calculateTransferFee", - "outputs": [ - { - "name": "fee", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "weiAmount", - "type": "uint256" - } - ], - "name": "calculateExchangeFee", - "outputs": [ - { - "name": "weiFee", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_11b039ce783db308e1a9b5f46f05824f.json b/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_11b039ce783db308e1a9b5f46f05824f.json deleted file mode 100644 index 305d243..0000000 --- a/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_11b039ce783db308e1a9b5f46f05824f.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "contractName": "InterestEarnedAccount", - "abiHash": "11b039ce783db308e1a9b5f46f05824f", - "generatedAt": "2018-06-04T12:49:52.514Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "weiAmount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - } - ], - "name": "WithdrawFromSystemAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "locker", - "type": "address" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "transferInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_2282749a57fa5c7d61cf33b2f04daf2b.json b/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_2282749a57fa5c7d61cf33b2f04daf2b.json deleted file mode 100644 index c0412e8..0000000 --- a/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_2282749a57fa5c7d61cf33b2f04daf2b.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "contractName": "InterestEarnedAccount", - "abiHash": "2282749a57fa5c7d61cf33b2f04daf2b", - "generatedAt": "2018-04-24T15:43:19.834Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdrawTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "locker", - "type": "address" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "transferInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_72a73972d565bb24463e7368fd263af4.json b/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_72a73972d565bb24463e7368fd263af4.json deleted file mode 100644 index b5bc5ea..0000000 --- a/src/augmintjs/abiniser/abis/InterestEarnedAccount_ABI_72a73972d565bb24463e7368fd263af4.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "contractName": "InterestEarnedAccount", - "abiHash": "72a73972d565bb24463e7368fd263af4", - "generatedAt": "2018-04-24T15:49:38.662Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "tokenAddress", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "tokenAmount", - "type": "uint256" - }, - { - "name": "weiAmount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "weiAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - } - ], - "name": "WithdrawFromSystemAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "augmintToken", - "type": "address" - }, - { - "name": "locker", - "type": "address" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "transferInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/LoanManager_ABI_291572b8d2ffe95dca1733ebc1472e08.json b/src/augmintjs/abiniser/abis/LoanManager_ABI_291572b8d2ffe95dca1733ebc1472e08.json deleted file mode 100644 index 6be4ad5..0000000 --- a/src/augmintjs/abiniser/abis/LoanManager_ABI_291572b8d2ffe95dca1733ebc1472e08.json +++ /dev/null @@ -1,696 +0,0 @@ -{ - "contractName": "LoanManager", - "abiHash": "291572b8d2ffe95dca1733ebc1472e08", - "generatedAt": "2018-04-24T15:49:38.817Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLoans", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "products", - "outputs": [ - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "loans", - "outputs": [ - { - "name": "collateralAmount", - "type": "uint256" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "borrower", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "state", - "type": "uint8" - }, - { - "name": "maturity", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "repaymentAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "maturity", - "type": "uint40" - } - ], - "name": "NewLoan", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newState", - "type": "bool" - } - ], - "name": "LoanProductActiveStateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - } - ], - "name": "LoanProductAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": false, - "name": "borrower", - "type": "address" - } - ], - "name": "LoanRepayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collectedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "releasedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "defaultingFee", - "type": "uint256" - } - ], - "name": "LoanCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - }, - { - "indexed": false, - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLoanProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - }, - { - "name": "newState", - "type": "bool" - } - ], - "name": "setLoanProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - } - ], - "name": "newEthBackedLoan", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanIds", - "type": "uint256[]" - } - ], - "name": "collect", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - }, - { - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getProductCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getProducts", - "outputs": [ - { - "name": "response", - "type": "uint256[8][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLoans", - "outputs": [ - { - "name": "response", - "type": "uint256[10][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - } - ], - "name": "getLoanCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLoansForAddress", - "outputs": [ - { - "name": "response", - "type": "uint256[10][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "getLoanTuple", - "outputs": [ - { - "name": "result", - "type": "uint256[10]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/LoanManager_ABI_d72d3bd9689dba0d1a8cd4ec23757257.json b/src/augmintjs/abiniser/abis/LoanManager_ABI_d72d3bd9689dba0d1a8cd4ec23757257.json deleted file mode 100644 index 21910d3..0000000 --- a/src/augmintjs/abiniser/abis/LoanManager_ABI_d72d3bd9689dba0d1a8cd4ec23757257.json +++ /dev/null @@ -1,679 +0,0 @@ -{ - "contractName": "LoanManager", - "abiHash": "d72d3bd9689dba0d1a8cd4ec23757257", - "generatedAt": "2018-04-24T15:44:28.545Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLoans", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "products", - "outputs": [ - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "loans", - "outputs": [ - { - "name": "collateralAmount", - "type": "uint256" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "borrower", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "state", - "type": "uint8" - }, - { - "name": "maturity", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "repaymentAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "maturity", - "type": "uint40" - } - ], - "name": "NewLoan", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newState", - "type": "bool" - } - ], - "name": "LoanProductActiveStateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - } - ], - "name": "LoanProductAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": false, - "name": "borrower", - "type": "address" - } - ], - "name": "LoanRepayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collectedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "releasedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "defaultingFee", - "type": "uint256" - } - ], - "name": "LoanCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLoanProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - }, - { - "name": "newState", - "type": "bool" - } - ], - "name": "setLoanProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - } - ], - "name": "newEthBackedLoan", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanIds", - "type": "uint256[]" - } - ], - "name": "collect", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getProductCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getProducts", - "outputs": [ - { - "name": "response", - "type": "uint256[7][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLoans", - "outputs": [ - { - "name": "response", - "type": "uint256[10][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - } - ], - "name": "getLoanCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLoansForAddress", - "outputs": [ - { - "name": "response", - "type": "uint256[10][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "getLoanTuple", - "outputs": [ - { - "name": "result", - "type": "uint256[10]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/LoanManager_ABI_dd8d5ec97e0a22b6f9e63b04d4e11e09.json b/src/augmintjs/abiniser/abis/LoanManager_ABI_dd8d5ec97e0a22b6f9e63b04d4e11e09.json deleted file mode 100644 index 20dfbd1..0000000 --- a/src/augmintjs/abiniser/abis/LoanManager_ABI_dd8d5ec97e0a22b6f9e63b04d4e11e09.json +++ /dev/null @@ -1,601 +0,0 @@ -{ - "contractName": "LoanManager", - "abiHash": "dd8d5ec97e0a22b6f9e63b04d4e11e09", - "generatedAt": "2018-04-24T15:43:19.945Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "products", - "outputs": [ - { - "name": "term", - "type": "uint256" - }, - { - "name": "discountRate", - "type": "uint256" - }, - { - "name": "collateralRatio", - "type": "uint256" - }, - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "defaultingFeePt", - "type": "uint256" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "mLoans", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "loans", - "outputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "state", - "type": "uint8" - }, - { - "name": "collateralAmount", - "type": "uint256" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "loanAmount", - "type": "uint256" - }, - { - "name": "interestAmount", - "type": "uint256" - }, - { - "name": "term", - "type": "uint256" - }, - { - "name": "disbursementDate", - "type": "uint256" - }, - { - "name": "maturity", - "type": "uint256" - }, - { - "name": "defaultingFeePt", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": false, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "repaymentAmount", - "type": "uint256" - } - ], - "name": "NewLoan", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint256" - }, - { - "indexed": false, - "name": "newState", - "type": "bool" - } - ], - "name": "LoanProductActiveStateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint256" - } - ], - "name": "LoanProductAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": false, - "name": "borrower", - "type": "address" - } - ], - "name": "LoanRepayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collectedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "releasedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "defaultingFee", - "type": "uint256" - } - ], - "name": "LoanCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "_term", - "type": "uint256" - }, - { - "name": "_discountRate", - "type": "uint256" - }, - { - "name": "_collateralRatio", - "type": "uint256" - }, - { - "name": "_minDisbursedAmount", - "type": "uint256" - }, - { - "name": "_defaultingFee", - "type": "uint256" - }, - { - "name": "_isActive", - "type": "bool" - } - ], - "name": "addLoanProduct", - "outputs": [ - { - "name": "newProductId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint8" - }, - { - "name": "newState", - "type": "bool" - } - ], - "name": "setLoanProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint8" - } - ], - "name": "newEthBackedLoan", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanIds", - "type": "uint256[]" - } - ], - "name": "collect", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getProductCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - } - ], - "name": "getLoanIds", - "outputs": [ - { - "name": "_loans", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/LoanManager_ABI_ec709c3341045caa3a75374b8cfc7286.json b/src/augmintjs/abiniser/abis/LoanManager_ABI_ec709c3341045caa3a75374b8cfc7286.json deleted file mode 100644 index 2a4489c..0000000 --- a/src/augmintjs/abiniser/abis/LoanManager_ABI_ec709c3341045caa3a75374b8cfc7286.json +++ /dev/null @@ -1,700 +0,0 @@ -{ - "contractName": "LoanManager", - "abiHash": "ec709c3341045caa3a75374b8cfc7286", - "generatedAt": "2018-06-04T12:49:52.622Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLoans", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "products", - "outputs": [ - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "loans", - "outputs": [ - { - "name": "collateralAmount", - "type": "uint256" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "borrower", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "state", - "type": "uint8" - }, - { - "name": "maturity", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "repaymentAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "maturity", - "type": "uint40" - } - ], - "name": "NewLoan", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newState", - "type": "bool" - } - ], - "name": "LoanProductActiveStateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - } - ], - "name": "LoanProductAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": false, - "name": "borrower", - "type": "address" - } - ], - "name": "LoanRepayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collectedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "releasedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "defaultingFee", - "type": "uint256" - } - ], - "name": "LoanCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - }, - { - "indexed": false, - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLoanProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - }, - { - "name": "newState", - "type": "bool" - } - ], - "name": "setLoanProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - } - ], - "name": "newEthBackedLoan", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanIds", - "type": "uint256[]" - } - ], - "name": "collect", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - }, - { - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getProductCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getProducts", - "outputs": [ - { - "name": "response", - "type": "uint256[8][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanCount", - "outputs": [ - { - "name": "ct", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLoans", - "outputs": [ - { - "name": "response", - "type": "uint256[10][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - } - ], - "name": "getLoanCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLoansForAddress", - "outputs": [ - { - "name": "response", - "type": "uint256[10][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "getLoanTuple", - "outputs": [ - { - "name": "result", - "type": "uint256[10]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/LoanManager_ABI_fdf5fde95aa940c6dbfb8353c572c5fb.json b/src/augmintjs/abiniser/abis/LoanManager_ABI_fdf5fde95aa940c6dbfb8353c572c5fb.json deleted file mode 100644 index c2ff1e0..0000000 --- a/src/augmintjs/abiniser/abis/LoanManager_ABI_fdf5fde95aa940c6dbfb8353c572c5fb.json +++ /dev/null @@ -1,698 +0,0 @@ -{ - "contractName": "LoanManager", - "abiHash": "fdf5fde95aa940c6dbfb8353c572c5fb", - "generatedAt": "2018-10-18T13:35:02.403Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rates", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLoans", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "products", - "outputs": [ - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "loans", - "outputs": [ - { - "name": "collateralAmount", - "type": "uint256" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "borrower", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "state", - "type": "uint8" - }, - { - "name": "maturity", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - }, - { - "name": "_rates", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "repaymentAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "maturity", - "type": "uint40" - } - ], - "name": "NewLoan", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newState", - "type": "bool" - } - ], - "name": "LoanProductActiveStateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "productId", - "type": "uint32" - } - ], - "name": "LoanProductAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": false, - "name": "borrower", - "type": "address" - } - ], - "name": "LoanRepayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "loanId", - "type": "uint256" - }, - { - "indexed": true, - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "name": "collectedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "releasedCollateral", - "type": "uint256" - }, - { - "indexed": false, - "name": "defaultingFee", - "type": "uint256" - } - ], - "name": "LoanCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newRatesContract", - "type": "address" - }, - { - "indexed": false, - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "term", - "type": "uint32" - }, - { - "name": "discountRate", - "type": "uint32" - }, - { - "name": "collateralRatio", - "type": "uint32" - }, - { - "name": "minDisbursedAmount", - "type": "uint256" - }, - { - "name": "defaultingFeePt", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLoanProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - }, - { - "name": "newState", - "type": "bool" - } - ], - "name": "setLoanProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "productId", - "type": "uint32" - } - ], - "name": "newEthBackedLoan", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "repaymentAmount", - "type": "uint256" - }, - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanIds", - "type": "uint256[]" - } - ], - "name": "collect", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newRatesContract", - "type": "address" - }, - { - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getProductCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getProducts", - "outputs": [ - { - "name": "", - "type": "uint256[8][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getLoans", - "outputs": [ - { - "name": "", - "type": "uint256[10][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - } - ], - "name": "getLoanCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getLoansForAddress", - "outputs": [ - { - "name": "", - "type": "uint256[10][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "loanId", - "type": "uint256" - } - ], - "name": "getLoanTuple", - "outputs": [ - { - "name": "result", - "type": "uint256[10]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Locker_ABI_6055e2cba8c8e9cb7e04b10e4c56ab9a.json b/src/augmintjs/abiniser/abis/Locker_ABI_6055e2cba8c8e9cb7e04b10e4c56ab9a.json deleted file mode 100644 index f9a97f4..0000000 --- a/src/augmintjs/abiniser/abis/Locker_ABI_6055e2cba8c8e9cb7e04b10e4c56ab9a.json +++ /dev/null @@ -1,548 +0,0 @@ -{ - "contractName": "Locker", - "abiHash": "6055e2cba8c8e9cb7e04b10e4c56ab9a", - "generatedAt": "2018-04-24T15:43:19.966Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "lockProducts", - "outputs": [ - { - "name": "perTermInterest", - "type": "uint256" - }, - { - "name": "durationInSecs", - "type": "uint256" - }, - { - "name": "minimumLockAmount", - "type": "uint256" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "locks", - "outputs": [ - { - "name": "amountLocked", - "type": "uint256" - }, - { - "name": "interestEarned", - "type": "uint256" - }, - { - "name": "lockedUntil", - "type": "uint256" - }, - { - "name": "perTermInterest", - "type": "uint256" - }, - { - "name": "durationInSecs", - "type": "uint256" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint256" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint256" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint256" - }, - { - "indexed": false, - "name": "minimumLockAmount", - "type": "uint256" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLockProduct", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint256" - }, - { - "indexed": false, - "name": "newActiveState", - "type": "bool" - } - ], - "name": "LockProductActiveChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": true, - "name": "lockIndex", - "type": "uint256" - }, - { - "indexed": false, - "name": "amountLocked", - "type": "uint256" - }, - { - "indexed": false, - "name": "interestEarned", - "type": "uint256" - }, - { - "indexed": false, - "name": "lockedUntil", - "type": "uint256" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint256" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint256" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": true, - "name": "lockIndex", - "type": "uint256" - } - ], - "name": "LockReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint256" - }, - { - "name": "durationInSecs", - "type": "uint256" - }, - { - "name": "minimumLockAmount", - "type": "uint256" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLockProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockProductId", - "type": "uint256" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "setLockProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - }, - { - "name": "lockIndex", - "type": "uint256" - } - ], - "name": "releaseFunds", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockProductCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLockProducts", - "outputs": [ - { - "name": "", - "type": "uint256[4][20]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - } - ], - "name": "getLockCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocksForAddress", - "outputs": [ - { - "name": "", - "type": "uint256[6][20]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "lockProductId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockProductId", - "type": "uint256" - }, - { - "name": "amountToLock", - "type": "uint256" - } - ], - "name": "calculateInterestForLockProduct", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Locker_ABI_619ff7809b73aead28176fe6317953c3.json b/src/augmintjs/abiniser/abis/Locker_ABI_619ff7809b73aead28176fe6317953c3.json deleted file mode 100644 index 4547fef..0000000 --- a/src/augmintjs/abiniser/abis/Locker_ABI_619ff7809b73aead28176fe6317953c3.json +++ /dev/null @@ -1,631 +0,0 @@ -{ - "contractName": "Locker", - "abiHash": "619ff7809b73aead28176fe6317953c3", - "generatedAt": "2018-06-04T12:49:52.661Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "lockProducts", - "outputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLocks", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "locks", - "outputs": [ - { - "name": "amountLocked", - "type": "uint256" - }, - { - "name": "owner", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "lockedUntil", - "type": "uint40" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - }, - { - "indexed": false, - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLockProduct", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newActiveState", - "type": "bool" - } - ], - "name": "LockProductActiveChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - }, - { - "indexed": false, - "name": "amountLocked", - "type": "uint256" - }, - { - "indexed": false, - "name": "interestEarned", - "type": "uint256" - }, - { - "indexed": false, - "name": "lockedUntil", - "type": "uint40" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - } - ], - "name": "NewLock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - } - ], - "name": "LockReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "MonetarySupervisorChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLockProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockProductId", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "setLockProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "_lockProductId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockId", - "type": "uint256" - } - ], - "name": "releaseFunds", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "setMonetarySupervisor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockProductCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLockProducts", - "outputs": [ - { - "name": "response", - "type": "uint256[5][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - } - ], - "name": "getLockCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocks", - "outputs": [ - { - "name": "response", - "type": "uint256[8][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocksForAddress", - "outputs": [ - { - "name": "response", - "type": "uint256[7][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "amountToLock", - "type": "uint256" - } - ], - "name": "calculateInterest", - "outputs": [ - { - "name": "interestEarned", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Locker_ABI_66e3e89133d9bbd91baac5552f21f7e1.json b/src/augmintjs/abiniser/abis/Locker_ABI_66e3e89133d9bbd91baac5552f21f7e1.json deleted file mode 100644 index 7dead52..0000000 --- a/src/augmintjs/abiniser/abis/Locker_ABI_66e3e89133d9bbd91baac5552f21f7e1.json +++ /dev/null @@ -1,627 +0,0 @@ -{ - "contractName": "Locker", - "abiHash": "66e3e89133d9bbd91baac5552f21f7e1", - "generatedAt": "2018-04-24T15:49:38.874Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "lockProducts", - "outputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLocks", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "locks", - "outputs": [ - { - "name": "amountLocked", - "type": "uint256" - }, - { - "name": "owner", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "lockedUntil", - "type": "uint40" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - }, - { - "indexed": false, - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLockProduct", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newActiveState", - "type": "bool" - } - ], - "name": "LockProductActiveChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - }, - { - "indexed": false, - "name": "amountLocked", - "type": "uint256" - }, - { - "indexed": false, - "name": "interestEarned", - "type": "uint256" - }, - { - "indexed": false, - "name": "lockedUntil", - "type": "uint40" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - } - ], - "name": "NewLock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - } - ], - "name": "LockReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "MonetarySupervisorChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLockProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockProductId", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "setLockProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "_lockProductId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockId", - "type": "uint256" - } - ], - "name": "releaseFunds", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "setMonetarySupervisor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockProductCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLockProducts", - "outputs": [ - { - "name": "response", - "type": "uint256[5][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - } - ], - "name": "getLockCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocks", - "outputs": [ - { - "name": "response", - "type": "uint256[8][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocksForAddress", - "outputs": [ - { - "name": "response", - "type": "uint256[7][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "amountToLock", - "type": "uint256" - } - ], - "name": "calculateInterest", - "outputs": [ - { - "name": "interestEarned", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Locker_ABI_c95c1ab8f11cd983deebbe203f4d49be.json b/src/augmintjs/abiniser/abis/Locker_ABI_c95c1ab8f11cd983deebbe203f4d49be.json deleted file mode 100644 index 2188682..0000000 --- a/src/augmintjs/abiniser/abis/Locker_ABI_c95c1ab8f11cd983deebbe203f4d49be.json +++ /dev/null @@ -1,606 +0,0 @@ -{ - "contractName": "Locker", - "abiHash": "c95c1ab8f11cd983deebbe203f4d49be", - "generatedAt": "2018-04-24T15:44:28.624Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "lockProducts", - "outputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLocks", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "locks", - "outputs": [ - { - "name": "amountLocked", - "type": "uint256" - }, - { - "name": "owner", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "lockedUntil", - "type": "uint40" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - }, - { - "indexed": false, - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLockProduct", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newActiveState", - "type": "bool" - } - ], - "name": "LockProductActiveChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - }, - { - "indexed": false, - "name": "amountLocked", - "type": "uint256" - }, - { - "indexed": false, - "name": "interestEarned", - "type": "uint256" - }, - { - "indexed": false, - "name": "lockedUntil", - "type": "uint40" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - } - ], - "name": "LockReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLockProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockProductId", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "setLockProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockId", - "type": "uint256" - } - ], - "name": "releaseFunds", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockProductCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLockProducts", - "outputs": [ - { - "name": "response", - "type": "uint32[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - } - ], - "name": "getLockCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocks", - "outputs": [ - { - "name": "response", - "type": "uint256[8][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getLocksForAddress", - "outputs": [ - { - "name": "response", - "type": "uint256[7][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "_lockProductId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "amountToLock", - "type": "uint256" - } - ], - "name": "calculateInterest", - "outputs": [ - { - "name": "interestEarned", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Locker_ABI_f59526398823aef0f0c1454d0b6b4eac.json b/src/augmintjs/abiniser/abis/Locker_ABI_f59526398823aef0f0c1454d0b6b4eac.json deleted file mode 100644 index 78cb98c..0000000 --- a/src/augmintjs/abiniser/abis/Locker_ABI_f59526398823aef0f0c1454d0b6b4eac.json +++ /dev/null @@ -1,629 +0,0 @@ -{ - "contractName": "Locker", - "abiHash": "f59526398823aef0f0c1454d0b6b4eac", - "generatedAt": "2018-10-18T13:35:02.422Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "lockProducts", - "outputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "monetarySupervisor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "accountLocks", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "locks", - "outputs": [ - { - "name": "amountLocked", - "type": "uint256" - }, - { - "name": "owner", - "type": "address" - }, - { - "name": "productId", - "type": "uint32" - }, - { - "name": "lockedUntil", - "type": "uint40" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_monetarySupervisor", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - }, - { - "indexed": false, - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "indexed": false, - "name": "isActive", - "type": "bool" - } - ], - "name": "NewLockProduct", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockProductId", - "type": "uint32" - }, - { - "indexed": false, - "name": "newActiveState", - "type": "bool" - } - ], - "name": "LockProductActiveChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - }, - { - "indexed": false, - "name": "amountLocked", - "type": "uint256" - }, - { - "indexed": false, - "name": "interestEarned", - "type": "uint256" - }, - { - "indexed": false, - "name": "lockedUntil", - "type": "uint40" - }, - { - "indexed": false, - "name": "perTermInterest", - "type": "uint32" - }, - { - "indexed": false, - "name": "durationInSecs", - "type": "uint32" - } - ], - "name": "NewLock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "lockOwner", - "type": "address" - }, - { - "indexed": false, - "name": "lockId", - "type": "uint256" - } - ], - "name": "LockReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "MonetarySupervisorChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "durationInSecs", - "type": "uint32" - }, - { - "name": "minimumLockAmount", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "addLockProduct", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockProductId", - "type": "uint32" - }, - { - "name": "isActive", - "type": "bool" - } - ], - "name": "setLockProductActiveState", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "_lockProductId", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockId", - "type": "uint256" - } - ], - "name": "releaseFunds", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newMonetarySupervisor", - "type": "address" - } - ], - "name": "setMonetarySupervisor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockProductCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getLockProducts", - "outputs": [ - { - "name": "", - "type": "uint256[5][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLockCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - } - ], - "name": "getLockCountForAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getLocks", - "outputs": [ - { - "name": "", - "type": "uint256[8][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "lockOwner", - "type": "address" - }, - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getLocksForAddress", - "outputs": [ - { - "name": "", - "type": "uint256[7][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "perTermInterest", - "type": "uint32" - }, - { - "name": "amountToLock", - "type": "uint256" - } - ], - "name": "calculateInterest", - "outputs": [ - { - "name": "interestEarned", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Migrations_ABI_78141a323f4a8416891b06a0a2b90065.json b/src/augmintjs/abiniser/abis/Migrations_ABI_78141a323f4a8416891b06a0a2b90065.json deleted file mode 100644 index 6340701..0000000 --- a/src/augmintjs/abiniser/abis/Migrations_ABI_78141a323f4a8416891b06a0a2b90065.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "contractName": "Migrations", - "abiHash": "78141a323f4a8416891b06a0a2b90065", - "generatedAt": "2018-04-24T18:57:53.347Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "last_completed_migration", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": false, - "inputs": [ - { - "name": "completed", - "type": "uint256" - } - ], - "name": "setCompleted", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newAddress", - "type": "address" - } - ], - "name": "upgrade", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_066c2220b91befd25691fefd91684117.json b/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_066c2220b91befd25691fefd91684117.json deleted file mode 100644 index d4e3e86..0000000 --- a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_066c2220b91befd25691fefd91684117.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "abiHash": "066c2220b91befd25691fefd91684117", - "generatedAt": "2018-04-24T15:43:19.927Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ltdDifferenceLimit", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalLoanAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "issuedByMonetaryBoard", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "allowedLtdDifferenceAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintReserves", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_augmintReserves", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - }, - { - "name": "_ltdDifferenceLimit", - "type": "uint256" - }, - { - "name": "_allowedLtdDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "ltdDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "allowedLtdDifferenceAmount", - "type": "uint256" - } - ], - "name": "ParamsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueToReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFromReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "requestInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockedAmount", - "type": "uint256" - } - ], - "name": "releaseFundsNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "issueLoan", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "loanRepaymentNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountCollected", - "type": "uint256" - } - ], - "name": "loanCollectionNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_ltdDifferenceLimit", - "type": "uint256" - }, - { - "name": "_allowedLtdDifferenceAmount", - "type": "uint256" - } - ], - "name": "setParams", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getParams", - "outputs": [ - { - "name": "", - "type": "uint256[2]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_54d27fedd8bf3010ad5509866a42c053.json b/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_54d27fedd8bf3010ad5509866a42c053.json deleted file mode 100644 index 314511d..0000000 --- a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_54d27fedd8bf3010ad5509866a42c053.json +++ /dev/null @@ -1,693 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "abiHash": "54d27fedd8bf3010ad5509866a42c053", - "generatedAt": "2018-06-04T12:49:52.546Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ltdParams", - "outputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalLoanAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "issuedByStabilityBoard", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERCENT_100", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "acceptedLegacyAugmintTokens", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintReserves", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_augmintReserves", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - }, - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "LtdParamsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "augmintTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "AcceptedLegacyAugmintTokenChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "oldTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "account", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "LegacyTokenConverted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "indexed": false, - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "KPIsAdjusted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "indexed": false, - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueToReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFromReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "requestInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockedAmount", - "type": "uint256" - } - ], - "name": "releaseFundsNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "issueLoan", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "loanRepaymentNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountCollected", - "type": "uint256" - } - ], - "name": "loanCollectionNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "legacyAugmintTokenAddress", - "type": "address" - }, - { - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "setAcceptedLegacyAugmintToken", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "setLtdParams", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "adjustKPIs", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanToDepositRatio", - "outputs": [ - { - "name": "loanToDepositRatio", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLockAmount", - "type": "uint256" - }, - { - "name": "interestPt", - "type": "uint256" - } - ], - "name": "getMaxLockAmount", - "outputs": [ - { - "name": "maxLock", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLoanAmount", - "type": "uint256" - } - ], - "name": "getMaxLoanAmount", - "outputs": [ - { - "name": "maxLoan", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLockAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLockByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLoanAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLoanByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_7f500b43397413e97de925528187f9cd.json b/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_7f500b43397413e97de925528187f9cd.json deleted file mode 100644 index 4b880bc..0000000 --- a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_7f500b43397413e97de925528187f9cd.json +++ /dev/null @@ -1,693 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "abiHash": "7f500b43397413e97de925528187f9cd", - "generatedAt": "2018-10-18T13:35:02.377Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ltdParams", - "outputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "burnedByStabilityBoard", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalLoanAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "issuedByStabilityBoard", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERCENT_100", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "acceptedLegacyAugmintTokens", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintReserves", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_augmintReserves", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - }, - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "LtdParamsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "augmintTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "AcceptedLegacyAugmintTokenChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "oldTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "account", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "LegacyTokenConverted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "indexed": false, - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "KPIsAdjusted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "indexed": false, - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueToReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFromReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "requestInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockedAmount", - "type": "uint256" - } - ], - "name": "releaseFundsNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "issueLoan", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "loanRepaymentNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountCollected", - "type": "uint256" - } - ], - "name": "loanCollectionNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "legacyAugmintTokenAddress", - "type": "address" - }, - { - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "setAcceptedLegacyAugmintToken", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "setLtdParams", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "adjustKPIs", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLockAmount", - "type": "uint256" - }, - { - "name": "interestPt", - "type": "uint256" - } - ], - "name": "getMaxLockAmount", - "outputs": [ - { - "name": "maxLock", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLoanAmount", - "type": "uint256" - } - ], - "name": "getMaxLoanAmount", - "outputs": [ - { - "name": "maxLoan", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLockAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLockByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLoanAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLoanByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_a552ee1f90ae83cb91d07311ae8eab1e.json b/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_a552ee1f90ae83cb91d07311ae8eab1e.json deleted file mode 100644 index 7ecd547..0000000 --- a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_a552ee1f90ae83cb91d07311ae8eab1e.json +++ /dev/null @@ -1,689 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "abiHash": "a552ee1f90ae83cb91d07311ae8eab1e", - "generatedAt": "2018-04-24T15:49:38.735Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ltdParams", - "outputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalLoanAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "issuedByMonetaryBoard", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERCENT_100", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "acceptedLegacyAugmintTokens", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintReserves", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_augmintReserves", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - }, - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "LtdParamsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "augmintTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "AcceptedLegacyAugmintTokenChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "oldTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "account", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "LegacyTokenConverted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "indexed": false, - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "KPIsAdjusted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "indexed": false, - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueToReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFromReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "requestInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockedAmount", - "type": "uint256" - } - ], - "name": "releaseFundsNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "issueLoan", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "loanRepaymentNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountCollected", - "type": "uint256" - } - ], - "name": "loanCollectionNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "legacyAugmintTokenAddress", - "type": "address" - }, - { - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "setAcceptedLegacyAugmintToken", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "setLtdParams", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "adjustKPIs", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLoanToDepositRatio", - "outputs": [ - { - "name": "loanToDepositRatio", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLockAmount", - "type": "uint256" - }, - { - "name": "interestPt", - "type": "uint256" - } - ], - "name": "getMaxLockAmount", - "outputs": [ - { - "name": "maxLock", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLoanAmount", - "type": "uint256" - } - ], - "name": "getMaxLoanAmount", - "outputs": [ - { - "name": "maxLoan", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLockAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLockByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLoanAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLoanByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_df21702119818bc90918a2ffe5f87b2d.json b/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_df21702119818bc90918a2ffe5f87b2d.json deleted file mode 100644 index 03e4da6..0000000 --- a/src/augmintjs/abiniser/abis/MonetarySupervisor_ABI_df21702119818bc90918a2ffe5f87b2d.json +++ /dev/null @@ -1,679 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "abiHash": "df21702119818bc90918a2ffe5f87b2d", - "generatedAt": "2018-09-27T14:51:01.967Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ltdParams", - "outputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalLoanAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestEarnedAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "issuedByStabilityBoard", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintToken", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERCENT_100", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "acceptedLegacyAugmintTokens", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "augmintReserves", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - }, - { - "name": "_augmintToken", - "type": "address" - }, - { - "name": "_augmintReserves", - "type": "address" - }, - { - "name": "_interestEarnedAccount", - "type": "address" - }, - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "indexed": false, - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "LtdParamsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "augmintTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "AcceptedLegacyAugmintTokenChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "oldTokenAddress", - "type": "address" - }, - { - "indexed": false, - "name": "account", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "LegacyTokenConverted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "indexed": false, - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "KPIsAdjusted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "indexed": false, - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "SystemContractsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueToReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFromReserve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amountToLock", - "type": "uint256" - }, - { - "name": "interestAmount", - "type": "uint256" - } - ], - "name": "requestInterest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockedAmount", - "type": "uint256" - } - ], - "name": "releaseFundsNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "borrower", - "type": "address" - }, - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "issueLoan", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "loanAmount", - "type": "uint256" - } - ], - "name": "loanRepaymentNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountCollected", - "type": "uint256" - } - ], - "name": "loanCollectionNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "legacyAugmintTokenAddress", - "type": "address" - }, - { - "name": "newAcceptedState", - "type": "bool" - } - ], - "name": "setAcceptedLegacyAugmintToken", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "lockDifferenceLimit", - "type": "uint256" - }, - { - "name": "loanDifferenceLimit", - "type": "uint256" - }, - { - "name": "allowedDifferenceAmount", - "type": "uint256" - } - ], - "name": "setLtdParams", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "totalLoanAmountAdjustment", - "type": "uint256" - }, - { - "name": "totalLockedAmountAdjustment", - "type": "uint256" - } - ], - "name": "adjustKPIs", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newInterestEarnedAccount", - "type": "address" - }, - { - "name": "newAugmintReserves", - "type": "address" - } - ], - "name": "setSystemContracts", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "transferNotification", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLockAmount", - "type": "uint256" - }, - { - "name": "interestPt", - "type": "uint256" - } - ], - "name": "getMaxLockAmount", - "outputs": [ - { - "name": "maxLock", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "minLoanAmount", - "type": "uint256" - } - ], - "name": "getMaxLoanAmount", - "outputs": [ - { - "name": "maxLoan", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLockAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLockByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getMaxLoanAmountAllowedByLtd", - "outputs": [ - { - "name": "maxLoanByLtd", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/PreTokenProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json b/src/augmintjs/abiniser/abis/PreTokenProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json deleted file mode 100644 index 2d1f12e..0000000 --- a/src/augmintjs/abiniser/abis/PreTokenProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "contractName": "PreTokenProxy", - "abiHash": "19ab69b650e28b2dd211d3851893f91f", - "generatedAt": "2018-06-06T15:25:31.855Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "activeSignersCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "cancelScript", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "execute", - "outputs": [ - { - "name": "result", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "isSigner", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "removeSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getScriptsCount", - "outputs": [ - { - "name": "scriptsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "scriptAddresses", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllSigners", - "outputs": [ - { - "name": "signersResult", - "type": "uint256[3][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllScripts", - "outputs": [ - { - "name": "scriptsResult", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "scripts", - "outputs": [ - { - "name": "state", - "type": "uint8" - }, - { - "name": "signCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAllSignersCount", - "outputs": [ - { - "name": "allSignersCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allSigners", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "addSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "sign", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "ScriptSigned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "result", - "type": "bool" - } - ], - "name": "ScriptExecuted", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/PreTokenProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json b/src/augmintjs/abiniser/abis/PreTokenProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json deleted file mode 100644 index ab52593..0000000 --- a/src/augmintjs/abiniser/abis/PreTokenProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "contractName": "PreTokenProxy", - "abiHash": "dd40c0d39ea8bad8a388522667a84687", - "generatedAt": "2018-10-18T13:35:02.451Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getSigners", - "outputs": [ - { - "name": "", - "type": "uint256[3][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getScripts", - "outputs": [ - { - "name": "", - "type": "uint256[4][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "activeSignersCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "cancelScript", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "execute", - "outputs": [ - { - "name": "result", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "isSigner", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "removeSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getScriptsCount", - "outputs": [ - { - "name": "scriptsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "scriptAddresses", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "scripts", - "outputs": [ - { - "name": "state", - "type": "uint8" - }, - { - "name": "signCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAllSignersCount", - "outputs": [ - { - "name": "allSignersCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allSigners", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "addSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "sign", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "ScriptSigned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "result", - "type": "bool" - } - ], - "name": "ScriptExecuted", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/PreToken_ABI_10eebbb51a771cfd3473475169a569f1.json b/src/augmintjs/abiniser/abis/PreToken_ABI_10eebbb51a771cfd3473475169a569f1.json deleted file mode 100644 index 9007527..0000000 --- a/src/augmintjs/abiniser/abis/PreToken_ABI_10eebbb51a771cfd3473475169a569f1.json +++ /dev/null @@ -1,500 +0,0 @@ -{ - "contractName": "PreToken", - "abiHash": "10eebbb51a771cfd3473475169a569f1", - "generatedAt": "2018-06-08T15:49:18.203Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allAgreements", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "agreementOwners", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "agreements", - "outputs": [ - { - "name": "owner", - "type": "address" - }, - { - "name": "balance", - "type": "uint256" - }, - { - "name": "discount", - "type": "uint32" - }, - { - "name": "valuationCap", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "agreementHash", - "type": "bytes32" - }, - { - "indexed": false, - "name": "discount", - "type": "uint32" - }, - { - "indexed": false, - "name": "valuationCap", - "type": "uint32" - } - ], - "name": "NewAgreement", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "owner", - "type": "address" - }, - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "discount", - "type": "uint32" - }, - { - "name": "valuationCap", - "type": "uint32" - } - ], - "name": "addAgreement", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "to", - "type": "address" - } - ], - "name": "transferAgreement", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAgreementsCount", - "outputs": [ - { - "name": "agreementsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllAgreements", - "outputs": [ - { - "name": "agreementsResult", - "type": "uint256[6][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/PreToken_ABI_771887af92db4b4330d700538df6e490.json b/src/augmintjs/abiniser/abis/PreToken_ABI_771887af92db4b4330d700538df6e490.json deleted file mode 100644 index 4799ec0..0000000 --- a/src/augmintjs/abiniser/abis/PreToken_ABI_771887af92db4b4330d700538df6e490.json +++ /dev/null @@ -1,485 +0,0 @@ -{ - "contractName": "PreToken", - "abiHash": "771887af92db4b4330d700538df6e490", - "generatedAt": "2018-06-07T13:00:00.733Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allAgreements", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "agreements", - "outputs": [ - { - "name": "balance", - "type": "uint256" - }, - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "discount", - "type": "uint32" - }, - { - "name": "valuationCap", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "agreementHash", - "type": "bytes32" - }, - { - "indexed": false, - "name": "discount", - "type": "uint32" - }, - { - "indexed": false, - "name": "valuationCap", - "type": "uint32" - } - ], - "name": "NewAgreement", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "owner", - "type": "address" - }, - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "discount", - "type": "uint32" - }, - { - "name": "valuationCap", - "type": "uint32" - } - ], - "name": "addAgreement", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "who", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAgreementsCount", - "outputs": [ - { - "name": "agreementsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllAgreements", - "outputs": [ - { - "name": "agreementsResult", - "type": "uint256[6][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/PreToken_ABI_7f69e33e7b345c780ac9e43f391437d9.json b/src/augmintjs/abiniser/abis/PreToken_ABI_7f69e33e7b345c780ac9e43f391437d9.json deleted file mode 100644 index 0f73ea6..0000000 --- a/src/augmintjs/abiniser/abis/PreToken_ABI_7f69e33e7b345c780ac9e43f391437d9.json +++ /dev/null @@ -1,490 +0,0 @@ -{ - "contractName": "PreToken", - "abiHash": "7f69e33e7b345c780ac9e43f391437d9", - "generatedAt": "2018-10-18T13:35:02.467Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allAgreements", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "agreementOwners", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "agreements", - "outputs": [ - { - "name": "owner", - "type": "address" - }, - { - "name": "balance", - "type": "uint256" - }, - { - "name": "discount", - "type": "uint32" - }, - { - "name": "valuationCap", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "agreementHash", - "type": "bytes32" - }, - { - "indexed": false, - "name": "discount", - "type": "uint32" - }, - { - "indexed": false, - "name": "valuationCap", - "type": "uint32" - } - ], - "name": "NewAgreement", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "owner", - "type": "address" - }, - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "discount", - "type": "uint32" - }, - { - "name": "valuationCap", - "type": "uint32" - } - ], - "name": "addAgreement", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agreementHash", - "type": "bytes32" - }, - { - "name": "to", - "type": "address" - } - ], - "name": "transferAgreement", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAgreementsCount", - "outputs": [ - { - "name": "agreementsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getAgreements", - "outputs": [ - { - "name": "", - "type": "uint256[6][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json b/src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json deleted file mode 100644 index b68bf9f..0000000 --- a/src/augmintjs/abiniser/abis/Rates_ABI_73a17ebb0acc71773371c6a8e1c8e6ce.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "contractName": "Rates", - "abiHash": "73a17ebb0acc71773371c6a8e1c8e6ce", - "generatedAt": "2018-06-04T12:49:52.450Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "rates", - "outputs": [ - { - "name": "rate", - "type": "uint256" - }, - { - "name": "lastUpdated", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "permissionGranterContract", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "symbol", - "type": "bytes32" - }, - { - "indexed": false, - "name": "newRate", - "type": "uint256" - } - ], - "name": "RateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "symbol", - "type": "bytes32" - }, - { - "name": "newRate", - "type": "uint256" - } - ], - "name": "setRate", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "symbols", - "type": "bytes32[]" - }, - { - "name": "newRates", - "type": "uint256[]" - } - ], - "name": "setMultipleRates", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "bSymbol", - "type": "bytes32" - }, - { - "name": "weiValue", - "type": "uint256" - } - ], - "name": "convertFromWei", - "outputs": [ - { - "name": "value", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "bSymbol", - "type": "bytes32" - }, - { - "name": "value", - "type": "uint256" - } - ], - "name": "convertToWei", - "outputs": [ - { - "name": "weiValue", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Rates_ABI_aad689098442fe73d35b427a36786f06.json b/src/augmintjs/abiniser/abis/Rates_ABI_aad689098442fe73d35b427a36786f06.json deleted file mode 100644 index 2ee4df3..0000000 --- a/src/augmintjs/abiniser/abis/Rates_ABI_aad689098442fe73d35b427a36786f06.json +++ /dev/null @@ -1,258 +0,0 @@ -{ - "contractName": "Rates", - "abiHash": "aad689098442fe73d35b427a36786f06", - "generatedAt": "2018-04-24T15:43:19.741Z", - "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "rates", - "outputs": [ - { - "name": "rate", - "type": "uint256" - }, - { - "name": "lastUpdated", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "symbol", - "type": "bytes32" - }, - { - "indexed": false, - "name": "newRate", - "type": "uint256" - } - ], - "name": "RateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "symbol", - "type": "bytes32" - }, - { - "name": "newRate", - "type": "uint256" - } - ], - "name": "setRate", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "symbols", - "type": "bytes32[]" - }, - { - "name": "newRates", - "type": "uint256[]" - } - ], - "name": "setMultipleRates", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "bSymbol", - "type": "bytes32" - }, - { - "name": "weiValue", - "type": "uint256" - } - ], - "name": "convertFromWei", - "outputs": [ - { - "name": "value", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "bSymbol", - "type": "bytes32" - }, - { - "name": "value", - "type": "uint256" - } - ], - "name": "convertToWei", - "outputs": [ - { - "name": "weiValue", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/Rates_ABI_cc8bc64cd780f047eca819e6cd3b8af9.json b/src/augmintjs/abiniser/abis/Rates_ABI_cc8bc64cd780f047eca819e6cd3b8af9.json deleted file mode 100644 index 2bead0b..0000000 --- a/src/augmintjs/abiniser/abis/Rates_ABI_cc8bc64cd780f047eca819e6cd3b8af9.json +++ /dev/null @@ -1,258 +0,0 @@ -{ - "contractName": "Rates", - "abiHash": "cc8bc64cd780f047eca819e6cd3b8af9", - "generatedAt": "2018-04-24T15:49:38.589Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "rates", - "outputs": [ - { - "name": "rate", - "type": "uint256" - }, - { - "name": "lastUpdated", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "symbol", - "type": "bytes32" - }, - { - "indexed": false, - "name": "newRate", - "type": "uint256" - } - ], - "name": "RateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "symbol", - "type": "bytes32" - }, - { - "name": "newRate", - "type": "uint256" - } - ], - "name": "setRate", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "symbols", - "type": "bytes32[]" - }, - { - "name": "newRates", - "type": "uint256[]" - } - ], - "name": "setMultipleRates", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "bSymbol", - "type": "bytes32" - }, - { - "name": "weiValue", - "type": "uint256" - } - ], - "name": "convertFromWei", - "outputs": [ - { - "name": "value", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "bSymbol", - "type": "bytes32" - }, - { - "name": "value", - "type": "uint256" - } - ], - "name": "convertToWei", - "outputs": [ - { - "name": "weiValue", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/SafeMath_ABI_d751713988987e9331980363e24189ce.json b/src/augmintjs/abiniser/abis/SafeMath_ABI_d751713988987e9331980363e24189ce.json deleted file mode 100644 index 8d3c89a..0000000 --- a/src/augmintjs/abiniser/abis/SafeMath_ABI_d751713988987e9331980363e24189ce.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "contractName": "SafeMath", - "abiHash": "d751713988987e9331980363e24189ce", - "generatedAt": "2018-04-24T18:57:53.343Z", - "abi": [] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json b/src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json deleted file mode 100644 index 9418150..0000000 --- a/src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_19ab69b650e28b2dd211d3851893f91f.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "contractName": "StabilityBoardProxy", - "abiHash": "19ab69b650e28b2dd211d3851893f91f", - "generatedAt": "2018-06-06T15:25:31.847Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "activeSignersCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "cancelScript", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "execute", - "outputs": [ - { - "name": "result", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "isSigner", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "removeSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getScriptsCount", - "outputs": [ - { - "name": "scriptsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "scriptAddresses", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllSigners", - "outputs": [ - { - "name": "signersResult", - "type": "uint256[3][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllScripts", - "outputs": [ - { - "name": "scriptsResult", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "scripts", - "outputs": [ - { - "name": "state", - "type": "uint8" - }, - { - "name": "signCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAllSignersCount", - "outputs": [ - { - "name": "allSignersCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allSigners", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "addSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "sign", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "ScriptSigned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "result", - "type": "bool" - } - ], - "name": "ScriptExecuted", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json b/src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json deleted file mode 100644 index dd666c9..0000000 --- a/src/augmintjs/abiniser/abis/StabilityBoardProxy_ABI_dd40c0d39ea8bad8a388522667a84687.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "contractName": "StabilityBoardProxy", - "abiHash": "dd40c0d39ea8bad8a388522667a84687", - "generatedAt": "2018-10-18T13:35:02.446Z", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getSigners", - "outputs": [ - { - "name": "", - "type": "uint256[3][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - }, - { - "name": "chunkSize", - "type": "uint16" - } - ], - "name": "getScripts", - "outputs": [ - { - "name": "", - "type": "uint256[4][]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "activeSignersCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "cancelScript", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "execute", - "outputs": [ - { - "name": "result", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "isSigner", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "removeSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getScriptsCount", - "outputs": [ - { - "name": "scriptsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "scriptAddresses", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "scripts", - "outputs": [ - { - "name": "state", - "type": "uint8" - }, - { - "name": "signCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAllSignersCount", - "outputs": [ - { - "name": "allSignersCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allSigners", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "addSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "sign", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "ScriptSigned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "result", - "type": "bool" - } - ], - "name": "ScriptExecuted", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/StabilityBoardSigner_ABI_19ab69b650e28b2dd211d3851893f91f.json b/src/augmintjs/abiniser/abis/StabilityBoardSigner_ABI_19ab69b650e28b2dd211d3851893f91f.json deleted file mode 100644 index c515a71..0000000 --- a/src/augmintjs/abiniser/abis/StabilityBoardSigner_ABI_19ab69b650e28b2dd211d3851893f91f.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "contractName": "StabilityBoardSigner", - "abiHash": "19ab69b650e28b2dd211d3851893f91f", - "generatedAt": "2018-05-31T23:56:48.745Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "activeSignersCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "cancelScript", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "execute", - "outputs": [ - { - "name": "result", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "isSigner", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "removeSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getScriptsCount", - "outputs": [ - { - "name": "scriptsCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "scriptAddresses", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllSigners", - "outputs": [ - { - "name": "signersResult", - "type": "uint256[3][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "offset", - "type": "uint256" - } - ], - "name": "getAllScripts", - "outputs": [ - { - "name": "scriptsResult", - "type": "uint256[4][100]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "scripts", - "outputs": [ - { - "name": "state", - "type": "uint8" - }, - { - "name": "signCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAllSignersCount", - "outputs": [ - { - "name": "allSignersCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "allSigners", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "signers", - "type": "address[]" - } - ], - "name": "addSigners", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CHUNK_SIZE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "scriptAddress", - "type": "address" - } - ], - "name": "sign", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "SignerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "signer", - "type": "address" - } - ], - "name": "ScriptSigned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - } - ], - "name": "ScriptCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "scriptAddress", - "type": "address" - }, - { - "indexed": false, - "name": "result", - "type": "bool" - } - ], - "name": "ScriptExecuted", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_1bf228e8c50681d2a93b6723af2144a7.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_1bf228e8c50681d2a93b6723af2144a7.json deleted file mode 100644 index a9e8cc3..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_1bf228e8c50681d2a93b6723af2144a7.json +++ /dev/null @@ -1,791 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "1bf228e8c50681d2a93b6723af2144a7", - "generatedAt": "2018-07-08T15:47:54.866Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_permissionGranterContract", - "type": "address" - }, - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_1d30184837b8c27bcac847509ab146a1.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_1d30184837b8c27bcac847509ab146a1.json deleted file mode 100644 index d9403a2..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_1d30184837b8c27bcac847509ab146a1.json +++ /dev/null @@ -1,714 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "1d30184837b8c27bcac847509ab146a1", - "generatedAt": "2018-04-24T15:44:28.414Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "transferFee", - "outputs": [ - { - "name": "pt", - "type": "uint256" - }, - { - "name": "min", - "type": "uint256" - }, - { - "name": "max", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_transferFeePt", - "type": "uint256" - }, - { - "name": "_transferFeeMin", - "type": "uint256" - }, - { - "name": "_transferFeeMax", - "type": "uint256" - } - ], - "name": "setTransferFees", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_feeAccount", - "type": "address" - }, - { - "name": "_transferFeePt", - "type": "uint256" - }, - { - "name": "_transferFeeMin", - "type": "uint256" - }, - { - "name": "_transferFeeMax", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_27721a2c77dc40da7639abd46791c3d7.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_27721a2c77dc40da7639abd46791c3d7.json deleted file mode 100644 index 020881f..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_27721a2c77dc40da7639abd46791c3d7.json +++ /dev/null @@ -1,748 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "27721a2c77dc40da7639abd46791c3d7", - "generatedAt": "2018-04-24T15:43:19.848Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMulitplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getParams", - "outputs": [ - { - "name": "", - "type": "uint256[3]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "transferFeeMax", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "transferFeePt", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "transferFeeMin", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_transferFeePt", - "type": "uint256" - }, - { - "name": "_transferFeeMin", - "type": "uint256" - }, - { - "name": "_transferFeeMax", - "type": "uint256" - } - ], - "name": "setTransferFees", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_feeAccount", - "type": "address" - }, - { - "name": "_transferFeePt", - "type": "uint256" - }, - { - "name": "_transferFeeMin", - "type": "uint256" - }, - { - "name": "_transferFeeMax", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json deleted file mode 100644 index 39a7a5c..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_2ea91d34a7bfefc8f38ef0e8a5ae24a5.json +++ /dev/null @@ -1,809 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "2ea91d34a7bfefc8f38ef0e8a5ae24a5", - "generatedAt": "2018-10-18T13:35:02.364Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_symbol", - "type": "string" - } - ], - "name": "setSymbol", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_name", - "type": "string" - } - ], - "name": "setName", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_permissionGranterContract", - "type": "address" - }, - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_303ed8bcda6fb3c3119cf273797961ef.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_303ed8bcda6fb3c3119cf273797961ef.json deleted file mode 100644 index 71e9d3b..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_303ed8bcda6fb3c3119cf273797961ef.json +++ /dev/null @@ -1,801 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "303ed8bcda6fb3c3119cf273797961ef", - "generatedAt": "2018-05-31T23:56:48.490Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stabilityBoardSigner", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_4b49e7e6d1a9a2de81a4d2d088acbc04.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_4b49e7e6d1a9a2de81a4d2d088acbc04.json deleted file mode 100644 index 0d89825..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_4b49e7e6d1a9a2de81a4d2d088acbc04.json +++ /dev/null @@ -1,787 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "4b49e7e6d1a9a2de81a4d2d088acbc04", - "generatedAt": "2018-05-12T00:22:15.160Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_6b1597192b36a746724929ec9ee7b6b8.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_6b1597192b36a746724929ec9ee7b6b8.json deleted file mode 100644 index 3faf42d..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_6b1597192b36a746724929ec9ee7b6b8.json +++ /dev/null @@ -1,795 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "6b1597192b36a746724929ec9ee7b6b8", - "generatedAt": "2018-05-09T12:19:24.878Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "minGasPrice", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "minGasPrice", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_962b41ca272a86b1f556fc47e0f7954f.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_962b41ca272a86b1f556fc47e0f7954f.json deleted file mode 100644 index 0766ed6..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_962b41ca272a86b1f556fc47e0f7954f.json +++ /dev/null @@ -1,805 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "962b41ca272a86b1f556fc47e0f7954f", - "generatedAt": "2018-06-04T12:49:52.518Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stabilityBoardSigner", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_permissionGranterContract", - "type": "address" - }, - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_9aa81519ec45a52d3f8f1a1a83d25c74.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_9aa81519ec45a52d3f8f1a1a83d25c74.json deleted file mode 100644 index 07e0a96..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_9aa81519ec45a52d3f8f1a1a83d25c74.json +++ /dev/null @@ -1,805 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "9aa81519ec45a52d3f8f1a1a83d25c74", - "generatedAt": "2018-06-06T15:25:31.747Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stabilityBoardProxy", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_permissionGranterContract", - "type": "address" - }, - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_d7dd02520f2d92b2ca237f066cf2488d.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_d7dd02520f2d92b2ca237f066cf2488d.json deleted file mode 100644 index 884dfb1..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_d7dd02520f2d92b2ca237f066cf2488d.json +++ /dev/null @@ -1,684 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "d7dd02520f2d92b2ca237f066cf2488d", - "generatedAt": "2018-04-24T15:49:38.681Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/abis/TokenAEur_ABI_d96bcadc59c7b9c8b1db01a11a021eef.json b/src/augmintjs/abiniser/abis/TokenAEur_ABI_d96bcadc59c7b9c8b1db01a11a021eef.json deleted file mode 100644 index eea6366..0000000 --- a/src/augmintjs/abiniser/abis/TokenAEur_ABI_d96bcadc59c7b9c8b1db01a11a021eef.json +++ /dev/null @@ -1,819 +0,0 @@ -{ - "contractName": "TokenAEur", - "abiHash": "d96bcadc59c7b9c8b1db01a11a021eef", - "generatedAt": "2018-07-09T11:28:14.585Z", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - } - ], - "name": "transferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "issueTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "peggedSymbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "setFeeAccount", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "permissions", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "revokePermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeAccount", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferFromWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "revokeMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermissions", - "type": "bytes32[]" - } - ], - "name": "grantMultiplePermissions", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_symbol", - "type": "string" - } - ], - "name": "setSymbol", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_name", - "type": "string" - } - ], - "name": "setName", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "from", - "type": "address" - }, - { - "name": "target", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "data", - "type": "uint256" - }, - { - "name": "maxExecutorFeeInToken", - "type": "uint256" - }, - { - "name": "nonce", - "type": "bytes32" - }, - { - "name": "signature", - "type": "bytes" - }, - { - "name": "requestedExecutorFeeInToken", - "type": "uint256" - } - ], - "name": "delegatedTransferAndNotify", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "remaining", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "name": "delegatedTxHashesUsed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "agent", - "type": "address" - }, - { - "name": "requiredPermission", - "type": "bytes32" - } - ], - "name": "grantPermission", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "to", - "type": "address" - }, - { - "name": "amount", - "type": "uint256" - }, - { - "name": "narrative", - "type": "string" - } - ], - "name": "transferWithNarrative", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_permissionGranterContract", - "type": "address" - }, - { - "name": "_feeAccount", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newFeeAccount", - "type": "address" - } - ], - "name": "FeeAccountChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "transferFeePt", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMin", - "type": "uint256" - }, - { - "indexed": false, - "name": "transferFeeMax", - "type": "uint256" - } - ], - "name": "TransferFeesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "narrative", - "type": "string" - }, - { - "indexed": false, - "name": "fee", - "type": "uint256" - } - ], - "name": "AugmintTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenBurned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "grantedPermission", - "type": "bytes32" - } - ], - "name": "PermissionGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "agent", - "type": "address" - }, - { - "indexed": false, - "name": "revokedPermission", - "type": "bytes32" - } - ], - "name": "PermissionRevoked", - "type": "event" - } - ] -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/AugmintReserves_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/AugmintReserves_DEPLOYS.json deleted file mode 100644 index ec7220a..0000000 --- a/src/augmintjs/abiniser/deployments/1/AugmintReserves_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "AugmintReserves", - "latestAbiHash": "024b81d1a1f75241167a8a0f6e62326f", - "deployedAbis": { - "fe74b7986dafb00f221486e790fc70ec": { - "latestDeployedAddress": "0x633cb544b2ef1bd9269b2111fd2b66fc05cd3477", - "deployments": { - "0x633cb544b2ef1bd9269b2111fd2b66fc05cd3477": { - "generatedAt": "2018-06-11T13:54:29.111Z", - "truffleContractFileUpdatedAt": "2018-06-11T13:35:00.862Z", - "deployTransactionHash": "0xbc3a1118ae2a9250b2bae34522a45a615f4fa645dbd62a1ab52612b6a3c3b003", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "4974a3c7784d990daf85675b5b7a0e17", - "deployedBytecodeHash": "d4f59c0df09ee0b51006f4945892828c", - "sourceHash": "d5753af67c3f621da910f47d3d749db3", - "source": "/* Contract to hold Augmint reserves (ETH & Token)\n - ETH as regular ETH balance of the contract\n - ERC20 token reserve (stored as regular Token balance under the contract address)\n\nNB: reserves are held under the contract address, therefore any transaction on the reserve is limited to the\n tx-s defined here (i.e. transfer is not allowed even by the contract owner or StabilityBoard or MonetarySupervisor)\n\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract AugmintReserves is SystemAccount {\n\n function () public payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into reserve (from defaulted loan's collateral )\n }\n\n constructor(address permissionGranterContract) public SystemAccount(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function burn(AugmintTokenInterface augmintToken, uint amount) external restrict(\"MonetarySupervisor\") {\n augmintToken.burn(amount);\n }\n\n}\n" - } - } - }, - "024b81d1a1f75241167a8a0f6e62326f": { - "latestDeployedAddress": "0x65f30f8dd20c707c1938ccad7416c7381e6eb9c8", - "deployments": { - "0x65f30f8dd20c707c1938ccad7416c7381e6eb9c8": { - "generatedAt": "2018-11-14T12:52:13.027Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.469Z", - "deployTransactionHash": "0x3f6f0c7e6d357fe0e8d195ad850ed5c787c01c99e03a8f64a7c064d429a1b666", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5bf4ede2aaad5b0b112f7b1ebf420fd2", - "deployedBytecodeHash": "3720667df6506876043fba53c540acb6", - "sourceHash": "b9d84f5f6153164ba581845190291c88", - "source": "/* Contract to hold Augmint reserves (ETH & Token)\n - ETH as regular ETH balance of the contract\n - ERC20 token reserve (stored as regular Token balance under the contract address)\n\nNB: reserves are held under the contract address, therefore any transaction on the reserve is limited to the\n tx-s defined here (i.e. transfer is not allowed even by the contract owner or StabilityBoard or MonetarySupervisor)\n\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract AugmintReserves is Restricted {\n\n event ReserveMigration(address to, uint weiAmount);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into reserve (from defaulted loan's collateral )\n }\n\n function burn(AugmintTokenInterface augmintToken, uint amount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.burn(amount);\n }\n\n function migrate(address to, uint weiAmount)\n external restrict(\"StabilityBoard\") {\n if (weiAmount > 0) {\n to.transfer(weiAmount);\n }\n emit ReserveMigration(to, weiAmount);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/Exchange_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/Exchange_DEPLOYS.json deleted file mode 100644 index ab18e92..0000000 --- a/src/augmintjs/abiniser/deployments/1/Exchange_DEPLOYS.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "contractName": "Exchange", - "latestAbiHash": "d3e7f8a261b756f9c40da097608b21cd", - "deployedAbis": { - "b2a23202a9a0f04755a186896c2b56eb": { - "latestDeployedAddress": "0x8b52b019d237d0bbe8baedf219132d5254e0690b", - "deployments": { - "0x8b52b019d237d0bbe8baedf219132d5254e0690b": { - "generatedAt": "2018-06-11T14:59:44.035Z", - "truffleContractFileUpdatedAt": "2018-06-11T14:55:55.596Z", - "deployTransactionHash": "0x6e94d5201dc67810d50210f26464fe6ffa74454b8f2663809db37b01830070d5", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "09662358eb649fe02860d3f98722ee64", - "deployedBytecodeHash": "5dc02051446dcb33dceff75a1635ea27", - "sourceHash": "7a417a79bd6036b0b1b796d00bc176ca", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint fillRate, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint fillRate = publishedRate.mul(price).roundedDiv(1000000);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(fillRate).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, fillRate, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "c28de2392aea85ef2aa1b108fce6568c": { - "latestDeployedAddress": "0xafea54badf7a68f93c2235b5f4cc8f02a2b55edd", - "deployments": { - "0xeae7d30bcd44f27d58985b56add007fcee254abd": { - "generatedAt": "2018-08-24T11:57:19.856Z", - "truffleContractFileUpdatedAt": "2018-08-24T11:56:50.685Z", - "deployTransactionHash": "0x63c1f732ab97198940c599777736d3aca263d1c8bfdc26a2adf44fbfe7e7da09", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "214d9b21e9fc776631897c811d75e7a7", - "deployedBytecodeHash": "c55ed2d4c5fb27f191f7d3e043afe771", - "sourceHash": "666961af517c36b10580b52699ba5ae9", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - }, - "0xafea54badf7a68f93c2235b5f4cc8f02a2b55edd": { - "generatedAt": "2018-09-12T13:20:55.240Z", - "truffleContractFileUpdatedAt": "2018-09-12T12:53:50.567Z", - "deployTransactionHash": "0x635f5a5c3a4f52c2c566af7025e9cba14c9cc2250329dc9cad0935aa386e80c6", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "223ee21caaeb265ed1ea7331ad7c92c7", - "deployedBytecodeHash": "b906f4b8d33bc83dd42cf4e56efa0bf8", - "sourceHash": "2fd035bece27394255c74c60658546e5", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n uint lastIndex = activeBuyOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeBuyOrders[lastIndex];\n activeBuyOrders[order.index] = movedOrderId;\n buyTokenOrders[movedOrderId].index = order.index;\n }\n activeBuyOrders.length--;\n }\n\n function _removeSellOrder(Order storage order) private {\n uint lastIndex = activeSellOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeSellOrders[lastIndex];\n activeSellOrders[order.index] = movedOrderId;\n sellTokenOrders[movedOrderId].index = order.index;\n }\n activeSellOrders.length--;\n }\n}\n" - } - } - }, - "d3e7f8a261b756f9c40da097608b21cd": { - "latestDeployedAddress": "0xc670ffbfa21c37481fb4ef2ea2249b9b78d2b073", - "deployments": { - "0xc670ffbfa21c37481fb4ef2ea2249b9b78d2b073": { - "generatedAt": "2018-11-14T12:52:13.099Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.470Z", - "deployTransactionHash": "0x69fd88f120b060e54cddb1ef2dce3fd3acb2ae3006544a8905933e8bf5ebc85d", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5a731d45c1595b7ffeb40bae693ef88d", - "deployedBytecodeHash": "136e48f6880df5153792c846d87ddede", - "sourceHash": "d6ff57acb1b45199b5dd08357978d8c2", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns active buy orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeBuyOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeBuyOrders[i];\n Order storage order = buyTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n // returns active sell orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveSellOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeSellOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeSellOrders[i];\n Order storage order = sellTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n uint lastIndex = activeBuyOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeBuyOrders[lastIndex];\n activeBuyOrders[order.index] = movedOrderId;\n buyTokenOrders[movedOrderId].index = order.index;\n }\n activeBuyOrders.length--;\n }\n\n function _removeSellOrder(Order storage order) private {\n uint lastIndex = activeSellOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeSellOrders[lastIndex];\n activeSellOrders[order.index] = movedOrderId;\n sellTokenOrders[movedOrderId].index = order.index;\n }\n activeSellOrders.length--;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/FeeAccount_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/FeeAccount_DEPLOYS.json deleted file mode 100644 index 308e28c..0000000 --- a/src/augmintjs/abiniser/deployments/1/FeeAccount_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "FeeAccount", - "latestAbiHash": "67db260db12738df3cced3511d34c65c", - "deployedAbis": { - "67db260db12738df3cced3511d34c65c": { - "latestDeployedAddress": "0xe3ed84a163b9eeaf4f69b4890ae45cc52171aa7e", - "deployments": { - "0xf6b541e1b5e001dcc11827c1a16232759aea730a": { - "generatedAt": "2018-06-11T13:29:06.622Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:34:29.728Z", - "deployTransactionHash": "0xc271c29b7529a9ab6a4473b2da776395dd773ab53a8670ebcfe1cca0c322fe3e", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "1db7295608dc7f030b9c01818f4afe93", - "deployedBytecodeHash": "1a57c03530d204909d1075b452099e77", - "sourceHash": "653a2a034144713dc046880dafd503c9", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(address permissionGranterContract, uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n public SystemAccount(permissionGranterContract) {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () public payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"StabilityBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoTransferFee\"] && !permissions[to][\"NoTransferFee\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - }, - "0xe3ed84a163b9eeaf4f69b4890ae45cc52171aa7e": { - "generatedAt": "2018-11-14T12:52:13.033Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.474Z", - "deployTransactionHash": "0x5ab749f0dda1932da74e9055eba69e4fbda32f1a26176ae89241f809c1b6526c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "7f27e332912911a33f3a5831a478a40e", - "deployedBytecodeHash": "62169a6a5b1bc79360f85c7d6b7cbadf", - "sourceHash": "d8975a5e1941ad79313f4b7bb0be9f95", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(address permissionGranterContract, uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n public SystemAccount(permissionGranterContract) {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"StabilityBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoTransferFee\"] && !permissions[to][\"NoTransferFee\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/InterestEarnedAccount_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/InterestEarnedAccount_DEPLOYS.json deleted file mode 100644 index 0aa0559..0000000 --- a/src/augmintjs/abiniser/deployments/1/InterestEarnedAccount_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "InterestEarnedAccount", - "latestAbiHash": "11b039ce783db308e1a9b5f46f05824f", - "deployedAbis": { - "11b039ce783db308e1a9b5f46f05824f": { - "latestDeployedAddress": "0xf23e0af0e41341127bb4e7b203aebca0185f9ebd", - "deployments": { - "0x5c1a44e07541203474d92bdd03f803ea74f6947c": { - "generatedAt": "2018-06-11T13:54:29.127Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:34:29.729Z", - "deployTransactionHash": "0x679218b7f07ac6214eda1b907cff176708fad8062eb97550d52518b5a0bfc73b", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "1a57f465af930a1cc7070876d2a6bde3", - "deployedBytecodeHash": "62cba71783fcbe9a394e7ef9880058da", - "sourceHash": "3ae3310cda808efba999807e54bf8c9b", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n constructor(address permissionGranterContract) public SystemAccount(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - }, - "0xf23e0af0e41341127bb4e7b203aebca0185f9ebd": { - "generatedAt": "2018-11-14T12:52:13.038Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.475Z", - "deployTransactionHash": "0x93d43a44973d67d2fd0709b277c7580ab74b1888998b6766fa6c75901720d724", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3994e47ec4faf784d97e783d6e3de64d", - "deployedBytecodeHash": "9b8b05d9a455663e6bc0b4aa953ef26e", - "sourceHash": "3ae3310cda808efba999807e54bf8c9b", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n constructor(address permissionGranterContract) public SystemAccount(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/LoanManager_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/LoanManager_DEPLOYS.json deleted file mode 100644 index e84f974..0000000 --- a/src/augmintjs/abiniser/deployments/1/LoanManager_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "LoanManager", - "latestAbiHash": "fdf5fde95aa940c6dbfb8353c572c5fb", - "deployedAbis": { - "ec709c3341045caa3a75374b8cfc7286": { - "latestDeployedAddress": "0xcbefaf199b800deeb9ead61f358ee46e06c54070", - "deployments": { - "0xcbefaf199b800deeb9ead61f358ee46e06c54070": { - "generatedAt": "2018-06-11T14:51:04.245Z", - "truffleContractFileUpdatedAt": "2018-06-11T14:22:34.479Z", - "deployTransactionHash": "0x6b4a94039ca2ebf7b9792bebf5f6267e0014cb98058215bd53e9b82e33e2e10f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "023cda0e36eef3289f062fda7d3b3d1a", - "deployedBytecodeHash": "1b89d6141a07f61e07790d5f4d97df58", - "sourceHash": "184d41cf8c8c034dc64e026f5d33bc3c", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = false;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(i < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee), releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0){\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - } - } - }, - "fdf5fde95aa940c6dbfb8353c572c5fb": { - "latestDeployedAddress": "0x1cabc34618ecf2949f0405a86353e7705e01c38b", - "deployments": { - "0x1cabc34618ecf2949f0405a86353e7705e01c38b": { - "generatedAt": "2018-11-14T12:52:13.068Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.475Z", - "deployTransactionHash": "0xd5e9fa5fbe38bfa5702451792a191b1b711c43fdb0e4846ae9378cfc3faa8f03", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "591f565c201032e0df4b9f7798e7ec85", - "deployedBytecodeHash": "e93edcccad1eb8f9142f6c257bb23bdd", - "sourceHash": "234fd5848af85ca2444c888fd6ba61aa", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted, TokenReceiver {\n using SafeMath for uint256;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = newState;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(loanIds[i] < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee),\n releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0) {\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint) {\n return products.length;\n }\n\n // returns loan products starting from some :\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), products.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LoanProduct storage product = products[i];\n response[i - offset] = [i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLoanCount() external view returns (uint) {\n return loans.length;\n }\n\n /* returns loans starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId,\n state, maturity, disbursementTime, loanAmount, interestAmount] */\n function getLoans(uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), loans.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(i);\n }\n return response;\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns loans of a given account, starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint[] storage loansForAddress = accountLoans[borrower];\n uint limit = SafeMath.min(offset.add(chunkSize), loansForAddress.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(loansForAddress[i]);\n }\n return response;\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/Locker_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/Locker_DEPLOYS.json deleted file mode 100644 index 3cc7333..0000000 --- a/src/augmintjs/abiniser/deployments/1/Locker_DEPLOYS.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "contractName": "Locker", - "latestAbiHash": "f59526398823aef0f0c1454d0b6b4eac", - "deployedAbis": { - "619ff7809b73aead28176fe6317953c3": { - "latestDeployedAddress": "0x26438D7c52cE617dFc75A2F02eE816557f01e5Bb", - "deployments": { - "0x095c0f071fd75875a6b5a1def3f3a993f591080c": { - "generatedAt": "2018-06-11T14:51:04.267Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:34:29.734Z", - "deployTransactionHash": "0x9b36f058c0e32ea415ca2eae11b80dfa95d8fd0ee1a65dd5807b5e78d0f626f2", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "7b257e4c44f08fec5d6d5d2f9b09545b", - "deployedBytecodeHash": "0cfd713f37d912355afd61f1f1f95aaa", - "sourceHash": "786e07d17116d302210e391b40adc6ef", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).div(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - }, - "0x26438D7c52cE617dFc75A2F02eE816557f01e5Bb": { - "generatedAt": "2018-07-08T13:53:52.504Z", - "truffleContractFileUpdatedAt": "2018-07-08T13:01:58.928Z", - "deployTransactionHash": "0xf35fab30788db2f107d1c7c54f28f3b97121d37f19a6a113a7b6c994d4645e56", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "2e46de94e61fb92a9f9c617a78c630a5", - "deployedBytecodeHash": "5cf2a8e6d2fab15963890e142d3d15a3", - "sourceHash": "0bc34f96859842d6cde3876ee878a209", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).ceilDiv(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - } - } - }, - "f59526398823aef0f0c1454d0b6b4eac": { - "latestDeployedAddress": "0x5cc161482e82f20840a4aaeb582becbcc4b539d7", - "deployments": { - "0x5cc161482e82f20840a4aaeb582becbcc4b539d7": { - "generatedAt": "2018-11-14T12:52:13.085Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.480Z", - "deployTransactionHash": "0xffe69e16f5456cdf6b5288b7f423ac4b417b4e127d33ca4540867ee4fa12a736", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0fe102ad0cf754658fdb075cb2850270", - "deployedBytecodeHash": "211e0b56eb9155bf091df2937a90551d", - "sourceHash": "5fb19771489eecebfa02e95214887146", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(_lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n return lockProducts.length;\n }\n\n // returns lock products starting from some \n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset, uint16 chunkSize)\n external view returns (uint[5][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), lockProducts.length);\n uint[5][] memory response = new uint[5][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LockProduct storage lockProduct = lockProducts[i];\n response[i - offset] = [lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns locks starting from some \n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), locks.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [uint(i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n return response;\n }\n\n // returns locks of a given account, starting from some \n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset, uint16 chunkSize)\n external view returns (uint[7][]) {\n uint[] storage locksForAddress = accountLocks[lockOwner];\n uint limit = SafeMath.min(offset.add(chunkSize), locksForAddress.length);\n uint[7][] memory response = new uint[7][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[locksForAddress[i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [locksForAddress[i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).ceilDiv(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n uint lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/Migrations_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/Migrations_DEPLOYS.json deleted file mode 100644 index ec9c802..0000000 --- a/src/augmintjs/abiniser/deployments/1/Migrations_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "Migrations", - "latestAbiHash": "78141a323f4a8416891b06a0a2b90065", - "deployedAbis": { - "78141a323f4a8416891b06a0a2b90065": { - "latestDeployedAddress": "0xf01C976E9189BC9ba68Eda0f1Dc9d94b243C78dC", - "deployments": { - "0xe7e9f87805c0bec5108963d07f85e4ca5892d421": { - "generatedAt": "2018-06-11T12:47:06.545Z", - "truffleContractFileUpdatedAt": "2018-06-11T12:46:22.741Z", - "deployTransactionHash": "0xbe5b9435d048b1943a0812584b60c3bc35d7c3ce85666f761ee2c186ab8cdca0", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "f0557c3c790f279d198ef1d54ea5f550", - "deployedBytecodeHash": "1c74c56a535b7d558a79121649239bdf", - "sourceHash": "16ee1835a27505e14d1b6990cdfa8c2c", - "source": "pragma solidity 0.4.24;\n\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration; // solhint-disable-line var-name-mixedcase\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) external restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address newAddress) external restricted {\n Migrations upgraded = Migrations(newAddress);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n" - }, - "0xf01C976E9189BC9ba68Eda0f1Dc9d94b243C78dC": { - "generatedAt": "2018-11-14T12:52:13.006Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.484Z", - "deployTransactionHash": "0x004664fc07e6877233d9608292037433a6622c0bd946eb70f192f859b5c42de9", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3bd5779c94259890d586374c5db67f2b", - "deployedBytecodeHash": "f00491b62e24c57c6d12323c73c1037e", - "sourceHash": "16ee1835a27505e14d1b6990cdfa8c2c", - "source": "pragma solidity 0.4.24;\n\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration; // solhint-disable-line var-name-mixedcase\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) external restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address newAddress) external restricted {\n Migrations upgraded = Migrations(newAddress);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/MonetarySupervisor_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/MonetarySupervisor_DEPLOYS.json deleted file mode 100644 index ab60914..0000000 --- a/src/augmintjs/abiniser/deployments/1/MonetarySupervisor_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "latestAbiHash": "7f500b43397413e97de925528187f9cd", - "deployedAbis": { - "54d27fedd8bf3010ad5509866a42c053": { - "latestDeployedAddress": "0x1ca4f9d261707af8a856020a4909b777da218868", - "deployments": { - "0x1ca4f9d261707af8a856020a4909b777da218868": { - "generatedAt": "2018-06-11T14:51:04.213Z", - "truffleContractFileUpdatedAt": "2018-06-11T14:22:34.506Z", - "deployTransactionHash": "0x4071bcab60530f6e8ece84d012a914177915216698b12b1aa8468a4fc40bfdbd", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "448d933f9032a207e9d955e79a3c27d0", - "deployedBytecodeHash": "4391d4ad0219048ed4665e3646b7a52f", - "sourceHash": "9bbc8e70067c1c5e61086cd06ed79ac7", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByStabilityBoard; // token issued by Stability Board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n function getLoanToDepositRatio() external view returns (uint loanToDepositRatio) {\n loanToDepositRatio = totalLockedAmount == 0 ? 0 : totalLockedAmount.mul(PERCENT_100).div(totalLoanAmount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n}\n" - } - } - }, - "7f500b43397413e97de925528187f9cd": { - "latestDeployedAddress": "0x27484AFe9e6c332fB07F21Fac82d442EBe1D22c3", - "deployments": { - "0x27484AFe9e6c332fB07F21Fac82d442EBe1D22c3": { - "generatedAt": "2018-11-14T12:52:13.052Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.484Z", - "deployTransactionHash": "0x6d043c09e99a1428e5e985e12120024c9da788c02fb2309a9d01bb67b12257f5", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "fa3e6bca24f24d5945b149c05701b69c", - "deployedBytecodeHash": "422b205eb739ddcf33fadad8edf32d7e", - "sourceHash": "62748c793556775f9ac607b991886bfb", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByStabilityBoard; // token issued by Stability Board\n uint public burnedByStabilityBoard; // token burned by Stability Board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n AugmintReserves _augmintReserves, InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoard\") {\n burnedByStabilityBoard = burnedByStabilityBoard.add(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/PreTokenProxy_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/PreTokenProxy_DEPLOYS.json deleted file mode 100644 index 6712a25..0000000 --- a/src/augmintjs/abiniser/deployments/1/PreTokenProxy_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "PreTokenProxy", - "latestAbiHash": "dd40c0d39ea8bad8a388522667a84687", - "deployedAbis": { - "19ab69b650e28b2dd211d3851893f91f": { - "latestDeployedAddress": "0x1411b3b189b01f6e6d1ea883bffcbd3a5224934c", - "deployments": { - "0x1411b3b189b01f6e6d1ea883bffcbd3a5224934c": { - "generatedAt": "2018-06-11T12:15:16.657Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:53:07.255Z", - "deployTransactionHash": "0xf8c213b070e20be38477c99b9ea14a9ac688fa6a52553a67691c41d000d47d34", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "9fd82afe11a8ff7af3e815e243d31647", - "deployedBytecodeHash": "1846d508980d6136e1e81708c995e572", - "sourceHash": "2d172fe41d2b97c827d6dca816138047", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract PreTokenProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - }, - "dd40c0d39ea8bad8a388522667a84687": { - "latestDeployedAddress": "0x8a69cf9d1d85bc150f69feb80cc34c552f5fbea9", - "deployments": { - "0x8a69cf9d1d85bc150f69feb80cc34c552f5fbea9": { - "generatedAt": "2018-11-14T12:52:13.107Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.490Z", - "deployTransactionHash": "0xf6a3f95b073e7bc0503691f0d3b68ab0837e9939d4c8f8a9febf284a9254a5e6", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5007bce3d0997985a9357d5b1a97103b", - "deployedBytecodeHash": "b5a32ad0b8570f3cd6b7efaef3655911", - "sourceHash": "2d172fe41d2b97c827d6dca816138047", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract PreTokenProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/PreToken_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/PreToken_DEPLOYS.json deleted file mode 100644 index cf93a3d..0000000 --- a/src/augmintjs/abiniser/deployments/1/PreToken_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "PreToken", - "latestAbiHash": "7f69e33e7b345c780ac9e43f391437d9", - "deployedAbis": { - "10eebbb51a771cfd3473475169a569f1": { - "latestDeployedAddress": "0xecb782b19be6e657ae2d88831dd98145a00d32d5", - "deployments": { - "0xecb782b19be6e657ae2d88831dd98145a00d32d5": { - "generatedAt": "2018-06-11T12:15:16.664Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:54:24.515Z", - "deployTransactionHash": "0x40726640442ac3c0845871b6f7b0e144f22e56b24370bf8b591d29e34136c562", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "1a1d2eee97db1fda81f02d5a4693cccc", - "deployedBytecodeHash": "39ecab521022215d08af346c490a4773", - "sourceHash": "652361fe32b441561edaf8ebd7f70277", - "source": "/* Augmint pretoken contract to record agreements and tokens allocated based on the agreement.\n\n Important: this is NOT an ERC20 token!\n\n PreTokens are non-fungible: agreements can have different conditions (valuationCap and discount)\n and pretokens are not tradable.\n\n Ownership can be transferred if owner wants to change wallet but the whole agreement and\n the total pretoken amount is moved to a new account\n\n PreTokenSigner can (via MultiSig):\n - add agreements and issue pretokens to an agreement\n - change owner of any agreement to handle if an owner lost a private keys\n - burn pretokens from any agreement to fix potential erroneous issuance\n These are known compromises on trustlessness hence all these tokens distributed based on signed agreements and\n preTokens are issued only to a closed group of contributors / team members.\n If despite these something goes wrong then as a last resort a new pretoken contract can be recreated from agreements.\n\n Some ERC20 functions are implemented so agreement owners can see their balances and use transfer in standard wallets.\n Restrictions:\n - only total balance can be transfered - effectively ERC20 transfer used to transfer agreement ownership\n - only agreement holders can transfer\n (i.e. can't transfer 0 amount if have no agreement to avoid polluting logs with Transfer events)\n - transfer is only allowed to accounts without an agreement yet\n - no approval and transferFrom ERC20 functions\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract PreToken is Restricted {\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n string constant public name = \"Augmint pretokens\"; // solhint-disable-line const-name-snakecase\n string constant public symbol = \"APRE\"; // solhint-disable-line const-name-snakecase\n uint8 constant public decimals = 0; // solhint-disable-line const-name-snakecase\n\n uint public totalSupply;\n\n struct Agreement {\n address owner;\n uint balance;\n uint32 discount; // discountRate in parts per million , ie. 10,000 = 1%\n uint32 valuationCap; // in USD (no decimals)\n }\n\n /* Agreement hash is the SHA-2 (SHA-256) hash of signed agreement document.\n To generate:\n OSX: shasum -a 256 agreement.pdf\n Windows: certUtil -hashfile agreement.pdf SHA256 */\n mapping(address => bytes32) public agreementOwners; // to lookup agrement by owner\n mapping(bytes32 => Agreement) public agreements;\n\n bytes32[] public allAgreements; // all agreements to able to iterate over\n\n event Transfer(address indexed from, address indexed to, uint amount);\n\n event NewAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function addAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap)\n external restrict(\"PreTokenSigner\") {\n require(owner != address(0), \"owner must not be 0x0\");\n require(agreementOwners[owner] == 0x0, \"owner must not have an aggrement yet\");\n require(agreementHash != 0x0, \"agreementHash must not be 0x0\");\n require(discount > 0, \"discount must be > 0\");\n require(agreements[agreementHash].discount == 0, \"agreement must not exist yet\");\n\n agreements[agreementHash] = Agreement(owner, 0, discount, valuationCap);\n agreementOwners[owner] = agreementHash;\n allAgreements.push(agreementHash);\n\n emit NewAgreement(owner, agreementHash, discount, valuationCap);\n }\n\n function issueTo(bytes32 agreementHash, uint amount) external restrict(\"PreTokenSigner\") {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\");\n\n agreement.balance = agreement.balance.add(amount);\n totalSupply = totalSupply.add(amount);\n\n emit Transfer(0x0, agreement.owner, amount);\n }\n\n /* Restricted function to allow pretoken signers to fix incorrect issuance */\n function burnFrom(bytes32 agreementHash, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\"); // this is redundant b/c of next requires but be explicit\n require(amount > 0, \"burn amount must be > 0\");\n require(agreement.balance >= amount, \"must not burn more than balance\"); // .sub would revert anyways but emit reason\n\n agreement.balance = agreement.balance.sub(amount);\n totalSupply = totalSupply.sub(amount);\n\n emit Transfer(agreement.owner, 0x0, amount);\n return true;\n }\n\n function balanceOf(address owner) public view returns (uint) {\n return agreements[agreementOwners[owner]].balance;\n }\n\n /* function to transfer agreement ownership to other wallet by owner\n it's in ERC20 form so owners can use standard ERC20 wallet just need to pass full balance as value */\n function transfer(address to, uint amount) public returns (bool) { // solhint-disable-line no-simple-event-func-name\n require(amount == agreements[agreementOwners[msg.sender]].balance, \"must transfer full balance\");\n _transfer(msg.sender, to);\n return true;\n }\n\n /* Restricted function to allow pretoken signers to fix if pretoken owner lost keys */\n function transferAgreement(bytes32 agreementHash, address to)\n public restrict(\"PreTokenSigner\") returns (bool) {\n _transfer(agreements[agreementHash].owner, to);\n return true;\n }\n\n /* private function used by transferAgreement & transfer */\n function _transfer(address from, address to) private {\n Agreement storage agreement = agreements[agreementOwners[from]];\n require(agreementOwners[from] != 0x0, \"from agreement must exists\");\n require(agreementOwners[to] == 0, \"to must not have an agreement\");\n require(to != 0x0, \"must not transfer to 0x0\");\n\n agreement.owner = to;\n\n agreementOwners[to] = agreementOwners[from];\n agreementOwners[from] = 0x0;\n\n emit Transfer(from, to, agreement.balance);\n }\n\n function getAgreementsCount() external view returns (uint agreementsCount) {\n return allAgreements.length;\n }\n\n // UI helper fx - Returns all agreements from offset as\n // [index in allAgreements, account address as uint, balance, agreementHash as uint,\n // discount as uint, valuationCap as uint ]\n function getAllAgreements(uint offset) external view returns(uint[6][CHUNK_SIZE] agreementsResult) {\n\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < allAgreements.length; i++) {\n bytes32 agreementHash = allAgreements[i + offset];\n Agreement storage agreement = agreements[agreementHash];\n\n agreementsResult[i] = [ i + offset, uint(agreement.owner), agreement.balance,\n uint(agreementHash), uint(agreement.discount), uint(agreement.valuationCap)];\n }\n }\n}\n" - } - } - }, - "7f69e33e7b345c780ac9e43f391437d9": { - "latestDeployedAddress": "0x97ea02179801fa94227db5fc1d13ac4277d40920", - "deployments": { - "0x97ea02179801fa94227db5fc1d13ac4277d40920": { - "generatedAt": "2018-11-14T12:52:13.115Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.487Z", - "deployTransactionHash": "0x4b26c0cee55d8431019bd8c0b47fa8221455e3711f648dcd52bde7c797dfa31c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "8d7e449258facd1c6fab22b402de6aee", - "deployedBytecodeHash": "bf64976158eb4f8696efd994652e7f49", - "sourceHash": "6cace117c42478e4f5c8cf116bec9a62", - "source": "/* Augmint pretoken contract to record agreements and tokens allocated based on the agreement.\n\n Important: this is NOT an ERC20 token!\n\n PreTokens are non-fungible: agreements can have different conditions (valuationCap and discount)\n and pretokens are not tradable.\n\n Ownership can be transferred if owner wants to change wallet but the whole agreement and\n the total pretoken amount is moved to a new account\n\n PreTokenSigner can (via MultiSig):\n - add agreements and issue pretokens to an agreement\n - change owner of any agreement to handle if an owner lost a private keys\n - burn pretokens from any agreement to fix potential erroneous issuance\n These are known compromises on trustlessness hence all these tokens distributed based on signed agreements and\n preTokens are issued only to a closed group of contributors / team members.\n If despite these something goes wrong then as a last resort a new pretoken contract can be recreated from agreements.\n\n Some ERC20 functions are implemented so agreement owners can see their balances and use transfer in standard wallets.\n Restrictions:\n - only total balance can be transfered - effectively ERC20 transfer used to transfer agreement ownership\n - only agreement holders can transfer\n (i.e. can't transfer 0 amount if have no agreement to avoid polluting logs with Transfer events)\n - transfer is only allowed to accounts without an agreement yet\n - no approval and transferFrom ERC20 functions\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract PreToken is Restricted {\n using SafeMath for uint256;\n\n string constant public name = \"Augmint pretokens\"; // solhint-disable-line const-name-snakecase\n string constant public symbol = \"APRE\"; // solhint-disable-line const-name-snakecase\n uint8 constant public decimals = 0; // solhint-disable-line const-name-snakecase\n\n uint public totalSupply;\n\n struct Agreement {\n address owner;\n uint balance;\n uint32 discount; // discountRate in parts per million , ie. 10,000 = 1%\n uint32 valuationCap; // in USD (no decimals)\n }\n\n /* Agreement hash is the SHA-2 (SHA-256) hash of signed agreement document.\n To generate:\n OSX: shasum -a 256 agreement.pdf\n Windows: certUtil -hashfile agreement.pdf SHA256 */\n mapping(address => bytes32) public agreementOwners; // to lookup agrement by owner\n mapping(bytes32 => Agreement) public agreements;\n\n bytes32[] public allAgreements; // all agreements to able to iterate over\n\n event Transfer(address indexed from, address indexed to, uint amount);\n\n event NewAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function addAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap)\n external restrict(\"PreTokenSigner\") {\n require(owner != address(0), \"owner must not be 0x0\");\n require(agreementOwners[owner] == 0x0, \"owner must not have an aggrement yet\");\n require(agreementHash != 0x0, \"agreementHash must not be 0x0\");\n require(discount > 0, \"discount must be > 0\");\n require(agreements[agreementHash].discount == 0, \"agreement must not exist yet\");\n\n agreements[agreementHash] = Agreement(owner, 0, discount, valuationCap);\n agreementOwners[owner] = agreementHash;\n allAgreements.push(agreementHash);\n\n emit NewAgreement(owner, agreementHash, discount, valuationCap);\n }\n\n function issueTo(bytes32 agreementHash, uint amount) external restrict(\"PreTokenSigner\") {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\");\n\n agreement.balance = agreement.balance.add(amount);\n totalSupply = totalSupply.add(amount);\n\n emit Transfer(0x0, agreement.owner, amount);\n }\n\n /* Restricted function to allow pretoken signers to fix incorrect issuance */\n function burnFrom(bytes32 agreementHash, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n Agreement storage agreement = agreements[agreementHash];\n // this is redundant b/c of next requires but be explicit\n require(agreement.discount > 0, \"agreement must exist\");\n require(amount > 0, \"burn amount must be > 0\");\n // .sub would revert anyways but emit reason\n require(agreement.balance >= amount, \"must not burn more than balance\");\n\n agreement.balance = agreement.balance.sub(amount);\n totalSupply = totalSupply.sub(amount);\n\n emit Transfer(agreement.owner, 0x0, amount);\n return true;\n }\n\n function balanceOf(address owner) public view returns (uint) {\n return agreements[agreementOwners[owner]].balance;\n }\n\n /* function to transfer agreement ownership to other wallet by owner\n it's in ERC20 form so owners can use standard ERC20 wallet just need to pass full balance as value */\n function transfer(address to, uint amount) public returns (bool) { // solhint-disable-line no-simple-event-func-name\n require(amount == agreements[agreementOwners[msg.sender]].balance, \"must transfer full balance\");\n _transfer(msg.sender, to);\n return true;\n }\n\n /* Restricted function to allow pretoken signers to fix if pretoken owner lost keys */\n function transferAgreement(bytes32 agreementHash, address to)\n public restrict(\"PreTokenSigner\") returns (bool) {\n _transfer(agreements[agreementHash].owner, to);\n return true;\n }\n\n /* private function used by transferAgreement & transfer */\n function _transfer(address from, address to) private {\n Agreement storage agreement = agreements[agreementOwners[from]];\n require(agreementOwners[from] != 0x0, \"from agreement must exists\");\n require(agreementOwners[to] == 0, \"to must not have an agreement\");\n require(to != 0x0, \"must not transfer to 0x0\");\n\n agreement.owner = to;\n\n agreementOwners[to] = agreementOwners[from];\n agreementOwners[from] = 0x0;\n\n emit Transfer(from, to, agreement.balance);\n }\n\n function getAgreementsCount() external view returns (uint agreementsCount) {\n return allAgreements.length;\n }\n\n // UI helper fx - Returns agreements from as\n // [index in allAgreements, account address as uint, balance, agreementHash as uint,\n // discount as uint, valuationCap as uint ]\n function getAgreements(uint offset, uint16 chunkSize)\n external view returns(uint[6][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), allAgreements.length);\n uint[6][] memory response = new uint[6][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n bytes32 agreementHash = allAgreements[i];\n Agreement storage agreement = agreements[agreementHash];\n\n response[i - offset] = [i, uint(agreement.owner), agreement.balance,\n uint(agreementHash), uint(agreement.discount), uint(agreement.valuationCap)];\n }\n return response;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/Rates_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/Rates_DEPLOYS.json deleted file mode 100644 index f3a3210..0000000 --- a/src/augmintjs/abiniser/deployments/1/Rates_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "Rates", - "latestAbiHash": "73a17ebb0acc71773371c6a8e1c8e6ce", - "deployedAbis": { - "73a17ebb0acc71773371c6a8e1c8e6ce": { - "latestDeployedAddress": "0x4272dB2EB82068E898588C3D6e4B5D55c3848793", - "deployments": { - "0x4babbe57453e2b6af125b4e304256fcbdf744480": { - "generatedAt": "2018-06-11T12:15:16.443Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:56:49.360Z", - "deployTransactionHash": "0x76efaa8491bd5622a2e328f812cb99c5c72236b663ac594edd94893b45596492", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "b2bf3f97147e9144c7103442be20e58a", - "deployedBytecodeHash": "6a3a4ec8c050710692adaa9f97d09bb6", - "sourceHash": "d71ec203e7ee6ed376feeb17e5df7966", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 4 decimals. i.e. ETH/EUR = 989.12 then rate = 989,1200\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"RatesFeeder\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"RatesFeeder\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - }, - "0x4272dB2EB82068E898588C3D6e4B5D55c3848793": { - "generatedAt": "2018-11-14T12:52:13.016Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.490Z", - "deployTransactionHash": "0x3a0ca0223275fc414b93f60548060dc1e4329deaaa14b46460a9ca28bfc322ea", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "be17116585b9b88d60fbe06a5499b6dc", - "deployedBytecodeHash": "0f403183577dac202159e32b1c8c9f44", - "sourceHash": "c65f6945fead6118910fccc8bca7494c", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 2 decimals. i.e. EUR/ETH = 989.12 then rate = 98912\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"RatesFeeder\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"RatesFeeder\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/StabilityBoardProxy_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/StabilityBoardProxy_DEPLOYS.json deleted file mode 100644 index 57b7eec..0000000 --- a/src/augmintjs/abiniser/deployments/1/StabilityBoardProxy_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "StabilityBoardProxy", - "latestAbiHash": "dd40c0d39ea8bad8a388522667a84687", - "deployedAbis": { - "19ab69b650e28b2dd211d3851893f91f": { - "latestDeployedAddress": "0x4686f017d456331ed2c1de66e134d8d05b24413d", - "deployments": { - "0x4686f017d456331ed2c1de66e134d8d05b24413d": { - "generatedAt": "2018-06-11T12:15:16.651Z", - "truffleContractFileUpdatedAt": "2018-06-11T11:45:49.733Z", - "deployTransactionHash": "0x1cc94aea1960571f64357e9f389007dbe3d1950deb692e3efaf6c66654f6283c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "56131f88a46fe46a487da0a9bae573fc", - "deployedBytecodeHash": "2996d609801f2039ae49c17ac8bcad92", - "sourceHash": "4d60c55b8e4009873db939b37558d9dc", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - }, - "dd40c0d39ea8bad8a388522667a84687": { - "latestDeployedAddress": "0xde36a8773531406dcbeffdfd3c7b89fced7a9f84", - "deployments": { - "0xde36a8773531406dcbeffdfd3c7b89fced7a9f84": { - "generatedAt": "2018-11-14T12:52:13.104Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.516Z", - "deployTransactionHash": "0xcb0e9651d51ba99070837dcf083acfcc3f13df8c146b4a01c8bf6f4d2a924d41", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "4f899546765577ad2e325da53c3e7179", - "deployedBytecodeHash": "a5f3dd7878e556db538c1206827e5959", - "sourceHash": "4d60c55b8e4009873db939b37558d9dc", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/1/TokenAEur_DEPLOYS.json b/src/augmintjs/abiniser/deployments/1/TokenAEur_DEPLOYS.json deleted file mode 100644 index 47a9558..0000000 --- a/src/augmintjs/abiniser/deployments/1/TokenAEur_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "TokenAEur", - "latestAbiHash": "2ea91d34a7bfefc8f38ef0e8a5ae24a5", - "deployedAbis": { - "9aa81519ec45a52d3f8f1a1a83d25c74": { - "latestDeployedAddress": "0x86a635eccefffa70ff8a6db29da9c8db288e40d0", - "deployments": { - "0x86a635eccefffa70ff8a6db29da9c8db288e40d0": { - "generatedAt": "2018-06-11T14:12:25.122Z", - "truffleContractFileUpdatedAt": "2018-06-11T14:02:33.932Z", - "deployTransactionHash": "0xfb18595275efce18c9f78ad93be17dd59372c2d81450d2e9a227a643d1b34427", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3abfdb182b58136a9dcb25c1ece5ed54", - "deployedBytecodeHash": "c3636b199ceefdd5deb396f099915a87", - "sourceHash": "20cc69065a6935fc7519147f3fc5fa2c", - "source": "/* Augmint Crypto Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "2ea91d34a7bfefc8f38ef0e8a5ae24a5": { - "latestDeployedAddress": "0xc994a2deb02543db1f48688438b9903c4b305ce3", - "deployments": { - "0xc994a2deb02543db1f48688438b9903c4b305ce3": { - "generatedAt": "2018-11-14T12:52:13.041Z", - "truffleContractFileUpdatedAt": "2018-11-13T16:34:24.517Z", - "deployTransactionHash": "0x55a49768013ad9201ab71c8cf91cea967f2165d2a3f2e025a0beb7631c4b8f30", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0398a39cdab3b394103910ea6b28eef7", - "deployedBytecodeHash": "2916088286d725e884630bc95fc19dbf", - "sourceHash": "04025a37ea64acbc6f0ea2ec8a6f3e4d", - "source": "/* Augmint Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/AugmintReserves_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/AugmintReserves_DEPLOYS.json deleted file mode 100644 index 73e5fc4..0000000 --- a/src/augmintjs/abiniser/deployments/4/AugmintReserves_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "AugmintReserves", - "latestAbiHash": "024b81d1a1f75241167a8a0f6e62326f", - "deployedAbis": { - "024b81d1a1f75241167a8a0f6e62326f": { - "latestDeployedAddress": "0x33bec125657470e53887400666bdeed360b2168a", - "deployments": { - "0xc036a1dd59ac55e2fb6b3d7416cb4ecc44605834": { - "generatedAt": "2018-10-18T13:35:02.347Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.845Z", - "deployTransactionHash": "0xf3b9798a6a93bbd5a1ff68f032e92c02d5d71556e5f5b573aa25b3a35f64b923", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5bf4ede2aaad5b0b112f7b1ebf420fd2", - "deployedBytecodeHash": "3720667df6506876043fba53c540acb6", - "sourceHash": "b9d84f5f6153164ba581845190291c88", - "source": "/* Contract to hold Augmint reserves (ETH & Token)\n - ETH as regular ETH balance of the contract\n - ERC20 token reserve (stored as regular Token balance under the contract address)\n\nNB: reserves are held under the contract address, therefore any transaction on the reserve is limited to the\n tx-s defined here (i.e. transfer is not allowed even by the contract owner or StabilityBoard or MonetarySupervisor)\n\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract AugmintReserves is Restricted {\n\n event ReserveMigration(address to, uint weiAmount);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into reserve (from defaulted loan's collateral )\n }\n\n function burn(AugmintTokenInterface augmintToken, uint amount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.burn(amount);\n }\n\n function migrate(address to, uint weiAmount)\n external restrict(\"StabilityBoard\") {\n if (weiAmount > 0) {\n to.transfer(weiAmount);\n }\n emit ReserveMigration(to, weiAmount);\n }\n}\n" - }, - "0x33bec125657470e53887400666bdeed360b2168a": { - "generatedAt": "2018-10-29T15:52:43.253Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.709Z", - "deployTransactionHash": "0xf76d1b2e93fd4fa074e60e0c60e7ee6ef0257d7aac0a0361b73c0b7f863a796b", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5bf4ede2aaad5b0b112f7b1ebf420fd2", - "deployedBytecodeHash": "3720667df6506876043fba53c540acb6", - "sourceHash": "b9d84f5f6153164ba581845190291c88", - "source": "/* Contract to hold Augmint reserves (ETH & Token)\n - ETH as regular ETH balance of the contract\n - ERC20 token reserve (stored as regular Token balance under the contract address)\n\nNB: reserves are held under the contract address, therefore any transaction on the reserve is limited to the\n tx-s defined here (i.e. transfer is not allowed even by the contract owner or StabilityBoard or MonetarySupervisor)\n\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract AugmintReserves is Restricted {\n\n event ReserveMigration(address to, uint weiAmount);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into reserve (from defaulted loan's collateral )\n }\n\n function burn(AugmintTokenInterface augmintToken, uint amount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.burn(amount);\n }\n\n function migrate(address to, uint weiAmount)\n external restrict(\"StabilityBoard\") {\n if (weiAmount > 0) {\n to.transfer(weiAmount);\n }\n emit ReserveMigration(to, weiAmount);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/Exchange_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/Exchange_DEPLOYS.json deleted file mode 100644 index a54aa91..0000000 --- a/src/augmintjs/abiniser/deployments/4/Exchange_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "Exchange", - "latestAbiHash": "d3e7f8a261b756f9c40da097608b21cd", - "deployedAbis": { - "d3e7f8a261b756f9c40da097608b21cd": { - "latestDeployedAddress": "0xe5d6d0c107eae79d2d30798f252ac6ff5ecad459", - "deployments": { - "0xdf47d51028daff13424f42523fdac73079ab901b": { - "generatedAt": "2018-10-18T13:35:02.438Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.980Z", - "deployTransactionHash": "0x35b0caa7f3479a08e88a8554eb6ffea246c5364e89969941a21a095cede76c65", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5a731d45c1595b7ffeb40bae693ef88d", - "deployedBytecodeHash": "136e48f6880df5153792c846d87ddede", - "sourceHash": "d6ff57acb1b45199b5dd08357978d8c2", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns active buy orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeBuyOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeBuyOrders[i];\n Order storage order = buyTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n // returns active sell orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveSellOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeSellOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeSellOrders[i];\n Order storage order = sellTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n uint lastIndex = activeBuyOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeBuyOrders[lastIndex];\n activeBuyOrders[order.index] = movedOrderId;\n buyTokenOrders[movedOrderId].index = order.index;\n }\n activeBuyOrders.length--;\n }\n\n function _removeSellOrder(Order storage order) private {\n uint lastIndex = activeSellOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeSellOrders[lastIndex];\n activeSellOrders[order.index] = movedOrderId;\n sellTokenOrders[movedOrderId].index = order.index;\n }\n activeSellOrders.length--;\n }\n}\n" - }, - "0xe5d6d0c107eae79d2d30798f252ac6ff5ecad459": { - "generatedAt": "2018-10-29T15:52:43.331Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.813Z", - "deployTransactionHash": "0x1823548271afb6df6cb6012027d2c32f3c7d649056be0e12a5698e35c2ed1fe1", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5a731d45c1595b7ffeb40bae693ef88d", - "deployedBytecodeHash": "136e48f6880df5153792c846d87ddede", - "sourceHash": "d6ff57acb1b45199b5dd08357978d8c2", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns active buy orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeBuyOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeBuyOrders[i];\n Order storage order = buyTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n // returns active sell orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveSellOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeSellOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeSellOrders[i];\n Order storage order = sellTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n uint lastIndex = activeBuyOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeBuyOrders[lastIndex];\n activeBuyOrders[order.index] = movedOrderId;\n buyTokenOrders[movedOrderId].index = order.index;\n }\n activeBuyOrders.length--;\n }\n\n function _removeSellOrder(Order storage order) private {\n uint lastIndex = activeSellOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeSellOrders[lastIndex];\n activeSellOrders[order.index] = movedOrderId;\n sellTokenOrders[movedOrderId].index = order.index;\n }\n activeSellOrders.length--;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/FeeAccount_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/FeeAccount_DEPLOYS.json deleted file mode 100644 index 9c2b294..0000000 --- a/src/augmintjs/abiniser/deployments/4/FeeAccount_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "FeeAccount", - "latestAbiHash": "67db260db12738df3cced3511d34c65c", - "deployedAbis": { - "67db260db12738df3cced3511d34c65c": { - "latestDeployedAddress": "0xaa16ede9093bb4140e2715ed9a1e41cdfd9d9c29", - "deployments": { - "0xb77f9cdda72eec47a57793be088c7b523f6b5014": { - "generatedAt": "2018-10-18T13:35:02.354Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.893Z", - "deployTransactionHash": "0x9fe716e506b3f5f797496ae5d4035724a698dc8b2aa606d9106d532990958c75", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "7f27e332912911a33f3a5831a478a40e", - "deployedBytecodeHash": "62169a6a5b1bc79360f85c7d6b7cbadf", - "sourceHash": "d8975a5e1941ad79313f4b7bb0be9f95", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(address permissionGranterContract, uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n public SystemAccount(permissionGranterContract) {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"StabilityBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoTransferFee\"] && !permissions[to][\"NoTransferFee\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - }, - "0xaa16ede9093bb4140e2715ed9a1e41cdfd9d9c29": { - "generatedAt": "2018-10-29T15:52:43.259Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.747Z", - "deployTransactionHash": "0x798c51bacfabcba263aceb1ea92f2cd6992b799e1654b11d3ac7e36a45aeb9bb", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "7f27e332912911a33f3a5831a478a40e", - "deployedBytecodeHash": "62169a6a5b1bc79360f85c7d6b7cbadf", - "sourceHash": "d8975a5e1941ad79313f4b7bb0be9f95", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(address permissionGranterContract, uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n public SystemAccount(permissionGranterContract) {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"StabilityBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoTransferFee\"] && !permissions[to][\"NoTransferFee\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/InterestEarnedAccount_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/InterestEarnedAccount_DEPLOYS.json deleted file mode 100644 index be5c1f7..0000000 --- a/src/augmintjs/abiniser/deployments/4/InterestEarnedAccount_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "InterestEarnedAccount", - "latestAbiHash": "11b039ce783db308e1a9b5f46f05824f", - "deployedAbis": { - "11b039ce783db308e1a9b5f46f05824f": { - "latestDeployedAddress": "0xdd96979697b76787b5062084eea60bf929ddd844", - "deployments": { - "0x489cbf1674b575e6dfcff0a4f2bbc74f7e9dde28": { - "generatedAt": "2018-10-18T13:35:02.360Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.821Z", - "deployTransactionHash": "0xaa5e1a7211cbc4d830e535773c1eb20d0866288ac86313016891c059200d8f9e", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3994e47ec4faf784d97e783d6e3de64d", - "deployedBytecodeHash": "9b8b05d9a455663e6bc0b4aa953ef26e", - "sourceHash": "3ae3310cda808efba999807e54bf8c9b", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n constructor(address permissionGranterContract) public SystemAccount(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - }, - "0xdd96979697b76787b5062084eea60bf929ddd844": { - "generatedAt": "2018-10-29T15:52:43.264Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.698Z", - "deployTransactionHash": "0x81314fc9a671dbec1fe3632110fbaeaf89124f186d431443fa67c0ebdb9bdd4a", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3994e47ec4faf784d97e783d6e3de64d", - "deployedBytecodeHash": "9b8b05d9a455663e6bc0b4aa953ef26e", - "sourceHash": "3ae3310cda808efba999807e54bf8c9b", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n constructor(address permissionGranterContract) public SystemAccount(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/LoanManager_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/LoanManager_DEPLOYS.json deleted file mode 100644 index f391087..0000000 --- a/src/augmintjs/abiniser/deployments/4/LoanManager_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "LoanManager", - "latestAbiHash": "fdf5fde95aa940c6dbfb8353c572c5fb", - "deployedAbis": { - "fdf5fde95aa940c6dbfb8353c572c5fb": { - "latestDeployedAddress": "0x3792c5a5077dacfe331b81837ef73bc0ea721d90", - "deployments": { - "0x6cb7731c78e677f85942b5f1d646b3485e5820c1": { - "generatedAt": "2018-10-18T13:35:02.404Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:37.002Z", - "deployTransactionHash": "0xc965162409524ff0b21cebe1a763229400994d88856dfdd766398a47f0d6493f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "591f565c201032e0df4b9f7798e7ec85", - "deployedBytecodeHash": "e93edcccad1eb8f9142f6c257bb23bdd", - "sourceHash": "234fd5848af85ca2444c888fd6ba61aa", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted, TokenReceiver {\n using SafeMath for uint256;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = newState;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(loanIds[i] < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee),\n releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0) {\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint) {\n return products.length;\n }\n\n // returns loan products starting from some :\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), products.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LoanProduct storage product = products[i];\n response[i - offset] = [i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLoanCount() external view returns (uint) {\n return loans.length;\n }\n\n /* returns loans starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId,\n state, maturity, disbursementTime, loanAmount, interestAmount] */\n function getLoans(uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), loans.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(i);\n }\n return response;\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns loans of a given account, starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint[] storage loansForAddress = accountLoans[borrower];\n uint limit = SafeMath.min(offset.add(chunkSize), loansForAddress.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(loansForAddress[i]);\n }\n return response;\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n}\n" - }, - "0x3792c5a5077dacfe331b81837ef73bc0ea721d90": { - "generatedAt": "2018-10-29T15:52:43.304Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.833Z", - "deployTransactionHash": "0x5539b5879aacf2739d48f457fcd22a70d74d12af2512a7770ab3d9558cc587d7", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "591f565c201032e0df4b9f7798e7ec85", - "deployedBytecodeHash": "e93edcccad1eb8f9142f6c257bb23bdd", - "sourceHash": "234fd5848af85ca2444c888fd6ba61aa", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted, TokenReceiver {\n using SafeMath for uint256;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = newState;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(loanIds[i] < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee),\n releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0) {\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint) {\n return products.length;\n }\n\n // returns loan products starting from some :\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), products.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LoanProduct storage product = products[i];\n response[i - offset] = [i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLoanCount() external view returns (uint) {\n return loans.length;\n }\n\n /* returns loans starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId,\n state, maturity, disbursementTime, loanAmount, interestAmount] */\n function getLoans(uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), loans.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(i);\n }\n return response;\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns loans of a given account, starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint[] storage loansForAddress = accountLoans[borrower];\n uint limit = SafeMath.min(offset.add(chunkSize), loansForAddress.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(loansForAddress[i]);\n }\n return response;\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/Locker_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/Locker_DEPLOYS.json deleted file mode 100644 index 8ecd474..0000000 --- a/src/augmintjs/abiniser/deployments/4/Locker_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "Locker", - "latestAbiHash": "f59526398823aef0f0c1454d0b6b4eac", - "deployedAbis": { - "f59526398823aef0f0c1454d0b6b4eac": { - "latestDeployedAddress": "0xc0b97fe5cad0d43d0c974c4e9a00312dc661f8ab", - "deployments": { - "0x6d84ab6c385b827e58c358d078ac7b1c61b68821": { - "generatedAt": "2018-10-18T13:35:02.423Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.960Z", - "deployTransactionHash": "0x2d7780b0e0947b2b96a2d3d14bdcec5d6045d619cdd8a94dccfc43e0b36c287a", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0fe102ad0cf754658fdb075cb2850270", - "deployedBytecodeHash": "211e0b56eb9155bf091df2937a90551d", - "sourceHash": "5fb19771489eecebfa02e95214887146", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(_lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n return lockProducts.length;\n }\n\n // returns lock products starting from some \n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset, uint16 chunkSize)\n external view returns (uint[5][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), lockProducts.length);\n uint[5][] memory response = new uint[5][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LockProduct storage lockProduct = lockProducts[i];\n response[i - offset] = [lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns locks starting from some \n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), locks.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [uint(i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n return response;\n }\n\n // returns locks of a given account, starting from some \n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset, uint16 chunkSize)\n external view returns (uint[7][]) {\n uint[] storage locksForAddress = accountLocks[lockOwner];\n uint limit = SafeMath.min(offset.add(chunkSize), locksForAddress.length);\n uint[7][] memory response = new uint[7][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[locksForAddress[i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [locksForAddress[i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).ceilDiv(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n uint lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n}\n" - }, - "0xc0b97fe5cad0d43d0c974c4e9a00312dc661f8ab": { - "generatedAt": "2018-10-29T15:52:43.317Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.796Z", - "deployTransactionHash": "0x597c1255ba3af1bc1b00801b54251e4dc7beebae567b927711edb78b23d41578", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0fe102ad0cf754658fdb075cb2850270", - "deployedBytecodeHash": "211e0b56eb9155bf091df2937a90551d", - "sourceHash": "5fb19771489eecebfa02e95214887146", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(_lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n return lockProducts.length;\n }\n\n // returns lock products starting from some \n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset, uint16 chunkSize)\n external view returns (uint[5][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), lockProducts.length);\n uint[5][] memory response = new uint[5][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LockProduct storage lockProduct = lockProducts[i];\n response[i - offset] = [lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns locks starting from some \n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), locks.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [uint(i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n return response;\n }\n\n // returns locks of a given account, starting from some \n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset, uint16 chunkSize)\n external view returns (uint[7][]) {\n uint[] storage locksForAddress = accountLocks[lockOwner];\n uint limit = SafeMath.min(offset.add(chunkSize), locksForAddress.length);\n uint[7][] memory response = new uint[7][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[locksForAddress[i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [locksForAddress[i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).ceilDiv(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n uint lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/Migrations_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/Migrations_DEPLOYS.json deleted file mode 100644 index ef29887..0000000 --- a/src/augmintjs/abiniser/deployments/4/Migrations_DEPLOYS.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "contractName": "Migrations", - "latestAbiHash": "78141a323f4a8416891b06a0a2b90065", - "deployedAbis": { - "78141a323f4a8416891b06a0a2b90065": { - "latestDeployedAddress": "0xc9a7258b2b1ea36ce735793e4816ad949532c9fd", - "deployments": { - "0xc9a7258b2b1ea36ce735793e4816ad949532c9fd": { - "generatedAt": "2018-10-18T13:35:02.323Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.823Z", - "deployTransactionHash": "0xf529f773b4efda519e62d6dcbb71e5e1fa7a0223599f5db5edf792e85a3f9679", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3bd5779c94259890d586374c5db67f2b", - "deployedBytecodeHash": "f00491b62e24c57c6d12323c73c1037e", - "sourceHash": "16ee1835a27505e14d1b6990cdfa8c2c", - "source": "pragma solidity 0.4.24;\n\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration; // solhint-disable-line var-name-mixedcase\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) external restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address newAddress) external restricted {\n Migrations upgraded = Migrations(newAddress);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/MonetarySupervisor_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/MonetarySupervisor_DEPLOYS.json deleted file mode 100644 index 81ecca9..0000000 --- a/src/augmintjs/abiniser/deployments/4/MonetarySupervisor_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "latestAbiHash": "7f500b43397413e97de925528187f9cd", - "deployedAbis": { - "7f500b43397413e97de925528187f9cd": { - "latestDeployedAddress": "0x4a7f6ecbe8b324a55b85adcc45313a412957b8ea", - "deployments": { - "0xcec3574eca89409b15a8a72a6e737c4171457871": { - "generatedAt": "2018-10-18T13:35:02.380Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.944Z", - "deployTransactionHash": "0x19fbec82a3e2c548de1e2ecdf4b849da6e0d72688505cd3b570ecbc373ee0b9e", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "fa3e6bca24f24d5945b149c05701b69c", - "deployedBytecodeHash": "422b205eb739ddcf33fadad8edf32d7e", - "sourceHash": "62748c793556775f9ac607b991886bfb", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByStabilityBoard; // token issued by Stability Board\n uint public burnedByStabilityBoard; // token burned by Stability Board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n AugmintReserves _augmintReserves, InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoard\") {\n burnedByStabilityBoard = burnedByStabilityBoard.add(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n}\n" - }, - "0x4a7f6ecbe8b324a55b85adcc45313a412957b8ea": { - "generatedAt": "2018-10-29T15:52:43.281Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.781Z", - "deployTransactionHash": "0x0baf8768f7981c779245386e877c955ef4617ab1c04e35d1e449c77c35c34e6c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "fa3e6bca24f24d5945b149c05701b69c", - "deployedBytecodeHash": "422b205eb739ddcf33fadad8edf32d7e", - "sourceHash": "62748c793556775f9ac607b991886bfb", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByStabilityBoard; // token issued by Stability Board\n uint public burnedByStabilityBoard; // token burned by Stability Board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n AugmintReserves _augmintReserves, InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoard\") {\n burnedByStabilityBoard = burnedByStabilityBoard.add(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/PreTokenProxy_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/PreTokenProxy_DEPLOYS.json deleted file mode 100644 index 09bbd81..0000000 --- a/src/augmintjs/abiniser/deployments/4/PreTokenProxy_DEPLOYS.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "contractName": "PreTokenProxy", - "latestAbiHash": "dd40c0d39ea8bad8a388522667a84687", - "deployedAbis": { - "dd40c0d39ea8bad8a388522667a84687": { - "latestDeployedAddress": "0xb7cae2c48f3f34b9696fd290001dea16b299498a", - "deployments": { - "0xb7cae2c48f3f34b9696fd290001dea16b299498a": { - "generatedAt": "2018-10-18T13:35:02.452Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.836Z", - "deployTransactionHash": "0x0999dfd76266fbe0226af6d4f62f9b440b3b9098af17193df1d47a9e63ef028a", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5007bce3d0997985a9357d5b1a97103b", - "deployedBytecodeHash": "b5a32ad0b8570f3cd6b7efaef3655911", - "sourceHash": "2d172fe41d2b97c827d6dca816138047", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract PreTokenProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/PreToken_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/PreToken_DEPLOYS.json deleted file mode 100644 index f363ad3..0000000 --- a/src/augmintjs/abiniser/deployments/4/PreToken_DEPLOYS.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "contractName": "PreToken", - "latestAbiHash": "7f69e33e7b345c780ac9e43f391437d9", - "deployedAbis": { - "7f69e33e7b345c780ac9e43f391437d9": { - "latestDeployedAddress": "0xa7b67e7e3e7f1e76e8d799a690f675abeb85c788", - "deployments": { - "0xa7b67e7e3e7f1e76e8d799a690f675abeb85c788": { - "generatedAt": "2018-10-18T13:35:02.470Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.930Z", - "deployTransactionHash": "0x972002c7374514d61b63f0e3bd1e72a3bfca440e2e0dcc58d0fbc96fdcdf83b8", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "8d7e449258facd1c6fab22b402de6aee", - "deployedBytecodeHash": "bf64976158eb4f8696efd994652e7f49", - "sourceHash": "6cace117c42478e4f5c8cf116bec9a62", - "source": "/* Augmint pretoken contract to record agreements and tokens allocated based on the agreement.\n\n Important: this is NOT an ERC20 token!\n\n PreTokens are non-fungible: agreements can have different conditions (valuationCap and discount)\n and pretokens are not tradable.\n\n Ownership can be transferred if owner wants to change wallet but the whole agreement and\n the total pretoken amount is moved to a new account\n\n PreTokenSigner can (via MultiSig):\n - add agreements and issue pretokens to an agreement\n - change owner of any agreement to handle if an owner lost a private keys\n - burn pretokens from any agreement to fix potential erroneous issuance\n These are known compromises on trustlessness hence all these tokens distributed based on signed agreements and\n preTokens are issued only to a closed group of contributors / team members.\n If despite these something goes wrong then as a last resort a new pretoken contract can be recreated from agreements.\n\n Some ERC20 functions are implemented so agreement owners can see their balances and use transfer in standard wallets.\n Restrictions:\n - only total balance can be transfered - effectively ERC20 transfer used to transfer agreement ownership\n - only agreement holders can transfer\n (i.e. can't transfer 0 amount if have no agreement to avoid polluting logs with Transfer events)\n - transfer is only allowed to accounts without an agreement yet\n - no approval and transferFrom ERC20 functions\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract PreToken is Restricted {\n using SafeMath for uint256;\n\n string constant public name = \"Augmint pretokens\"; // solhint-disable-line const-name-snakecase\n string constant public symbol = \"APRE\"; // solhint-disable-line const-name-snakecase\n uint8 constant public decimals = 0; // solhint-disable-line const-name-snakecase\n\n uint public totalSupply;\n\n struct Agreement {\n address owner;\n uint balance;\n uint32 discount; // discountRate in parts per million , ie. 10,000 = 1%\n uint32 valuationCap; // in USD (no decimals)\n }\n\n /* Agreement hash is the SHA-2 (SHA-256) hash of signed agreement document.\n To generate:\n OSX: shasum -a 256 agreement.pdf\n Windows: certUtil -hashfile agreement.pdf SHA256 */\n mapping(address => bytes32) public agreementOwners; // to lookup agrement by owner\n mapping(bytes32 => Agreement) public agreements;\n\n bytes32[] public allAgreements; // all agreements to able to iterate over\n\n event Transfer(address indexed from, address indexed to, uint amount);\n\n event NewAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function addAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap)\n external restrict(\"PreTokenSigner\") {\n require(owner != address(0), \"owner must not be 0x0\");\n require(agreementOwners[owner] == 0x0, \"owner must not have an aggrement yet\");\n require(agreementHash != 0x0, \"agreementHash must not be 0x0\");\n require(discount > 0, \"discount must be > 0\");\n require(agreements[agreementHash].discount == 0, \"agreement must not exist yet\");\n\n agreements[agreementHash] = Agreement(owner, 0, discount, valuationCap);\n agreementOwners[owner] = agreementHash;\n allAgreements.push(agreementHash);\n\n emit NewAgreement(owner, agreementHash, discount, valuationCap);\n }\n\n function issueTo(bytes32 agreementHash, uint amount) external restrict(\"PreTokenSigner\") {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\");\n\n agreement.balance = agreement.balance.add(amount);\n totalSupply = totalSupply.add(amount);\n\n emit Transfer(0x0, agreement.owner, amount);\n }\n\n /* Restricted function to allow pretoken signers to fix incorrect issuance */\n function burnFrom(bytes32 agreementHash, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n Agreement storage agreement = agreements[agreementHash];\n // this is redundant b/c of next requires but be explicit\n require(agreement.discount > 0, \"agreement must exist\");\n require(amount > 0, \"burn amount must be > 0\");\n // .sub would revert anyways but emit reason\n require(agreement.balance >= amount, \"must not burn more than balance\");\n\n agreement.balance = agreement.balance.sub(amount);\n totalSupply = totalSupply.sub(amount);\n\n emit Transfer(agreement.owner, 0x0, amount);\n return true;\n }\n\n function balanceOf(address owner) public view returns (uint) {\n return agreements[agreementOwners[owner]].balance;\n }\n\n /* function to transfer agreement ownership to other wallet by owner\n it's in ERC20 form so owners can use standard ERC20 wallet just need to pass full balance as value */\n function transfer(address to, uint amount) public returns (bool) { // solhint-disable-line no-simple-event-func-name\n require(amount == agreements[agreementOwners[msg.sender]].balance, \"must transfer full balance\");\n _transfer(msg.sender, to);\n return true;\n }\n\n /* Restricted function to allow pretoken signers to fix if pretoken owner lost keys */\n function transferAgreement(bytes32 agreementHash, address to)\n public restrict(\"PreTokenSigner\") returns (bool) {\n _transfer(agreements[agreementHash].owner, to);\n return true;\n }\n\n /* private function used by transferAgreement & transfer */\n function _transfer(address from, address to) private {\n Agreement storage agreement = agreements[agreementOwners[from]];\n require(agreementOwners[from] != 0x0, \"from agreement must exists\");\n require(agreementOwners[to] == 0, \"to must not have an agreement\");\n require(to != 0x0, \"must not transfer to 0x0\");\n\n agreement.owner = to;\n\n agreementOwners[to] = agreementOwners[from];\n agreementOwners[from] = 0x0;\n\n emit Transfer(from, to, agreement.balance);\n }\n\n function getAgreementsCount() external view returns (uint agreementsCount) {\n return allAgreements.length;\n }\n\n // UI helper fx - Returns agreements from as\n // [index in allAgreements, account address as uint, balance, agreementHash as uint,\n // discount as uint, valuationCap as uint ]\n function getAgreements(uint offset, uint16 chunkSize)\n external view returns(uint[6][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), allAgreements.length);\n uint[6][] memory response = new uint[6][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n bytes32 agreementHash = allAgreements[i];\n Agreement storage agreement = agreements[agreementHash];\n\n response[i - offset] = [i, uint(agreement.owner), agreement.balance,\n uint(agreementHash), uint(agreement.discount), uint(agreement.valuationCap)];\n }\n return response;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/Rates_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/Rates_DEPLOYS.json deleted file mode 100644 index 0981849..0000000 --- a/src/augmintjs/abiniser/deployments/4/Rates_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "Rates", - "latestAbiHash": "73a17ebb0acc71773371c6a8e1c8e6ce", - "deployedAbis": { - "73a17ebb0acc71773371c6a8e1c8e6ce": { - "latestDeployedAddress": "0xee8c7a3e99945a5207dca026504d67527125da9c", - "deployments": { - "0xdfa3a0aeb9645a55b684cb3ace8c42d018405bda": { - "generatedAt": "2018-10-18T13:35:02.334Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.909Z", - "deployTransactionHash": "0xcdfc636cb95b245a8e7fb30a8d5a2be26fc2f781f73cd0ef33d82f271b684613", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "be17116585b9b88d60fbe06a5499b6dc", - "deployedBytecodeHash": "0f403183577dac202159e32b1c8c9f44", - "sourceHash": "c65f6945fead6118910fccc8bca7494c", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 2 decimals. i.e. EUR/ETH = 989.12 then rate = 98912\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"RatesFeeder\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"RatesFeeder\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - }, - "0xee8c7a3e99945a5207dca026504d67527125da9c": { - "generatedAt": "2018-10-29T15:52:43.242Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.755Z", - "deployTransactionHash": "0x300a82bb283510c9a429d6ce81e22586f0c42c9caf9445633a72e2424968967f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "be17116585b9b88d60fbe06a5499b6dc", - "deployedBytecodeHash": "0f403183577dac202159e32b1c8c9f44", - "sourceHash": "c65f6945fead6118910fccc8bca7494c", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 2 decimals. i.e. EUR/ETH = 989.12 then rate = 98912\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"RatesFeeder\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"RatesFeeder\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/SafeMath_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/SafeMath_DEPLOYS.json deleted file mode 100644 index 039e7f8..0000000 --- a/src/augmintjs/abiniser/deployments/4/SafeMath_DEPLOYS.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "contractName": "SafeMath", - "latestAbiHash": "d751713988987e9331980363e24189ce", - "deployedAbis": { - "d751713988987e9331980363e24189ce": { - "latestDeployedAddress": "0x1a2b65efd1e45ad49b6d5c5c48089ebb6d987c05", - "deployments": { - "0x0cbd4a1475b62fa5b1def3c864d031b0001e3c5b": { - "generatedAt": "2018-04-25T12:29:07.427Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:31:03.068Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "f9302c2a25cd095142e68aae6ff44cd5", - "deployedBytecodeHash": "e2996d9682fd6b73836fbcf2be0c44bd", - "sourceHash": "494c9e0684ae0df336dbb0f1daa07b27", - "source": "/**\n* @title SafeMath\n* @dev Math operations with safety checks that throw on error\n\n TODO: check against ds-math: https://blog.dapphub.com/ds-math/\n TODO: move roundedDiv to a sep lib? (eg. Math.sol)\n*/\npragma solidity 0.4.19;\n\n\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a * b;\n require(a == 0 || c / a == b);\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // require(b > 0); // Solidity automatically throws when dividing by 0\n uint256 c = a / b;\n // require(a == b * c + a % b); // There is no case in which this doesn't hold\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n return c;\n }\n\n function roundedDiv(uint a, uint b) internal pure returns (uint256) {\n // require(b > 0); // Solidity automatically throws when dividing by 0\n uint256 z = a / b;\n if (a % b >= b / 2) {\n z++; // no need for safe add b/c it can happen only if we divided the input\n }\n return z;\n }\n}\n" - }, - "0x0485aa36d1743a7e8c2d04421c9d5c7d401d5795": { - "generatedAt": "2018-04-25T12:30:49.008Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:35:58.096Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "d0ddb0ad1c84ed0576cb1f397cc5aac6", - "deployedBytecodeHash": "01962f146b796909675e431df6fb1dbb", - "sourceHash": "494c9e0684ae0df336dbb0f1daa07b27", - "source": "/**\n* @title SafeMath\n* @dev Math operations with safety checks that throw on error\n\n TODO: check against ds-math: https://blog.dapphub.com/ds-math/\n TODO: move roundedDiv to a sep lib? (eg. Math.sol)\n*/\npragma solidity 0.4.19;\n\n\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a * b;\n require(a == 0 || c / a == b);\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // require(b > 0); // Solidity automatically throws when dividing by 0\n uint256 c = a / b;\n // require(a == b * c + a % b); // There is no case in which this doesn't hold\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n return c;\n }\n\n function roundedDiv(uint a, uint b) internal pure returns (uint256) {\n // require(b > 0); // Solidity automatically throws when dividing by 0\n uint256 z = a / b;\n if (a % b >= b / 2) {\n z++; // no need for safe add b/c it can happen only if we divided the input\n }\n return z;\n }\n}\n" - }, - "0x1a2b65efd1e45ad49b6d5c5c48089ebb6d987c05": { - "generatedAt": "2018-04-25T12:31:28.938Z", - "truffleContractFileUpdatedAt": "2018-04-20T18:25:08.412Z", - "deployTransactionHash": "0x9e9532fc955991639331472822eb35b7f46537de2025bfc363c7fb86f1d65c13", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "5c02a412ee11dc181e23608b85b249b9", - "deployedBytecodeHash": "d808bf41b73524260974a832a9735da9", - "sourceHash": "f07bc306764da6ef496a297a30a18531", - "source": "/**\n* @title SafeMath\n* @dev Math operations with safety checks that throw on error\n\n TODO: check against ds-math: https://blog.dapphub.com/ds-math/\n TODO: move roundedDiv to a sep lib? (eg. Math.sol)\n*/\npragma solidity ^0.4.23;\n\n\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a * b;\n require(a == 0 || c / a == b, \"mul overflow\");\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"div by 0\"); // Solidity automatically throws for div by 0 but require to emit reason\n uint256 c = a / b;\n // require(a == b * c + a % b); // There is no case in which this doesn't hold\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"sub underflow\");\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"add overflow\");\n return c;\n }\n\n function roundedDiv(uint a, uint b) internal pure returns (uint256) {\n require(b > 0, \"div by 0\"); // Solidity automatically throws for div by 0 but require to emit reason\n uint256 z = a / b;\n if (a % b >= b / 2) {\n z++; // no need for safe add b/c it can happen only if we divided the input\n }\n return z;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/StabilityBoardProxy_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/StabilityBoardProxy_DEPLOYS.json deleted file mode 100644 index b720d02..0000000 --- a/src/augmintjs/abiniser/deployments/4/StabilityBoardProxy_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "StabilityBoardProxy", - "latestAbiHash": "dd40c0d39ea8bad8a388522667a84687", - "deployedAbis": { - "dd40c0d39ea8bad8a388522667a84687": { - "latestDeployedAddress": "0xa612de13b629a1ff790c1f4e41d0422d2bb50a30", - "deployments": { - "0x50d281c28846576eaaf679ab6f3baac52b776e72": { - "generatedAt": "2018-10-18T13:35:02.447Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.835Z", - "deployTransactionHash": "0x3a64beffca962812a3ee1b5abb1eeba7f10d2632ba817195d2727bad6a1e83b0", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "4f899546765577ad2e325da53c3e7179", - "deployedBytecodeHash": "a5f3dd7878e556db538c1206827e5959", - "sourceHash": "4d60c55b8e4009873db939b37558d9dc", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - }, - "0xa612de13b629a1ff790c1f4e41d0422d2bb50a30": { - "generatedAt": "2018-10-29T15:52:43.339Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.704Z", - "deployTransactionHash": "0x845cfad1fef968fa69e03efa40f81b014b7bddaaf6574dd9cc6a9b337b73694c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "4f899546765577ad2e325da53c3e7179", - "deployedBytecodeHash": "a5f3dd7878e556db538c1206827e5959", - "sourceHash": "4d60c55b8e4009873db939b37558d9dc", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/StabilityBoardSigner_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/StabilityBoardSigner_DEPLOYS.json deleted file mode 100644 index a9beea8..0000000 --- a/src/augmintjs/abiniser/deployments/4/StabilityBoardSigner_DEPLOYS.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "contractName": "StabilityBoardSigner", - "latestAbiHash": "19ab69b650e28b2dd211d3851893f91f", - "deployedAbis": { - "19ab69b650e28b2dd211d3851893f91f": { - "latestDeployedAddress": "0xe733dde64ce5b9930dff8f97e5615635fd4095fb", - "deployments": { - "0xe733dde64ce5b9930dff8f97e5615635fd4095fb": { - "generatedAt": "2018-06-04T12:49:52.718Z", - "truffleContractFileUpdatedAt": "2018-06-04T12:49:10.418Z", - "deployTransactionHash": "0x41c284c979b043d91bbc9caebd5defd6bb6a08bca796b7077cb74d5fe25c1657", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0e2f8e783790013f07705a1cecd5f703", - "deployedBytecodeHash": "9a38fc566f79a4d2fd6e6fa64b406b1b", - "sourceHash": "1c9e1e3dd1979663773a97ac32a067c0", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardSigner is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/4/TokenAEur_DEPLOYS.json b/src/augmintjs/abiniser/deployments/4/TokenAEur_DEPLOYS.json deleted file mode 100644 index 11b5c3c..0000000 --- a/src/augmintjs/abiniser/deployments/4/TokenAEur_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "TokenAEur", - "latestAbiHash": "2ea91d34a7bfefc8f38ef0e8a5ae24a5", - "deployedAbis": { - "2ea91d34a7bfefc8f38ef0e8a5ae24a5": { - "latestDeployedAddress": "0x79065a165ec09e6a89d584a14872802717fe12a3", - "deployments": { - "0x0557183334edc23a666201edc6b0aa2787e2ad3f": { - "generatedAt": "2018-10-18T13:35:02.366Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.871Z", - "deployTransactionHash": "0x4d8b7e1eff4e7237355399cf154526e73c7716887173a0cedb81fb0434613507", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0398a39cdab3b394103910ea6b28eef7", - "deployedBytecodeHash": "2916088286d725e884630bc95fc19dbf", - "sourceHash": "04025a37ea64acbc6f0ea2ec8a6f3e4d", - "source": "/* Augmint Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - }, - "0x79065a165ec09e6a89d584a14872802717fe12a3": { - "generatedAt": "2018-10-29T15:52:43.268Z", - "truffleContractFileUpdatedAt": "2018-10-19T15:49:10.721Z", - "deployTransactionHash": "0x81e6c73a51dfcff2ca2424db2f08c13692416bb52f028de012ac631e97d0b631", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0398a39cdab3b394103910ea6b28eef7", - "deployedBytecodeHash": "2916088286d725e884630bc95fc19dbf", - "sourceHash": "04025a37ea64acbc6f0ea2ec8a6f3e4d", - "source": "/* Augmint Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/AugmintReserves_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/AugmintReserves_DEPLOYS.json deleted file mode 100644 index e5c7fb7..0000000 --- a/src/augmintjs/abiniser/deployments/999/AugmintReserves_DEPLOYS.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "contractName": "AugmintReserves", - "latestAbiHash": "024b81d1a1f75241167a8a0f6e62326f", - "deployedAbis": { - "024b81d1a1f75241167a8a0f6e62326f": { - "latestDeployedAddress": "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4", - "deployments": { - "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4": { - "generatedAt": "2018-10-18T13:35:02.347Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.845Z", - "deployTransactionHash": "0x856ac4754df0c03bfe83966e71225b02c97363a09cabc370aafba56ad4a016f2", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5bf4ede2aaad5b0b112f7b1ebf420fd2", - "deployedBytecodeHash": "3720667df6506876043fba53c540acb6", - "sourceHash": "b9d84f5f6153164ba581845190291c88", - "source": "/* Contract to hold Augmint reserves (ETH & Token)\n - ETH as regular ETH balance of the contract\n - ERC20 token reserve (stored as regular Token balance under the contract address)\n\nNB: reserves are held under the contract address, therefore any transaction on the reserve is limited to the\n tx-s defined here (i.e. transfer is not allowed even by the contract owner or StabilityBoard or MonetarySupervisor)\n\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract AugmintReserves is Restricted {\n\n event ReserveMigration(address to, uint weiAmount);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into reserve (from defaulted loan's collateral )\n }\n\n function burn(AugmintTokenInterface augmintToken, uint amount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.burn(amount);\n }\n\n function migrate(address to, uint weiAmount)\n external restrict(\"StabilityBoard\") {\n if (weiAmount > 0) {\n to.transfer(weiAmount);\n }\n emit ReserveMigration(to, weiAmount);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/Exchange_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/Exchange_DEPLOYS.json deleted file mode 100644 index 2da239e..0000000 --- a/src/augmintjs/abiniser/deployments/999/Exchange_DEPLOYS.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "contractName": "Exchange", - "latestAbiHash": "d3e7f8a261b756f9c40da097608b21cd", - "deployedAbis": { - "3aa2aedd2972391a12570ba4bfca2f72": { - "latestDeployedAddress": "0x367f6272f3c4146f045f19be8774d97fd0966af5", - "deployments": { - "0xd171711fd9bcd582a3cbc1c16d33b19b91aaf23d": { - "generatedAt": "2018-04-25T12:29:07.683Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:31:03.072Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "95533c8abeab1480f1c82f2f0593dae8", - "deployedBytecodeHash": "ce8bd79d6703d524cb59226bc11fc7d8", - "sourceHash": "c308207b18b39a21996dc30f8a59bc2f", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n*/\npragma solidity 0.4.19;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\ncontract Exchange {\n using SafeMath for uint256;\n AugmintTokenInterface public augmintToken;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // tokens per ether\n uint32 price;\n\n // buy order: amount in wei \n // sell order: token amount\n uint amount; \n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount,\n uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n function Exchange(AugmintTokenInterface _augmintToken) public {\n augmintToken = _augmintToken;\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0);\n require(msg.value > 0);\n\n orderId = ++orderCount; \n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender);\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender);\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length);\n for (uint i = 0; i < len && msg.gas > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) public {\n require(msg.sender == address(augmintToken));\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price);\n\n // meet in the middle\n uint price = uint(buy.price).add(sell.price).div(2);\n\n uint sellWei = sell.amount.mul(1 ether).div(price);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(price).div(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, uint32(price), tradedWei, tradedTokens);\n }\n\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0);\n require(tokenAmount > 0);\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - }, - "0x367f6272f3c4146f045f19be8774d97fd0966af5": { - "generatedAt": "2018-04-25T12:30:49.487Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:35:58.103Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "e47f3492d775d281872d832c98118822", - "deployedBytecodeHash": "8656667e0062d2a11e000c4d34d156db", - "sourceHash": "eacd00fb6a1cfd4cd37484832bef5f6b", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n*/\npragma solidity 0.4.19;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract Exchange {\n using SafeMath for uint256;\n AugmintTokenInterface public augmintToken;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // tokens per ether\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount,\n uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n function Exchange(AugmintTokenInterface _augmintToken) public {\n augmintToken = _augmintToken;\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0);\n require(msg.value > 0);\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender);\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender);\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length);\n for (uint i = 0; i < len && msg.gas > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) public {\n require(msg.sender == address(augmintToken));\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price);\n\n // meet in the middle\n uint price = uint(buy.price).add(sell.price).div(2);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(price);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(price).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, uint32(price), tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0);\n require(tokenAmount > 0);\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "7595b255e567ae1d0eeef4460d0b0c16": { - "latestDeployedAddress": "0x7f3abcd33ffe83ba7426ee6ec45014364fe1cab4", - "deployments": { - "0x7f3abcd33ffe83ba7426ee6ec45014364fe1cab4": { - "generatedAt": "2018-04-26T01:54:21.224Z", - "truffleContractFileUpdatedAt": "2018-04-26T01:54:10.377Z", - "deployTransactionHash": "0xb16a40cf6a491b676417954faf4c0eb6de85e7e5916aa5686e92c5375da0cf70", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "3d56e595f09574a81b0697291e3c90de", - "deployedBytecodeHash": "faa13d30ecd13e69c3a3973b2b12de30", - "sourceHash": "694787926bafd9e5e4b1f1e926b5c25a", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract Exchange {\n using SafeMath for uint256;\n AugmintTokenInterface public augmintToken;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // tokens per ether\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount,\n uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n constructor(AugmintTokenInterface _augmintToken) public {\n augmintToken = _augmintToken;\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) { \n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // meet in the middle\n uint price = uint(buy.price).add(sell.price).div(2);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(price);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(price).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, uint32(price), tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "a1dd11684e0aba7b453b7dbae42b2edb": { - "latestDeployedAddress": "0x0179416e01def5166ce16f0ba74f3506b0ac06d1", - "deployments": { - "0x7f3abcd33ffe83ba7426ee6ec45014364fe1cab4": { - "generatedAt": "2018-04-29T16:37:49.362Z", - "truffleContractFileUpdatedAt": "2018-04-29T16:37:40.472Z", - "deployTransactionHash": "0x6d11795608aedb8b7c0468edf4045a97f0ac5fce374062a7dc611f571ea46c5f", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "620d31ed1a67e93a4ab76d85e0ac270b", - "deployedBytecodeHash": "aaab555e292065199eb31d83fe8a18f9", - "sourceHash": "b85b7ae31888e9c5492d43f1745111cd", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // tokens per ether for limit orders. 0 when order is on current published peggedSymbol/ETH rates\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(AugmintTokenInterface _augmintToken, Rates _rates) public {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price || buy.price == 0, \"buy price must be >= sell price or sell or buy price == 0\");\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint buyPrice = buy.price > 0 ? buy.price : publishedRate;\n uint sellPrice = sell.price > 0 ? sell.price : publishedRate;\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint price = buyTokenId > sellTokenId ? sellPrice : buyPrice;\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(price);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(price).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, uint32(price), tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - }, - "0x0179416e01def5166ce16f0ba74f3506b0ac06d1": { - "generatedAt": "2018-04-30T10:44:44.371Z", - "truffleContractFileUpdatedAt": "2018-04-30T10:44:29.296Z", - "deployTransactionHash": "0xa3d87eced21d4c10578424c4e3c8a5aa0c5cf3880d17e3badbeb33591ea08d7d", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "620d31ed1a67e93a4ab76d85e0ac270b", - "deployedBytecodeHash": "aaab555e292065199eb31d83fe8a18f9", - "sourceHash": "b85b7ae31888e9c5492d43f1745111cd", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // tokens per ether for limit orders. 0 when order is on current published peggedSymbol/ETH rates\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(AugmintTokenInterface _augmintToken, Rates _rates) public {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price || buy.price == 0, \"buy price must be >= sell price or sell or buy price == 0\");\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint buyPrice = buy.price > 0 ? buy.price : publishedRate;\n uint sellPrice = sell.price > 0 ? sell.price : publishedRate;\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint price = buyTokenId > sellTokenId ? sellPrice : buyPrice;\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(price);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(price).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, uint32(price), tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "3c157a5256a2093da587f166d4dbd537": { - "latestDeployedAddress": "0x2657738b98587f923e0d6ec71331c3dc67b41a47", - "deployments": { - "0x0179416e01def5166ce16f0ba74f3506b0ac06d1": { - "generatedAt": "2018-05-01T20:24:25.543Z", - "truffleContractFileUpdatedAt": "2018-05-01T20:24:20.925Z", - "deployTransactionHash": "0x8e4a1136b3ec176a7ebaed676a91bcd5a8a8077114e4ae8c3f783070138e013a", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "4a1da36560fdae5d5f9aeb9bb9e12f3e", - "deployedBytecodeHash": "2c390a9b03f57a87af44432fc6444647", - "sourceHash": "6e27bdbdc64d0d9cf52de1abc46c4cf7", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint fillRate, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(AugmintTokenInterface _augmintToken, Rates _rates) public {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint fillRate = publishedRate.mul(price).roundedDiv(1000000);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(fillRate).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, fillRate, tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - }, - "0x367f6272f3c4146f045f19be8774d97fd0966af5": { - "generatedAt": "2018-05-12T00:22:15.270Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:12.453Z", - "deployTransactionHash": "0x5f0778b2c07d8392ba59c905b51eb0f528d89948108b6f9adcc1aca28982f35d", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "0c3aae2a1e26a2cc4f1800e62fa873ee", - "deployedBytecodeHash": "4c6ad15993389d8d7326c731b2b92d63", - "sourceHash": "6e27bdbdc64d0d9cf52de1abc46c4cf7", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint fillRate, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(AugmintTokenInterface _augmintToken, Rates _rates) public {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint fillRate = publishedRate.mul(price).roundedDiv(1000000);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(fillRate).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, fillRate, tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - }, - "0x2657738b98587f923e0d6ec71331c3dc67b41a47": { - "generatedAt": "2018-05-31T23:56:48.715Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.545Z", - "deployTransactionHash": "0x1fb50f83f963837e2bea3207320dbc05fc4d0e2b6ddbebf5874d59979937f336", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "999c2b2dd0fec3e940cfcf4f21a6f187", - "deployedBytecodeHash": "826352dcdc91c83a8de4601b6f6ff0dd", - "sourceHash": "102595503ce93407191a5dad48b519ed", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint fillRate, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(AugmintTokenInterface _augmintToken, Rates _rates) public {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoardSignerContract\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price meets in the middle\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n _fillOrder(buyTokenId, sellTokenId);\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Stops if any match is invalid (case when any of the orders removed after client generated the match list sent)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n _fillOrder(buyTokenIds[i], sellTokenIds[i]);\n matchCount++;\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint fillRate = publishedRate.mul(price).roundedDiv(1000000);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(fillRate).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, fillRate, tradedWei, tradedTokens);\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "b2a23202a9a0f04755a186896c2b56eb": { - "latestDeployedAddress": "0xfacea53a04befcc6c9246eb3951814cfee2a1415", - "deployments": { - "0xfacea53a04befcc6c9246eb3951814cfee2a1415": { - "generatedAt": "2018-07-09T11:28:14.642Z", - "truffleContractFileUpdatedAt": "2018-07-09T11:27:55.398Z", - "deployTransactionHash": "0x05010a30a371459433268e18fbef3a7c9b3f825ffa3abb1ceaf5404d80546385", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0e74038bd2bc1c6bb79e37ea1e10dc67", - "deployedBytecodeHash": "30d675a32d83c2684152c23f3f43b955", - "sourceHash": "7a417a79bd6036b0b1b796d00bc176ca", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint fillRate, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n uint fillRate = publishedRate.mul(price).roundedDiv(1000000);\n\n uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(fillRate).roundedDiv(1 ether);\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, fillRate, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "c28de2392aea85ef2aa1b108fce6568c": { - "latestDeployedAddress": "0xfacea53a04befcc6c9246eb3951814cfee2a1415", - "deployments": { - "0xfacea53a04befcc6c9246eb3951814cfee2a1415": { - "generatedAt": "2018-08-14T19:51:18.215Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:59.328Z", - "deployTransactionHash": "0x65578114bccbfe65a8d9a76f0bb294fa41ea8e4876d3f0472c4f7433b3b066ed", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "1ce1dbfbab818d02ee0eceb95532332f", - "deployedBytecodeHash": "82efe438a15e53888dc4d8b01cb89e08", - "sourceHash": "666961af517c36b10580b52699ba5ae9", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n uint public constant CHUNK_SIZE = 100;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns CHUNK_SIZE orders starting from offset\n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {\n uint64 orderId = activeBuyOrders[offset + i];\n Order storage order = buyTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {\n uint64 orderId = activeSellOrders[offset + i];\n Order storage order = sellTokenOrders[orderId];\n response[i] = [orderId, uint(order.maker), order.price, order.amount];\n }\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n _removeOrder(activeBuyOrders, order.index);\n }\n\n function _removeSellOrder(Order storage order) private {\n _removeOrder(activeSellOrders, order.index);\n }\n\n function _removeOrder(uint64[] storage orders, uint64 index) private {\n if (index < orders.length - 1) {\n orders[index] = orders[orders.length - 1];\n }\n orders.length--;\n }\n\n}\n" - } - } - }, - "d3e7f8a261b756f9c40da097608b21cd": { - "latestDeployedAddress": "0xfacea53a04befcc6c9246eb3951814cfee2a1415", - "deployments": { - "0xfacea53a04befcc6c9246eb3951814cfee2a1415": { - "generatedAt": "2018-10-18T13:35:02.438Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.980Z", - "deployTransactionHash": "0xe209afd86747757d7e1538dec4967fa6ec924b4d588c9b2a85091e6eb62ccacb", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5a731d45c1595b7ffeb40bae693ef88d", - "deployedBytecodeHash": "136e48f6880df5153792c846d87ddede", - "sourceHash": "d6ff57acb1b45199b5dd08357978d8c2", - "source": "/* Augmint's Internal Exchange\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png\n\n TODO:\n - change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17\n - deduct fee\n - consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)\n - use Rates interface?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./Rates.sol\";\n\n\ncontract Exchange is Restricted {\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n Rates public rates;\n\n struct Order {\n uint64 index;\n address maker;\n\n // % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million\n // I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity\n uint32 price;\n\n // buy order: amount in wei\n // sell order: token amount\n uint amount;\n }\n\n uint64 public orderCount;\n mapping(uint64 => Order) public buyTokenOrders;\n mapping(uint64 => Order) public sellTokenOrders;\n\n uint64[] private activeBuyOrders;\n uint64[] private activeSellOrders;\n\n /* used to stop executing matchMultiple when running out of gas.\n actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/\n uint32 private constant ORDER_MATCH_WORST_GAS = 100000;\n\n event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);\n\n event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,\n uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint weiAmount, uint tokenAmount);\n\n event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);\n\n event RatesContractChanged(Rates newRatesContract);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n rates = _rates;\n }\n\n /* to allow upgrade of Rates contract */\n function setRatesContract(Rates newRatesContract)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n emit RatesContractChanged(newRatesContract);\n }\n\n function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(msg.value > 0, \"msg.value must be > 0\");\n\n orderId = ++orderCount;\n buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);\n activeBuyOrders.push(orderId);\n\n emit NewOrder(orderId, msg.sender, price, 0, msg.value);\n }\n\n /* this function requires previous approval to transfer tokens */\n function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {\n augmintToken.transferFrom(msg.sender, this, tokenAmount);\n return _placeSellTokenOrder(msg.sender, price, tokenAmount);\n }\n\n /* place sell token order called from AugmintToken's transferAndNotify\n Flow:\n 1) user calls token contract's transferAndNotify price passed in data arg\n 2) transferAndNotify transfers tokens to the Exchange contract\n 3) transferAndNotify calls Exchange.transferNotification with lockProductId\n */\n function transferNotification(address maker, uint tokenAmount, uint price) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n _placeSellTokenOrder(maker, uint32(price), tokenAmount);\n }\n\n function cancelBuyTokenOrder(uint64 buyTokenId) external {\n Order storage order = buyTokenOrders[buyTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"buy order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeBuyOrder(order);\n\n msg.sender.transfer(amount);\n\n emit CancelledOrder(buyTokenId, msg.sender, 0, amount);\n }\n\n function cancelSellTokenOrder(uint64 sellTokenId) external {\n Order storage order = sellTokenOrders[sellTokenId];\n require(order.maker == msg.sender, \"msg.sender must be order.maker\");\n require(order.amount > 0, \"sell order already removed\");\n\n uint amount = order.amount;\n order.amount = 0;\n _removeSellOrder(order);\n\n augmintToken.transferWithNarrative(msg.sender, amount, \"Sell token order cancelled\");\n\n emit CancelledOrder(sellTokenId, msg.sender, amount, 0);\n }\n\n /* matches any two orders if the sell price >= buy price\n trade price is the price of the maker (the order placed earlier)\n reverts if any of the orders have been removed\n */\n function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {\n require(_fillOrder(buyTokenId, sellTokenId), \"fill order failed\");\n }\n\n /* matches as many orders as possible from the passed orders\n Runs as long as gas is available for the call.\n Reverts if any match is invalid (e.g sell price > buy price)\n Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)\n */\n function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {\n uint len = buyTokenIds.length;\n require(len == sellTokenIds.length, \"buyTokenIds and sellTokenIds lengths must be equal\");\n\n for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {\n if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {\n matchCount++;\n }\n }\n }\n\n function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {\n return(activeBuyOrders.length, activeSellOrders.length);\n }\n\n // returns active buy orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveBuyOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeBuyOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeBuyOrders[i];\n Order storage order = buyTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n // returns active sell orders starting from \n // orders are encoded as [id, maker, price, amount]\n function getActiveSellOrders(uint offset, uint16 chunkSize)\n external view returns (uint[4][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), activeSellOrders.length);\n uint[4][] memory response = new uint[4][](limit.sub(offset));\n for (uint i = offset; i < limit; i++) {\n uint64 orderId = activeSellOrders[i];\n Order storage order = sellTokenOrders[orderId];\n response[i - offset] = [orderId, uint(order.maker), order.price, order.amount];\n }\n return response;\n }\n\n uint private constant E12 = 1000000000000;\n\n function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {\n Order storage buy = buyTokenOrders[buyTokenId];\n Order storage sell = sellTokenOrders[sellTokenId];\n if( buy.amount == 0 || sell.amount == 0 ) {\n return false; // one order is already filled and removed.\n // we let matchMultiple continue, indivudal match will revert\n }\n\n require(buy.price >= sell.price, \"buy price must be >= sell price\");\n\n // pick maker's price (whoever placed order sooner considered as maker)\n uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;\n\n uint publishedRate;\n (publishedRate, ) = rates.rates(augmintToken.peggedSymbol());\n // fillRate = publishedRate * 1000000 / price\n\n uint sellWei = sell.amount.mul(uint(price)).mul(E12).roundedDiv(publishedRate);\n\n uint tradedWei;\n uint tradedTokens;\n if (sellWei <= buy.amount) {\n tradedWei = sellWei;\n tradedTokens = sell.amount;\n } else {\n tradedWei = buy.amount;\n tradedTokens = buy.amount.mul(publishedRate).roundedDiv(uint(price).mul(E12));\n }\n\n buy.amount = buy.amount.sub(tradedWei);\n if (buy.amount == 0) {\n _removeBuyOrder(buy);\n }\n\n sell.amount = sell.amount.sub(tradedTokens);\n if (sell.amount == 0) {\n _removeSellOrder(sell);\n }\n\n augmintToken.transferWithNarrative(buy.maker, tradedTokens, \"Buy token order fill\");\n sell.maker.transfer(tradedWei);\n\n emit OrderFill(buy.maker, sell.maker, buyTokenId,\n sellTokenId, publishedRate, price, tradedWei, tradedTokens);\n\n return true;\n }\n\n function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)\n private returns (uint64 orderId) {\n require(price > 0, \"price must be > 0\");\n require(tokenAmount > 0, \"tokenAmount must be > 0\");\n\n orderId = ++orderCount;\n sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);\n activeSellOrders.push(orderId);\n\n emit NewOrder(orderId, maker, price, tokenAmount, 0);\n }\n\n function _removeBuyOrder(Order storage order) private {\n uint lastIndex = activeBuyOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeBuyOrders[lastIndex];\n activeBuyOrders[order.index] = movedOrderId;\n buyTokenOrders[movedOrderId].index = order.index;\n }\n activeBuyOrders.length--;\n }\n\n function _removeSellOrder(Order storage order) private {\n uint lastIndex = activeSellOrders.length - 1;\n if (order.index < lastIndex) {\n uint64 movedOrderId = activeSellOrders[lastIndex];\n activeSellOrders[order.index] = movedOrderId;\n sellTokenOrders[movedOrderId].index = order.index;\n }\n activeSellOrders.length--;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/FeeAccount_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/FeeAccount_DEPLOYS.json deleted file mode 100644 index c0a5059..0000000 --- a/src/augmintjs/abiniser/deployments/999/FeeAccount_DEPLOYS.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "contractName": "FeeAccount", - "latestAbiHash": "67db260db12738df3cced3511d34c65c", - "deployedAbis": { - "3bf67cdfa9f7a16596598e19aeb06b39": { - "latestDeployedAddress": "0xf5efcaa78f5656f7ddc971bc5d51a08b5f161573", - "deployments": { - "0xf5efcaa78f5656f7ddc971bc5d51a08b5f161573": { - "generatedAt": "2018-04-25T12:30:49.084Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:23:57.497Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "590b35b115c16a5eeb45e74226771380", - "deployedBytecodeHash": "1d79d9ce02c401f7a91c98ab2d54b5e5", - "sourceHash": "683f4469ac7396c5de93d4ce60e32c47", - "source": "/* Contract to collect fees from system */\n\npragma solidity 0.4.19;\nimport \"./generic/SystemAccount.sol\";\n\n\ncontract FeeAccount is SystemAccount { // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "dd4594a936e439aa46ed5b06cb69eafa": { - "latestDeployedAddress": "0x61fd2df116a3c1d1e0c50552d820c90e2c6c951b", - "deployments": { - "0xb0a2a8e846b66c7384f52635cecef5280f766c8b": { - "generatedAt": "2018-04-26T01:54:21.110Z", - "truffleContractFileUpdatedAt": "2018-04-26T01:54:11.449Z", - "deployTransactionHash": "0xd8793495a7a15adaa17d87e69ca6ed20f64f8439524bef4101a9552df2dbef28", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "ea1ca3863b740d0cebc130bd99919069", - "deployedBytecodeHash": "d64b9e9eed98c75afb9cbf0d9a709fd5", - "sourceHash": "fe888fa25a5c364abea5c0856f1ebd5b", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity ^0.4.23;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(uint transferFeePt, uint transferFeeMin, uint transferFeeMax) public {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () public payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"MonetaryBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoFeeTransferContracts\"] && !permissions[to][\"NoFeeTransferContracts\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - }, - "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01": { - "generatedAt": "2018-05-12T00:22:15.150Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:12.418Z", - "deployTransactionHash": "0x30eed67ceb1c3ebd5c235da1cf58a490de7a95f6c7fe90998b60184e254bbc42", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "7b671216a10bbb9643a8b9f48eabe6ee", - "deployedBytecodeHash": "aaa8149858e7a4fda67a0feeaf2846c5", - "sourceHash": "fe888fa25a5c364abea5c0856f1ebd5b", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity ^0.4.23;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(uint transferFeePt, uint transferFeeMin, uint transferFeeMax) public {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () public payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"MonetaryBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoFeeTransferContracts\"] && !permissions[to][\"NoFeeTransferContracts\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - }, - "0x61fd2df116a3c1d1e0c50552d820c90e2c6c951b": { - "generatedAt": "2018-05-31T23:56:48.472Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.499Z", - "deployTransactionHash": "0xad8bd77bee37305919c9f195ab469be16189670c89ca41448013a62136d9513a", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "70ab69343e4905fd08b47547aba2847a", - "deployedBytecodeHash": "eceb8d093a256a88355a8a19255fd132", - "sourceHash": "fcfc3451f85f07051e276314b1ad3381", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(uint transferFeePt, uint transferFeeMin, uint transferFeeMax) public {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () public payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"StabilityBoardSignerContract\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoFeeTransferContracts\"] && !permissions[to][\"NoFeeTransferContracts\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - } - } - }, - "67db260db12738df3cced3511d34c65c": { - "latestDeployedAddress": "0xf5efcaa78f5656f7ddc971bc5d51a08b5f161573", - "deployments": { - "0xf5efcaa78f5656f7ddc971bc5d51a08b5f161573": { - "generatedAt": "2018-10-18T13:35:02.354Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.893Z", - "deployTransactionHash": "0x8f20ad1a0464acd457877feb774cc3b6fabb1d3db7a49cb12fa8bc8a494b0db2", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "7f27e332912911a33f3a5831a478a40e", - "deployedBytecodeHash": "62169a6a5b1bc79360f85c7d6b7cbadf", - "sourceHash": "d8975a5e1941ad79313f4b7bb0be9f95", - "source": "/* Contract to collect fees from system\n TODO: calculateExchangeFee + Exchange params and setters\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/TransferFeeInterface.sol\";\n\n\ncontract FeeAccount is SystemAccount, TransferFeeInterface {\n\n using SafeMath for uint256;\n\n struct TransferFee {\n uint pt; // in parts per million (ppm) , ie. 2,000 = 0.2%\n uint min; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n uint max; // with base unit of augmint token, eg. 2 decimals for token, eg. 310 = 3.1 ACE\n }\n\n TransferFee public transferFee;\n\n event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);\n\n constructor(address permissionGranterContract, uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n public SystemAccount(permissionGranterContract) {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function () external payable { // solhint-disable-line no-empty-blocks\n // to accept ETH sent into feeAccount (defaulting fee in ETH )\n }\n\n function setTransferFees(uint transferFeePt, uint transferFeeMin, uint transferFeeMax)\n external restrict(\"StabilityBoard\") {\n transferFee = TransferFee(transferFeePt, transferFeeMin, transferFeeMax);\n emit TransferFeesChanged(transferFeePt, transferFeeMin, transferFeeMax);\n }\n\n function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee) {\n if (!permissions[from][\"NoTransferFee\"] && !permissions[to][\"NoTransferFee\"]) {\n fee = amount.mul(transferFee.pt).div(1000000);\n if (fee > transferFee.max) {\n fee = transferFee.max;\n } else if (fee < transferFee.min) {\n fee = transferFee.min;\n }\n }\n return fee;\n }\n\n function calculateExchangeFee(uint weiAmount) external view returns (uint256 weiFee) {\n /* TODO: to be implemented and use in Exchange.sol. always revert for now */\n require(weiAmount != weiAmount, \"not yet implemented\");\n weiFee = transferFee.max; // to silence compiler warnings until it's implemented\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/InterestEarnedAccount_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/InterestEarnedAccount_DEPLOYS.json deleted file mode 100644 index 5f80f51..0000000 --- a/src/augmintjs/abiniser/deployments/999/InterestEarnedAccount_DEPLOYS.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "contractName": "InterestEarnedAccount", - "latestAbiHash": "11b039ce783db308e1a9b5f46f05824f", - "deployedAbis": { - "2282749a57fa5c7d61cf33b2f04daf2b": { - "latestDeployedAddress": "0xbbecff5db2f9cccc936895121802fc15053344c6", - "deployments": { - "0x80d62c62138ed74699008c6f041b589c51619145": { - "generatedAt": "2018-04-25T12:29:07.537Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:28:03.467Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "10f2c7bcc89c991f8036cd653a9c9254", - "deployedBytecodeHash": "6d1f7692b0b3214dce6de23ef79d0567", - "sourceHash": "a08b32cfe73754d798c1e9a2f2d69bcb", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.19;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisorContract\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - }, - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-04-25T12:30:49.115Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:31:58.109Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "fa7e41b12921f5486139b113e27d9f42", - "deployedBytecodeHash": "3b0ffecb49e2308162baea06ab012022", - "sourceHash": "a08b32cfe73754d798c1e9a2f2d69bcb", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.19;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisorContract\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - } - } - }, - "72a73972d565bb24463e7368fd263af4": { - "latestDeployedAddress": "0xc3f2a0508dbacc3ffd9846a166dcb257029b59a0", - "deployments": { - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-04-26T01:54:21.116Z", - "truffleContractFileUpdatedAt": "2018-04-26T01:54:07.621Z", - "deployTransactionHash": "0x586bcafbe202c8fc761732b7b79532156889c4764c241e410c4ab746f85bb512", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "5c959e1fbd244532a0db3a14f46aa086", - "deployedBytecodeHash": "d1c4729a444bfc4abb71e5af98bb6ed2", - "sourceHash": "080bdccd163b74b49fb908b443c45199", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity ^0.4.23;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisorContract\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - }, - "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4": { - "generatedAt": "2018-05-12T00:22:15.155Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:09.283Z", - "deployTransactionHash": "0x2cdb7fd6f6500ec39f69a8633af900a2264fe9b6b2696b3f5930af950a708a24", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "435a1a8da265b92f0ae3fd4eb5089baa", - "deployedBytecodeHash": "f7581b87c6854d5aec16c65f738876d8", - "sourceHash": "080bdccd163b74b49fb908b443c45199", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity ^0.4.23;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisorContract\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - }, - "0xc3f2a0508dbacc3ffd9846a166dcb257029b59a0": { - "generatedAt": "2018-05-31T23:56:48.479Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:28.738Z", - "deployTransactionHash": "0x3a9a6a75ba6d42ac8b581fd9a560317a22309f425e0d0e1faad5243b571edb7f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "b1f4223998740495884af010a7935166", - "deployedBytecodeHash": "056bca4e150103c5c45b9eff68e5f952", - "sourceHash": "9a624a36ae15529e7434fd305f347c8b", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisorContract\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - } - } - }, - "11b039ce783db308e1a9b5f46f05824f": { - "latestDeployedAddress": "0x1efb52b6aacc403cc9d762282b2aec1b066931c5", - "deployments": { - "0x1efb52b6aacc403cc9d762282b2aec1b066931c5": { - "generatedAt": "2018-10-18T13:35:02.360Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.821Z", - "deployTransactionHash": "0x5e3f2463c5ec4fcc56eb8210b534253f58e5b77d4190d013ec8a85dd662cbd4c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3994e47ec4faf784d97e783d6e3de64d", - "deployedBytecodeHash": "9b8b05d9a455663e6bc0b4aa953ef26e", - "sourceHash": "3ae3310cda808efba999807e54bf8c9b", - "source": "/* Contract to hold earned interest from loans repaid\n premiums for locks are being accrued (i.e. transferred) to Locker */\n\npragma solidity 0.4.24;\nimport \"./generic/SystemAccount.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\n\n\ncontract InterestEarnedAccount is SystemAccount {\n\n constructor(address permissionGranterContract) public SystemAccount(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function transferInterest(AugmintTokenInterface augmintToken, address locker, uint interestAmount)\n external restrict(\"MonetarySupervisor\") {\n augmintToken.transfer(locker, interestAmount);\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/LoanManager_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/LoanManager_DEPLOYS.json deleted file mode 100644 index 518d51d..0000000 --- a/src/augmintjs/abiniser/deployments/999/LoanManager_DEPLOYS.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "contractName": "LoanManager", - "latestAbiHash": "fdf5fde95aa940c6dbfb8353c572c5fb", - "deployedAbis": { - "dd8d5ec97e0a22b6f9e63b04d4e11e09": { - "latestDeployedAddress": "0x72ab340874d8189778d5b4def3eaabc9069da7f2", - "deployments": { - "0x72ab340874d8189778d5b4def3eaabc9069da7f2": { - "generatedAt": "2018-04-25T12:29:07.585Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:28:03.482Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "aa67baec70431e71c2be8d412df7f2d8", - "deployedBytecodeHash": "9906a9c556eabbf516789bbd2510ca24", - "sourceHash": "759bfe882bcce74bc3b207640322e232", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - interestEarnedAccount setter?\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - create and use InterestEarnedAccount interface instead?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.19;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n enum LoanState { Open, Repaid, Defaulted }\n\n struct LoanProduct {\n uint term; // 0\n uint discountRate; // 1: discountRate in parts per million , ie. 10,000 = 1%\n uint collateralRatio; // 2: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint minDisbursedAmount; // 3: with 4 decimals, e.g. 31000 = 3.1ACE\n uint defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n struct LoanData {\n address borrower; // 0\n LoanState state; // 1\n uint collateralAmount; // 2\n uint repaymentAmount; // 3\n uint loanAmount; // 4\n uint interestAmount; // 5\n uint term; // 6\n uint disbursementDate; // 7\n uint maturity; // 8\n uint defaultingFeePt; // 9\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public mLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n InterestEarnedAccount public interestEarnedAccount;\n\n event NewLoan(uint productId, uint loanId, address borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount);\n\n event LoanProductActiveStateChanged(uint productId, bool newState);\n\n event LoanProductAdded(uint productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint indexed loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n function LoanManager(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor, Rates _rates,\n InterestEarnedAccount _interestEarnedAccount)\n public {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n interestEarnedAccount = _interestEarnedAccount;\n }\n\n function addLoanProduct(uint _term, uint _discountRate, uint _collateralRatio, uint _minDisbursedAmount,\n uint _defaultingFee, bool _isActive)\n external restrict(\"MonetaryBoard\") returns (uint newProductId) {\n newProductId = products.push(\n LoanProduct(_term, _discountRate, _collateralRatio, _minDisbursedAmount, _defaultingFee, _isActive)\n ) - 1;\n\n LoanProductAdded(newProductId);\n return newProductId;\n }\n\n function setLoanProductActiveState(uint8 productId, bool newState)\n external restrict (\"MonetaryBoard\") {\n products[productId].isActive = false;\n LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint8 productId) external payable {\n require(products[productId].isActive); // valid productId?\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(products[productId].collateralRatio).roundedDiv(100000000);\n repaymentAmount = repaymentAmount * 100; // rounding 4 decimals value to 2 decimals.\n // no safe mul needed b/c of prev divide\n\n uint mul = products[productId].collateralRatio.mul(products[productId].discountRate) / 1000000;\n uint loanAmount = tokenValue.mul(mul).roundedDiv(100000000);\n loanAmount = loanAmount * 100; // rounding 4 decimals value to 2 decimals.\n // no safe mul needed b/c of prev divide\n\n require(loanAmount >= products[productId].minDisbursedAmount);\n uint interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n\n // Create new loan\n uint loanId = loans.push(\n LoanData(msg.sender, LoanState.Open, msg.value, repaymentAmount, loanAmount,\n interestAmount, products[productId].term, now, now + products[productId].term,\n products[productId].defaultingFeePt)\n ) - 1;\n\n // Store ref to new loan\n mLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n for (uint i = 0; i < loanIds.length; i++) {\n uint loanId = loanIds[i];\n require(loans[loanId].state == LoanState.Open);\n require(now >= loans[loanId].maturity);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loans[loanId].loanAmount);\n\n loans[loanId].state = LoanState.Defaulted;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loans[loanId].repaymentAmount.mul(loans[loanId].defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(), loans[loanId].repaymentAmount)\n .add(defaultingFee);\n uint releasedCollateral;\n if (targetCollection < loans[loanId].collateralAmount) {\n releasedCollateral = loans[loanId].collateralAmount.sub(targetCollection);\n loans[loanId].borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loans[loanId].collateralAmount.sub(releasedCollateral);\n if (defaultingFee > collateralToCollect) {\n defaultingFee = collateralToCollect;\n }\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n LoanCollected(loanId, loans[loanId].borrower, collateralToCollect, releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n monetarySupervisor.augmintReserves().transfer(totalCollateralToCollect);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n function getLoanIds(address borrower) external view returns (uint[] _loans) {\n return mLoans[borrower];\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) public {\n require(msg.sender == address(augmintToken));\n _repayLoan(loanId, repaymentAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loans[loanId].state == LoanState.Open);\n require(now <= loans[loanId].maturity);\n require(loans[loanId].repaymentAmount == repaymentAmount);\n loans[loanId].state = LoanState.Repaid;\n\n augmintToken.transfer(interestEarnedAccount, loans[loanId].interestAmount);\n\n augmintToken.burn(loans[loanId].loanAmount);\n monetarySupervisor.loanRepaymentNotification(loans[loanId].loanAmount); // update KPIs\n\n loans[loanId].borrower.transfer(loans[loanId].collateralAmount); // send back ETH collateral\n\n LoanRepayed(loanId, loans[loanId].borrower);\n }\n\n}\n" - } - } - }, - "d72d3bd9689dba0d1a8cd4ec23757257": { - "latestDeployedAddress": "0x6d3c4ce65b4b1267804e011120f3359d44a3a1a3", - "deployments": { - "0x6d3c4ce65b4b1267804e011120f3359d44a3a1a3": { - "generatedAt": "2018-04-25T12:30:49.374Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:36:28.169Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "9aa1d3b1d7b1c4593514e33e4854ac41", - "deployedBytecodeHash": "60180139c1bd8c2e65ca93a4a5023884", - "sourceHash": "5663e971bf347b437fd2860c13e65ea1", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - interestEarnedAccount setter?\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - create and use InterestEarnedAccount interface instead?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.19;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n InterestEarnedAccount public interestEarnedAccount;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n function LoanManager(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor, Rates _rates,\n InterestEarnedAccount _interestEarnedAccount)\n public {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n interestEarnedAccount = _interestEarnedAccount;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId);\n\n LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"MonetaryBoard\") {\n products[productId].isActive = false;\n LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n LoanProduct storage product = products[productId];\n require(product.isActive); // valid productId?\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount);\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration);\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n for (uint i = 0; i < loanIds.length; i++) {\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open);\n require(now >= loan.maturity);\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee > collateralToCollect) {\n defaultingFee = collateralToCollect;\n }\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n LoanCollected(loanIds[i], loan.borrower, collateralToCollect, releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n monetarySupervisor.augmintReserves().transfer(totalCollateralToCollect);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive ]\n function getProducts(uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt, product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) public {\n require(msg.sender == address(augmintToken));\n _repayLoan(loanId, repaymentAmount);\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open);\n require(repaymentAmount == loan.repaymentAmount);\n require(now <= loan.maturity);\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(interestEarnedAccount, interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - } - } - }, - "291572b8d2ffe95dca1733ebc1472e08": { - "latestDeployedAddress": "0xb47028142d73d199c4b6a1dd837fb39e3cf93f13", - "deployments": { - "0x9b17fd903246da0b0304e0e984389dabd1ae6a8c": { - "generatedAt": "2018-04-26T14:50:56.186Z", - "truffleContractFileUpdatedAt": "2018-04-26T14:50:44.207Z", - "deployTransactionHash": "0xe9760ff3fc6981a8e1c951cff90306e281159792287d53eb4565783c68200030", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "9b2af2190d11f139267470192e159dae", - "deployedBytecodeHash": "efd0e7f623cf1fab5dbce721e75be938", - "sourceHash": "9d5f96db98b6d336c18b8c6df5c7cd92", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity ^0.4.23;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor, Rates _rates)\n public {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"MonetaryBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = false;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(i < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee), releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0){\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - }, - "0x6d3c4ce65b4b1267804e011120f3359d44a3a1a3": { - "generatedAt": "2018-04-30T10:44:44.312Z", - "truffleContractFileUpdatedAt": "2018-04-30T10:44:29.276Z", - "deployTransactionHash": "0x6ababb66c1c011c88674b028136a25fd0434b53de433d5cac0ba3d69e5848000", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "9b2af2190d11f139267470192e159dae", - "deployedBytecodeHash": "efd0e7f623cf1fab5dbce721e75be938", - "sourceHash": "9d5f96db98b6d336c18b8c6df5c7cd92", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity ^0.4.23;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor, Rates _rates)\n public {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"MonetaryBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = false;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(i < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee), releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0){\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - }, - "0x8280d8de1424a92f69a4055e5666d2e1e6950a33": { - "generatedAt": "2018-05-12T00:22:15.222Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:12.428Z", - "deployTransactionHash": "0xbe49c6789885926bfcd5c5ac1322f41fbe2b380e202cde626ca337bc93a21203", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "feef104fe0b04cf9bde178c2f8ee4c04", - "deployedBytecodeHash": "d16030995b358f9fd29dafc6df7e6d35", - "sourceHash": "9d5f96db98b6d336c18b8c6df5c7cd92", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity ^0.4.23;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor, Rates _rates)\n public {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"MonetaryBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = false;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(i < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee), releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0){\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"MonetaryBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - }, - "0xb47028142d73d199c4b6a1dd837fb39e3cf93f13": { - "generatedAt": "2018-05-31T23:56:48.589Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.512Z", - "deployTransactionHash": "0x113dee4896101c371a3cb214e07847b9b5d3efaab75bdff90f13617c0ad8ea56", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "96f4b3244bc55277110afc130c8178ca", - "deployedBytecodeHash": "32891ebaec80d3cf6561e209ccc0c46b", - "sourceHash": "78c31332f74dc7f47dcbe30b764bb754", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor, Rates _rates)\n public {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoardSignerContract\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoardSignerContract\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = false;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(i < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee), releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0){\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoardSignerContract\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - } - } - }, - "ec709c3341045caa3a75374b8cfc7286": { - "latestDeployedAddress": "0x213135c85437c23bc529a2ee9c2980646c332fcb", - "deployments": { - "0x213135c85437c23bc529a2ee9c2980646c332fcb": { - "generatedAt": "2018-08-14T19:51:18.122Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:59.315Z", - "deployTransactionHash": "0xb27807db5aba8a016eceff16ca672d7e7d43f4bd96034646b1e32ef52fd04d9c", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "f4fe8f33fd6fa9d301a30b88444b52f6", - "deployedBytecodeHash": "748f315cf4d5785e681c636774aab06a", - "sourceHash": "184d41cf8c8c034dc64e026f5d33bc3c", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted {\n using SafeMath for uint256;\n\n uint16 public constant CHUNK_SIZE = 100;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = false;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(i < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee), releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0){\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint ct) {\n return products.length;\n }\n\n // returns CHUNK_SIZE loan products starting from some offset:\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= products.length) { break; }\n\n LoanProduct storage product = products[offset + i];\n\n response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n }\n\n function getLoanCount() external view returns (uint ct) {\n return loans.length;\n }\n\n /* returns CHUNK_SIZE loans starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoans(uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loans.length) { break; }\n\n response[i] = getLoanTuple(offset + i);\n }\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns CHUNK_SIZE loans of a given account, starting from some offset. Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset) external view returns (uint[10][CHUNK_SIZE] response) {\n\n uint[] storage loansForAddress = accountLoans[borrower];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= loansForAddress.length) { break; }\n\n response[i] = getLoanTuple(loansForAddress[offset + i]);\n }\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n\n}\n" - } - } - }, - "fdf5fde95aa940c6dbfb8353c572c5fb": { - "latestDeployedAddress": "0x213135c85437c23bc529a2ee9c2980646c332fcb", - "deployments": { - "0x213135c85437c23bc529a2ee9c2980646c332fcb": { - "generatedAt": "2018-10-18T13:35:02.404Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:37.002Z", - "deployTransactionHash": "0xb22fb6501cdcc6b9bfe2ee1ca2e111047085674e2f9dd120a8dde83ffeaf872e", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "591f565c201032e0df4b9f7798e7ec85", - "deployedBytecodeHash": "e93edcccad1eb8f9142f6c257bb23bdd", - "sourceHash": "234fd5848af85ca2444c888fd6ba61aa", - "source": "/*\n Contract to manage Augmint token loan contracts backed by ETH\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/loanFlow.png\n\n TODO:\n - create MonetarySupervisor interface and use it instead?\n - make data arg generic bytes?\n - make collect() run as long as gas provided allows\n*/\npragma solidity 0.4.24;\n\nimport \"./Rates.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\n\n\ncontract LoanManager is Restricted, TokenReceiver {\n using SafeMath for uint256;\n\n enum LoanState { Open, Repaid, Defaulted, Collected } // NB: Defaulted state is not stored, only getters calculate\n\n struct LoanProduct {\n uint minDisbursedAmount; // 0: with decimals set in AugmintToken.decimals\n uint32 term; // 1\n uint32 discountRate; // 2: discountRate in parts per million , ie. 10,000 = 1%\n uint32 collateralRatio; // 3: loan token amount / colleteral pegged ccy value\n // in parts per million , ie. 10,000 = 1%\n uint32 defaultingFeePt; // 4: % of collateral in parts per million , ie. 50,000 = 5%\n bool isActive; // 5\n }\n\n /* NB: we don't need to store loan parameters because loan products can't be altered (only disabled/enabled) */\n struct LoanData {\n uint collateralAmount; // 0\n uint repaymentAmount; // 1\n address borrower; // 2\n uint32 productId; // 3\n LoanState state; // 4\n uint40 maturity; // 5\n }\n\n LoanProduct[] public products;\n\n LoanData[] public loans;\n mapping(address => uint[]) public accountLoans; // owner account address => array of loan Ids\n\n Rates public rates; // instance of ETH/pegged currency rate provider contract\n AugmintTokenInterface public augmintToken; // instance of token contract\n MonetarySupervisor public monetarySupervisor;\n\n event NewLoan(uint32 productId, uint loanId, address indexed borrower, uint collateralAmount, uint loanAmount,\n uint repaymentAmount, uint40 maturity);\n\n event LoanProductActiveStateChanged(uint32 productId, bool newState);\n\n event LoanProductAdded(uint32 productId);\n\n event LoanRepayed(uint loanId, address borrower);\n\n event LoanCollected(uint loanId, address indexed borrower, uint collectedCollateral,\n uint releasedCollateral, uint defaultingFee);\n\n event SystemContractsChanged(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor, Rates _rates)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n rates = _rates;\n }\n\n function addLoanProduct(uint32 term, uint32 discountRate, uint32 collateralRatio, uint minDisbursedAmount,\n uint32 defaultingFeePt, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newProductId = products.push(\n LoanProduct(minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, isActive)\n ) - 1;\n\n uint32 newProductId = uint32(_newProductId);\n require(newProductId == _newProductId, \"productId overflow\");\n\n emit LoanProductAdded(newProductId);\n }\n\n function setLoanProductActiveState(uint32 productId, bool newState)\n external restrict (\"StabilityBoard\") {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n products[productId].isActive = newState;\n emit LoanProductActiveStateChanged(productId, newState);\n }\n\n function newEthBackedLoan(uint32 productId) external payable {\n require(productId < products.length, \"invalid productId\"); // next line would revert but require to emit reason\n LoanProduct storage product = products[productId];\n require(product.isActive, \"product must be in active state\"); // valid product\n\n\n // calculate loan values based on ETH sent in with Tx\n uint tokenValue = rates.convertFromWei(augmintToken.peggedSymbol(), msg.value);\n uint repaymentAmount = tokenValue.mul(product.collateralRatio).div(1000000);\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, repaymentAmount);\n\n require(loanAmount >= product.minDisbursedAmount, \"loanAmount must be >= minDisbursedAmount\");\n\n uint expiration = now.add(product.term);\n uint40 maturity = uint40(expiration);\n require(maturity == expiration, \"maturity overflow\");\n\n // Create new loan\n uint loanId = loans.push(LoanData(msg.value, repaymentAmount, msg.sender,\n productId, LoanState.Open, maturity)) - 1;\n\n // Store ref to new loan\n accountLoans[msg.sender].push(loanId);\n\n // Issue tokens and send to borrower\n monetarySupervisor.issueLoan(msg.sender, loanAmount);\n\n emit NewLoan(productId, loanId, msg.sender, msg.value, loanAmount, repaymentAmount, maturity);\n }\n\n /* repay loan, called from AugmintToken's transferAndNotify\n Flow for repaying loan:\n 1) user calls token contract's transferAndNotify loanId passed in data arg\n 2) transferAndNotify transfers tokens to the Lender contract\n 3) transferAndNotify calls Lender.transferNotification with lockProductId\n */\n // from arg is not used as we allow anyone to repay a loan:\n function transferNotification(address, uint repaymentAmount, uint loanId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n\n _repayLoan(loanId, repaymentAmount);\n }\n\n function collect(uint[] loanIds) external {\n /* when there are a lots of loans to be collected then\n the client need to call it in batches to make sure tx won't exceed block gas limit.\n Anyone can call it - can't cause harm as it only allows to collect loans which they are defaulted\n TODO: optimise defaulting fee calculations\n */\n uint totalLoanAmountCollected;\n uint totalCollateralToCollect;\n uint totalDefaultingFee;\n for (uint i = 0; i < loanIds.length; i++) {\n require(loanIds[i] < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanIds[i]];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(now >= loan.maturity, \"current time must be later than maturity\");\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n (loanAmount, ) = calculateLoanValues(product, loan.repaymentAmount);\n\n totalLoanAmountCollected = totalLoanAmountCollected.add(loanAmount);\n\n loan.state = LoanState.Collected;\n\n // send ETH collateral to augmintToken reserve\n uint defaultingFeeInToken = loan.repaymentAmount.mul(product.defaultingFeePt).div(1000000);\n uint defaultingFee = rates.convertToWei(augmintToken.peggedSymbol(), defaultingFeeInToken);\n uint targetCollection = rates.convertToWei(augmintToken.peggedSymbol(),\n loan.repaymentAmount).add(defaultingFee);\n\n uint releasedCollateral;\n if (targetCollection < loan.collateralAmount) {\n releasedCollateral = loan.collateralAmount.sub(targetCollection);\n loan.borrower.transfer(releasedCollateral);\n }\n uint collateralToCollect = loan.collateralAmount.sub(releasedCollateral);\n if (defaultingFee >= collateralToCollect) {\n defaultingFee = collateralToCollect;\n collateralToCollect = 0;\n } else {\n collateralToCollect = collateralToCollect.sub(defaultingFee);\n }\n totalDefaultingFee = totalDefaultingFee.add(defaultingFee);\n\n totalCollateralToCollect = totalCollateralToCollect.add(collateralToCollect);\n\n emit LoanCollected(loanIds[i], loan.borrower, collateralToCollect.add(defaultingFee),\n releasedCollateral, defaultingFee);\n }\n\n if (totalCollateralToCollect > 0) {\n address(monetarySupervisor.augmintReserves()).transfer(totalCollateralToCollect);\n }\n\n if (totalDefaultingFee > 0) {\n address(augmintToken.feeAccount()).transfer(totalDefaultingFee);\n }\n\n monetarySupervisor.loanCollectionNotification(totalLoanAmountCollected);// update KPIs\n\n }\n\n /* to allow upgrade of Rates and MonetarySupervisor contracts */\n function setSystemContracts(Rates newRatesContract, MonetarySupervisor newMonetarySupervisor)\n external restrict(\"StabilityBoard\") {\n rates = newRatesContract;\n monetarySupervisor = newMonetarySupervisor;\n emit SystemContractsChanged(newRatesContract, newMonetarySupervisor);\n }\n\n function getProductCount() external view returns (uint) {\n return products.length;\n }\n\n // returns loan products starting from some :\n // [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]\n function getProducts(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), products.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LoanProduct storage product = products[i];\n response[i - offset] = [i, product.minDisbursedAmount, product.term, product.discountRate,\n product.collateralRatio, product.defaultingFeePt,\n monetarySupervisor.getMaxLoanAmount(product.minDisbursedAmount), product.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLoanCount() external view returns (uint) {\n return loans.length;\n }\n\n /* returns loans starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId,\n state, maturity, disbursementTime, loanAmount, interestAmount] */\n function getLoans(uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), loans.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(i);\n }\n return response;\n }\n\n function getLoanCountForAddress(address borrower) external view returns (uint) {\n return accountLoans[borrower].length;\n }\n\n /* returns loans of a given account, starting from some . Loans data encoded as:\n [loanId, collateralAmount, repaymentAmount, borrower, productId, state, maturity, disbursementTime,\n loanAmount, interestAmount ] */\n function getLoansForAddress(address borrower, uint offset, uint16 chunkSize)\n external view returns (uint[10][]) {\n uint[] storage loansForAddress = accountLoans[borrower];\n uint limit = SafeMath.min(offset.add(chunkSize), loansForAddress.length);\n uint[10][] memory response = new uint[10][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n response[i - offset] = getLoanTuple(loansForAddress[i]);\n }\n return response;\n }\n\n function getLoanTuple(uint loanId) public view returns (uint[10] result) {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n LoanProduct storage product = products[loan.productId];\n\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n uint disbursementTime = loan.maturity - product.term;\n\n LoanState loanState =\n loan.state == LoanState.Open && now >= loan.maturity ? LoanState.Defaulted : loan.state;\n\n result = [loanId, loan.collateralAmount, loan.repaymentAmount, uint(loan.borrower),\n loan.productId, uint(loanState), loan.maturity, disbursementTime, loanAmount, interestAmount];\n }\n\n function calculateLoanValues(LoanProduct storage product, uint repaymentAmount)\n internal view returns (uint loanAmount, uint interestAmount) {\n // calculate loan values based on repayment amount\n loanAmount = repaymentAmount.mul(product.discountRate).div(1000000);\n interestAmount = loanAmount > repaymentAmount ? 0 : repaymentAmount.sub(loanAmount);\n }\n\n /* internal function, assuming repayment amount already transfered */\n function _repayLoan(uint loanId, uint repaymentAmount) internal {\n require(loanId < loans.length, \"invalid loanId\"); // next line would revert but require to emit reason\n LoanData storage loan = loans[loanId];\n require(loan.state == LoanState.Open, \"loan state must be Open\");\n require(repaymentAmount == loan.repaymentAmount, \"repaymentAmount must be equal to tokens sent\");\n require(now <= loan.maturity, \"current time must be earlier than maturity\");\n\n LoanProduct storage product = products[loan.productId];\n uint loanAmount;\n uint interestAmount;\n (loanAmount, interestAmount) = calculateLoanValues(product, loan.repaymentAmount);\n\n loans[loanId].state = LoanState.Repaid;\n\n if (interestAmount > 0) {\n augmintToken.transfer(monetarySupervisor.interestEarnedAccount(), interestAmount);\n augmintToken.burn(loanAmount);\n } else {\n // negative or zero interest (i.e. discountRate >= 0)\n augmintToken.burn(repaymentAmount);\n }\n\n monetarySupervisor.loanRepaymentNotification(loanAmount); // update KPIs\n\n loan.borrower.transfer(loan.collateralAmount); // send back ETH collateral\n\n emit LoanRepayed(loanId, loan.borrower);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/Locker_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/Locker_DEPLOYS.json deleted file mode 100644 index 13f9b03..0000000 --- a/src/augmintjs/abiniser/deployments/999/Locker_DEPLOYS.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "contractName": "Locker", - "latestAbiHash": "f59526398823aef0f0c1454d0b6b4eac", - "deployedAbis": { - "6055e2cba8c8e9cb7e04b10e4c56ab9a": { - "latestDeployedAddress": "0x8fd4d02f46ec6c92924780d2bf35ae31078db9c5", - "deployments": { - "0x8fd4d02f46ec6c92924780d2bf35ae31078db9c5": { - "generatedAt": "2018-04-25T12:29:07.651Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:29:32.229Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "66f7b66ff12fcb40830b0b95777fb852", - "deployedBytecodeHash": "75adc582771c489bbe9ef06428e8e6cf", - "sourceHash": "1135716bfcd72d7542f37f36acc8673e", - "source": "/* contract for tracking locked funds etc.\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO:\n - create MonetarySupervisorInterface and use it instead of MonetarySupervisor\n - monetarySupervisor setter?\n - store locks in array so we can iterate over them\n\n to do/think about:\n -> self-destruct function?\n -> return only active loan products from getLoanProducts?\n*/\n\npragma solidity 0.4.19;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n event NewLockProduct(uint indexed lockProductId, uint perTermInterest, uint durationInSecs,\n uint minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint indexed lockIndex, uint amountLocked, uint interestEarned,\n uint lockedUntil, uint perTermInterest, uint durationInSecs, bool isActive);\n\n event LockReleased(address indexed lockOwner, uint indexed lockIndex);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint perTermInterest;\n uint durationInSecs;\n uint minimumLockAmount;\n bool isActive;\n }\n\n struct Lock {\n uint amountLocked;\n uint interestEarned;\n uint lockedUntil;\n uint perTermInterest;\n uint durationInSecs;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n // per account locks (i.e. an id for a lock is a tuple (owner, index)):\n mapping(address => Lock[]) public locks;\n\n function Locker(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor) public {\n\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint perTermInterest, uint durationInSecs, uint minimumLockAmount, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint lockProductId, bool isActive) external restrict(\"MonetaryBoard\") {\n\n require(lockProductId < lockProducts.length);\n lockProducts[lockProductId].isActive = isActive;\n LockProductActiveChange(lockProductId, isActive);\n\n }\n\n function releaseFunds(address lockOwner, uint lockIndex) external {\n\n Lock storage lock = locks[lockOwner][lockIndex];\n\n require(lock.isActive && now >= lock.lockedUntil);\n\n lock.isActive = false;\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lockOwner, lock.amountLocked.add(lock.interestEarned),\n \"Funds released from lock\");\n\n LockReleased(lockOwner, lockIndex);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[4][20]) {\n\n uint[4][20] memory response;\n\n for (uint8 i = 0; i < 20; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs,\n lockProduct.minimumLockAmount, lockProduct.isActive ? 1 : 0 ];\n\n }\n\n return response;\n\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n\n return locks[lockOwner].length;\n\n }\n\n // returns 20 locks starting from some offset\n // lock products are encoded as\n // [amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[6][20]) {\n\n Lock[] storage locksForAddress = locks[lockOwner];\n uint[6][20] memory response;\n\n for (uint8 i = 0; i < 20; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locksForAddress[offset + i];\n\n response[i] = [ lock.amountLocked, lock.interestEarned, lock.lockedUntil, lock.perTermInterest,\n lock.durationInSecs, lock.isActive ? 1 : 0 ];\n\n }\n\n return response;\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint lockProductId) public {\n require(msg.sender == address(augmintToken));\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function calculateInterestForLockProduct(uint lockProductId, uint amountToLock) public view returns (uint) {\n\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive);\n require(amountToLock >= lockProduct.minimumLockAmount);\n\n uint interestEarned = amountToLock.mul(lockProduct.perTermInterest).div(1000000);\n\n return interestEarned;\n\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint lockProductId, address lockOwner, uint amountToLock) internal returns (uint) {\n\n // NB: calculateInterestForLockProduct will validate the lock product and amountToLock:\n uint interestEarned = calculateInterestForLockProduct(lockProductId, amountToLock);\n\n LockProduct storage lockProduct = lockProducts[lockProductId];\n\n uint lockedUntil = now.add(lockProduct.durationInSecs);\n uint lockIndex = locks[lockOwner].push(Lock(amountToLock, interestEarned, lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, true)) - 1;\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n NewLock(lockOwner, lockIndex, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs, true);\n\n return interestEarned;\n }\n\n}\n" - } - } - }, - "c95c1ab8f11cd983deebbe203f4d49be": { - "latestDeployedAddress": "0xc56757df630980ddcd4e788d0ccf73574a1838ab", - "deployments": { - "0xc56757df630980ddcd4e788d0ccf73574a1838ab": { - "generatedAt": "2018-04-25T12:30:49.440Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:36:28.125Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "1ee8107823c445557e111187d4dc2fe1", - "deployedBytecodeHash": "a90b815047f5c6925b959452739394ee", - "sourceHash": "d32907ca14fc212ac860efcefb66c83b", - "source": "/* contract for tracking locked funds etc.\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n - monetarySupervisor setter?\n\n to do/think about:\n -> self-destruct function?\n -> return only active loan products from getLoanProducts?\n*/\n\npragma solidity 0.4.19;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs, bool isActive);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n function Locker(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor) public {\n\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId);\n NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"MonetaryBoard\") {\n\n require(lockProductId < lockProducts.length);\n lockProducts[lockProductId].isActive = isActive;\n LockProductActiveChange(lockProductId, isActive);\n\n }\n\n function releaseFunds(uint lockId) external {\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive);\n require(now >= lock.lockedUntil);\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n LockReleased(lock.owner, lockId);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint32[4][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs,\n lockProduct.minimumLockAmount, lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) public {\n require(msg.sender == address(augmintToken));\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId);\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).div(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive);\n require(amountToLock >= lockProduct.minimumLockAmount);\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration);\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs, true);\n }\n\n}\n" - } - } - }, - "66e3e89133d9bbd91baac5552f21f7e1": { - "latestDeployedAddress": "0x08f7b3c41b347c6603119412a324f6608194b57f", - "deployments": { - "0xe3f2872407243412e4753a77f75eda2269f02da2": { - "generatedAt": "2018-04-26T14:50:56.210Z", - "truffleContractFileUpdatedAt": "2018-04-26T14:50:44.242Z", - "deployTransactionHash": "0x249f764b25cefb3652520d0c3dd3ca20c90c5619c664da5131c396320c213ab2", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "2c6ce8f98482b1d83e432eeb23536574", - "deployedBytecodeHash": "c0a9aa9f3a0bb633f930f11515b1d0b6", - "sourceHash": "7ffe14f90465530802dc1f5762e0217f", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity ^0.4.23;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor) public {\n\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"MonetaryBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"MonetaryBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).div(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - }, - "0x664cf487408a31c812fc3e8a875d26bf26b604d8": { - "generatedAt": "2018-04-30T10:44:44.341Z", - "truffleContractFileUpdatedAt": "2018-04-30T10:44:29.257Z", - "deployTransactionHash": "0xef7d363deef3203326294e370f199976b3f3448289267de68051eb3fdc738762", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "2c6ce8f98482b1d83e432eeb23536574", - "deployedBytecodeHash": "c0a9aa9f3a0bb633f930f11515b1d0b6", - "sourceHash": "7ffe14f90465530802dc1f5762e0217f", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity ^0.4.23;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor) public {\n\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"MonetaryBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"MonetaryBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).div(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - }, - "0x3444841a0e3417fd486aebc096ef3e67b75d7939": { - "generatedAt": "2018-05-12T00:22:15.251Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:12.442Z", - "deployTransactionHash": "0x7d1abed1db9494281c59fa6b7242aed68c8fe109ba641c6714bdb6bd70d30627", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "c6c9a4350153bfd4b81eaf228df169f4", - "deployedBytecodeHash": "878366e51dfa79329645837646563469", - "sourceHash": "7ffe14f90465530802dc1f5762e0217f", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity ^0.4.23;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor) public {\n\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"MonetaryBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"MonetaryBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"MonetaryBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).div(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - }, - "0x08f7b3c41b347c6603119412a324f6608194b57f": { - "generatedAt": "2018-05-31T23:56:48.648Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.567Z", - "deployTransactionHash": "0xa8792b8e7ea6f09d5c04575b7479c7fd8bb5387a3ac3227346c796b0f15d47db", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "1d3844fdcfe377c1d77109548d4c03c1", - "deployedBytecodeHash": "7ecad473f89755346869451c10e0e56a", - "sourceHash": "45b7822ca3d09ba1a9cb34a0cecc6610", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(AugmintTokenInterface _augmintToken, MonetarySupervisor _monetarySupervisor) public {\n\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoardSignerContract\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoardSignerContract\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoardSignerContract\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).div(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - } - } - }, - "619ff7809b73aead28176fe6317953c3": { - "latestDeployedAddress": "0x26b4ababb98fcadd579f28e9c30931bbbe66fc88", - "deployments": { - "0x26b4ababb98fcadd579f28e9c30931bbbe66fc88": { - "generatedAt": "2018-08-14T19:51:18.170Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:59.304Z", - "deployTransactionHash": "0xf20bcb8da89378ff7e87984323ceadd194f077400aa2814076f904a78e311061", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "d70fd016b0dd90d831c6fa598f5db895", - "deployedBytecodeHash": "53ea6691d90091a48438f4e80961c2f7", - "sourceHash": "0bc34f96859842d6cde3876ee878a209", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n require(lockProductId == _lockProductId, \"lockProductId overflow\");\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n\n return lockProducts.length;\n\n }\n\n // returns 20 lock products starting from some offset\n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset) external view returns (uint[5][CHUNK_SIZE] response) {\n for (uint8 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= lockProducts.length) { break; }\n\n LockProduct storage lockProduct = lockProducts[offset + i];\n\n response[i] = [ lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns CHUNK_SIZE locks starting from some offset\n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset) external view returns (uint[8][CHUNK_SIZE] response) {\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locks.length) { break; }\n\n Lock storage lock = locks[offset + i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [uint(offset + i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n }\n\n // returns CHUNK_SIZE locks of a given account, starting from some offset\n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset) external view returns (uint[7][CHUNK_SIZE] response) {\n\n uint[] storage locksForAddress = accountLocks[lockOwner];\n\n for (uint16 i = 0; i < CHUNK_SIZE; i++) {\n\n if (offset + i >= locksForAddress.length) { break; }\n\n Lock storage lock = locks[locksForAddress[offset + i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i] = [ locksForAddress[offset + i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).ceilDiv(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal returns(uint lockId) {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n\n}\n" - } - } - }, - "f59526398823aef0f0c1454d0b6b4eac": { - "latestDeployedAddress": "0x26b4ababb98fcadd579f28e9c30931bbbe66fc88", - "deployments": { - "0x26b4ababb98fcadd579f28e9c30931bbbe66fc88": { - "generatedAt": "2018-10-18T13:35:02.423Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.960Z", - "deployTransactionHash": "0xc7c614d66a755c9a7e1046a3eb03fb9caa64606d726368532dfea3de500bf2ba", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0fe102ad0cf754658fdb075cb2850270", - "deployedBytecodeHash": "211e0b56eb9155bf091df2937a90551d", - "sourceHash": "5fb19771489eecebfa02e95214887146", - "source": "/* contract for tracking locked funds\n\n requirements\n -> lock funds\n -> unlock funds\n -> index locks by address\n\n For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/lockFlow.png\n\n TODO / think about:\n -> self-destruct function?\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./generic/Restricted.sol\";\nimport \"./generic/SafeMath.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./MonetarySupervisor.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\n\n\ncontract Locker is Restricted, TokenReceiver {\n\n using SafeMath for uint256;\n\n event NewLockProduct(uint32 indexed lockProductId, uint32 perTermInterest, uint32 durationInSecs,\n uint32 minimumLockAmount, bool isActive);\n\n event LockProductActiveChange(uint32 indexed lockProductId, bool newActiveState);\n\n // NB: amountLocked includes the original amount, plus interest\n event NewLock(address indexed lockOwner, uint lockId, uint amountLocked, uint interestEarned,\n uint40 lockedUntil, uint32 perTermInterest, uint32 durationInSecs);\n\n event LockReleased(address indexed lockOwner, uint lockId);\n\n event MonetarySupervisorChanged(MonetarySupervisor newMonetarySupervisor);\n\n struct LockProduct {\n // perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n uint32 perTermInterest;\n uint32 durationInSecs;\n uint32 minimumLockAmount;\n bool isActive;\n }\n\n /* NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) */\n struct Lock {\n uint amountLocked;\n address owner;\n uint32 productId;\n uint40 lockedUntil;\n bool isActive;\n }\n\n AugmintTokenInterface public augmintToken;\n MonetarySupervisor public monetarySupervisor;\n\n LockProduct[] public lockProducts;\n\n Lock[] public locks;\n\n // lock ids for an account\n mapping(address => uint[]) public accountLocks;\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n MonetarySupervisor _monetarySupervisor)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n monetarySupervisor = _monetarySupervisor;\n\n }\n\n function addLockProduct(uint32 perTermInterest, uint32 durationInSecs, uint32 minimumLockAmount, bool isActive)\n external restrict(\"StabilityBoard\") {\n uint _newLockProductId = lockProducts.push(\n LockProduct(perTermInterest, durationInSecs, minimumLockAmount, isActive)) - 1;\n uint32 newLockProductId = uint32(_newLockProductId);\n require(newLockProductId == _newLockProductId, \"lockProduct overflow\");\n emit NewLockProduct(newLockProductId, perTermInterest, durationInSecs, minimumLockAmount, isActive);\n }\n\n function setLockProductActiveState(uint32 lockProductId, bool isActive) external restrict(\"StabilityBoard\") {\n // next line would revert but require to emit reason:\n require(lockProductId < lockProducts.length, \"invalid lockProductId\");\n\n lockProducts[lockProductId].isActive = isActive;\n emit LockProductActiveChange(lockProductId, isActive);\n }\n\n /* lock funds, called from AugmintToken's transferAndNotify\n Flow for locking tokens:\n 1) user calls token contract's transferAndNotify lockProductId passed in data arg\n 2) transferAndNotify transfers tokens to the Lock contract\n 3) transferAndNotify calls Lock.transferNotification with lockProductId\n */\n function transferNotification(address from, uint256 amountToLock, uint _lockProductId) external {\n require(msg.sender == address(augmintToken), \"msg.sender must be augmintToken\");\n // next line would revert but require to emit reason:\n require(_lockProductId < lockProducts.length, \"invalid lockProductId\");\n uint32 lockProductId = uint32(_lockProductId);\n /* TODO: make data arg generic bytes\n uint productId;\n assembly { // solhint-disable-line no-inline-assembly\n productId := mload(data)\n } */\n _createLock(lockProductId, from, amountToLock);\n }\n\n function releaseFunds(uint lockId) external {\n // next line would revert but require to emit reason:\n require(lockId < locks.length, \"invalid lockId\");\n Lock storage lock = locks[lockId];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n require(lock.isActive, \"lock must be in active state\");\n require(now >= lock.lockedUntil, \"current time must be later than lockedUntil\");\n\n lock.isActive = false;\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n monetarySupervisor.releaseFundsNotification(lock.amountLocked); // to maintain totalLockAmount\n augmintToken.transferWithNarrative(lock.owner, lock.amountLocked.add(interestEarned),\n \"Funds released from lock\");\n\n emit LockReleased(lock.owner, lockId);\n }\n\n function setMonetarySupervisor(MonetarySupervisor newMonetarySupervisor) external restrict(\"StabilityBoard\") {\n monetarySupervisor = newMonetarySupervisor;\n emit MonetarySupervisorChanged(newMonetarySupervisor);\n }\n\n function getLockProductCount() external view returns (uint) {\n return lockProducts.length;\n }\n\n // returns lock products starting from some \n // lock products are encoded as [ perTermInterest, durationInSecs, minimumLockAmount, maxLockAmount, isActive ]\n function getLockProducts(uint offset, uint16 chunkSize)\n external view returns (uint[5][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), lockProducts.length);\n uint[5][] memory response = new uint[5][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n LockProduct storage lockProduct = lockProducts[i];\n response[i - offset] = [lockProduct.perTermInterest, lockProduct.durationInSecs, lockProduct.minimumLockAmount,\n monetarySupervisor.getMaxLockAmount(lockProduct.minimumLockAmount, lockProduct.perTermInterest),\n lockProduct.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function getLockCount() external view returns (uint) {\n return locks.length;\n }\n\n function getLockCountForAddress(address lockOwner) external view returns (uint) {\n return accountLocks[lockOwner].length;\n }\n\n // returns locks starting from some \n // lock products are encoded as\n // [lockId, owner, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n // NB: perTermInterest is in millionths (i.e. 1,000,000 = 100%):\n function getLocks(uint offset, uint16 chunkSize)\n external view returns (uint[8][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), locks.length);\n uint[8][] memory response = new uint[8][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[i];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [uint(i), uint(lock.owner), lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0];\n }\n return response;\n }\n\n // returns locks of a given account, starting from some \n // lock products are encoded as\n // [lockId, amountLocked, interestEarned, lockedUntil, perTermInterest, durationInSecs, isActive ]\n function getLocksForAddress(address lockOwner, uint offset, uint16 chunkSize)\n external view returns (uint[7][]) {\n uint[] storage locksForAddress = accountLocks[lockOwner];\n uint limit = SafeMath.min(offset.add(chunkSize), locksForAddress.length);\n uint[7][] memory response = new uint[7][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n Lock storage lock = locks[locksForAddress[i]];\n LockProduct storage lockProduct = lockProducts[lock.productId];\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, lock.amountLocked);\n\n response[i - offset] = [locksForAddress[i], lock.amountLocked, interestEarned, lock.lockedUntil,\n lockProduct.perTermInterest, lockProduct.durationInSecs, lock.isActive ? 1 : 0 ];\n }\n return response;\n }\n\n function calculateInterest(uint32 perTermInterest, uint amountToLock) public pure returns (uint interestEarned) {\n interestEarned = amountToLock.mul(perTermInterest).ceilDiv(1000000);\n }\n\n // Internal function. assumes amountToLock is already transferred to this Lock contract\n function _createLock(uint32 lockProductId, address lockOwner, uint amountToLock) internal {\n LockProduct storage lockProduct = lockProducts[lockProductId];\n require(lockProduct.isActive, \"lockProduct must be in active state\");\n require(amountToLock >= lockProduct.minimumLockAmount, \"amountToLock must be >= minimumLockAmount\");\n\n uint interestEarned = calculateInterest(lockProduct.perTermInterest, amountToLock);\n uint expiration = now.add(lockProduct.durationInSecs);\n uint40 lockedUntil = uint40(expiration);\n require(lockedUntil == expiration, \"lockedUntil overflow\");\n\n uint lockId = locks.push(Lock(amountToLock, lockOwner, lockProductId, lockedUntil, true)) - 1;\n accountLocks[lockOwner].push(lockId);\n\n monetarySupervisor.requestInterest(amountToLock, interestEarned); // update KPIs & transfer interest here\n\n emit NewLock(lockOwner, lockId, amountToLock, interestEarned, lockedUntil, lockProduct.perTermInterest,\n lockProduct.durationInSecs);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/Migrations_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/Migrations_DEPLOYS.json deleted file mode 100644 index 134c931..0000000 --- a/src/augmintjs/abiniser/deployments/999/Migrations_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "Migrations", - "latestAbiHash": "78141a323f4a8416891b06a0a2b90065", - "deployedAbis": { - "78141a323f4a8416891b06a0a2b90065": { - "latestDeployedAddress": "0xd217ac4354211cda27dd4027b5e223280f885ad3", - "deployments": { - "0xd217ac4354211cda27dd4027b5e223280f885ad3": { - "generatedAt": "2018-10-18T13:35:02.323Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.823Z", - "deployTransactionHash": "0x844cbb39556551447a6dc5bc8a9298949e75f395a11329e133244ea06297133e", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3bd5779c94259890d586374c5db67f2b", - "deployedBytecodeHash": "f00491b62e24c57c6d12323c73c1037e", - "sourceHash": "16ee1835a27505e14d1b6990cdfa8c2c", - "source": "pragma solidity 0.4.24;\n\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration; // solhint-disable-line var-name-mixedcase\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) external restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address newAddress) external restricted {\n Migrations upgraded = Migrations(newAddress);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n" - }, - "0x78ca328135c3eed65d66ef6e611ec8ed166fa5b2": { - "generatedAt": "2018-05-31T23:56:48.426Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.559Z", - "deployTransactionHash": "0x3a2e51f26281565889c279bf31056ebce10d193d157dc91ebe8a24ac63ae9b7f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "f0557c3c790f279d198ef1d54ea5f550", - "deployedBytecodeHash": "1c74c56a535b7d558a79121649239bdf", - "sourceHash": "16ee1835a27505e14d1b6990cdfa8c2c", - "source": "pragma solidity 0.4.24;\n\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration; // solhint-disable-line var-name-mixedcase\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) external restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address newAddress) external restricted {\n Migrations upgraded = Migrations(newAddress);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/MonetarySupervisor_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/MonetarySupervisor_DEPLOYS.json deleted file mode 100644 index fd7ad41..0000000 --- a/src/augmintjs/abiniser/deployments/999/MonetarySupervisor_DEPLOYS.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "contractName": "MonetarySupervisor", - "latestAbiHash": "7f500b43397413e97de925528187f9cd", - "deployedAbis": { - "066c2220b91befd25691fefd91684117": { - "latestDeployedAddress": "0x88166fdc3c3e6768c375488fa45c90f1b904a767", - "deployments": { - "0x213135c85437c23bc529a2ee9c2980646c332fcb": { - "generatedAt": "2018-04-25T12:29:07.564Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:29:32.214Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "0c0d7f8840d3267bcc4625b5d0b07c6b", - "deployedBytecodeHash": "2931a2d6f8a22994a9f4ed26ac04aa59", - "sourceHash": "3d16faed337b9adec2d66024be645249", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n\n TODO:\n - MonetarySupervisorInterface (and use it everywhere)\n - interestEarnedAccount setter?\n - create and use InterestEarnedAccount interface instead?\n\n*/\n\npragma solidity 0.4.19;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByMonetaryBoard; // supply issued manually by monetary board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /* Parameters Used to ensure totalLoanAmount or totalLockedAmount difference is withing limit and system also works\n when any of those 0 or low. */\n uint public ltdDifferenceLimit; /* allow lock or loan if Loan To Deposut ratio stay within 1 +- this param\n stored as parts per million */\n uint public allowedLtdDifferenceAmount; /* in token - if totalLoan and totalLock difference is less than that\n then allow loan or lock even if ltdDifference limit would go off with it */\n\n event ParamsChanged(uint ltdDifferenceLimit, uint allowedLtdDifferenceAmount);\n\n function MonetarySupervisor(AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint _ltdDifferenceLimit, uint _allowedLtdDifferenceAmount) public {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdDifferenceLimit = _ltdDifferenceLimit;\n allowedLtdDifferenceAmount = _allowedLtdDifferenceAmount;\n }\n\n function issueToReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n // Locker requesting interest when locking funds\n function requestInterest(uint amountToLock, uint interestAmount) external {\n require(permissions[msg.sender][\"LockerContracts\"]); // only whitelisted LockerContracts\n /* TODO: enforce LTD limits (ltdDifferenceLimit & allowedLtdDifferenceAmount) */\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n require(permissions[msg.sender][\"LockerContracts\"]); // only whitelisted LockerContracts\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n function issueLoan(address borrower, uint loanAmount) external {\n require(permissions[msg.sender][\"LoanManagerContracts\"]); // only whitelisted LoanManager contracts\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n require(permissions[msg.sender][\"LoanManagerContracts\"]); // only whitelisted Lender contracts\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n require(permissions[msg.sender][\"LoanManagerContracts\"]); // only whitelisted Lender contracts\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setParams(uint _ltdDifferenceLimit, uint _allowedLtdDifferenceAmount)\n external restrict(\"MonetaryBoard\") {\n ltdDifferenceLimit = _ltdDifferenceLimit;\n allowedLtdDifferenceAmount = _allowedLtdDifferenceAmount;\n\n ParamsChanged(ltdDifferenceLimit, allowedLtdDifferenceAmount);\n }\n\n // helper function for FrontEnd to reduce calls\n function getParams() external view returns(uint[2]) {\n return [ltdDifferenceLimit, allowedLtdDifferenceAmount];\n }\n\n}\n" - }, - "0x88166fdc3c3e6768c375488fa45c90f1b904a767": { - "generatedAt": "2018-04-25T12:30:49.339Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:36:28.104Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "aaa00593c08a52c6bbce73d97d28e20a", - "deployedBytecodeHash": "6a662f2eb12115963b51303c0a7a0912", - "sourceHash": "3d16faed337b9adec2d66024be645249", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n\n TODO:\n - MonetarySupervisorInterface (and use it everywhere)\n - interestEarnedAccount setter?\n - create and use InterestEarnedAccount interface instead?\n\n*/\n\npragma solidity 0.4.19;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByMonetaryBoard; // supply issued manually by monetary board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /* Parameters Used to ensure totalLoanAmount or totalLockedAmount difference is withing limit and system also works\n when any of those 0 or low. */\n uint public ltdDifferenceLimit; /* allow lock or loan if Loan To Deposut ratio stay within 1 +- this param\n stored as parts per million */\n uint public allowedLtdDifferenceAmount; /* in token - if totalLoan and totalLock difference is less than that\n then allow loan or lock even if ltdDifference limit would go off with it */\n\n event ParamsChanged(uint ltdDifferenceLimit, uint allowedLtdDifferenceAmount);\n\n function MonetarySupervisor(AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint _ltdDifferenceLimit, uint _allowedLtdDifferenceAmount) public {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdDifferenceLimit = _ltdDifferenceLimit;\n allowedLtdDifferenceAmount = _allowedLtdDifferenceAmount;\n }\n\n function issueToReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n // Locker requesting interest when locking funds\n function requestInterest(uint amountToLock, uint interestAmount) external {\n require(permissions[msg.sender][\"LockerContracts\"]); // only whitelisted LockerContracts\n /* TODO: enforce LTD limits (ltdDifferenceLimit & allowedLtdDifferenceAmount) */\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n require(permissions[msg.sender][\"LockerContracts\"]); // only whitelisted LockerContracts\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n function issueLoan(address borrower, uint loanAmount) external {\n require(permissions[msg.sender][\"LoanManagerContracts\"]); // only whitelisted LoanManager contracts\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n require(permissions[msg.sender][\"LoanManagerContracts\"]); // only whitelisted Lender contracts\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n require(permissions[msg.sender][\"LoanManagerContracts\"]); // only whitelisted Lender contracts\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setParams(uint _ltdDifferenceLimit, uint _allowedLtdDifferenceAmount)\n external restrict(\"MonetaryBoard\") {\n ltdDifferenceLimit = _ltdDifferenceLimit;\n allowedLtdDifferenceAmount = _allowedLtdDifferenceAmount;\n\n ParamsChanged(ltdDifferenceLimit, allowedLtdDifferenceAmount);\n }\n\n // helper function for FrontEnd to reduce calls\n function getParams() external view returns(uint[2]) {\n return [ltdDifferenceLimit, allowedLtdDifferenceAmount];\n }\n\n}\n" - } - } - }, - "a552ee1f90ae83cb91d07311ae8eab1e": { - "latestDeployedAddress": "0x5d8f6ed90b17c65ed4dd2b1a0cef98cba385e79f", - "deployments": { - "0xbd68d7e5984c5000c432777e38c51554d9de1eaf": { - "generatedAt": "2018-04-26T14:50:56.159Z", - "truffleContractFileUpdatedAt": "2018-04-26T14:50:44.194Z", - "deployTransactionHash": "0xd38fe6fe69d2cdce07ea864e94d6e0d9c1c37c86243871d636ba8a3e868fd523", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "c41181b91537cc751d880d79baf095dd", - "deployedBytecodeHash": "afc07e949d0fc0522760e21001e6442e", - "sourceHash": "cbd67b35e74bbbc9ef5a78c3180eb002", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n\n TODO:\n - Mcreate and use MonetarySupervisorInterface?\n - create and use InterestEarnedAccount interface ?\n\n*/\n\npragma solidity ^0.4.23;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByMonetaryBoard; // supply issued manually by monetary board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount) public {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"MonetaryBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"MonetaryBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"MonetaryBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"MonetaryBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n function getLoanToDepositRatio() external view returns (uint loanToDepositRatio) {\n loanToDepositRatio = totalLockedAmount == 0 ? 0 : totalLockedAmount.mul(PERCENT_100).div(totalLoanAmount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n}\n" - }, - "0x88166fdc3c3e6768c375488fa45c90f1b904a767": { - "generatedAt": "2018-04-30T10:44:44.271Z", - "truffleContractFileUpdatedAt": "2018-04-30T10:44:29.234Z", - "deployTransactionHash": "0xbfd9a0283e236e6dfce41aa7d81fd859739a75b100d5ad5cdee2cd1b80fbe24e", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "c41181b91537cc751d880d79baf095dd", - "deployedBytecodeHash": "afc07e949d0fc0522760e21001e6442e", - "sourceHash": "cbd67b35e74bbbc9ef5a78c3180eb002", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n\n TODO:\n - Mcreate and use MonetarySupervisorInterface?\n - create and use InterestEarnedAccount interface ?\n\n*/\n\npragma solidity ^0.4.23;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByMonetaryBoard; // supply issued manually by monetary board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount) public {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"MonetaryBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"MonetaryBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"MonetaryBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"MonetaryBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n function getLoanToDepositRatio() external view returns (uint loanToDepositRatio) {\n loanToDepositRatio = totalLockedAmount == 0 ? 0 : totalLockedAmount.mul(PERCENT_100).div(totalLoanAmount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n}\n" - }, - "0x80d62c62138ed74699008c6f041b589c51619145": { - "generatedAt": "2018-05-12T00:22:15.188Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:12.412Z", - "deployTransactionHash": "0x06d7f813c999ae03a38d8d9e8bea67ee85b1d8669d8fbba98f064b55e63d4ab8", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "83f4ac731042d988dad02af18401f3f3", - "deployedBytecodeHash": "6356e4110fb4cbff5b57908614a63219", - "sourceHash": "cbd67b35e74bbbc9ef5a78c3180eb002", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n\n TODO:\n - Mcreate and use MonetarySupervisorInterface?\n - create and use InterestEarnedAccount interface ?\n\n*/\n\npragma solidity ^0.4.23;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByMonetaryBoard; // supply issued manually by monetary board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount) public {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"MonetaryBoard\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"MonetaryBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"MonetaryBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"MonetaryBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"MonetaryBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n function getLoanToDepositRatio() external view returns (uint loanToDepositRatio) {\n loanToDepositRatio = totalLockedAmount == 0 ? 0 : totalLockedAmount.mul(PERCENT_100).div(totalLoanAmount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n}\n" - }, - "0x5d8f6ed90b17c65ed4dd2b1a0cef98cba385e79f": { - "generatedAt": "2018-05-31T23:56:48.540Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.525Z", - "deployTransactionHash": "0x22bf443441e5d954c60eeca003dd9bab960bd0e8c7f964c32a141c5b223f5507", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "c23be0bec43f78dfeab0fcc474de0be0", - "deployedBytecodeHash": "c407f30647c8b0a6f70bec90ea3fbc8d", - "sourceHash": "a6af232a5f0886008c7170dece78a088", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n\n TODO:\n - Mcreate and use MonetarySupervisorInterface?\n - create and use InterestEarnedAccount interface ?\n\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByMonetaryBoard; // supply issued manually by monetary board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount) public {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoardSignerContract\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoardSignerContract\") {\n issuedByMonetaryBoard = issuedByMonetaryBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted LockerContracts\n require(permissions[msg.sender][\"LockerContracts\"], \"msg.sender must have LockerContracts permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManagerContracts\"],\n \"msg.sender must have LoanManagerContracts permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoardSignerContract\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoardSignerContract\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoardSignerContract\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoardSignerContract\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n function getLoanToDepositRatio() external view returns (uint loanToDepositRatio) {\n loanToDepositRatio = totalLockedAmount == 0 ? 0 : totalLockedAmount.mul(PERCENT_100).div(totalLoanAmount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n}\n" - } - } - }, - "54d27fedd8bf3010ad5509866a42c053": { - "latestDeployedAddress": "0x1555469d4a6c063a13ff1e12ca4ab00f5f1b7320", - "deployments": { - "0x1555469d4a6c063a13ff1e12ca4ab00f5f1b7320": { - "generatedAt": "2018-08-14T19:51:18.056Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:59.295Z", - "deployTransactionHash": "0x43aef0c8ff74d1e763827cdea3fdca932d8f09f4d05b3289776c5648fc70517f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "cd815999fcceb174d218efb1144145a3", - "deployedBytecodeHash": "5739962dc9bd1a0fb0ede862997956e9", - "sourceHash": "9bbc8e70067c1c5e61086cd06ed79ac7", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByStabilityBoard; // token issued by Stability Board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, AugmintReserves _augmintReserves,\n InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.sub(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n function getLoanToDepositRatio() external view returns (uint loanToDepositRatio) {\n loanToDepositRatio = totalLockedAmount == 0 ? 0 : totalLockedAmount.mul(PERCENT_100).div(totalLoanAmount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n}\n" - } - } - }, - "7f500b43397413e97de925528187f9cd": { - "latestDeployedAddress": "0x1555469d4a6c063a13ff1e12ca4ab00f5f1b7320", - "deployments": { - "0x1555469d4a6c063a13ff1e12ca4ab00f5f1b7320": { - "generatedAt": "2018-10-18T13:35:02.380Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.944Z", - "deployTransactionHash": "0xb223be3763733e04d2188b04764e06c50bc9dd51bf7ac414e5d44a117631d7e1", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "fa3e6bca24f24d5945b149c05701b69c", - "deployedBytecodeHash": "422b205eb739ddcf33fadad8edf32d7e", - "sourceHash": "62748c793556775f9ac607b991886bfb", - "source": "/* MonetarySupervisor\n - maintains system wide KPIs (eg totalLockAmount, totalLoanAmount)\n - holds system wide parameters/limits\n - enforces system wide limits\n - burns and issues to AugmintReserves\n - Send funds from reserve to exchange when intervening (not implemented yet)\n - Converts older versions of AugmintTokens in 1:1 to new\n*/\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\nimport \"./interfaces/AugmintTokenInterface.sol\";\nimport \"./interfaces/TokenReceiver.sol\";\nimport \"./InterestEarnedAccount.sol\";\nimport \"./AugmintReserves.sol\";\n\n\ncontract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks\n using SafeMath for uint256;\n\n uint public constant PERCENT_100 = 1000000;\n\n AugmintTokenInterface public augmintToken;\n InterestEarnedAccount public interestEarnedAccount;\n AugmintReserves public augmintReserves;\n\n uint public issuedByStabilityBoard; // token issued by Stability Board\n uint public burnedByStabilityBoard; // token burned by Stability Board\n\n uint public totalLoanAmount; // total amount of all loans without interest, in token\n uint public totalLockedAmount; // total amount of all locks without premium, in token\n\n /**********\n Parameters to ensure totalLoanAmount or totalLockedAmount difference is within limits and system also works\n when total loan or lock amounts are low.\n for test calculations: https://docs.google.com/spreadsheets/d/1MeWYPYZRIm1n9lzpvbq8kLfQg1hhvk5oJY6NrR401S0\n **********/\n struct LtdParams {\n uint lockDifferenceLimit; /* only allow a new lock if Loan To Deposit ratio would stay above\n (1 - lockDifferenceLimit) with new lock. Stored as parts per million */\n uint loanDifferenceLimit; /* only allow a new loan if Loan To Deposit ratio would stay above\n (1 + loanDifferenceLimit) with new loan. Stored as parts per million */\n /* allowedDifferenceAmount param is to ensure the system is not \"freezing\" when totalLoanAmount or\n totalLockAmount is low.\n It allows a new loan or lock (up to an amount to reach this difference) even if LTD will go below / above\n lockDifferenceLimit / loanDifferenceLimit with the new lock/loan */\n uint allowedDifferenceAmount;\n }\n\n LtdParams public ltdParams;\n\n /* Previously deployed AugmintTokens which are accepted for conversion (see transferNotification() )\n NB: it's not iterable so old version addresses needs to be added for UI manually after each deploy */\n mapping(address => bool) public acceptedLegacyAugmintTokens;\n\n event LtdParamsChanged(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount);\n\n event AcceptedLegacyAugmintTokenChanged(address augmintTokenAddress, bool newAcceptedState);\n\n event LegacyTokenConverted(address oldTokenAddress, address account, uint amount);\n\n event KPIsAdjusted(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment);\n\n event SystemContractsChanged(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves);\n\n constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken,\n AugmintReserves _augmintReserves, InterestEarnedAccount _interestEarnedAccount,\n uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n public Restricted(permissionGranterContract) {\n augmintToken = _augmintToken;\n augmintReserves = _augmintReserves;\n interestEarnedAccount = _interestEarnedAccount;\n\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n function issueToReserve(uint amount) external restrict(\"StabilityBoard\") {\n issuedByStabilityBoard = issuedByStabilityBoard.add(amount);\n augmintToken.issueTo(augmintReserves, amount);\n }\n\n function burnFromReserve(uint amount) external restrict(\"StabilityBoard\") {\n burnedByStabilityBoard = burnedByStabilityBoard.add(amount);\n augmintReserves.burn(augmintToken, amount);\n }\n\n /* Locker requesting interest when locking funds. Enforcing LTD to stay within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function requestInterest(uint amountToLock, uint interestAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n require(amountToLock <= getMaxLockAmountAllowedByLtd(), \"amountToLock must be <= maxLockAmountAllowedByLtd\");\n\n totalLockedAmount = totalLockedAmount.add(amountToLock);\n // next line would revert but require to emit reason:\n require(augmintToken.balanceOf(address(interestEarnedAccount)) >= interestAmount,\n \"interestEarnedAccount balance must be >= interestAmount\");\n interestEarnedAccount.transferInterest(augmintToken, msg.sender, interestAmount); // transfer interest to Locker\n }\n\n // Locker notifying when releasing funds to update KPIs\n function releaseFundsNotification(uint lockedAmount) external {\n // only whitelisted Locker\n require(permissions[msg.sender][\"Locker\"], \"msg.sender must have Locker permission\");\n totalLockedAmount = totalLockedAmount.sub(lockedAmount);\n }\n\n /* Issue loan if LTD stays within range allowed by LTD params\n NB: it does not know about min loan amount, it's the loan contract's responsibility to enforce it */\n function issueLoan(address borrower, uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n require(loanAmount <= getMaxLoanAmountAllowedByLtd(), \"loanAmount must be <= maxLoanAmountAllowedByLtd\");\n totalLoanAmount = totalLoanAmount.add(loanAmount);\n augmintToken.issueTo(borrower, loanAmount);\n }\n\n function loanRepaymentNotification(uint loanAmount) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(loanAmount);\n }\n\n // NB: this is called by Lender contract with the sum of all loans collected in batch\n function loanCollectionNotification(uint totalLoanAmountCollected) external {\n // only whitelisted LoanManager contracts\n require(permissions[msg.sender][\"LoanManager\"],\n \"msg.sender must have LoanManager permission\");\n totalLoanAmount = totalLoanAmount.sub(totalLoanAmountCollected);\n }\n\n function setAcceptedLegacyAugmintToken(address legacyAugmintTokenAddress, bool newAcceptedState)\n external restrict(\"StabilityBoard\") {\n acceptedLegacyAugmintTokens[legacyAugmintTokenAddress] = newAcceptedState;\n emit AcceptedLegacyAugmintTokenChanged(legacyAugmintTokenAddress, newAcceptedState);\n }\n\n function setLtdParams(uint lockDifferenceLimit, uint loanDifferenceLimit, uint allowedDifferenceAmount)\n external restrict(\"StabilityBoard\") {\n ltdParams = LtdParams(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n emit LtdParamsChanged(lockDifferenceLimit, loanDifferenceLimit, allowedDifferenceAmount);\n }\n\n /* function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract\n when it's upgraded.\n Set new monetarySupervisor contract in all locker and loanManager contracts before executing this */\n function adjustKPIs(uint totalLoanAmountAdjustment, uint totalLockedAmountAdjustment)\n external restrict(\"StabilityBoard\") {\n totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment);\n totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment);\n emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment);\n }\n\n /* to allow upgrades of InterestEarnedAccount and AugmintReserves contracts. */\n function setSystemContracts(InterestEarnedAccount newInterestEarnedAccount, AugmintReserves newAugmintReserves)\n external restrict(\"StabilityBoard\") {\n interestEarnedAccount = newInterestEarnedAccount;\n augmintReserves = newAugmintReserves;\n emit SystemContractsChanged(newInterestEarnedAccount, newAugmintReserves);\n }\n\n /* User can request to convert their tokens from older AugmintToken versions in 1:1\n transferNotification is called from AugmintToken's transferAndNotify\n Flow for converting old tokens:\n 1) user calls old token contract's transferAndNotify with the amount to convert,\n addressing the new MonetarySupervisor Contract\n 2) transferAndNotify transfers user's old tokens to the current MonetarySupervisor contract's address\n 3) transferAndNotify calls MonetarySupervisor.transferNotification\n 4) MonetarySupervisor checks if old AugmintToken is permitted\n 5) MonetarySupervisor issues new tokens to user's account in current AugmintToken\n 6) MonetarySupervisor burns old tokens from own balance\n */\n function transferNotification(address from, uint amount, uint /* data, not used */ ) external {\n AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);\n require(acceptedLegacyAugmintTokens[legacyToken], \"msg.sender must be allowed in acceptedLegacyAugmintTokens\");\n\n legacyToken.burn(amount);\n augmintToken.issueTo(from, amount);\n emit LegacyTokenConverted(msg.sender, from, amount);\n }\n\n /* Helper function for UI.\n Returns max lock amount based on minLockAmount, interestPt, using LTD params & interestEarnedAccount balance */\n function getMaxLockAmount(uint minLockAmount, uint interestPt) external view returns (uint maxLock) {\n uint allowedByEarning = augmintToken.balanceOf(address(interestEarnedAccount)).mul(PERCENT_100).div(interestPt);\n uint allowedByLtd = getMaxLockAmountAllowedByLtd();\n maxLock = allowedByEarning < allowedByLtd ? allowedByEarning : allowedByLtd;\n maxLock = maxLock < minLockAmount ? 0 : maxLock;\n }\n\n /* Helper function for UI.\n Returns max loan amount based on minLoanAmont using LTD params */\n function getMaxLoanAmount(uint minLoanAmount) external view returns (uint maxLoan) {\n uint allowedByLtd = getMaxLoanAmountAllowedByLtd();\n maxLoan = allowedByLtd < minLoanAmount ? 0 : allowedByLtd;\n }\n\n /* returns maximum lockable token amount allowed by LTD params. */\n function getMaxLockAmountAllowedByLtd() public view returns(uint maxLockByLtd) {\n uint allowedByLtdDifferencePt = totalLoanAmount.mul(PERCENT_100).div(PERCENT_100\n .sub(ltdParams.lockDifferenceLimit));\n allowedByLtdDifferencePt = totalLockedAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLockedAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLockedAmount >= totalLoanAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLoanAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLockedAmount);\n\n maxLockByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n\n /* returns maximum borrowable token amount allowed by LTD params */\n function getMaxLoanAmountAllowedByLtd() public view returns(uint maxLoanByLtd) {\n uint allowedByLtdDifferencePt = totalLockedAmount.mul(ltdParams.loanDifferenceLimit.add(PERCENT_100))\n .div(PERCENT_100);\n allowedByLtdDifferencePt = totalLoanAmount >= allowedByLtdDifferencePt ?\n 0 : allowedByLtdDifferencePt.sub(totalLoanAmount);\n\n uint allowedByLtdDifferenceAmount =\n totalLoanAmount >= totalLockedAmount.add(ltdParams.allowedDifferenceAmount) ?\n 0 : totalLockedAmount.add(ltdParams.allowedDifferenceAmount).sub(totalLoanAmount);\n\n maxLoanByLtd = allowedByLtdDifferencePt > allowedByLtdDifferenceAmount ?\n allowedByLtdDifferencePt : allowedByLtdDifferenceAmount;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/PreTokenProxy_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/PreTokenProxy_DEPLOYS.json deleted file mode 100644 index 56fa439..0000000 --- a/src/augmintjs/abiniser/deployments/999/PreTokenProxy_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "PreTokenProxy", - "latestAbiHash": "dd40c0d39ea8bad8a388522667a84687", - "deployedAbis": { - "19ab69b650e28b2dd211d3851893f91f": { - "latestDeployedAddress": "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463", - "deployments": { - "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463": { - "generatedAt": "2018-08-14T19:51:18.249Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:46.737Z", - "deployTransactionHash": "0xb6d3bbc7f8b5d233923e24afcdf977acd4d2b40fcc36301e9eabe47d6bf71b24", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "9c5756eba5d12433f15b0ba1c6e78424", - "deployedBytecodeHash": "41bc836f0fad20e8f9a4afdd4d4725f3", - "sourceHash": "2d172fe41d2b97c827d6dca816138047", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract PreTokenProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - }, - "dd40c0d39ea8bad8a388522667a84687": { - "latestDeployedAddress": "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463", - "deployments": { - "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463": { - "generatedAt": "2018-10-18T13:35:02.452Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.836Z", - "deployTransactionHash": "0xca9e92624b1c86721a4e6804e793b8b87606564f302d28ddefb2f560158e9415", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "5007bce3d0997985a9357d5b1a97103b", - "deployedBytecodeHash": "b5a32ad0b8570f3cd6b7efaef3655911", - "sourceHash": "2d172fe41d2b97c827d6dca816138047", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract PreTokenProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/PreToken_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/PreToken_DEPLOYS.json deleted file mode 100644 index 63f2575..0000000 --- a/src/augmintjs/abiniser/deployments/999/PreToken_DEPLOYS.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "contractName": "PreToken", - "latestAbiHash": "7f69e33e7b345c780ac9e43f391437d9", - "deployedAbis": { - "771887af92db4b4330d700538df6e490": { - "latestDeployedAddress": "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01", - "deployments": { - "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01": { - "generatedAt": "2018-06-07T13:00:00.734Z", - "truffleContractFileUpdatedAt": "2018-06-07T12:51:20.015Z", - "deployTransactionHash": "0x393ce3b7bfd805b5b8ffb162602b4c294d616c1c3ad84e433ae0bed7a80ee396", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "4c28508dceb343d11fc03065ea0a4dfb", - "deployedBytecodeHash": "4e60c77460939aa05c185f2d2e341660", - "sourceHash": "cab74a015e98f8925b8866d60ca94278", - "source": "/* Augmint pretoken contract to record tokens allocated based on agreements.\nThese tokens are not fungible because agreements can have different conditions (valuationCap and discount).\nDespite being non-fungible some ERC20 functions are implemented so agreement owners can see their balances and transfers\n in standard wallets.\nWhere it's not ERC20 compliant:\n - transfer is only allowed by agreement holders (to avoid polluting transfer logs)\n - transfer is only allowed to accounts without an agreement yet or same agreement\n - no approval and transferFrom\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract PreToken is Restricted {\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n string constant public name = \"Augmint pretokens\"; // solhint-disable-line const-name-snakecase\n string constant public symbol = \"APRE\"; // solhint-disable-line const-name-snakecase\n uint8 constant public decimals = 0; // solhint-disable-line const-name-snakecase\n\n uint public totalSupply;\n\n struct Agreement {\n uint balance;\n bytes32 agreementHash; // SHA-2 (SHA-256) hash of signed agreement.\n // OSX: shasum -a 256 agreement.pdf\n // Windows: certUtil -hashfile agreement.pdf SHA256\n uint32 discount; // discountRate in parts per million , ie. 10,000 = 1%\n uint32 valuationCap; // in USD (no decimals)\n }\n\n mapping(address => Agreement) public agreements; // Balances for each account\n address[] public allAgreements; // all addresses with agreements to able to iterate over\n\n event Transfer(address indexed from, address indexed to, uint amount);\n\n event NewAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function addAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap)\n external restrict(\"PreTokenSigner\") {\n require(owner != address(0));\n require(agreements[owner].agreementHash == 0x0);\n require(agreementHash != 0x0);\n\n agreements[owner] = Agreement(0, agreementHash, discount, valuationCap);\n allAgreements.push(owner);\n\n emit NewAgreement(owner, agreementHash, discount, valuationCap);\n }\n\n function issueTo(address _to, uint amount) external restrict(\"PreTokenSigner\") {\n Agreement storage to = agreements[_to];\n require(to.agreementHash != 0x0);\n\n to.balance = to.balance.add(amount);\n totalSupply = totalSupply.add(amount);\n\n emit Transfer(0x0, _to, amount);\n }\n\n /* Restricted function to allow pretoken signers to fix incorrect issuance */\n function burnFrom(address from, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n require(amount > 0, \"burn amount must be > 0\"); // this effectively restricts burning from agreement holders only\n require(agreements[from].balance >= amount, \"must not burn more than balance\"); // .sub would revert anyways but emit reason\n\n agreements[from].balance = agreements[from].balance.sub(amount);\n totalSupply = totalSupply.sub(amount);\n\n emit Transfer(from, 0x0, amount);\n return true;\n }\n\n function balanceOf(address who) public view returns (uint) {\n return agreements[who].balance;\n }\n\n function transfer(address to, uint amount) public returns (bool) { // solhint-disable-line no-simple-event-func-name\n _transfer(msg.sender, to, amount);\n return true;\n }\n\n /* Restricted function to allow pretoken signers to fix if pretoken owner lost keys */\n function transferFrom(address from, address to, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n _transfer(from, to, amount);\n return true;\n }\n\n /* private function used by transferFrom & transfer */\n function _transfer(address from, address to, uint amount) private {\n require(agreements[from].agreementHash != 0x0, \"only holder of an agreement can transfer\");\n require(to != 0x0, \"must not transfer to 0x0\");\n require(\n agreements[to].agreementHash == 0 || // allow to transfer to address without agreement\n amount == 0 || // allow 0 amount transfers to any acc for voting\n agreements[to].agreementHash == agreements[from].agreementHash // allow transfer to acc w/ same agr.\n );\n\n if (amount > 0) { // transfer agreement if it's not a 0 amount \"vote only\" transfer\n agreements[from].balance = agreements[from].balance.sub(amount);\n agreements[to].balance = agreements[to].balance.add(amount);\n\n agreements[to].agreementHash = agreements[from].agreementHash;\n agreements[to].valuationCap = agreements[from].valuationCap;\n agreements[to].discount = agreements[from].discount;\n }\n\n emit Transfer(from, to, amount);\n }\n\n function getAgreementsCount() external view returns (uint agreementsCount) {\n return allAgreements.length;\n }\n\n // UI helper fx - Returns all agreements from offset as\n // [index in allAgreements, account address as uint, balance, agreementHash as uint,\n // discount as uint, valuationCap as uint ]\n function getAllAgreements(uint offset) external view returns(uint[6][CHUNK_SIZE] agreementsResult) {\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < allAgreements.length; i++) {\n address agreementAccount = allAgreements[i + offset];\n Agreement storage agreement = agreements[agreementAccount];\n agreementsResult[i] = [ i + offset, uint(agreementAccount), agreement.balance,\n uint(agreement.agreementHash), uint(agreement.discount), uint(agreement.valuationCap)];\n }\n }\n\n}\n" - } - } - }, - "10eebbb51a771cfd3473475169a569f1": { - "latestDeployedAddress": "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01", - "deployments": { - "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01": { - "generatedAt": "2018-08-14T19:51:18.275Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:59.883Z", - "deployTransactionHash": "0xcd5e3793dca16d1521eafcb607ab8236651adcd7290eb81ff7e6876b788f11b0", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0b0a2b09f36e8731a771658a30182cc2", - "deployedBytecodeHash": "14fc900d37e9e53a6fd363cab08b87e8", - "sourceHash": "652361fe32b441561edaf8ebd7f70277", - "source": "/* Augmint pretoken contract to record agreements and tokens allocated based on the agreement.\n\n Important: this is NOT an ERC20 token!\n\n PreTokens are non-fungible: agreements can have different conditions (valuationCap and discount)\n and pretokens are not tradable.\n\n Ownership can be transferred if owner wants to change wallet but the whole agreement and\n the total pretoken amount is moved to a new account\n\n PreTokenSigner can (via MultiSig):\n - add agreements and issue pretokens to an agreement\n - change owner of any agreement to handle if an owner lost a private keys\n - burn pretokens from any agreement to fix potential erroneous issuance\n These are known compromises on trustlessness hence all these tokens distributed based on signed agreements and\n preTokens are issued only to a closed group of contributors / team members.\n If despite these something goes wrong then as a last resort a new pretoken contract can be recreated from agreements.\n\n Some ERC20 functions are implemented so agreement owners can see their balances and use transfer in standard wallets.\n Restrictions:\n - only total balance can be transfered - effectively ERC20 transfer used to transfer agreement ownership\n - only agreement holders can transfer\n (i.e. can't transfer 0 amount if have no agreement to avoid polluting logs with Transfer events)\n - transfer is only allowed to accounts without an agreement yet\n - no approval and transferFrom ERC20 functions\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract PreToken is Restricted {\n using SafeMath for uint256;\n\n uint public constant CHUNK_SIZE = 100;\n\n string constant public name = \"Augmint pretokens\"; // solhint-disable-line const-name-snakecase\n string constant public symbol = \"APRE\"; // solhint-disable-line const-name-snakecase\n uint8 constant public decimals = 0; // solhint-disable-line const-name-snakecase\n\n uint public totalSupply;\n\n struct Agreement {\n address owner;\n uint balance;\n uint32 discount; // discountRate in parts per million , ie. 10,000 = 1%\n uint32 valuationCap; // in USD (no decimals)\n }\n\n /* Agreement hash is the SHA-2 (SHA-256) hash of signed agreement document.\n To generate:\n OSX: shasum -a 256 agreement.pdf\n Windows: certUtil -hashfile agreement.pdf SHA256 */\n mapping(address => bytes32) public agreementOwners; // to lookup agrement by owner\n mapping(bytes32 => Agreement) public agreements;\n\n bytes32[] public allAgreements; // all agreements to able to iterate over\n\n event Transfer(address indexed from, address indexed to, uint amount);\n\n event NewAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function addAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap)\n external restrict(\"PreTokenSigner\") {\n require(owner != address(0), \"owner must not be 0x0\");\n require(agreementOwners[owner] == 0x0, \"owner must not have an aggrement yet\");\n require(agreementHash != 0x0, \"agreementHash must not be 0x0\");\n require(discount > 0, \"discount must be > 0\");\n require(agreements[agreementHash].discount == 0, \"agreement must not exist yet\");\n\n agreements[agreementHash] = Agreement(owner, 0, discount, valuationCap);\n agreementOwners[owner] = agreementHash;\n allAgreements.push(agreementHash);\n\n emit NewAgreement(owner, agreementHash, discount, valuationCap);\n }\n\n function issueTo(bytes32 agreementHash, uint amount) external restrict(\"PreTokenSigner\") {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\");\n\n agreement.balance = agreement.balance.add(amount);\n totalSupply = totalSupply.add(amount);\n\n emit Transfer(0x0, agreement.owner, amount);\n }\n\n /* Restricted function to allow pretoken signers to fix incorrect issuance */\n function burnFrom(bytes32 agreementHash, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\"); // this is redundant b/c of next requires but be explicit\n require(amount > 0, \"burn amount must be > 0\");\n require(agreement.balance >= amount, \"must not burn more than balance\"); // .sub would revert anyways but emit reason\n\n agreement.balance = agreement.balance.sub(amount);\n totalSupply = totalSupply.sub(amount);\n\n emit Transfer(agreement.owner, 0x0, amount);\n return true;\n }\n\n function balanceOf(address owner) public view returns (uint) {\n return agreements[agreementOwners[owner]].balance;\n }\n\n /* function to transfer agreement ownership to other wallet by owner\n it's in ERC20 form so owners can use standard ERC20 wallet just need to pass full balance as value */\n function transfer(address to, uint amount) public returns (bool) { // solhint-disable-line no-simple-event-func-name\n require(amount == agreements[agreementOwners[msg.sender]].balance, \"must transfer full balance\");\n _transfer(msg.sender, to);\n return true;\n }\n\n /* Restricted function to allow pretoken signers to fix if pretoken owner lost keys */\n function transferAgreement(bytes32 agreementHash, address to)\n public restrict(\"PreTokenSigner\") returns (bool) {\n _transfer(agreements[agreementHash].owner, to);\n return true;\n }\n\n /* private function used by transferAgreement & transfer */\n function _transfer(address from, address to) private {\n Agreement storage agreement = agreements[agreementOwners[from]];\n require(agreementOwners[from] != 0x0, \"from agreement must exists\");\n require(agreementOwners[to] == 0, \"to must not have an agreement\");\n require(to != 0x0, \"must not transfer to 0x0\");\n\n agreement.owner = to;\n\n agreementOwners[to] = agreementOwners[from];\n agreementOwners[from] = 0x0;\n\n emit Transfer(from, to, agreement.balance);\n }\n\n function getAgreementsCount() external view returns (uint agreementsCount) {\n return allAgreements.length;\n }\n\n // UI helper fx - Returns all agreements from offset as\n // [index in allAgreements, account address as uint, balance, agreementHash as uint,\n // discount as uint, valuationCap as uint ]\n function getAllAgreements(uint offset) external view returns(uint[6][CHUNK_SIZE] agreementsResult) {\n\n for (uint8 i = 0; i < CHUNK_SIZE && i + offset < allAgreements.length; i++) {\n bytes32 agreementHash = allAgreements[i + offset];\n Agreement storage agreement = agreements[agreementHash];\n\n agreementsResult[i] = [ i + offset, uint(agreement.owner), agreement.balance,\n uint(agreementHash), uint(agreement.discount), uint(agreement.valuationCap)];\n }\n }\n}\n" - } - } - }, - "7f69e33e7b345c780ac9e43f391437d9": { - "latestDeployedAddress": "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01", - "deployments": { - "0xbed57eb0b4232da0cddd3c9c27490fc0759e0a01": { - "generatedAt": "2018-10-18T13:35:02.470Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.930Z", - "deployTransactionHash": "0x1ece2c264ca1d3e1252bf27f7aea6598218bf72007b66f965338a63f92642306", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "8d7e449258facd1c6fab22b402de6aee", - "deployedBytecodeHash": "bf64976158eb4f8696efd994652e7f49", - "sourceHash": "6cace117c42478e4f5c8cf116bec9a62", - "source": "/* Augmint pretoken contract to record agreements and tokens allocated based on the agreement.\n\n Important: this is NOT an ERC20 token!\n\n PreTokens are non-fungible: agreements can have different conditions (valuationCap and discount)\n and pretokens are not tradable.\n\n Ownership can be transferred if owner wants to change wallet but the whole agreement and\n the total pretoken amount is moved to a new account\n\n PreTokenSigner can (via MultiSig):\n - add agreements and issue pretokens to an agreement\n - change owner of any agreement to handle if an owner lost a private keys\n - burn pretokens from any agreement to fix potential erroneous issuance\n These are known compromises on trustlessness hence all these tokens distributed based on signed agreements and\n preTokens are issued only to a closed group of contributors / team members.\n If despite these something goes wrong then as a last resort a new pretoken contract can be recreated from agreements.\n\n Some ERC20 functions are implemented so agreement owners can see their balances and use transfer in standard wallets.\n Restrictions:\n - only total balance can be transfered - effectively ERC20 transfer used to transfer agreement ownership\n - only agreement holders can transfer\n (i.e. can't transfer 0 amount if have no agreement to avoid polluting logs with Transfer events)\n - transfer is only allowed to accounts without an agreement yet\n - no approval and transferFrom ERC20 functions\n */\n\npragma solidity 0.4.24;\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract PreToken is Restricted {\n using SafeMath for uint256;\n\n string constant public name = \"Augmint pretokens\"; // solhint-disable-line const-name-snakecase\n string constant public symbol = \"APRE\"; // solhint-disable-line const-name-snakecase\n uint8 constant public decimals = 0; // solhint-disable-line const-name-snakecase\n\n uint public totalSupply;\n\n struct Agreement {\n address owner;\n uint balance;\n uint32 discount; // discountRate in parts per million , ie. 10,000 = 1%\n uint32 valuationCap; // in USD (no decimals)\n }\n\n /* Agreement hash is the SHA-2 (SHA-256) hash of signed agreement document.\n To generate:\n OSX: shasum -a 256 agreement.pdf\n Windows: certUtil -hashfile agreement.pdf SHA256 */\n mapping(address => bytes32) public agreementOwners; // to lookup agrement by owner\n mapping(bytes32 => Agreement) public agreements;\n\n bytes32[] public allAgreements; // all agreements to able to iterate over\n\n event Transfer(address indexed from, address indexed to, uint amount);\n\n event NewAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap);\n\n constructor(address permissionGranterContract)\n public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function addAgreement(address owner, bytes32 agreementHash, uint32 discount, uint32 valuationCap)\n external restrict(\"PreTokenSigner\") {\n require(owner != address(0), \"owner must not be 0x0\");\n require(agreementOwners[owner] == 0x0, \"owner must not have an aggrement yet\");\n require(agreementHash != 0x0, \"agreementHash must not be 0x0\");\n require(discount > 0, \"discount must be > 0\");\n require(agreements[agreementHash].discount == 0, \"agreement must not exist yet\");\n\n agreements[agreementHash] = Agreement(owner, 0, discount, valuationCap);\n agreementOwners[owner] = agreementHash;\n allAgreements.push(agreementHash);\n\n emit NewAgreement(owner, agreementHash, discount, valuationCap);\n }\n\n function issueTo(bytes32 agreementHash, uint amount) external restrict(\"PreTokenSigner\") {\n Agreement storage agreement = agreements[agreementHash];\n require(agreement.discount > 0, \"agreement must exist\");\n\n agreement.balance = agreement.balance.add(amount);\n totalSupply = totalSupply.add(amount);\n\n emit Transfer(0x0, agreement.owner, amount);\n }\n\n /* Restricted function to allow pretoken signers to fix incorrect issuance */\n function burnFrom(bytes32 agreementHash, uint amount)\n public restrict(\"PreTokenSigner\") returns (bool) {\n Agreement storage agreement = agreements[agreementHash];\n // this is redundant b/c of next requires but be explicit\n require(agreement.discount > 0, \"agreement must exist\");\n require(amount > 0, \"burn amount must be > 0\");\n // .sub would revert anyways but emit reason\n require(agreement.balance >= amount, \"must not burn more than balance\");\n\n agreement.balance = agreement.balance.sub(amount);\n totalSupply = totalSupply.sub(amount);\n\n emit Transfer(agreement.owner, 0x0, amount);\n return true;\n }\n\n function balanceOf(address owner) public view returns (uint) {\n return agreements[agreementOwners[owner]].balance;\n }\n\n /* function to transfer agreement ownership to other wallet by owner\n it's in ERC20 form so owners can use standard ERC20 wallet just need to pass full balance as value */\n function transfer(address to, uint amount) public returns (bool) { // solhint-disable-line no-simple-event-func-name\n require(amount == agreements[agreementOwners[msg.sender]].balance, \"must transfer full balance\");\n _transfer(msg.sender, to);\n return true;\n }\n\n /* Restricted function to allow pretoken signers to fix if pretoken owner lost keys */\n function transferAgreement(bytes32 agreementHash, address to)\n public restrict(\"PreTokenSigner\") returns (bool) {\n _transfer(agreements[agreementHash].owner, to);\n return true;\n }\n\n /* private function used by transferAgreement & transfer */\n function _transfer(address from, address to) private {\n Agreement storage agreement = agreements[agreementOwners[from]];\n require(agreementOwners[from] != 0x0, \"from agreement must exists\");\n require(agreementOwners[to] == 0, \"to must not have an agreement\");\n require(to != 0x0, \"must not transfer to 0x0\");\n\n agreement.owner = to;\n\n agreementOwners[to] = agreementOwners[from];\n agreementOwners[from] = 0x0;\n\n emit Transfer(from, to, agreement.balance);\n }\n\n function getAgreementsCount() external view returns (uint agreementsCount) {\n return allAgreements.length;\n }\n\n // UI helper fx - Returns agreements from as\n // [index in allAgreements, account address as uint, balance, agreementHash as uint,\n // discount as uint, valuationCap as uint ]\n function getAgreements(uint offset, uint16 chunkSize)\n external view returns(uint[6][]) {\n uint limit = SafeMath.min(offset.add(chunkSize), allAgreements.length);\n uint[6][] memory response = new uint[6][](limit.sub(offset));\n\n for (uint i = offset; i < limit; i++) {\n bytes32 agreementHash = allAgreements[i];\n Agreement storage agreement = agreements[agreementHash];\n\n response[i - offset] = [i, uint(agreement.owner), agreement.balance,\n uint(agreementHash), uint(agreement.discount), uint(agreement.valuationCap)];\n }\n return response;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/Rates_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/Rates_DEPLOYS.json deleted file mode 100644 index d55d756..0000000 --- a/src/augmintjs/abiniser/deployments/999/Rates_DEPLOYS.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "contractName": "Rates", - "latestAbiHash": "73a17ebb0acc71773371c6a8e1c8e6ce", - "deployedAbis": { - "aad689098442fe73d35b427a36786f06": { - "latestDeployedAddress": "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463", - "deployments": { - "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463": { - "generatedAt": "2018-04-25T12:30:49.023Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:31:58.107Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "b072f2ac9f39bd4e54ec18306443b251", - "deployedBytecodeHash": "94217efb3293a39e7ccfaf54347d3bfe", - "sourceHash": "6aba5d7c578a7c3d328066fa72de1429", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.19;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 4 decimals. i.e. ETH/EUR = 989.12 then rate = 989,1200\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"setRate\") {\n rates[symbol] = RateInfo(newRate, now);\n RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"setRate\") {\n require(symbols.length == newRates.length);\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0);\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // no require(rates[symbol].rate > 0) needed b/c it will revert with div by zero\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - } - } - }, - "cc8bc64cd780f047eca819e6cd3b8af9": { - "latestDeployedAddress": "0xa47b07db70126f0095b09c846d0d7e2d965eae6b", - "deployments": { - "0x8b639dc72f3e640c0d6bc19497fbc7b5160d0463": { - "generatedAt": "2018-04-25T12:31:28.978Z", - "truffleContractFileUpdatedAt": "2018-04-20T18:21:38.645Z", - "deployTransactionHash": "0x2406592c676468988c721d4051e727eb5659016c6560234ea53a2e65775978c8", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "7b3cb84bdbfbe54d0c253744ccc86bd9", - "deployedBytecodeHash": "36714b840505a1bedac90a82a36e514c", - "sourceHash": "e9dda67ca678fd3a4700e8970b50acd3", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 4 decimals. i.e. ETH/EUR = 989.12 then rate = 989,1200\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"setRate\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"setRate\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - }, - "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb": { - "generatedAt": "2018-05-09T12:19:24.837Z", - "truffleContractFileUpdatedAt": "2018-05-09T12:19:15.658Z", - "deployTransactionHash": "0xf54d0cd33fc046bdca1066c84c2c1af0a3064d14b41d820a952d6739e015de6b", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "7b3cb84bdbfbe54d0c253744ccc86bd9", - "deployedBytecodeHash": "36714b840505a1bedac90a82a36e514c", - "sourceHash": "e9dda67ca678fd3a4700e8970b50acd3", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity ^0.4.23;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 4 decimals. i.e. ETH/EUR = 989.12 then rate = 989,1200\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"setRate\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"setRate\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - }, - "0xa47b07db70126f0095b09c846d0d7e2d965eae6b": { - "generatedAt": "2018-05-31T23:56:48.438Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.495Z", - "deployTransactionHash": "0x00b941f25c54731b9920198c6d89223ffe7e50dd06ed65b820b51190ffd8fb07", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3b2f1c4e52d682390b3e3f52bfb7149e", - "deployedBytecodeHash": "ba3833719d4aefe680165cbe9faa139f", - "sourceHash": "0c937a45e5ca30ca3cc1314b3cc1fd39", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 4 decimals. i.e. ETH/EUR = 989.12 then rate = 989,1200\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"setRate\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"setRate\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - } - } - }, - "73a17ebb0acc71773371c6a8e1c8e6ce": { - "latestDeployedAddress": "0xb0a2a8e846b66c7384f52635cecef5280f766c8b", - "deployments": { - "0xb0a2a8e846b66c7384f52635cecef5280f766c8b": { - "generatedAt": "2018-10-18T13:35:02.334Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.909Z", - "deployTransactionHash": "0x5c42470dba96ffc854c98239f1488b3698d35fb6acd9f425bcb305244d26bc48", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "be17116585b9b88d60fbe06a5499b6dc", - "deployedBytecodeHash": "0f403183577dac202159e32b1c8c9f44", - "sourceHash": "c65f6945fead6118910fccc8bca7494c", - "source": "/*\n Generic symbol / WEI rates contract.\n only callable by trusted price oracles.\n Being regularly called by a price oracle\n TODO: trustless/decentrilezed price Oracle\n TODO: shall we use blockNumber instead of now for lastUpdated?\n TODO: consider if we need storing rates with variable decimals instead of fixed 4\n TODO: could we emit 1 RateChanged event from setMultipleRates (symbols and newrates arrays)?\n*/\npragma solidity 0.4.24;\n\nimport \"./generic/SafeMath.sol\";\nimport \"./generic/Restricted.sol\";\n\n\ncontract Rates is Restricted {\n using SafeMath for uint256;\n\n struct RateInfo {\n uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate\n // 0 rate means no rate info available\n uint lastUpdated;\n }\n\n // mapping currency symbol => rate. all rates are stored with 2 decimals. i.e. EUR/ETH = 989.12 then rate = 98912\n mapping(bytes32 => RateInfo) public rates;\n\n event RateChanged(bytes32 symbol, uint newRate);\n\n constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks\n\n function setRate(bytes32 symbol, uint newRate) external restrict(\"RatesFeeder\") {\n rates[symbol] = RateInfo(newRate, now);\n emit RateChanged(symbol, newRate);\n }\n\n function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict(\"RatesFeeder\") {\n require(symbols.length == newRates.length, \"symobls and newRates lengths must be equal\");\n for (uint256 i = 0; i < symbols.length; i++) {\n rates[symbols[i]] = RateInfo(newRates[i], now);\n emit RateChanged(symbols[i], newRates[i]);\n }\n }\n\n function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);\n }\n\n function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {\n // next line would revert with div by zero but require to emit reason\n require(rates[bSymbol].rate > 0, \"rates[bSymbol] must be > 0\");\n /* TODO: can we make this not loosing max scale? */\n return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);\n }\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/SafeMath_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/SafeMath_DEPLOYS.json deleted file mode 100644 index e3f1540..0000000 --- a/src/augmintjs/abiniser/deployments/999/SafeMath_DEPLOYS.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "contractName": "SafeMath", - "latestAbiHash": "d751713988987e9331980363e24189ce", - "deployedAbis": { - "d751713988987e9331980363e24189ce": { - "latestDeployedAddress": "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb", - "deployments": { - "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb": { - "generatedAt": "2018-04-25T12:31:28.938Z", - "truffleContractFileUpdatedAt": "2018-04-20T18:25:08.412Z", - "deployTransactionHash": "0xd8e25dba18520bed923f67e86eccfc28fc3c91375b1ccccc426e95e1c66f5c77", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "5c02a412ee11dc181e23608b85b249b9", - "deployedBytecodeHash": "d808bf41b73524260974a832a9735da9", - "sourceHash": "f07bc306764da6ef496a297a30a18531", - "source": "/**\n* @title SafeMath\n* @dev Math operations with safety checks that throw on error\n\n TODO: check against ds-math: https://blog.dapphub.com/ds-math/\n TODO: move roundedDiv to a sep lib? (eg. Math.sol)\n*/\npragma solidity ^0.4.23;\n\n\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a * b;\n require(a == 0 || c / a == b, \"mul overflow\");\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"div by 0\"); // Solidity automatically throws for div by 0 but require to emit reason\n uint256 c = a / b;\n // require(a == b * c + a % b); // There is no case in which this doesn't hold\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"sub underflow\");\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"add overflow\");\n return c;\n }\n\n function roundedDiv(uint a, uint b) internal pure returns (uint256) {\n require(b > 0, \"div by 0\"); // Solidity automatically throws for div by 0 but require to emit reason\n uint256 z = a / b;\n if (a % b >= b / 2) {\n z++; // no need for safe add b/c it can happen only if we divided the input\n }\n return z;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/StabilityBoardProxy_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/StabilityBoardProxy_DEPLOYS.json deleted file mode 100644 index aecf092..0000000 --- a/src/augmintjs/abiniser/deployments/999/StabilityBoardProxy_DEPLOYS.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "contractName": "StabilityBoardProxy", - "latestAbiHash": "dd40c0d39ea8bad8a388522667a84687", - "deployedAbis": { - "19ab69b650e28b2dd211d3851893f91f": { - "latestDeployedAddress": "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb", - "deployments": { - "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb": { - "generatedAt": "2018-08-14T19:51:18.228Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:54.958Z", - "deployTransactionHash": "0x44c25cfe9621958b0a9d98b2d0819e66035c1bea0e9ff0ab4e28921805e041a9", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "956ad89450cdb2da8fa7fd2c4173eb96", - "deployedBytecodeHash": "89743a0395b3528cf96780a1751106f4", - "sourceHash": "4d60c55b8e4009873db939b37558d9dc", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - }, - "dd40c0d39ea8bad8a388522667a84687": { - "latestDeployedAddress": "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb", - "deployments": { - "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb": { - "generatedAt": "2018-10-18T13:35:02.447Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.835Z", - "deployTransactionHash": "0xa45d84e1ac026dae6366bd54454b85972921e5931e159c71da19d65a64ab4ad5", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "4f899546765577ad2e325da53c3e7179", - "deployedBytecodeHash": "a5f3dd7878e556db538c1206827e5959", - "sourceHash": "4d60c55b8e4009873db939b37558d9dc", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardProxy is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/StabilityBoardSigner_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/StabilityBoardSigner_DEPLOYS.json deleted file mode 100644 index 1a5be88..0000000 --- a/src/augmintjs/abiniser/deployments/999/StabilityBoardSigner_DEPLOYS.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "contractName": "StabilityBoardSigner", - "latestAbiHash": "19ab69b650e28b2dd211d3851893f91f", - "deployedAbis": { - "19ab69b650e28b2dd211d3851893f91f": { - "latestDeployedAddress": "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb", - "deployments": { - "0x4dce039de757afb05bf942922764e8221aff99e0": { - "generatedAt": "2018-05-31T23:56:48.747Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:26.401Z", - "deployTransactionHash": "0xb5e55bf4532acb5a8ab285827c839668d120d8a949e7c5e3125f0775a7b28a10", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "fe7f91f971eb7ab308a3ec5e5455dc7f", - "deployedBytecodeHash": "e91ac371e44ef6d2ab3cc6a4d86e9646", - "sourceHash": "1c9e1e3dd1979663773a97ac32a067c0", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardSigner is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - }, - "0xd3ef19679c2dbbf3b8e2077c61b88f5e9c6178eb": { - "generatedAt": "2018-06-04T12:57:19.487Z", - "truffleContractFileUpdatedAt": "2018-06-04T12:57:09.842Z", - "deployTransactionHash": "0x0345b32e949b3a51bee3f0bfccab4377f26faf463cb6d830bc08066caae8f28b", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0e2f8e783790013f07705a1cecd5f703", - "deployedBytecodeHash": "9a38fc566f79a4d2fd6e6fa64b406b1b", - "sourceHash": "1c9e1e3dd1979663773a97ac32a067c0", - "source": "/* allows tx to execute if 50% +1 vote of active signers signed */\npragma solidity 0.4.24;\nimport \"./generic/MultiSig.sol\";\n\n\ncontract StabilityBoardSigner is MultiSig {\n\n function checkQuorum(uint signersCount) internal view returns(bool isQuorum) {\n isQuorum = signersCount > activeSignersCount / 2 ;\n }\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/abiniser/deployments/999/TokenAEur_DEPLOYS.json b/src/augmintjs/abiniser/deployments/999/TokenAEur_DEPLOYS.json deleted file mode 100644 index 561f9f3..0000000 --- a/src/augmintjs/abiniser/deployments/999/TokenAEur_DEPLOYS.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "contractName": "TokenAEur", - "latestAbiHash": "2ea91d34a7bfefc8f38ef0e8a5ae24a5", - "deployedAbis": { - "27721a2c77dc40da7639abd46791c3d7": { - "latestDeployedAddress": "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4", - "deployments": { - "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4": { - "generatedAt": "2018-04-25T12:29:07.543Z", - "truffleContractFileUpdatedAt": "2018-02-14T23:31:03.067Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "9c7803268a74b93337c591b93c5df7cd", - "deployedBytecodeHash": "4c8e7c0e4eceb0cf659bdffd7cb68f48", - "sourceHash": "f8f534b0f0f4314bb7c994451860d3ae", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity 0.4.19;\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n function TokenAEur(address _feeAccount, uint _transferFeePt, uint _transferFeeMin, uint _transferFeeMax)\n public AugmintToken(\"Augmint Crypto Euro\", \"A-EUR\", \"EUR\", 4, _feeAccount,\n _transferFeePt, _transferFeeMin, _transferFeeMax )\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "1d30184837b8c27bcac847509ab146a1": { - "latestDeployedAddress": "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4", - "deployments": { - "0x1b9441428f9e682bab4f9cc70fdf50adcc3411f4": { - "generatedAt": "2018-04-25T12:30:49.280Z", - "truffleContractFileUpdatedAt": "2018-02-27T07:36:28.112Z", - "compiler": { - "name": "solc", - "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" - }, - "bytecodeHash": "6d5fefd571498d9dee8ed2325f0f25de", - "deployedBytecodeHash": "e6d94e42be358d534f5c0d5d4b9b2d60", - "sourceHash": "8fdbab94c89af22962cf36a54a5c9c33", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity 0.4.19;\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n function TokenAEur(address _feeAccount, uint _transferFeePt, uint _transferFeeMin, uint _transferFeeMax)\n public AugmintToken(\"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount,\n _transferFeePt, _transferFeeMin, _transferFeeMax )\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "d7dd02520f2d92b2ca237f066cf2488d": { - "latestDeployedAddress": "0x1efb52b6aacc403cc9d762282b2aec1b066931c5", - "deployments": { - "0x1efb52b6aacc403cc9d762282b2aec1b066931c5": { - "generatedAt": "2018-04-26T01:54:21.126Z", - "truffleContractFileUpdatedAt": "2018-04-26T01:54:11.447Z", - "deployTransactionHash": "0x12bf84c2b3100d293c9b8444fbe25604ebd121da216fa59940cc8f88a44c3be7", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "9a779166b00ad29d1415869063f4ee51", - "deployedBytecodeHash": "0064ccab590d4152e492e7eb1717492b", - "sourceHash": "61dded7836f4431e621382340f32670c", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity ^0.4.23;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(TransferFeeInterface _feeAccount)\n public AugmintToken(\"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "6b1597192b36a746724929ec9ee7b6b8": { - "latestDeployedAddress": "0x1a93886326b0220731f25926d56074f7f0b074ce", - "deployments": { - "0x1a93886326b0220731f25926d56074f7f0b074ce": { - "generatedAt": "2018-05-09T12:19:24.881Z", - "truffleContractFileUpdatedAt": "2018-05-09T12:19:17.167Z", - "deployTransactionHash": "0x43cafa531d88afc9f1e6c7ed2b61b446b4881da1ee87d4c52a99f582bae59cb2", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "f2b7e271f06e88e3b6b6bc423ff97850", - "deployedBytecodeHash": "0b4acdad4c4f7dc3b8cb55fe3479a743", - "sourceHash": "61dded7836f4431e621382340f32670c", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity ^0.4.23;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(TransferFeeInterface _feeAccount)\n public AugmintToken(\"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "4b49e7e6d1a9a2de81a4d2d088acbc04": { - "latestDeployedAddress": "0x1a93886326b0220731f25926d56074f7f0b074ce", - "deployments": { - "0x1a93886326b0220731f25926d56074f7f0b074ce": { - "generatedAt": "2018-05-12T00:22:15.164Z", - "truffleContractFileUpdatedAt": "2018-05-12T00:22:12.405Z", - "deployTransactionHash": "0xf13fed4e1c899f3287abfa6aefe1a5e3f63a61e3eb525b990297894d7be92607", - "compiler": { - "name": "solc", - "version": "0.4.23+commit.124ca40d.Emscripten.clang" - }, - "bytecodeHash": "042675fc70cfed8762b1e7de8d15799f", - "deployedBytecodeHash": "03b0c0d8c49d83af34516ac82bc0b2a9", - "sourceHash": "61dded7836f4431e621382340f32670c", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity ^0.4.23;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(TransferFeeInterface _feeAccount)\n public AugmintToken(\"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "303ed8bcda6fb3c3119cf273797961ef": { - "latestDeployedAddress": "0x2c07940b38c82486e7d26f49cc8b38bc7a663601", - "deployments": { - "0x2c07940b38c82486e7d26f49cc8b38bc7a663601": { - "generatedAt": "2018-05-31T23:56:48.494Z", - "truffleContractFileUpdatedAt": "2018-05-31T23:54:54.487Z", - "deployTransactionHash": "0x0ea2df27876bb07781f0872d7f92a7ce9a0e93ed469a7045d86b7db98e2c452f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "aab94da8bade346d5cae1e8fe8350299", - "deployedBytecodeHash": "586f597aa66909d58eb545346863be5e", - "sourceHash": "01bf01b9d42f2148a5f4621dbfddd077", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(TransferFeeInterface _feeAccount)\n public AugmintToken(\"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "962b41ca272a86b1f556fc47e0f7954f": { - "latestDeployedAddress": "0xbbecff5db2f9cccc936895121802fc15053344c6", - "deployments": { - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-06-04T12:57:19.299Z", - "truffleContractFileUpdatedAt": "2018-06-04T12:57:14.628Z", - "deployTransactionHash": "0xec0fc4004f6eb55bd27618c9cfc6534e97cb15572b4e20fc6ee3959af9c24e04", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "699a73688b7440a29431472c956c52ef", - "deployedBytecodeHash": "dc1bc9565dbd19b63734454b17413e3f", - "sourceHash": "b0939983ed3409574d7f6dfeeaa213c3", - "source": "/* Augmint Crypto Euro token (ACE) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "9aa81519ec45a52d3f8f1a1a83d25c74": { - "latestDeployedAddress": "0xbbecff5db2f9cccc936895121802fc15053344c6", - "deployments": { - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-06-06T15:25:31.749Z", - "truffleContractFileUpdatedAt": "2018-06-06T15:25:22.671Z", - "deployTransactionHash": "0x901cdf027cc7821b74752a6696b06e7da3839d56917714f3e1297c2c9c1b1d7a", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "3abfdb182b58136a9dcb25c1ece5ed54", - "deployedBytecodeHash": "c3636b199ceefdd5deb396f099915a87", - "sourceHash": "20cc69065a6935fc7519147f3fc5fa2c", - "source": "/* Augmint Crypto Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "1bf228e8c50681d2a93b6723af2144a7": { - "latestDeployedAddress": "0xbbecff5db2f9cccc936895121802fc15053344c6", - "deployments": { - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-07-08T15:47:54.868Z", - "truffleContractFileUpdatedAt": "2018-07-08T15:47:45.353Z", - "deployTransactionHash": "0x8535cd83c4138fd21f5d39b01b552e417657cfdd797b99bd46bf26d17e567894", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "093843934c4ff45016cf0169ef7f3d6d", - "deployedBytecodeHash": "a819383d32ed79e90279b14fda248aa8", - "sourceHash": "20cc69065a6935fc7519147f3fc5fa2c", - "source": "/* Augmint Crypto Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Crypto Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "d96bcadc59c7b9c8b1db01a11a021eef": { - "latestDeployedAddress": "0xbbecff5db2f9cccc936895121802fc15053344c6", - "deployments": { - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-08-14T19:51:18.035Z", - "truffleContractFileUpdatedAt": "2018-08-14T19:50:59.284Z", - "deployTransactionHash": "0xd66218d77bcb39823c02c1299a914f4383ce6a124b180babb4687d579cd2d5f3", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "fd49b2c846d91ab5e1003493be2a7915", - "deployedBytecodeHash": "5d570ca7b32725662d79af0d420f3a8b", - "sourceHash": "04025a37ea64acbc6f0ea2ec8a6f3e4d", - "source": "/* Augmint Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - }, - "2ea91d34a7bfefc8f38ef0e8a5ae24a5": { - "latestDeployedAddress": "0xbbecff5db2f9cccc936895121802fc15053344c6", - "deployments": { - "0xbbecff5db2f9cccc936895121802fc15053344c6": { - "generatedAt": "2018-10-18T13:35:02.366Z", - "truffleContractFileUpdatedAt": "2018-10-18T11:36:36.871Z", - "deployTransactionHash": "0x59d1c589b1714ab43380156a86e422e54a6bb846b51a588e60f2e44f700c6d9f", - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "bytecodeHash": "0398a39cdab3b394103910ea6b28eef7", - "deployedBytecodeHash": "2916088286d725e884630bc95fc19dbf", - "sourceHash": "04025a37ea64acbc6f0ea2ec8a6f3e4d", - "source": "/* Augmint Euro token (A-EUR) implementation */\npragma solidity 0.4.24;\nimport \"./interfaces/TransferFeeInterface.sol\";\nimport \"./generic/AugmintToken.sol\";\n\n\ncontract TokenAEur is AugmintToken {\n constructor(address _permissionGranterContract, TransferFeeInterface _feeAccount)\n public AugmintToken(_permissionGranterContract, \"Augmint Euro\", \"AEUR\", \"EUR\", 2, _feeAccount)\n {} // solhint-disable-line no-empty-blocks\n\n}\n" - } - } - } - } -} \ No newline at end of file diff --git a/src/augmintjs/constants.js b/src/augmintjs/constants.js deleted file mode 100644 index 5f43cfc..0000000 --- a/src/augmintjs/constants.js +++ /dev/null @@ -1,22 +0,0 @@ -const constants = { - ONE_ETH_IN_WEI: 1e18, - - /* augmintToken decimals */ - DECIMALS_DIV: 100, - - DECIMALS: 2, - - PPM_DIV: 1000000, - - ETHEUR: "ETHEUR", - - /* in legacy contracts CHUNK_SIZE set in contract so don't change this value */ - LEGACY_CONTRACTS_CHUNK_SIZE: 100, - // New contracts accept chunksize as param for each fx so it can be adjusted with this constant - CHUNK_SIZE: 100, - - TOKEN_BUY: 0, - TOKEN_SELL: 1 -}; - -module.exports = { constants }; diff --git a/src/augmintjs/gas.js b/src/augmintjs/gas.js deleted file mode 100644 index b6514de..0000000 --- a/src/augmintjs/gas.js +++ /dev/null @@ -1,38 +0,0 @@ -const cost = { - NEW_LOAN_GAS: 240000, // As of now it's on ganache: 167,196-167390 - 182,000??? - NEW_FIRST_LOAN_GAS: 240000, // 227390 - REPAY_GAS: 150000, // AugmintToken.transferAndNotify, as of now on testRpc: first: 105,354, tehn : 120305 ? - COLLECT_BASE_GAS: 90000, // as of now on testRpc: 1 loan = first: 73,333, consecutive: 64,683 - COLLECT_ONE_GAS: 20000, // as of now: ca. 10000 - - TRANSFER_AUGMINT_TOKEN_GAS: 100000, // on testrpc: first: 75189 - 75405, rinkeby first: 76629 - //consecutive : no narr: 45405 - 60405 (higher when sent to account which never received) - // w narrative: 46733 - 56693 - - PLACE_ORDER_GAS: 200000, - - MATCH_ORDERS_GAS: 150000, // a single matchOrders - - // base cost for matchMultipleOrders - // actual on ganache: 80667 but requires higher b/c Exchange contract's matchMultipleOrders stops matching if gasLeft < 100k - MATCH_MULTIPLE_FIRST_MATCH_GAS: 200000, - - // additional cost for each match for matchMultipleOrder. - // actual on ganache: 2nd: +57760. then between 45652-47767, sometimes 5783? - MATCH_MULTIPLE_ADDITIONAL_MATCH_GAS: 50000, - - // actuals on ganache: sell cancel: 31891-43725 / buy cancel: 24264-28470 - // last sell order cancel reverts in ganache with 60000 gas limit despite it runs w/ 31891 gas... likely a ganache bug - CANCEL_ORDER_GAS: 70000, - - LEGACY_BALANCE_CONVERT_GAS: 200000, - - NEW_LOCK_GAS: 200000, // actual on ganache: 176761 - NEW_FIRST_LOCK_GAS: 240000, // actual on ganache: 206761 - - RELEASE_LOCK_GAS: 100000, // actual on ganache: 62515 - - SET_RATE_GAS_LIMIT: 80000 -}; - -module.exports = { cost }; diff --git a/src/augmintjs/helpers/contractConnection.js b/src/augmintjs/helpers/contractConnection.js deleted file mode 100644 index ec6e8dd..0000000 --- a/src/augmintjs/helpers/contractConnection.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = { - connectLatest -}; - -function connectLatest(ethereumConnection, abiFile) { - const contractName = abiFile.contractName; - const abiVersionHash = abiFile.abiHash; - - const deploysFile = getDeploysFile(ethereumConnection.networkId, contractName); - - if (!deploysFile.deployedAbis[abiVersionHash] || !deploysFile.deployedAbis[abiVersionHash].latestDeployedAddress) { - throw new Error( - `Couldn't find deployment info for ${contractName} with abi version ${abiVersionHash} in ${ - deploysFile._fileName - }` - ); - } - const contractAddress = deploysFile.deployedAbis[abiVersionHash].latestDeployedAddress; - - return new ethereumConnection.web3.eth.Contract(abiFile.abi, contractAddress); -} - -function getDeploysFile(networkId, contractName) { - const deploysFileName = `../abiniser/deployments/${networkId}/${contractName}_DEPLOYS.json`; - let deploysFile; - - try { - /* must provide fileName string again for webpack (needs to be statically analysable) */ - deploysFile = require(`../abiniser/deployments/${networkId}/${contractName}_DEPLOYS.json`); - } catch (error) { - throw new Error(`Couldn't import deployment file ${deploysFileName} for ${contractName}\n${error}`); - } - deploysFile._fileName = deploysFileName; - return deploysFile; -} diff --git a/src/augmintjs/helpers/env.js b/src/augmintjs/helpers/env.js deleted file mode 100644 index 8b480cf..0000000 --- a/src/augmintjs/helpers/env.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - set process.env vars from .env files, based on NODE_ENV setting, in this order: - 1. .env - loadded first - 2. .env.[development|test|production] - Environment-specific settings. - 3. .env.local - Local overrides. This file is loaded for all environments except test. - 4. .env.[development|test|production].local - Local overrides of environment-specific settings. - 5. environment variables - never overwritten -*/ -"use strict"; - -const fs = require("fs"); -const dotenvConfig = require("dotenv").config; -const DOTENV_PATH = ".env"; -const NODE_ENV = process.env.NODE_ENV; - -if (!NODE_ENV) { - throw new Error("The NODE_ENV environment variable is required but was not specified."); -} - -// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -const dotenvFiles = [ - `${DOTENV_PATH}.${NODE_ENV}.local`, - `${DOTENV_PATH}.${NODE_ENV}`, - // Don't include `.env.local` for `test` environment since normally you expect tests to produce the same results for everyone - NODE_ENV !== "test" && `${DOTENV_PATH}.local`, - DOTENV_PATH // the base .env -].filter(Boolean); - -// Load environment variables from .env* files. Suppress warnings using silent if this file is missing. -// dotenv will never modify any environment variables that have already been set. https://github.com/motdotla/dotenv -dotenvFiles.forEach(dotenvFile => { - if (fs.existsSync(dotenvFile)) { - dotenvConfig({ - path: dotenvFile - }); - // require("dotenv").config({ - // path: dotenvFile - // }); - } -}); diff --git a/src/augmintjs/helpers/log.js b/src/augmintjs/helpers/log.js deleted file mode 100644 index ba55c0a..0000000 --- a/src/augmintjs/helpers/log.js +++ /dev/null @@ -1,5 +0,0 @@ -require("src/augmintjs/helpers/env.js"); -const ulog = require("ulog"); -const log = moduleName => ulog(moduleName); - -module.exports = log; diff --git a/src/augmintjs/helpers/promiseTimeout.js b/src/augmintjs/helpers/promiseTimeout.js deleted file mode 100644 index 9c3d1ae..0000000 --- a/src/augmintjs/helpers/promiseTimeout.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = promiseTimeout; - -function promiseTimeout(ms, promise) { - let id; - let timeout = new Promise((resolve, reject) => { - id = setTimeout(() => { - reject("Timed out in " + ms + "ms."); - }, ms); - }); - - return Promise.race([promise, timeout]) - .then(result => { - clearTimeout(id); - return result; - }) - .catch(error => { - clearTimeout(id); - throw error; - }); -} diff --git a/src/augmintjs/helpers/sigintHandler.js b/src/augmintjs/helpers/sigintHandler.js deleted file mode 100644 index 720c7ed..0000000 --- a/src/augmintjs/helpers/sigintHandler.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = setExitHandler; - -const log = require("src/augmintjs/helpers/log.js")("sigintHandler"); -const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); -const DEFAULT_EXIT_TIMEOUT = 10000; // how much to wait before timing out disconnect (in ms) -const SIGNALS = ["SIGINT", "SIGQUIT", "SIGTERM"]; - -function setExitHandler(exitHandler, name, exitTimeout = DEFAULT_EXIT_TIMEOUT) { - SIGNALS.forEach(signal => { - process.on(signal, async signal => { - await promiseTimeout(exitTimeout, exitHandler(signal)) - .then(() => { - log.debug(`${name} exit (${signal}) success`); - }) - .catch(error => { - // most likely timeout - log.warn(`${name} exit (${signal}) failed with Error:`, error); - process.exitCode = 999; - }); - }); - }); -} diff --git a/src/augmintjs/testHelpers/ganache.js b/src/augmintjs/testHelpers/ganache.js deleted file mode 100644 index cec0f2e..0000000 --- a/src/augmintjs/testHelpers/ganache.js +++ /dev/null @@ -1,53 +0,0 @@ -module.exports = { - takeSnapshot, - revertSnapshot -}; - -//let snapshotCount = 0; -function takeSnapshot(web3) { - //dirty hack for web3@1.0.0 support for localhost testrpc, see https://github.com/trufflesuite/truffle-contract/issues/56#issuecomment-331084530 - if (typeof web3.currentProvider.sendAsync !== "function") { - web3.currentProvider.sendAsync = function() { - return web3.currentProvider.send.apply(web3.currentProvider, arguments); - }; - } - - return new Promise(function(resolve, reject) { - web3.currentProvider.sendAsync( - { - method: "evm_snapshot", - params: [], - jsonrpc: "2.0", - id: new Date().getTime() - }, - function(error, res) { - if (error) { - reject(new Error("Can't take snapshot with web3\n" + error)); - } else { - resolve(res.result); - } - } - ); - }); -} - -function revertSnapshot(web3, snapshotId) { - return new Promise(function(resolve, reject) { - web3.currentProvider.sendAsync( - { - method: "evm_revert", - params: [snapshotId], - jsonrpc: "2.0", - id: new Date().getTime() - }, - function(error, res) { - if (error) { - // TODO: this error is not bubbling up to truffle test run :/ - reject(new Error("Can't revert snapshot with web3. snapshotId: " + snapshotId + "\n" + error)); - } else { - resolve(res); - } - } - ); - }); -} diff --git a/src/runFeeder.js b/src/runFeeder.js index e0a562e..79a4c76 100644 --- a/src/runFeeder.js +++ b/src/runFeeder.js @@ -1,6 +1,6 @@ -require("src/augmintjs/helpers/env.js"); -const log = require("src/augmintjs/helpers/log.js")("runFeeder"); -const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); +require("@augmint/js/src/helpers/env.js"); +const log = require("@augmint/js/src/helpers/log.js")("runFeeder"); +const EthereumConnection = require("@augmint/js/src/EthereumConnection.js"); const RatesFeeder = require("src/RatesFeeder.js"); const MatchMaker = require("src/MatchMaker/MatchMaker.js"); const subscribeTickers = require("src/subscribeTickers.js"); diff --git a/src/statusApi/app.js b/src/statusApi/app.js index 64b2599..1993197 100644 --- a/src/statusApi/app.js +++ b/src/statusApi/app.js @@ -1,4 +1,4 @@ -require("src/augmintjs/helpers/env.js"); +require("@augmint/js/src/helpers/env.js"); // const log = require("src/augmintjs/helpers/log.js")("statusApi"); const httplogger = require("morgan"); diff --git a/src/statusApi/server.js b/src/statusApi/server.js index 0f273fb..114dc07 100644 --- a/src/statusApi/server.js +++ b/src/statusApi/server.js @@ -1,7 +1,7 @@ -require("src/augmintjs/helpers/env.js"); -const log = require("src/augmintjs/helpers/log.js")("statusApi"); -const promiseTimeout = require("src/augmintjs/helpers/promiseTimeout.js"); -const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); +require("@augmint/js/src/helpers/env.js"); +const log = require("@augmint/js/src/helpers/log.js")("statusApi"); +const promiseTimeout = require("@augmint/js/src/helpers/promiseTimeout.js"); +const setExitHandler = require("@augmint/js/src/helpers/sigintHandler.js"); const app = require("./app.js"); const http = require("http"); let httpServer; @@ -58,16 +58,16 @@ function start(ratesFeeder) { // handle specific listen errors with friendly messages switch (error.code) { - case "EACCES": - log.error("Error: Can't start statusApi server:" + bind + " requires elevated privileges"); - process.exit(1); - break; - case "EADDRINUSE": - log.error("Error: Can't start statusApi server:" + bind + " is already in use"); - process.exit(1); - break; - default: - throw error; + case "EACCES": + log.error("Error: Can't start statusApi server:" + bind + " requires elevated privileges"); + process.exit(1); + break; + case "EADDRINUSE": + log.error("Error: Can't start statusApi server:" + bind + " is already in use"); + process.exit(1); + break; + default: + throw error; } } diff --git a/src/tickerProviders/BaseHttpTickerProvider.js b/src/tickerProviders/BaseHttpTickerProvider.js index ea51928..6124ac7 100644 --- a/src/tickerProviders/BaseHttpTickerProvider.js +++ b/src/tickerProviders/BaseHttpTickerProvider.js @@ -1,5 +1,5 @@ -require("src/augmintjs/helpers/env.js"); -const log = require("src/augmintjs/helpers/log.js")("TickerProvider"); +require("@augmint/js/src/helpers/env.js"); +const log = require("@augmint/js/src/helpers/log.js")("TickerProvider"); const BaseTickerProvider = require("./BaseTickerProvider.js"); const fetch = require("node-fetch"); diff --git a/src/tickerProviders/BaseTickerProvider.js b/src/tickerProviders/BaseTickerProvider.js index c3984d1..3f67a86 100644 --- a/src/tickerProviders/BaseTickerProvider.js +++ b/src/tickerProviders/BaseTickerProvider.js @@ -1,6 +1,6 @@ -const log = require("src/augmintjs/helpers/log.js")("TickerProvider"); +const log = require("@augmint/js/src/helpers/log.js")("TickerProvider"); const EventEmitter = require("events"); -const setExitHandler = require("src/augmintjs/helpers/sigintHandler.js"); +const setExitHandler = require("@augmint/js/src/helpers/sigintHandler.js"); class BaseTickerProvider extends EventEmitter { // for each provider implement a getter for name diff --git a/src/tickerProviders/KrakenHttpTicker.js b/src/tickerProviders/KrakenHttpTicker.js index ccd18dc..74e117c 100644 --- a/src/tickerProviders/KrakenHttpTicker.js +++ b/src/tickerProviders/KrakenHttpTicker.js @@ -3,7 +3,6 @@ NB: Kraken's websocket has vwaps for different time periods than 24hrs */ -const log = require("src/augmintjs/helpers/log.js")("TickerProvider"); const BaseHttpTickerProvider = require("./BaseHttpTickerProvider.js"); class KrakenHttpTicker extends BaseHttpTickerProvider { diff --git a/test/RatesFeeder.onchain.js b/test/RatesFeeder.onchain.js index 276a162..d1d135d 100644 --- a/test/RatesFeeder.onchain.js +++ b/test/RatesFeeder.onchain.js @@ -2,7 +2,7 @@ */ const assert = require("chai").assert; const baseHelpers = require("./helpers/base.js"); -const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); +const EthereumConnection = require("@augmint/js/src/EthereumConnection.js"); const ethereumConnection = new EthereumConnection(); const RatesFeeder = require("src/RatesFeeder.js"); diff --git a/test/ratesfeeder.js b/test/ratesfeeder.js index 8a58eb8..e77c920 100644 --- a/test/ratesfeeder.js +++ b/test/ratesfeeder.js @@ -2,7 +2,7 @@ */ const assert = require("chai").assert; const RatesFeeder = require("src/RatesFeeder.js"); -const EthereumConnection = require("src/augmintjs/EthereumConnection.js"); +const EthereumConnection = require("@augmint/js/src/EthereumConnection.js"); const ethereumConnection = new EthereumConnection(); const getStatus = () => "tickerProvider mock getStatus for test"; From c762a06d2b8dbee87879813fe0ea7a116cd91806 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Fri, 12 Apr 2019 00:15:37 +0000 Subject: [PATCH 27/46] chore(package): update mocha to version 6.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a17daf..4d027e0 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "devDependencies": { "chai": "4.2.0", "eslint": "5.16.0", - "mocha": "6.1.2", + "mocha": "6.1.3", "nock": "10.0.6", "sinon": "7.3.1" }, From b5fdfe5d35cfeb97e8ea440091f8716486926e54 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Fri, 12 Apr 2019 00:15:43 +0000 Subject: [PATCH 28/46] chore(package): update lockfile yarn.lock --- yarn.lock | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/yarn.lock b/yarn.lock index a2d4c36..9eabe6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2001,10 +2001,10 @@ mkdirp@*, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -mocha@6.1.2: - version "6.1.2" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.2.tgz#31e960580ef709ef5f26bbe760547cf5207b44df" - integrity sha512-BgD2/RozoSC3uQK5R0isDcxjqaWw2n5HWdk8njYUyZf2NC79ErO5FtYVX52+rfqGoEgMfJf4fuG0IWh2TMzFoA== +mocha@6.1.3: + version "6.1.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.3.tgz#79d1b370a92dfdb409e6f77bc395ca5afe4cdc93" + integrity sha512-QdE/w//EPHrqgT5PNRUjRVHy6IJAzAf1R8n2O8W8K2RZ+NbPfOD5cBDp+PGa2Gptep37C/TdBiaNwakppEzEbg== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" @@ -2020,7 +2020,7 @@ mocha@6.1.2: minimatch "3.0.4" mkdirp "0.5.1" ms "2.1.1" - node-environment-flags "1.0.4" + node-environment-flags "1.0.5" object.assign "4.1.0" strip-json-comments "2.0.1" supports-color "6.0.0" @@ -2131,12 +2131,13 @@ nock@10.0.6: qs "^6.5.1" semver "^5.5.0" -node-environment-flags@1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.4.tgz#0b784a6551426bfc16d3b2208424dcbc2b2ff038" - integrity sha512-M9rwCnWVLW7PX+NUWe3ejEdiLYinRpsEre9hMkU/6NS4h+EEulYaDH1gCEZ2gyXsmw+RXYDaV2JkkTNcsPDJ0Q== +node-environment-flags@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a" + integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== dependencies: object.getownpropertydescriptors "^2.0.3" + semver "^5.7.0" node-fetch@2.3.0: version "2.3.0" @@ -2705,7 +2706,7 @@ seek-bzip@^1.0.5: dependencies: commander "~2.8.1" -semver@^5.5.0, semver@^5.5.1: +semver@^5.5.0, semver@^5.5.1, semver@^5.7.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== From f9becd3841d662322474b48b0fb2b8121026335f Mon Sep 17 00:00:00 2001 From: robi Date: Fri, 12 Apr 2019 14:19:38 +0200 Subject: [PATCH 29/46] pin yarn's exact version --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3e15e7a..54240e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ cache: - "node_modules" - "augmint-contracts/node_modules" before_install: + - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 + - export PATH="$HOME/.yarn/bin:$PATH" - export BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" - yarn global add greenkeeper-lockfile@1 install: From 39a1067a8d91be8a973da5c51d9d19a7ee4054b9 Mon Sep 17 00:00:00 2001 From: robi Date: Fri, 12 Apr 2019 14:43:31 +0200 Subject: [PATCH 30/46] pin yarn version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dec9606..b62e9d1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "engines": { "node": "10.15.3", - "yarn": "^1.15.2" + "yarn": "1.15.2" }, "dependencies": { "@augmint/js": "0.0.2", @@ -61,4 +61,4 @@ "url": "https://github.com/Augmint/augmint-ratesfeeder/issues" }, "homepage": "https://github.com/Augmint/augmint-ratesfeeder#readme" -} \ No newline at end of file +} From e6d08413028a21b5d655eb19f5029fba3591049a Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 11:04:17 +0100 Subject: [PATCH 31/46] auto reformat --- .travis.yml | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54240e5..8387e3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,41 +1,41 @@ dist: xenial # https://docs.travis-ci.com/user/reference/xenial/ language: node_js cache: - directories: - - "node_modules" - - "augmint-contracts/node_modules" + directories: + - "node_modules" + - "augmint-contracts/node_modules" before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 - - export PATH="$HOME/.yarn/bin:$PATH" - - export BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" - - yarn global add greenkeeper-lockfile@1 + - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 + - export PATH="$HOME/.yarn/bin:$PATH" + - export BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" + - yarn global add greenkeeper-lockfile@1 install: - - | - if [[ $BRANCH == "greenkeeper/"* ]]; then - echo Greenkeeper build using .yarnrc.greenkeeper; cp .yarnrc.greenkeeper .yarnrc; yarn install; - else - echo Normal build using .yarnrc and --frozen-lockfile option; yarn install --frozen-lockfile; - fi - - cd augmint-contracts && yarn install && cd .. + - | + if [[ $BRANCH == "greenkeeper/"* ]]; then + echo Greenkeeper build using .yarnrc.greenkeeper; cp .yarnrc.greenkeeper .yarnrc; yarn install; + else + echo Normal build using .yarnrc and --frozen-lockfile option; yarn install --frozen-lockfile; + fi + - cd augmint-contracts && yarn install && cd .. before_script: - - greenkeeper-lockfile-update - - yarn ganache:run > ganache.out & - - yarn contracts:migrate + - greenkeeper-lockfile-update + - yarn ganache:run > ganache.out & + - yarn contracts:migrate script: - - yarn test + - yarn test # discord webhooks hack until this is released: https://github.com/travis-ci/travis-tasks/pull/71 after_script: greenkeeper-lockfile-upload after_success: - - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh - - chmod +x send.sh - - ./send.sh success $DISCORD_WEBHOOK_URL + - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh + - chmod +x send.sh + - ./send.sh success $DISCORD_WEBHOOK_URL after_failure: - - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh - - chmod +x send.sh - - ./send.sh failure $DISCORD_WEBHOOK_URL + - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh + - chmod +x send.sh + - ./send.sh failure $DISCORD_WEBHOOK_URL env: - global: - # GH_TOKEN for greenkeeper - - secure: SSgqXUNxvwXsEz2WuY72oqhIy+OOKCtuFejf6vPODnY+eGxYIZIskganepdJmZkFF0EklPi44D3DNnm1yeQNuSrExC1Fq49qiHRhRsa22soY2JrvXsGHA8x3tbZ4FxexYzb7p4Ej75TlAb2F9kRr+r9M0eqq/pD4IjdT9Zy05E7zodXxANmGbct6DsYyqSvxyHeH5cYsK33HA8UmrIbose2VHjGwvPI4T64LxEEla9mnWDLmN5gmLNYPglUWckJlRwXRGOyswedO7FI1P2xk+e3nByYpE+SI0KLKnth9I5PBYTwrPU7Uy2JeGM8bpZK86tRSeMvFb5pn5h0sW14TWQdzlUpaXDI8/+o1m9BrgTIC38fw3VMm5Vo/EWZXG9zm1A56hVHf7NJkWeOC2KoPsCwCAViOKLMsErCfa+xOf2E+/JzvUpS78DiMmgouuzQ59NKU6BhMUsHDBcQNP5YS8sIRYedtEfsO9O4iwx5BG3+izs5zHEiJ1vUN8ACOa3TJ0/PKbGSgZx8lmLW8dRJw9P1i1N5LSH5X/xuAd/b1HbiM4ItkCq28WKVlQRUlqO+WYcOYdbNMQ4u6Xs+8gqdC2zGwaZ7YBMr2lcXKxJtrYHx4b95WCw7iBVWwuA5zXDDiAFpvCjV/etJ+i0GplqFL1ziFZ3Nb2R7wGezak0LffSc= - # DISCORD_WEBHOOK_URL - - secure: dswuM6gVOnYKsYjsyF3lqO1vRExc4WivTXoGW2/37zF73S51yLICrhLzSkHe77CN5pLZHAbhkTZLpqfFmsTdnpiq3d3epBpG/B18If/I4w39eyUiYiyPJb8T+9PHBuf9HLNzAI9Lv+HZErokzG2sLya9gbiTV/Em3QY/8+5FLw2jf4wOkzmWV4Bxfh8Fxul0vR+R4UcX6FF77GboW7Fpk958TpkQYYBwt439TW47fix6/pHzKqvwQX5UhjI0tcixecP9/PR7mZPDZN/G3ISPCc7BpHZzHt87CfUZJBKmz+8smGWhhUyyfcFbwqt9hG+yVjqoZqXSIDmN5sG0jJvWISSPo3wlPdjKTKiPCElIrvNJBKesB5cfVFHAoIrI53bNPdoSFwhkyzcZ6s2V1LqgQnRYq+MqPtH1X4vi7+715+t17ULcB7depXYhH1d/gf60O0CSw5U903d0Ev7lWaWOfZocZjxHt/3ah1ZrgtWmKgn8Yc+2HO04Fsl7+Ntvk5/MzjGJDaqNtOk+2Ocf7CSu5R9AY1ofNsjyq0+V+n2JvlCkOR8P0MJ6oYORrjIFi0NwTVV53NT+2eigahtZqOzZfLSKR8ibWxOtIFtljL5RoN+eiDWiZO79FfNTxTP7Ok4uGKImmrYZwzhnFW29rWsonzFwyllMLhjteiL7bgO8gTo= + global: + # GH_TOKEN for greenkeeper + - secure: SSgqXUNxvwXsEz2WuY72oqhIy+OOKCtuFejf6vPODnY+eGxYIZIskganepdJmZkFF0EklPi44D3DNnm1yeQNuSrExC1Fq49qiHRhRsa22soY2JrvXsGHA8x3tbZ4FxexYzb7p4Ej75TlAb2F9kRr+r9M0eqq/pD4IjdT9Zy05E7zodXxANmGbct6DsYyqSvxyHeH5cYsK33HA8UmrIbose2VHjGwvPI4T64LxEEla9mnWDLmN5gmLNYPglUWckJlRwXRGOyswedO7FI1P2xk+e3nByYpE+SI0KLKnth9I5PBYTwrPU7Uy2JeGM8bpZK86tRSeMvFb5pn5h0sW14TWQdzlUpaXDI8/+o1m9BrgTIC38fw3VMm5Vo/EWZXG9zm1A56hVHf7NJkWeOC2KoPsCwCAViOKLMsErCfa+xOf2E+/JzvUpS78DiMmgouuzQ59NKU6BhMUsHDBcQNP5YS8sIRYedtEfsO9O4iwx5BG3+izs5zHEiJ1vUN8ACOa3TJ0/PKbGSgZx8lmLW8dRJw9P1i1N5LSH5X/xuAd/b1HbiM4ItkCq28WKVlQRUlqO+WYcOYdbNMQ4u6Xs+8gqdC2zGwaZ7YBMr2lcXKxJtrYHx4b95WCw7iBVWwuA5zXDDiAFpvCjV/etJ+i0GplqFL1ziFZ3Nb2R7wGezak0LffSc= + # DISCORD_WEBHOOK_URL + - secure: dswuM6gVOnYKsYjsyF3lqO1vRExc4WivTXoGW2/37zF73S51yLICrhLzSkHe77CN5pLZHAbhkTZLpqfFmsTdnpiq3d3epBpG/B18If/I4w39eyUiYiyPJb8T+9PHBuf9HLNzAI9Lv+HZErokzG2sLya9gbiTV/Em3QY/8+5FLw2jf4wOkzmWV4Bxfh8Fxul0vR+R4UcX6FF77GboW7Fpk958TpkQYYBwt439TW47fix6/pHzKqvwQX5UhjI0tcixecP9/PR7mZPDZN/G3ISPCc7BpHZzHt87CfUZJBKmz+8smGWhhUyyfcFbwqt9hG+yVjqoZqXSIDmN5sG0jJvWISSPo3wlPdjKTKiPCElIrvNJBKesB5cfVFHAoIrI53bNPdoSFwhkyzcZ6s2V1LqgQnRYq+MqPtH1X4vi7+715+t17ULcB7depXYhH1d/gf60O0CSw5U903d0Ev7lWaWOfZocZjxHt/3ah1ZrgtWmKgn8Yc+2HO04Fsl7+Ntvk5/MzjGJDaqNtOk+2Ocf7CSu5R9AY1ofNsjyq0+V+n2JvlCkOR8P0MJ6oYORrjIFi0NwTVV53NT+2eigahtZqOzZfLSKR8ibWxOtIFtljL5RoN+eiDWiZO79FfNTxTP7Ok4uGKImmrYZwzhnFW29rWsonzFwyllMLhjteiL7bgO8gTo= From 9b93aab0d12213a70011d659ce285047cef2a632 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 11:12:49 +0100 Subject: [PATCH 32/46] Removed augmint-contracts submodule --- .gitmodules | 3 --- augmint-contracts | 1 - 2 files changed, 4 deletions(-) delete mode 160000 augmint-contracts diff --git a/.gitmodules b/.gitmodules index 6000fc4..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "augmint-contracts"] - path = augmint-contracts - url = https://github.com/Augmint/augmint-contracts.git diff --git a/augmint-contracts b/augmint-contracts deleted file mode 160000 index 34af567..0000000 --- a/augmint-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 34af567ef85fec99aec900668de6653a0b8ba979 From 68cd3e68b76f5b95f2e73d67b393b68bc341101f Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 11:46:08 +0100 Subject: [PATCH 33/46] use docker --- .travis.yml | 7 +-- docs/developmentEnvironment.md | 84 +++++++++++++++++----------------- package.json | 6 +-- 3 files changed, 48 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8387e3f..a81a551 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ dist: xenial # https://docs.travis-ci.com/user/reference/xenial/ language: node_js +services: + - docker cache: directories: - "node_modules" @@ -19,12 +21,11 @@ install: - cd augmint-contracts && yarn install && cd .. before_script: - greenkeeper-lockfile-update - - yarn ganache:run > ganache.out & - - yarn contracts:migrate + - yarn ganache:start > /dev/null & script: - yarn test -# discord webhooks hack until this is released: https://github.com/travis-ci/travis-tasks/pull/71 after_script: greenkeeper-lockfile-upload +# discord webhooks hack until this is released: https://github.com/travis-ci/travis-tasks/pull/71 after_success: - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh - chmod +x send.sh diff --git a/docs/developmentEnvironment.md b/docs/developmentEnvironment.md index 754ec22..b41c6f1 100644 --- a/docs/developmentEnvironment.md +++ b/docs/developmentEnvironment.md @@ -2,104 +2,102 @@ ## Install -These instructions are about the dev environment for rates feeder (oracle) development. +Instructions about the dev environment setup for Ratesfeeder development. + For contracs development see [augmint-contracts repo](https://github.com/Augmint/augmint-contracts) + For UI development see [augmint-web repo](https://github.com/Augmint/augmint-web) ### OSX / Linux 1. [Git](https://git-scm.com/download) -1. [Ethereum CLI](https://www.ethereum.org/cli) -1. Install [nodejs](https://nodejs.org/en/download/) - _tested with v10.15.3_ - or install nodejs with [n node version manager](https://github.com/tj/n): +1. [nodejs](https://nodejs.org/en/download/) + NB: check supported node version in [package.json](../package.json) + + Installing nodejs with [n node version manager](https://github.com/tj/n): ``` npm install -g n - n 10.15.3 + n ``` -1. Install yarn if you don't have it: `npm install -g yarn@1.13.0` +1. Yarn: `npm install -g yarn@` + NB: check required yarn version in [package.json](../package.json) + +1. [Docker cli](https://hub.docker.com/search/?type=edition&offering=community) + 1. ``` - git clone https://github.com/Augmint/augmint-ratesfeeder.git --recurse-submodules + git clone https://github.com/Augmint/augmint-ratesfeeder.git cd augmint-ratesfeeder yarn install - cd augmint-contracts - git checkout master - yarn install ``` ### Windows -_Note: It is recommended to use PowerShell (win+X => powershell)_ +_Note: windows install was not tested since a while, update on it is welcome_ -1. [Git Bash](https://git-for-windows.github.io/) (required for truffle & yarn start) +1. [Git Bash](https://git-for-windows.github.io/) 1. [Git](https://git-scm.com/download) (if you haven't installed it as part of Git Bash in previous step) -1. [Ethereum CLI](https://www.ethereum.org/cli) - including development tools -1. [Node Version Manager(NVM)](https://github.com/coreybutler/nvm-windows/releases) -1. [nodejs](https://nodejs.org/en/download/) +1. [nodejs](https://nodejs.org/en/download/) + NB: check supported node version in [package.json](../package.json) - or install nodejs with [Node Version Manager(NVM)](https://github.com/coreybutler/nvm-windows/releases): + Installing nodejs with [Node Version Manager(NVM)](https://github.com/coreybutler/nvm-windows/releases): ``` - nvm install 10.15.3 + nvm install nvm use 10.15.3 ``` -1. Install yarn if you don't have it: `npm install -g yarn` -1. Get the source code: +1. Yarn: `npm install -g yarn@` + NB: check required yarn version in [package.json](../package.json) + +1. [Docker cli](https://hub.docker.com/search/?type=edition&offering=community) + +1. in Git bash: ``` - git clone https://github.com/Augmint/augmint-ratesfeeder.git --recurse-submodules + git clone https://github.com/Augmint/augmint-ratesfeeder.git cd augmint-ratesfeeder yarn install - cd augmint-contracts - git checkout master - yarn install ``` _If python already installed but npm does not find it: npm --add-python-to-path='true' --debug install --global windows-build-tools (as administrator)_ ## Launch -### 1. Update to latest augmint-ratesfeeder +### Update to latest augmint-ratesfeeder ``` git pull yarn install # if there were any node package changes in packages.json ``` -### 2. Update to latest augmint contract - -``` -cd augmint-contracts -git checkout master -git pull -yarn install # if there were any node package changes in packages.json -``` +### Tests -### 3. Tests +1. Start ganache-cli (formerly testrpc) -1. Start ganache-cli (formerly testrpc) - `yarn contracts:runmigrate` - or - `yarn ganache:run` and in separate console: - `yarn contracts:migrate` + ``` + yarn ganache:start + ``` -1. Run tests +2. Run tests ``` yarn test ``` -### 4. Feeding +### Feeding #### Local -1. `yarn contracts:runmigrate` -1. when migrate finished, in a separate console: `yarn start` +``` +yarn ganache:start +``` -or for production +``` +yarn start +``` #### Production (rinkeby or mainnet) diff --git a/package.json b/package.json index 96101e3..149c1ac 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "test": "yarn cross-env NODE_ENV=test NODE_PATH=. mocha '{src/**/*.test.js,test/**/*.js}' --exit", "test:augmintjs": "yarn cross-env NODE_ENV=test NODE_PATH=. mocha 'src/augmintjs/**/*.test.js' --exit", "contracts:migrate": "cd augmint-contracts && yarn migrate", - "ganache:run": "cd augmint-contracts && yarn ganache:run", - "contracts:runmigrate": "cd augmint-contracts && yarn runmigrate" + "ganache:start": "docker start ganache || docker run --name ganache -p 8545:8545 augmint/contracts:v1.0.4 --db ./dockerLocalchaindb --gasLimit 0x47D5DE --gasPrice 1000000000 --networkId 999 -m \"hello build tongue rack parade express shine salute glare rate spice stock\"", + "ganache:stop": "docker stop ganache" }, "greenkeeper": { "ignore": [ @@ -61,4 +61,4 @@ "url": "https://github.com/Augmint/augmint-ratesfeeder/issues" }, "homepage": "https://github.com/Augmint/augmint-ratesfeeder#readme" -} +} \ No newline at end of file From e3c282012ee16ec734d7cdde89f3171d5301d163 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 11:57:28 +0100 Subject: [PATCH 34/46] no more augmint-contracts submodule --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a81a551..d833544 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,6 @@ install: else echo Normal build using .yarnrc and --frozen-lockfile option; yarn install --frozen-lockfile; fi - - cd augmint-contracts && yarn install && cd .. before_script: - greenkeeper-lockfile-update - yarn ganache:start > /dev/null & From 106f08721859effd0243cd2c7f4ae96f8d88a01d Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 11:58:01 +0100 Subject: [PATCH 35/46] add wait-on devdep --- package.json | 3 ++- yarn.lock | 71 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 149c1ac..45281de 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "eslint": "5.16.0", "mocha": "6.1.3", "nock": "10.0.6", - "sinon": "7.3.1" + "sinon": "7.3.1", + "wait-on": "3.2.0" }, "optionalDependencies": { "bufferutil": "4.0.1", diff --git a/yarn.lock b/yarn.lock index e44d1c6..33f5c32 100644 --- a/yarn.lock +++ b/yarn.lock @@ -552,6 +552,11 @@ cookiejar@^2.1.1: resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== +core-js@^2.5.7: + version "2.6.5" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" + integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A== + core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -1493,6 +1498,16 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +hoek@5.x.x: + version "5.0.4" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-5.0.4.tgz#0f7fa270a1cafeb364a4b2ddfaa33f864e4157da" + integrity sha512-Alr4ZQgoMlnere5FZJsIyfIjORBqZll5POhDsF4q64dPuJR6rNxXdDxtHSQq8OXRurhmx+PWYEE8bXRROY8h0w== + +hoek@6.x.x: + version "6.1.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.3.tgz#73b7d33952e01fe27a38b0457294b79dd8da242c" + integrity sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ== + http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: version "1.6.3" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" @@ -1715,6 +1730,13 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +isemail@3.x.x: + version "3.2.0" + resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c" + integrity sha512-zKqkK+O+dGqevc93KNsbZ/TqTUFd46MwWjYOoMrjIMZ51eU7DtQG3Wmd9SQQT7i7RVnuTPEiYEWHU3MSbxC1Tg== + dependencies: + punycode "2.x.x" + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -1733,6 +1755,15 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" +joi@^13.0.0: + version "13.7.0" + resolved "https://registry.yarnpkg.com/joi/-/joi-13.7.0.tgz#cfd85ebfe67e8a1900432400b4d03bbd93fb879f" + integrity sha512-xuY5VkHfeOYK3Hdi91ulocfuFopwgbSORmIwzcwHKESQhC7w1kD5jaVSPnqDxS2I8t3RZ9omCKAxNwXN5zG1/Q== + dependencies: + hoek "5.x.x" + isemail "3.x.x" + topo "3.x.x" + js-sha3@0.5.7, js-sha3@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" @@ -1985,6 +2016,11 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + mkdirp-promise@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" @@ -2485,16 +2521,16 @@ punycode@2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" integrity sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0= +punycode@2.x.x, punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - qs@6.5.2, qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" @@ -2567,7 +2603,7 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -request@^2.79.0: +request@^2.79.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -2643,6 +2679,11 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +rx@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" + integrity sha1-pfE/957zt0D+MKqAP7CfmIBdR4I= + rxjs@^6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" @@ -3076,6 +3117,13 @@ toidentifier@1.0.0: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== +topo@3.x.x: + version "3.0.3" + resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c" + integrity sha512-IgpPtvD4kjrJ7CRA3ov2FhWQADwv+Tdqbsf1ZnPUSAtCJ9e1Z44MmoSGDXGk4IppoZA7jd/QRkNddlLJWlUZsQ== + dependencies: + hoek "6.x.x" + tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" @@ -3226,6 +3274,17 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +wait-on@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-3.2.0.tgz#c83924df0fc42a675c678324c49c769d378bcb85" + integrity sha512-QUGNKlKLDyY6W/qHdxaRlXUAgLPe+3mLL/tRByHpRNcHs/c7dZXbu+OnJWGNux6tU1WFh/Z8aEwvbuzSAu79Zg== + dependencies: + core-js "^2.5.7" + joi "^13.0.0" + minimist "^1.2.0" + request "^2.88.0" + rx "^4.1.0" + web3-bzz@1.0.0-beta.36: version "1.0.0-beta.36" resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.0.0-beta.36.tgz#adb3fe7a70053eb7843e32b106792b01b482ef41" From cf5bd55cbb7c4495b67e6c812d83cfa647464c4c Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 12:01:12 +0100 Subject: [PATCH 36/46] wait for ganache to start --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d833544..7721be1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: fi before_script: - greenkeeper-lockfile-update - - yarn ganache:start > /dev/null & + - yarn ganache:start > /dev/null & wait-on http-get://localhost:8545 script: - yarn test after_script: greenkeeper-lockfile-upload From f04d480b7061b4f10ef53c6ad935a2e1a5511d91 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 12:01:32 +0100 Subject: [PATCH 37/46] remove old script --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 45281de..970f8da 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "start:production": "yarn cross-env NODE_ENV=production NODE_PATH=. node ./src/runFeeder.js", "test": "yarn cross-env NODE_ENV=test NODE_PATH=. mocha '{src/**/*.test.js,test/**/*.js}' --exit", "test:augmintjs": "yarn cross-env NODE_ENV=test NODE_PATH=. mocha 'src/augmintjs/**/*.test.js' --exit", - "contracts:migrate": "cd augmint-contracts && yarn migrate", "ganache:start": "docker start ganache || docker run --name ganache -p 8545:8545 augmint/contracts:v1.0.4 --db ./dockerLocalchaindb --gasLimit 0x47D5DE --gasPrice 1000000000 --networkId 999 -m \"hello build tongue rack parade express shine salute glare rate spice stock\"", "ganache:stop": "docker stop ganache" }, From 0dd9e2cabc4116daab378345f043385309c41d48 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 12:24:35 +0100 Subject: [PATCH 38/46] wait for ganache to launch --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7721be1..63f1745 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,8 @@ install: fi before_script: - greenkeeper-lockfile-update - - yarn ganache:start > /dev/null & wait-on http-get://localhost:8545 + - yarn ganache:start > /dev/null & + - wait-on tcp://localhost:8545 # ganache script: - yarn test after_script: greenkeeper-lockfile-upload From 018a010e5ac13ba71290ae2c17e921ee8c900a15 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 12:29:09 +0100 Subject: [PATCH 39/46] proper wait for ganache launch --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 63f1745..88e7388 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ install: before_script: - greenkeeper-lockfile-update - yarn ganache:start > /dev/null & - - wait-on tcp://localhost:8545 # ganache + - wait-on tcp:localhost:8545 # ganache script: - yarn test after_script: greenkeeper-lockfile-upload From 8f7ce2ff416869c94d5c2914050e2ccc32c9028c Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Sat, 13 Apr 2019 13:29:26 +0100 Subject: [PATCH 40/46] ganache container to handle SIGINT (faster stop) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 970f8da..c48a847 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "start:production": "yarn cross-env NODE_ENV=production NODE_PATH=. node ./src/runFeeder.js", "test": "yarn cross-env NODE_ENV=test NODE_PATH=. mocha '{src/**/*.test.js,test/**/*.js}' --exit", "test:augmintjs": "yarn cross-env NODE_ENV=test NODE_PATH=. mocha 'src/augmintjs/**/*.test.js' --exit", - "ganache:start": "docker start ganache || docker run --name ganache -p 8545:8545 augmint/contracts:v1.0.4 --db ./dockerLocalchaindb --gasLimit 0x47D5DE --gasPrice 1000000000 --networkId 999 -m \"hello build tongue rack parade express shine salute glare rate spice stock\"", + "ganache:start": "docker start ganache || docker run --init --name ganache -p 8545:8545 augmint/contracts:v1.0.4 --db ./dockerLocalchaindb --gasLimit 0x47D5DE --gasPrice 1000000000 --networkId 999 -m \"hello build tongue rack parade express shine salute glare rate spice stock\"", "ganache:stop": "docker stop ganache" }, "greenkeeper": { From e3dd74a8ee68a1de3e8f50faada9454e2fbc01d3 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Mon, 15 Apr 2019 08:52:52 +0100 Subject: [PATCH 41/46] cache fix --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88e7388..37f239e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,7 @@ dist: xenial # https://docs.travis-ci.com/user/reference/xenial/ language: node_js services: - docker -cache: - directories: - - "node_modules" - - "augmint-contracts/node_modules" +cache: yarn before_install: - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 - export PATH="$HOME/.yarn/bin:$PATH" From d5c48eb46ff2aa6838a0615c295c69e954a9b091 Mon Sep 17 00:00:00 2001 From: szerintedmi Date: Mon, 15 Apr 2019 09:39:08 +0100 Subject: [PATCH 42/46] yarn wait-on --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 37f239e..3153330 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: before_script: - greenkeeper-lockfile-update - yarn ganache:start > /dev/null & - - wait-on tcp:localhost:8545 # ganache + - yarn wait-on tcp:localhost:8545 # ganache script: - yarn test after_script: greenkeeper-lockfile-upload From da8002af415ea388f2aaa431c855888a3e51c96d Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 18 Apr 2019 18:44:06 +0000 Subject: [PATCH 43/46] chore(package): update mocha to version 6.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c48a847..8fc6b44 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "devDependencies": { "chai": "4.2.0", "eslint": "5.16.0", - "mocha": "6.1.3", + "mocha": "6.1.4", "nock": "10.0.6", "sinon": "7.3.1", "wait-on": "3.2.0" From 81124cba2430d02810909b4c29251de424d2ec85 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 18 Apr 2019 18:44:10 +0000 Subject: [PATCH 44/46] chore(package): update lockfile yarn.lock --- yarn.lock | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 33f5c32..6114ca6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1779,15 +1779,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.13.0: - version "3.13.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" - integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -js-yaml@^3.13.0: +js-yaml@3.13.1, js-yaml@^3.13.0: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -2035,10 +2027,10 @@ mkdirp@*, mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -mocha@6.1.3: - version "6.1.3" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.3.tgz#79d1b370a92dfdb409e6f77bc395ca5afe4cdc93" - integrity sha512-QdE/w//EPHrqgT5PNRUjRVHy6IJAzAf1R8n2O8W8K2RZ+NbPfOD5cBDp+PGa2Gptep37C/TdBiaNwakppEzEbg== +mocha@6.1.4: + version "6.1.4" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.4.tgz#e35fada242d5434a7e163d555c705f6875951640" + integrity sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" @@ -2049,7 +2041,7 @@ mocha@6.1.3: glob "7.1.3" growl "1.10.5" he "1.2.0" - js-yaml "3.13.0" + js-yaml "3.13.1" log-symbols "2.2.0" minimatch "3.0.4" mkdirp "0.5.1" From 2cb645f60266f696827bb007457a88933b043383 Mon Sep 17 00:00:00 2001 From: Snyk bot Date: Mon, 14 Sep 2020 13:14:23 +0300 Subject: [PATCH 45/46] fix: upgrade express from 4.16.4 to 4.17.1 (#112) Snyk has created this PR to upgrade express from 4.16.4 to 4.17.1. See this package in npm: See this project in Snyk: https://app.snyk.io/org/szerintedmi/project/40317aa3-ac97-44de-a2c0-641b11d64023?utm_source=github&utm_medium=upgrade-pr --- package.json | 2 +- yarn.lock | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 203 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8fc6b44..315ce75 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "bignumber.js": "5.0.0", "cross-env": "5.2.0", "dotenv": "7.0.0", - "express": "4.16.4", + "express": "4.17.1", "http-errors": "1.7.2", "morgan": "1.9.1", "node-fetch": "2.3.0", diff --git a/yarn.lock b/yarn.lock index 6114ca6..6dfad4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -70,6 +70,14 @@ accepts@~1.3.5: mime-types "~2.1.18" negotiator "0.6.1" +accepts@~1.3.7: + version "1.3.7" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== + dependencies: + mime-types "~2.1.24" + negotiator "0.6.2" + acorn-jsx@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" @@ -280,6 +288,22 @@ body-parser@1.18.3, body-parser@^1.16.0: raw-body "2.3.3" type-is "~1.6.16" +body-parser@1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" + integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== + dependencies: + bytes "3.1.0" + content-type "~1.0.4" + debug "2.6.9" + depd "~1.1.2" + http-errors "1.7.2" + iconv-lite "0.4.24" + on-finished "~2.3.0" + qs "6.7.0" + raw-body "2.4.0" + type-is "~1.6.17" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -411,6 +435,11 @@ bytes@3.0.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= +bytes@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" + integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -532,6 +561,13 @@ content-disposition@0.5.2: resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" integrity sha1-DPaLud318r55YcOoUXjLhdunjLQ= +content-disposition@0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" + integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== + dependencies: + safe-buffer "5.1.2" + content-type@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" @@ -547,6 +583,11 @@ cookie@0.3.1: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s= +cookie@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" + integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== + cookiejar@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" @@ -1085,7 +1126,43 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -express@4.16.4, express@^4.14.0: +express@4.17.1: + version "4.17.1" + resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" + integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== + dependencies: + accepts "~1.3.7" + array-flatten "1.1.1" + body-parser "1.19.0" + content-disposition "0.5.3" + content-type "~1.0.4" + cookie "0.4.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "~1.1.2" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "~1.1.2" + fresh "0.5.2" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "~2.3.0" + parseurl "~1.3.3" + path-to-regexp "0.1.7" + proxy-addr "~2.0.5" + qs "6.7.0" + range-parser "~1.2.1" + safe-buffer "5.1.2" + send "0.17.1" + serve-static "1.14.1" + setprototypeof "1.1.1" + statuses "~1.5.0" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + +express@^4.14.0: version "4.16.4" resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e" integrity sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg== @@ -1209,6 +1286,19 @@ finalhandler@1.1.1: statuses "~1.4.0" unpipe "~1.0.0" +finalhandler@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" + integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.3" + statuses "~1.5.0" + unpipe "~1.0.0" + find-up@3.0.0, find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -1529,6 +1619,17 @@ http-errors@1.7.2: statuses ">= 1.5.0 < 2" toidentifier "1.0.0" +http-errors@~1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + http-https@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" @@ -1550,7 +1651,7 @@ iconv-lite@0.4.23: dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@^0.4.24: +iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -1600,6 +1701,11 @@ inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, i resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +inherits@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + inquirer@^6.2.2: version "6.2.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" @@ -1629,6 +1735,11 @@ ipaddr.js@1.8.0: resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" integrity sha1-6qM9bd16zo9/b+DJygRA5wZzix4= +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + is-buffer@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" @@ -1947,6 +2058,11 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" +mime-db@1.44.0: + version "1.44.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" + integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== + mime-db@~1.38.0: version "1.38.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad" @@ -1959,11 +2075,23 @@ mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.18, mime-types@~2.1.19: dependencies: mime-db "~1.38.0" +mime-types@~2.1.24: + version "2.1.27" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" + integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== + dependencies: + mime-db "1.44.0" + mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== +mime@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" @@ -2126,6 +2254,11 @@ negotiator@0.6.1: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk= +negotiator@0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" + integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -2365,6 +2498,11 @@ parseurl@~1.3.2: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" integrity sha1-/CidTtiZMRlGDBViUyYs3I3mW/M= +parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -2483,6 +2621,14 @@ proxy-addr@~2.0.4: forwarded "~0.1.2" ipaddr.js "1.8.0" +proxy-addr@~2.0.5: + version "2.0.6" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf" + integrity sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw== + dependencies: + forwarded "~0.1.2" + ipaddr.js "1.9.1" + psl@^1.1.24: version "1.1.31" resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" @@ -2528,7 +2674,7 @@ qs@6.5.2, qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -qs@^6.5.1: +qs@6.7.0, qs@^6.5.1: version "6.7.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== @@ -2567,6 +2713,11 @@ range-parser@~1.2.0: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + raw-body@2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.3.tgz#1b324ece6b5706e153855bc1148c65bb7f6ea0c3" @@ -2577,6 +2728,16 @@ raw-body@2.3.3: iconv-lite "0.4.23" unpipe "1.0.0" +raw-body@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" + integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== + dependencies: + bytes "3.1.0" + http-errors "1.7.2" + iconv-lite "0.4.24" + unpipe "1.0.0" + readable-stream@^2.3.0, readable-stream@^2.3.5: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -2751,6 +2912,25 @@ send@0.16.2: range-parser "~1.2.0" statuses "~1.4.0" +send@0.17.1: + version "0.17.1" + resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" + integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== + dependencies: + debug "2.6.9" + depd "~1.1.2" + destroy "~1.0.4" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "~1.7.2" + mime "1.6.0" + ms "2.1.1" + on-finished "~2.3.0" + range-parser "~1.2.1" + statuses "~1.5.0" + serve-static@1.13.2: version "1.13.2" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1" @@ -2761,6 +2941,16 @@ serve-static@1.13.2: parseurl "~1.3.2" send "0.16.2" +serve-static@1.14.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" + integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.17.1" + servify@^0.1.12: version "0.1.12" resolved "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" @@ -2885,7 +3075,7 @@ sshpk@^1.7.0: safer-buffer "^2.0.2" tweetnacl "~0.14.0" -"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2": +"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= @@ -3161,6 +3351,14 @@ type-is@~1.6.16: media-typer "0.3.0" mime-types "~2.1.18" +type-is@~1.6.17, type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + typedarray-to-buffer@^3.1.2: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" From 2b58831c4250e6110299c74ba98fc34eb1085e25 Mon Sep 17 00:00:00 2001 From: Snyk bot Date: Mon, 14 Sep 2020 13:20:41 +0300 Subject: [PATCH 46/46] fix: upgrade node-fetch from 2.3.0 to 2.6.0 (#111) Snyk has created this PR to upgrade node-fetch from 2.3.0 to 2.6.0. See this package in npm: See this project in Snyk: https://app.snyk.io/org/szerintedmi/project/40317aa3-ac97-44de-a2c0-641b11d64023?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Peter Petrovics --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 315ce75..58b3b96 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "express": "4.17.1", "http-errors": "1.7.2", "morgan": "1.9.1", - "node-fetch": "2.3.0", + "node-fetch": "2.6.0", "ulog": "2.0.0-beta.6", "web3": "1.0.0-beta.36" }, diff --git a/yarn.lock b/yarn.lock index 6dfad4d..125af85 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2298,10 +2298,10 @@ node-environment-flags@1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5" - integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA== +node-fetch@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" + integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== node-gyp-build@~3.7.0: version "3.7.0"