Skip to content

Commit 7bb6454

Browse files
committed
Add validate-metadata command documentaion
1 parent e789f42 commit 7bb6454

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "mocha testing/test/*.js",
77
"validate": "mocha testing/validate/*.js",
88
"test-tvl": "mocha v2/testing/test/*.js",
9-
"validate-tvl": "mocha v2/testing/validate/*.js",
9+
"validate-metadata": "mocha v2/testing/validate/*.js",
1010
"test-token": "mocha tokens/testing/test/*.js",
1111
"validate-token": "mocha tokens/testing/validate/*.js"
1212
},

v2/README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Feel free to add additional files and folders within your project adapter direct
2121
## Project Metadata
2222
```js
2323
module.exports = {
24+
/* Metadata */
2425
name: 'Loopring', // token project name
2526
symbol: 'LRC', // protocol token symbol (if exists any)
2627
category: 'DEXes', // allowed values can be 'Derivatives', 'DEXes', 'Lending', 'Payments', 'Assets'
@@ -96,7 +97,7 @@ module.exports = {
9697
}
9798
```
9899

99-
In case you need more flexibility pass in a function instead to return tokens or holders addresses.
100+
In case you need more flexibility add a function instead that will return tokens or holders addresses.
100101

101102
#### ```Balancer``` adapter `tokenHolderMap` configuration
102103
```js
@@ -139,5 +140,31 @@ module.exports = {
139140
}
140141
```
141142

142-
In case your protocol follows factory pattern or is based on AMM model pass in log configs to pull holder addresses from smart contract events.
143+
In case your protocol follows factory pattern or is based on AMM model add log configs to pull holder addresses from smart contract events.
143144
By default we use ```(poolLog) => `0x${poolLog[2].slice(26)}`; ``` this code snippet as log ```transform``` function. Pass a different custom function if you need.
145+
146+
147+
## Testing
148+
149+
While writing your project adapter, you'll need to run the code to check for errors, check for output etc. Some testing commands are provided for this purpose.
150+
151+
```
152+
npm run validate-metadata -- --project=loopring
153+
```
154+
155+
run `validate-metadata` command to check if you have project `Metadata` setup correctly.
156+
157+
output:
158+
```
159+
Checking Loopring project adapter metadata
160+
✓ has a valid name
161+
✓ has a valid start time
162+
✓ category matches one of the defined categories
163+
has valid tokenHolderMap configurations
164+
✓ tokenHolderMap is an array
165+
✓ tokenHolderMap has valid token configurations
166+
✓ tokenHolderMap has valid holder/vault/pool configurations
167+
168+
169+
6 passing (11ms)
170+
```

v2/projects/balancer/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
/* Project Metadata */
23
name: 'Balancer',
34
token: null,
45
category: 'DEXes',
@@ -13,7 +14,8 @@ module.exports = {
1314
topic: 'LOG_NEW_POOL(address,address)',
1415
keys: ['topics'],
1516
fromBlock: 9562480
16-
}
17+
},
18+
transform: null,
1719
},
1820
tokens: {
1921
pullFromPools: true,

v2/projects/loopring/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
/* Project Metadata */
23
name: 'Loopring',
34
token: 'LRC',
45
category: 'DEXes',

v2/projects/xdai/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const sdk = require('../../../sdk/index');
22

33
module.exports = {
4-
/* basic project info */
4+
/* Project Metadata */
55
name: 'xDai',
66
token: null,
77
category: 'Payments',

v2/testing/validate/json-validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const categories = [
1313
];
1414

1515
_.each(args.projects, (projectAdapter) => {
16-
describe(`${projectAdapter.name} project adapter export format`, () => {
16+
describe(`Checking ${projectAdapter.name} project adapter metadata`, () => {
1717
it('has a valid name', () => {
1818
chai.assert.isString(projectAdapter.name);
1919
});

0 commit comments

Comments
 (0)