-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add launch scripts * format code & use only one .gitignore * add start script * remove asset-setup.sh * simplify loop * use legacy node_modules linker * add missing amm-bench target * Resolve comments * Update script for log once * Fix decimal issue * Update init assets * ignore yarn error log * update editorcofnig * run test also for benchmark * activate try-runtime for pallet-assets * check also wasm build * remove genesis markets & fix ratio decimal Co-authored-by: Alan WANG <[email protected]> Co-authored-by: Cheng JIANG <[email protected]>
- Loading branch information
1 parent
207752a
commit ef1b874
Showing
16 changed files
with
3,705 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ jobs: | |
- name: Check Build | ||
run: | | ||
make check | ||
make check-wasm | ||
- name: Check Clippy Warnings | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-rc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"liquidAsset": 1000, | ||
"stakingAsset": 100, | ||
"assets": [ | ||
{ | ||
"name": "Kusama", | ||
"symbol": "KSM", | ||
"assetId": 100, | ||
"decimal": 12, | ||
"marketOption": { | ||
"closeFactor": 50e4, | ||
"collateralFactor": 50e4, | ||
"reserveFactor": 15e4, | ||
"liquidateIncentive": 110e16, | ||
"rateModel": { | ||
"jumpModel": { | ||
"baseRate": 2e16, | ||
"jumpRate": 10e16, | ||
"fullRate": 32e16, | ||
"jumpUtilization": 8e5 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "Parallel Kusama", | ||
"symbol": "XKSM", | ||
"assetId": 1000, | ||
"decimal": 12, | ||
"marketOption": { | ||
"closeFactor": 50e4, | ||
"collateralFactor": 50e4, | ||
"reserveFactor": 15e4, | ||
"liquidateIncentive": 110e16, | ||
"rateModel": { | ||
"jumpModel": { | ||
"baseRate": 2e16, | ||
"jumpRate": 10e16, | ||
"fullRate": 32e16, | ||
"jumpUtilization": 8e5 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "Tether Dollar", | ||
"symbol": "USDT", | ||
"assetId": 102, | ||
"decimal": 6, | ||
"marketOption": { | ||
"closeFactor": 50e4, | ||
"collateralFactor": 50e4, | ||
"reserveFactor": 15e4, | ||
"liquidateIncentive": 110e16, | ||
"rateModel": { | ||
"jumpModel": { | ||
"baseRate": 2e16, | ||
"jumpRate": 10e16, | ||
"fullRate": 32e16, | ||
"jumpUtilization": 8e5 | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import {options} from '@parallel-finance/api' | ||
import {ApiPromise, Keyring, WsProvider} from '@polkadot/api' | ||
import {assets, liquidAsset, stakingAsset} from './assets.json' | ||
|
||
function sleep(ms: number) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)) | ||
} | ||
|
||
async function main() { | ||
|
||
const api = await ApiPromise.create( | ||
options({ | ||
provider: new WsProvider('ws://localhost:9947'), | ||
}) | ||
) | ||
|
||
const chainHeight = async () => { | ||
const { | ||
block: { | ||
header: {number: height}, | ||
}, | ||
} = await api.rpc.chain.getBlock() | ||
return height.toNumber() | ||
} | ||
|
||
console.log("Wait for block producing") | ||
do await sleep(1000) | ||
while (!(await chainHeight())) | ||
|
||
const keyring = new Keyring({type: 'sr25519', ss58Format: 110}) | ||
const signer = keyring.addFromUri('//Dave') | ||
|
||
let call = [] | ||
|
||
for (const {name, symbol, assetId, decimal, marketOption} of assets) { | ||
console.log(`Create ${name}(${symbol}) asset.`) | ||
call.push( | ||
api.tx.sudo.sudo(api.tx.assets.forceCreate(assetId, signer.address, true, 1)), | ||
api.tx.sudo.sudo( | ||
api.tx.assets.forceSetMetadata(assetId, name, symbol, decimal, false) | ||
), | ||
api.tx.sudo.sudo( | ||
api.tx.loans.addMarket( | ||
assetId, | ||
api.createType('Market', marketOption) | ||
) | ||
) | ||
) | ||
} | ||
|
||
call.push( | ||
api.tx.sudo.sudo(api.tx.liquidStaking.setLiquidCurrency(liquidAsset)), | ||
api.tx.sudo.sudo(api.tx.liquidStaking.setStakingCurrency(stakingAsset)) | ||
) | ||
|
||
console.log('Submit batches.') | ||
await api.tx.utility.batchAll(call).signAndSend(signer) | ||
process.exit(0) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "launch", | ||
"version": "1.0.0", | ||
"main": "index.ts", | ||
"scripts": { | ||
"start": "ts-node index.ts" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^16.7.10", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.4.3" | ||
}, | ||
"dependencies": { | ||
"@parallel-finance/api": "^1.1.3-2", | ||
"@polkadot/api": "^5.6.2-5", | ||
"@polkadot/rpc-core": "^5.6.2-5", | ||
"@polkadot/types": "^5.6.2-5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"resolveJsonModule": true | ||
} | ||
} |
Oops, something went wrong.