From 1e15125f1158d0ee8376220b244e2a15f91ffff5 Mon Sep 17 00:00:00 2001 From: Chad Lynch Date: Thu, 10 Feb 2022 13:48:28 -0500 Subject: [PATCH 01/13] chore: updates readme adds example env --- .env.exmple | 3 +++ README.md | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 .env.exmple diff --git a/.env.exmple b/.env.exmple new file mode 100644 index 0000000..6fb6500 --- /dev/null +++ b/.env.exmple @@ -0,0 +1,3 @@ +RINKEBY_RPC_URL= +KOVAN_RPC_URL= +MAINNET_RPC_URL= \ No newline at end of file diff --git a/README.md b/README.md index 85421bc..c511ff2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,13 @@ A JavaScript SDK which provides tools for interacting with Maple Protocol. ## Getting Started +For testing, you'll need to copy `.env.example` as `.env` and add the RPC urls. + +``` +yarn +yarn build +``` + To interface directly with the contracts you can use the typechain interface. ```js From aa12ece7191eb2609498729c6624103b208bfbf2 Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Thu, 14 Apr 2022 15:52:03 +0100 Subject: [PATCH 02/13] Add xMPL packages to SDK --- config.json | 119 +++++++++++++++++++++++++++++++++++++++------------ package.json | 3 +- yarn.lock | 5 +++ 3 files changed, 99 insertions(+), 28 deletions(-) diff --git a/config.json b/config.json index ca14ae7..38e553f 100644 --- a/config.json +++ b/config.json @@ -2,68 +2,133 @@ "contractPackages": { "collateralLocker": { "repo": "@maplelabs/collateral-locker", - "alias": ["collateralLocker"], - "versions": ["v1.0.0"] + "alias": [ + "collateralLocker" + ], + "versions": [ + "v1.0.0" + ] }, "debtLocker": { "repo": "@maplelabs/debt-locker", - "alias": ["debtLockerV1", "debtLockerV2"], - "versions": ["v1.0.0", "v2.0.0"] + "alias": [ + "debtLockerV1", + "debtLockerV2" + ], + "versions": [ + "v1.0.0", + "v2.0.0" + ] }, "fundingLocker": { "repo": "@maplelabs/funding-locker", - "alias": ["fundingLocker"], - "versions": ["v1.0.0"] + "alias": [ + "fundingLocker" + ], + "versions": [ + "v1.0.0" + ] }, "lateFeeCalculator": { "repo": "@maplelabs/late-fee-calculator", - "alias": ["lateFeeCalculator"], - "versions": ["v1.0.0"] + "alias": [ + "lateFeeCalculator" + ], + "versions": [ + "v1.0.0" + ] }, "liquidityLocker": { "repo": "@maplelabs/liquidity-locker", - "alias": ["liquidityLocker"], - "versions": ["v1.0.0"] + "alias": [ + "liquidityLocker" + ], + "versions": [ + "v1.0.0" + ] }, "loan": { "repo": "@maplelabs/loan", - "alias": ["loanV1", "loanV2"], - "versions": ["v1.0.0", "v2.0.0"] + "alias": [ + "loanV1", + "loanV2" + ], + "versions": [ + "v1.0.0", + "v2.0.0" + ] }, "mapleGlobals": { "repo": "@maplelabs/globals", - "alias": ["mapleGlobals"], - "versions": ["v1.0.0"] + "alias": [ + "mapleGlobals" + ], + "versions": [ + "v1.0.0" + ] }, "mplRewards": { "repo": "@maplelabs/mpl-rewards", - "alias": ["mplRewards"], - "versions": ["v1.0.0"] + "alias": [ + "mplRewards" + ], + "versions": [ + "v1.0.0" + ] }, "pool": { "repo": "@maplelabs/pool", - "alias": ["pool"], - "versions": ["v1.0.0"] + "alias": [ + "pool" + ], + "versions": [ + "v1.0.0" + ] }, "premiumCalculator": { "repo": "@maplelabs/premium-calculator", - "alias": ["premiumCalculator"], - "versions": ["v1.0.0"] + "alias": [ + "premiumCalculator" + ], + "versions": [ + "v1.0.0" + ] }, "repaymentCalculator": { "repo": "@maplelabs/repayment-calculator", - "alias": ["repaymentCalculator"], - "versions": ["v1.0.0"] + "alias": [ + "repaymentCalculator" + ], + "versions": [ + "v1.0.0" + ] }, "stakeLocker": { "repo": "@maplelabs/stake-locker", - "alias": ["stakeLocker"], - "versions": ["v1.0.0"] + "alias": [ + "stakeLocker" + ], + "versions": [ + "v1.0.0" + ] + }, + "xmpl": { + "repo": "@maplelabs/xmpl", + "alias": [ + "xmpl" + ], + "versions": [ + "v1.1.0" + ] }, "external": { "repo": "@maplelabs/environment-mocks", - "alias": ["environment-mocks"], - "versions": ["v1.0.0"] + "alias": [ + "environment-mocks" + ], + "versions": [ + "v1.0.0" + ] } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 407c999..daae5fc 100644 --- a/package.json +++ b/package.json @@ -50,9 +50,10 @@ "@maplelabs/premiumCalculator": "npm:@maplelabs/premium-calculator@v1.0.0", "@maplelabs/repaymentCalculator": "npm:@maplelabs/repayment-calculator@v1.0.0", "@maplelabs/stakeLocker": "npm:@maplelabs/stake-locker@v1.0.0", + "@maplelabs/xmpl": "npm:@maplelabs/xmpl@v1.0.1", "@typechain/ethers-v5": "^9.0.0", "ethers": "^5.5.3", "shelljs": "^0.8.5", "typechain": "^7.0.0" } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index ff18358..c31ae7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -940,6 +940,11 @@ resolved "https://registry.npmjs.org/@maplelabs/stake-locker/-/stake-locker-1.0.0.tgz#ea24815c50d68d2490f9e5851493732976182c00" integrity sha512-kU6veFILrHJp8uJgf6XDWVvQCVlwSbPJTEIYYG1Z6SM9C5UuIAcau6r30HRAG0g7/Pk+oorH9bZPUm3ow8SGNw== +"@maplelabs/xmpl@npm:@maplelabs/xmpl@v1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@maplelabs/xmpl/-/xmpl-1.0.1.tgz#3d90df79f56e1105b1dbce9a3557d916afe2ea19" + integrity sha512-kVg7Aq5o2l9C1JgI7OQIETjmNox5CqRxg/QS9lV/k2pkp95KJKsSCMQOfh4Asp5e4zu248iMLHEakWOhr7pCgQ== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" From 3b561a0023a0da9d4eb4e03134d5db45192301a1 Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Thu, 14 Apr 2022 16:03:20 +0100 Subject: [PATCH 03/13] Add PR template to repo --- .github/pull_request_template.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..b7025f0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,24 @@ +| Type | Ticket | +| :---------------: | :------------------------------: | +| Bug/Feature/Chore | [Link]() | + +## Problem + +Brief descriptions of the problem that this PR will fix or if it a new feature brief description of what is the business need. + +## Solution + +How we fixed the problem or implemented the new feature + +## Other notes + +Not mandatory section. Use this section to provide extra info like: + +- PR's related to this one (maybe form maple-api) +- additional fixes +- how this feature should be tested if it's hard to test +- ... + +## Screenshots + +Paste all the needed screenshots or animated gifs. If this PR is a bug fix you could include the before and after screenshots. From 5635847f1baf16c658b305e343b8cef7483c9ee6 Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Fri, 15 Apr 2022 09:15:45 +0100 Subject: [PATCH 04/13] Correct xMPL version in config --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 38e553f..5c3d036 100644 --- a/config.json +++ b/config.json @@ -118,7 +118,7 @@ "xmpl" ], "versions": [ - "v1.1.0" + "v1.0.1" ] }, "external": { From 6a84e99a04815ba5216b8831cba084845e52a35d Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Fri, 15 Apr 2022 09:46:14 +0100 Subject: [PATCH 05/13] Export xmpl interface from sdk --- src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 058d66c..43e5359 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ import * as poolImports from './typechain/pool' import * as premiumCalcImports from './typechain/premiumCalculator' import * as repaymentCalcImports from './typechain/repaymentCalculator' import * as stakeLockerImports from './typechain/stakeLocker' +import * as xmplImports from './typechain/xmpl' import * as environmentMocksImports from './typechain/environment-mocks' const collateralLocker = { @@ -103,6 +104,10 @@ const uniswapRouterV2 = { core: environmentMocksImports.UniswapV2Router02__factory } +const xmpl = { + factory: xmplImports.XMPL__factory +} + export { bPool, collateralLocker, @@ -121,5 +126,6 @@ export { premiumCalc, repaymentCalculator, stakeLocker, - uniswapRouterV2 + uniswapRouterV2, + xmpl } From c4be2248dda87c918105a57ab75a9338c8adec8f Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Fri, 15 Apr 2022 10:41:19 +0100 Subject: [PATCH 06/13] Add mapleToken to SDK --- config.json | 9 +++++++++ package.json | 1 + src/index.ts | 6 ++++++ yarn.lock | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/config.json b/config.json index 5c3d036..5ef8fce 100644 --- a/config.json +++ b/config.json @@ -121,6 +121,15 @@ "v1.0.1" ] }, + "mapleToken": { + "repo": "@maplelabs/maple-token", + "alias": [ + "mapleToken" + ], + "versions": [ + "v1.0.0" + ] + }, "external": { "repo": "@maplelabs/environment-mocks", "alias": [ diff --git a/package.json b/package.json index daae5fc..a113e6c 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@maplelabs/liquidityLocker": "npm:@maplelabs/liquidity-locker@v1.0.0", "@maplelabs/loanV1": "npm:@maplelabs/loan@v1.0.0", "@maplelabs/loanV2": "npm:@maplelabs/loan@v2.0.0", + "@maplelabs/mapleToken": "npm:@maplelabs/maple-token@1.0.0 ", "@maplelabs/mapleGlobals": "npm:@maplelabs/globals@v1.0.0", "@maplelabs/mplRewards": "npm:@maplelabs/mpl-rewards@v1.0.0", "@maplelabs/pool": "npm:@maplelabs/pool@v1.0.0", diff --git a/src/index.ts b/src/index.ts index 43e5359..718599c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,6 +6,7 @@ import * as lateFeeCalcImports from './typechain/lateFeeCalculator' import * as liquidityLockerImports from './typechain/liquidityLocker' import * as loanV1Imports from './typechain/loanV1' import * as loanV2Imports from './typechain/loanV2' +import * as mapleTokenImports from './typechain/mapleToken' import * as mapleGlobalsImports from './typechain/mapleGlobals' import * as mapleRewardsImports from './typechain/mplRewards' import * as poolImports from './typechain/pool' @@ -67,6 +68,10 @@ const mapleRewards = { factory: mapleRewardsImports.MplRewardsFactory__factory } +const mapleToken = { + factory: mapleTokenImports.MapleToken__factory +} + const pool = { core: poolImports.Pool__factory, factory: poolImports.PoolFactory__factory, @@ -122,6 +127,7 @@ export { loanV2, mapleGlobals, mapleRewards, + mapleToken, pool, premiumCalc, repaymentCalculator, diff --git a/yarn.lock b/yarn.lock index c31ae7e..ce849fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -915,6 +915,11 @@ resolved "https://registry.npmjs.org/@maplelabs/globals/-/globals-1.0.0.tgz#85fd3e667cdb5cd26e5882951e8a7cf7426645fe" integrity sha512-pNqeltNI03JD0PdvZinJKP9UE9Xu8jFRzVxXm3mHMmLFkJmsEgwh2J8Sr8+2HSKouS9eX9RiH6vCh+nUwo45ug== +"@maplelabs/mapleToken@npm:@maplelabs/maple-token@1.0.0 ": + version "1.0.0" + resolved "https://registry.npmjs.org/@maplelabs/maple-token/-/maple-token-1.0.0.tgz#c160531e3be688d4cd90c524a1baa2d585da772c" + integrity sha512-WiJFk15Xic43gnqKC8u6Fnl11AfCADbtcY1668PswnMMIC08RJJgDlwlDy5dq1bYqyWFpMfPem6Ye/McMNua+A== + "@maplelabs/mplRewards@npm:@maplelabs/mpl-rewards@v1.0.0": version "1.0.0" resolved "https://registry.npmjs.org/@maplelabs/mpl-rewards/-/mpl-rewards-1.0.0.tgz#7915e10bd59bd80374784f0f8772817ca87e45ad" From eab6a402618411a817c83fe09553da5a65beb899 Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Tue, 19 Apr 2022 14:51:15 +0100 Subject: [PATCH 07/13] Update package.json formatting change request --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a113e6c..252de46 100644 --- a/package.json +++ b/package.json @@ -57,4 +57,4 @@ "shelljs": "^0.8.5", "typechain": "^7.0.0" } -} \ No newline at end of file +} From 7763d1b43b054127738555a20c35c7a18b4ad34e Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Tue, 19 Apr 2022 14:52:06 +0100 Subject: [PATCH 08/13] Update config.json formatting change request --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 5ef8fce..cd89da3 100644 --- a/config.json +++ b/config.json @@ -140,4 +140,4 @@ ] } } -} \ No newline at end of file +} From 1e180d397e6ad8d0fc5cca8abd58cf2681fa1c6d Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Wed, 20 Apr 2022 14:28:12 +0100 Subject: [PATCH 09/13] Export xmpl + mapleToken types from SDK --- src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 718599c..e247f0c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -113,6 +113,11 @@ const xmpl = { factory: xmplImports.XMPL__factory } +interface Types { + xmplfactory: xmplImports.XMPL + mapleToken: mapleTokenImports.MapleToken +} + export { bPool, collateralLocker, @@ -133,5 +138,6 @@ export { repaymentCalculator, stakeLocker, uniswapRouterV2, - xmpl + xmpl, + Types } From 429d5ae3907ecba19b8aa272b90d71fa5427ae0f Mon Sep 17 00:00:00 2001 From: Jack Casey Date: Wed, 20 Apr 2022 16:30:13 +0100 Subject: [PATCH 10/13] Clearer naming for type exports --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index e247f0c..f72dff0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -113,8 +113,8 @@ const xmpl = { factory: xmplImports.XMPL__factory } -interface Types { - xmplfactory: xmplImports.XMPL +interface ContractTypes { + xmpl: xmplImports.XMPL mapleToken: mapleTokenImports.MapleToken } @@ -139,5 +139,5 @@ export { stakeLocker, uniswapRouterV2, xmpl, - Types + ContractTypes } From a2f556399663cb998ed703927c2c1d02a41cf6cf Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 28 Apr 2022 16:01:43 +0200 Subject: [PATCH 11/13] chore: update package.json version to match npm version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 252de46..d7ba0a8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.0.1", + "version": "0.0.2", "license": "MIT", "name": "maple-js", "description": "Maple SDK for JavaScript", From 217e5ca6d313c191fdd397bac56de6bd478a7276 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 28 Apr 2022 16:01:58 +0200 Subject: [PATCH 12/13] 0.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7ba0a8..5bbae35 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.0.2", + "version": "0.0.3", "license": "MIT", "name": "maple-js", "description": "Maple SDK for JavaScript", From 8bd55a4c4a708468c807a04638b6467ac153e468 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 28 Apr 2022 16:17:59 +0200 Subject: [PATCH 13/13] fix: name of package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5bbae35..02cb3c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "version": "0.0.3", "license": "MIT", - "name": "maple-js", + "name": "@maplelabs/maple-js", "description": "Maple SDK for JavaScript", "author": "Maple Labs", "main": "dist/index.js",