Skip to content

Commit

Permalink
Margin loan (#101)
Browse files Browse the repository at this point in the history
* Margin loan (#98)

* move loan methods from web to augmint-js

* basic address type

* get loans from a loanManager

* Move loan functions to augmint.ts

* fixing loan tests

* run one testfile

* fix tests of LoanManager

* loanManager passes the correct address

* use string instead of BN based address

* use the real address

* lmContract is not an array!

* fix Wei's toNumber and extend Tokens with toNumber

* expose new eth backed loan on augmint js

* collect loans

* fix loan's due state

* fix collect loans

* raise collect gas fee

* collect loans

* update loanmanager with correct types

* test: fix loanmanager test

* update package to pre5

* create loanmanager instance

* LoanManager is a static getter

* test: fix loanmanager test mock products

* test: use proper address checksum instead of tolowercase

* loancount for loanmanagers

* loanmanager test: add mock products and test data for legacy loanproducts, cleanup test

* loanmanager test: add mock products and test data for legacy loanproducts, cleanup test

* wrap margin loans

* loanmanager test: add mock products and test data for legacy loanproducts, cleanup test

* new eth backed loan with min rate!

* loanmanager test: remove fixme-s (loanproduct code was fixed)

* loanmanager test: remove fixme-s (loanproduct code was fixed)

* config: allow newer yarn versions

* loanmanager test: create legacy loanproduct from tuple

* loanproduct: invert collateral ratio for legacy loanproducts

* update Loan to handle margin loan

* update loans

* upgrade bn.js to 5.0

* add extra collateral api

* test: additional units tests

* minRate should be in eurocents

* units: rounding modes for mul and div, tests

* use Tokens.toString() instead of internal BN.toString()

* units: add ceiling variant of multiplication

* loanproduct: fix rounding in calculate methods

* loanmanager test: fix collateral calculation test cases

* connect contract with ethersjs

* loanmanager test: fix test cases for calculating with negative interest rates

* a Loan needs to know, which token was used

* set package's version to prerelease

* loanmanager test: test cases for invalid calls

* proper connection handling for ethers.js

* upgrade augmint-contracts to 1.1.0-pre7

* loanmanager test: update test with new ganache test product numbers (1.1.0-pre7)

* bump version

* loan: fix isRepayable condition (also check maturity)

* upgrade augmint-contracts to 1.1.0-pre8

* bump pre version

* fix tests WIP

* Revert "fix tests WIP"

This reverts commit 530e3ff.

* loanmanager test: get maxloanamount from monetarysoupervisor

* margin call rate calculator

* rename marginCallRate getter to calculate

* loan: helper method to calculate current collateral ratio

* loan: helper method to calculate required collateral change amount

* warning for marginCallRate

* bump version number (0.3.4-pre4)

* prepare a clean build before install

* bump package version

* loan: helper method to calculate new collateral ratio if collateralamount is changed

* fix due state

* bump version number to 0.3.4-pre6

* don't throw error if directories are not exists

* reverse the instance lookup

* fix LoanManager type check

* never returns undefined

* simplify and cache loanManagers

* trenary insted of if

* semicolon fix

* use Promise.all instead of sequential await-s

* use map instead of array of promises

* extract flatten function

* extract common pattern of collecting promises from multiple sources

* simplify other collection of promises

* remove spurious error handler

* please the linter with type declarations

* throw plain error on evironment configuration error instead of MissingContractError

* loans: remove deprecated method, add bool flags instead

* non-lazy loading of loanmanagers in Augmint

* improve initialization of Augmint, do not allow missing environment, move the optional logic out of the constructor

* bump version to 0.3.4-pre7

* fix: never returns undefined

* move global variable into the Augmint class

* optimize chunked query

* fix chunked query in Exchange (decide chunksize only once, and use that), factor out isLegacyExchangeContract

* linter: move private method after all public methods

* optimize chunked query

* fix typo

* drop contractName

* optimize chunked query

* simplify getLoanManager methods in Augmint (use the map)

* move utility functions to the utils package

* bump version to 0.3.4-pre8

* tslint config

* yarn task for the linter

* tslint config

* fix chunk size based pager

* fix chunk sized loanmanger's pager

* bump version to 0.3.4-pre9

* fix loanmanager lookup

* bump to version 0.3.4-pre10

* bump to releasse version

* fix(package): update @Augmint/contracts to version 1.1.0

* fix missing yarn.lock update
  • Loading branch information
rszaloki authored Aug 9, 2019
1 parent 9628606 commit 229ea4f
Show file tree
Hide file tree
Showing 19 changed files with 1,165 additions and 285 deletions.
157 changes: 80 additions & 77 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
{
"name": "@augmint/js",
"version": "0.3.3",
"description": "Augmint Javascript Library",
"keywords": [
"augmint javascript library A-EUR stablecoin web3 dapp"
],
"author": "Augmint",
"license": "AGPL-3.0-only",
"repository": {
"type": "git",
"url": "git+https://github.com/Augmint/augmint-js.git"
},
"bugs": {
"url": "https://github.com/Augmint/augmint-js/issues"
},
"homepage": "https://github.com/Augmint/augmint-js#readme",
"directories": {
"test": "test"
},
"bin": {
"augmint-cli": "scripts/augmint-cli.sh"
},
"engines": {
"node": "^10.15.3",
"yarn": "1.15.2"
},
"dependencies": {
"@augmint/contracts": "1.0.12",
"bn.js": "4.11.8",
"dotenv": "8.0.0",
"ulog": "2.0.0-beta.6",
"web3": "1.0.0-beta.36"
},
"devDependencies": {
"@types/bn.js": "4.11.5",
"@types/node": "^10.14.5",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chai-exclude": "2.0.1",
"cross-env": "5.2",
"eslint": "5.16.0",
"mocha": "6.1.4",
"rollup": "1.12.4",
"rollup-plugin-node-builtins": "2.1.2",
"rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-typescript2": "0.21.1",
"sinon": "7.3.2",
"tslint": "5.16.0",
"tslint-config-prettier": "1.18.0",
"typechain": "0.3.14",
"typedoc": "0.14.2",
"typedoc-plugin-sourcefile-url": "1.0.4",
"typescript": "3.4.3",
"wait-on": "3.2.0"
},
"scripts": {
"clean": "rm -r ./dist ./generated",
"build": "yarn build:typings && rollup -c",
"build:typings": "ts-generator ./ts-generator.json",
"test": "yarn build && yarn cross-env NODE_ENV=test NODE_PATH=./ mocha 'test/**/*.test.js' --exit --timeout 5000",
"ganache:start": "scripts/augmint-cli.sh ganache start --blockTime 1",
"ganache:stop": "scripts/augmint-cli.sh ganache stop",
"ganache:run": "scripts/augmint-cli.sh ganache run --blockTime 1",
"typedoc": "./generateDocs.sh"
},
"greenkeeper": {
"ignore": [
"@types/node"
]
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"files": [
"dist",
"scripts/augmint-cli.sh"
],
"types": "dist/src/index.d.ts"
"name": "@augmint/js",
"version": "0.3.4",
"description": "Augmint Javascript Library",
"keywords": [
"augmint javascript library A-EUR stablecoin web3 dapp"
],
"author": "Augmint",
"license": "AGPL-3.0-only",
"repository": {
"type": "git",
"url": "git+https://github.com/Augmint/augmint-js.git"
},
"bugs": {
"url": "https://github.com/Augmint/augmint-js/issues"
},
"homepage": "https://github.com/Augmint/augmint-js#readme",
"directories": {
"test": "test"
},
"bin": {
"augmint-cli": "scripts/augmint-cli.sh"
},
"engines": {
"node": "^10.15.3",
"yarn": ">=1.15.2"
},
"dependencies": {
"@augmint/contracts": "1.1.0",
"bn.js": "5.0.0",
"dotenv": "8.0.0",
"ulog": "2.0.0-beta.6",
"web3": "1.0.0-beta.36"
},
"devDependencies": {
"@types/bn.js": "4.11.5",
"@types/node": "^10.14.5",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chai-exclude": "2.0.1",
"cross-env": "5.2",
"eslint": "5.16.0",
"mocha": "6.1.4",
"rollup": "1.12.4",
"rollup-plugin-node-builtins": "2.1.2",
"rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-typescript2": "0.21.1",
"sinon": "7.3.2",
"tslint": "5.16.0",
"tslint-config-prettier": "1.18.0",
"typechain": "0.3.14",
"typedoc": "0.14.2",
"typedoc-plugin-sourcefile-url": "1.0.4",
"typescript": "3.4.3",
"wait-on": "3.2.0"
},
"scripts": {
"clean": "rm -rf ./dist ./generated",
"build": "yarn build:typings && rollup -c",
"build:typings": "ts-generator ./ts-generator.json",
"test": "yarn build && yarn cross-env NODE_ENV=test NODE_PATH=./ mocha 'test/**/*.test.js' --exit --timeout 5000",
"testOne": "yarn build && yarn cross-env NODE_ENV=test NODE_PATH=./ mocha $1 --exit --timeout 5000",
"ganache:start": "scripts/augmint-cli.sh ganache start --blockTime 1",
"ganache:stop": "scripts/augmint-cli.sh ganache stop",
"ganache:run": "scripts/augmint-cli.sh ganache run --blockTime 1",
"typedoc": "./generateDocs.sh",
"prepublishOnly": "yarn clean && yarn build",
"lint": "tslint -t stylish --project ."
},
"greenkeeper": {
"ignore": [
"@types/node"
]
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"files": [
"dist",
"scripts/augmint-cli.sh"
],
"types": "dist/src/index.d.ts"
}
Loading

0 comments on commit 229ea4f

Please sign in to comment.