Skip to content

Commit

Permalink
Merge pull request #16 from AcalaNetwork/develop
Browse files Browse the repository at this point in the history
Release 0.4.6
  • Loading branch information
RomeroYang authored May 26, 2022
2 parents a6bf04e + af83d25 commit 812d08e
Show file tree
Hide file tree
Showing 54 changed files with 2,886 additions and 656 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.4.6] - 20220526
- bump polkawallet_sdk v0.4.6.
- new module browser.
- new module vault-multiply.

## [0.4.5] - 20220505
- bump polkawallet_sdk v0.4.5.
- XCM transfer rebuild.
Expand Down
Binary file added assets/images/adjust_multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/icon_multiply.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/multiply_update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions lib/api/assets/acalaServiceAssets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ class AcalaServiceAssets {
tokens.forEach((e) {
final channel = '$tokenBalanceChannel${e.symbol}';
plugin.sdk.api.subscribeMessage(
'api.query.tokens.accounts',
[
address,
e.currencyId ?? {'Token': e.symbol}
],
'acala.getTokenBalance',
['api', address, e.tokenNameId],
channel,
(Map data) {
callback({
Expand All @@ -76,8 +73,8 @@ class AcalaServiceAssets {
final channel =
'$tokenBalanceChannel${lpToken.map((e) => e.symbol).join('')}';
plugin.sdk.api.subscribeMessage(
'api.query.tokens.accounts',
[address, currencyId],
'acala.getTokenBalance',
['api', address, e.tokenNameId],
channel,
(Map data) {
callback({
Expand Down
17 changes: 0 additions & 17 deletions lib/api/types/calcHomaMintAmountData.dart

This file was deleted.

24 changes: 0 additions & 24 deletions lib/api/types/calcHomaMintAmountData.g.dart

This file was deleted.

2 changes: 1 addition & 1 deletion lib/api/types/homaNewEnvData.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class HomaNewEnvData {
double totalStaking;
double totalLiquidity;
double exchangeRate;
double apy;
double? apy;
double fastMatchFeeRate;
double mintThreshold;
double redeemThreshold;
Expand Down
2 changes: 1 addition & 1 deletion lib/api/types/homaNewEnvData.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions lib/api/types/loanType.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class LoanType extends _LoanType {
BigInt.parse((json['requiredCollateralRatio'] ?? 0).toString());
data.interestRatePerSec =
BigInt.parse((json['interestRatePerSec'] ?? 0).toString());
data.globalInterestRatePerSec = json['globalInterestRatePerSec'] == null
? null
: BigInt.parse(json['globalInterestRatePerSec'].toString());
data.stableFeeYear = data.calcStableFee(SECONDS_OF_YEAR);
data.maximumTotalDebitValue =
BigInt.parse(json['maximumTotalDebitValue'].toString());
data.minimumDebitValue = BigInt.parse(json['minimumDebitValue'].toString());
Expand Down Expand Up @@ -87,6 +85,12 @@ class LoanType extends _LoanType {
requiredCollateralRatio
: BigInt.zero;
}

double calcStableFee(int seconds) {
final base =
interestRatePerSec / BigInt.from(pow(10, acala_price_decimals));
return pow((1 + base), seconds) - 1;
}
}

abstract class _LoanType {
Expand All @@ -96,9 +100,9 @@ abstract class _LoanType {
BigInt liquidationRatio = BigInt.zero;
BigInt requiredCollateralRatio = BigInt.zero;
BigInt interestRatePerSec = BigInt.zero;
BigInt? globalInterestRatePerSec = BigInt.zero;
BigInt maximumTotalDebitValue = BigInt.zero;
BigInt minimumDebitValue = BigInt.zero;
double stableFeeYear = 0;
int expectedBlockTime = 0;
}

Expand Down Expand Up @@ -179,8 +183,8 @@ abstract class _LoanData {
BigInt liquidationPrice = BigInt.zero;

double calcStableFee(int seconds) {
final base = (type.globalInterestRatePerSec! + type.interestRatePerSec) /
BigInt.from(pow(10, acala_price_decimals));
final base =
type.interestRatePerSec / BigInt.from(pow(10, acala_price_decimals));
return pow((1 + base), seconds) - 1;
}
}
Expand Down
6 changes: 2 additions & 4 deletions lib/common/constants/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const plugin_genesis_hash =
const acala_price_decimals = 18;
const acala_stable_coin = 'AUSD';
const acala_stable_coin_view = 'aUSD';
const acala_token_ren_btc = 'RENBTC';
const acala_token_ren_btc_view = 'renBTC';
const acala_token_polka_btc = 'POLKABTC';
const acala_token_polka_btc_view = 'polkaBTC';
const acala_token_lc_dot = 'LCDOT';
const acala_token_lc_dot_view = 'lcDOT';

const relay_chain_name = 'polkadot';
const relay_chain_token_symbol = 'DOT';
Expand Down
2 changes: 1 addition & 1 deletion lib/common/constants/nodeList.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ const node_list = [
// {
// 'name': 'Acala (acala dev node)',
// 'ss58': ss58_prefix_acala,
// 'endpoint': 'wss://crosschain-dev.polkawallet.io:9904',
// 'endpoint': 'wss://kusama-1.polkawallet.io:3000',
// },
];
2 changes: 1 addition & 1 deletion lib/js_service_acala/dist/main.js

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions lib/js_service_acala/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@
"build-dev": "webpack --mode development"
},
"resolutions": {
"@polkadot/api": "^7.2.1",
"@acala-network/api": "4.0.4-1",
"@acala-network/sdk": "4.0.4-1",
"@acala-network/sdk-core": "4.0.4-1",
"@acala-network/sdk-swap": "4.0.4-1",
"@acala-network/sdk-wallet": "4.0.4-1"
"@polkadot/api": "^7.2.1"
},
"dependencies": {
"@acala-network/api": "^4.0.4-1",
"@acala-network/sdk": "^4.0.4-1",
"@acala-network/sdk-core": "^4.0.4-1",
"@acala-network/sdk-swap": "^4.0.4-1",
"@acala-network/sdk-wallet": "^4.0.4-1",
"@acala-network/api": "^4.1.2-28",
"@acala-network/sdk": "^4.1.2-28",
"@acala-network/sdk-core": "^4.1.2-28",
"@acala-network/sdk-swap": "^4.1.2-28",
"@acala-network/sdk-wallet": "^4.1.2-28",
"@babel/polyfill": "^7.8.3",
"@polkadot/api": "^7.2.1",
"@polkadot/ui-shared": "^0.85.3",
Expand Down
11 changes: 3 additions & 8 deletions lib/js_service_acala/src/constants/acala.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
export const nft_image_config = {
0: "https://acala.subdao.com/nft/metadata/AcalaCrowdloanContributor2021Metadata.json",
1: "https://acala.subdao.com/nft/metadata/AcalaCrowdloanQuestsMetadata.json",
};

export const existential_deposit = {
DOT: "100000000",
AUSD: "10000000000",
LDOT: "500000000",
0: "https://acala.polkawallet-cloud.com/nft/metadata/AcalaCrowdloanContributor2021Metadata.json",
1: "https://acala.polkawallet-cloud.com/nft/metadata/AcalaCrowdloanQuestsMetadata.json",
4: "https://acala.polkawallet-cloud.com/nft/metadata/AcalaEarlyAdopterMetadata.json",
};
5 changes: 4 additions & 1 deletion lib/js_service_acala/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { WsProvider, ApiPromise } from "@polkadot/api";
import { subscribeMessage, getNetworkConst, getNetworkProperties } from "./service/setting";
import keyring from "./service/keyring";
import { options } from "@acala-network/api";
// import { WalletPromise } from "@acala-network/sdk-wallet";
import { Wallet } from "@acala-network/sdk";
import account from "./service/account";
import acala from "./service/acala";
import gov from "./service/gov";
Expand Down Expand Up @@ -38,6 +38,9 @@ async function connect(nodes: string[]) {
const url = nodes[(<any>res)._options.provider.__private_29_endpointIndex];
send("log", `${url} wss connected success`);
resolve(url);

(<any>window).wallet = new Wallet(res, { wsProvider });
(<any>window).wallet.isReady;
} else {
res.disconnect();
const url = nodes[(<any>res)._options.provider.__private_29_endpointIndex];
Expand Down
Loading

0 comments on commit 812d08e

Please sign in to comment.