Skip to content

Commit

Permalink
Merge pull request #604 from interlay/wip-feat-amm
Browse files Browse the repository at this point in the history
Feat AMM
  • Loading branch information
peterslany authored Mar 13, 2023
2 parents a393146 + fbd3ff4 commit f7bfaf3
Show file tree
Hide file tree
Showing 59 changed files with 2,989 additions and 694 deletions.
12 changes: 2 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ services:
- --auto-register=KINT=180000000000000
- --btc-parachain-url=ws://interbtc:9944
- --bitcoin-relay-start-height=1
environment: &client-env
BITCOIN_RPC_URL: http://bitcoind:18443
BITCOIN_RPC_USER: rpcuser
BITCOIN_RPC_PASS: rpcpassword
RUST_LOG: info
environment: *client-env
volumes:
- ./docker/vault_2-keyfile.json:/keyfile.json
vault_3:
Expand All @@ -107,10 +103,6 @@ services:
- --auto-register=KINT=180000000000000
- --btc-parachain-url=ws://interbtc:9944
- --bitcoin-relay-start-height=1
environment: &client-env
BITCOIN_RPC_URL: http://bitcoind:18443
BITCOIN_RPC_USER: rpcuser
BITCOIN_RPC_PASS: rpcpassword
RUST_LOG: info
environment: *client-env
volumes:
- ./docker/vault_3-keyfile.json:/keyfile.json
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interlay/interbtc-api",
"version": "1.22.0",
"version": "2.0.0",
"description": "JavaScript library to interact with interBTC",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down Expand Up @@ -53,8 +53,8 @@
"engineStrict": true,
"dependencies": {
"@interlay/esplora-btc-api": "0.4.0",
"@interlay/interbtc-types": "1.11.2",
"@interlay/monetary-js": "0.7.0",
"@interlay/interbtc-types": "1.12.0",
"@interlay/monetary-js": "0.7.2",
"@polkadot/api": "9.11.1",
"big.js": "6.1.1",
"bitcoin-core": "^3.0.0",
Expand Down
36 changes: 16 additions & 20 deletions src/interbtc-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ import {
DefaultLoansAPI,
EscrowAPI,
LoansAPI,
tokenSymbolToCurrency,
} from ".";
import {
tokenSymbolToCurrency
} from "./utils";
import { AssetRegistryAPI } from "./parachain/asset-registry";
import { AMMAPI, DefaultAMMAPI } from "./parachain/amm";

export * from "./factory";
export * from "./parachain/transaction";
Expand Down Expand Up @@ -62,6 +65,7 @@ export interface InterBtcApi {
readonly escrow: EscrowAPI;
readonly assetRegistry: AssetRegistryAPI;
readonly loans: LoansAPI;
readonly amm: AMMAPI;
setAccount(account: AddressOrPair, signer?: Signer): void;
removeAccount(): void;
readonly account: AddressOrPair | undefined;
Expand Down Expand Up @@ -90,6 +94,7 @@ export class DefaultInterBtcApi implements InterBtcApi {
public readonly escrow: EscrowAPI;
public readonly assetRegistry: AssetRegistryAPI;
public readonly loans: LoansAPI;
public readonly amm: AMMAPI;
private transactionAPI: TransactionAPI;

constructor(
Expand All @@ -106,12 +111,12 @@ export class DefaultInterBtcApi implements InterBtcApi {
this.transactionAPI = new DefaultTransactionAPI(api, _account);

this.assetRegistry = new DefaultAssetRegistryAPI(api);
this.loans = new DefaultLoansAPI(api, wrappedCurrency, this.assetRegistry, this.transactionAPI);
this.oracle = new DefaultOracleAPI(api, wrappedCurrency, this.transactionAPI);
this.loans = new DefaultLoansAPI(api, wrappedCurrency, this.transactionAPI, this.oracle);
this.tokens = new DefaultTokensAPI(api, this.transactionAPI);
this.system = new DefaultSystemAPI(api, this.transactionAPI);
this.oracle = new DefaultOracleAPI(api, wrappedCurrency, this.transactionAPI);
this.fee = new DefaultFeeAPI(api, this.oracle, this.assetRegistry, this.loans);
this.rewards = new DefaultRewardsAPI(api, wrappedCurrency, this.transactionAPI, this.assetRegistry, this.loans);
this.fee = new DefaultFeeAPI(api, this.oracle);
this.rewards = new DefaultRewardsAPI(api, wrappedCurrency, this.transactionAPI);
this.escrow = new DefaultEscrowAPI(api, governanceCurrency, this.system, this.transactionAPI);

this.vaults = new DefaultVaultsAPI(
Expand All @@ -124,9 +129,7 @@ export class DefaultInterBtcApi implements InterBtcApi {
this.fee,
this.rewards,
this.system,
this.transactionAPI,
this.assetRegistry,
this.loans
this.transactionAPI
);
this.faucet = new FaucetClient(api, "");
this.btcRelay = new DefaultBTCRelayAPI(api);
Expand All @@ -137,9 +140,7 @@ export class DefaultInterBtcApi implements InterBtcApi {
this.electrsAPI,
wrappedCurrency,
this.fee,
this.transactionAPI,
this.assetRegistry,
this.loans
this.transactionAPI
);
this.issue = new DefaultIssueAPI(
api,
Expand All @@ -148,9 +149,7 @@ export class DefaultInterBtcApi implements InterBtcApi {
wrappedCurrency,
this.fee,
this.vaults,
this.transactionAPI,
this.assetRegistry,
this.loans
this.transactionAPI
);
this.redeem = new DefaultRedeemAPI(
api,
Expand All @@ -160,19 +159,16 @@ export class DefaultInterBtcApi implements InterBtcApi {
this.vaults,
this.oracle,
this.transactionAPI,
this.assetRegistry,
this.system,
this.loans
this.system
);
this.nomination = new DefaultNominationAPI(
api,
wrappedCurrency,
this.vaults,
this.rewards,
this.transactionAPI,
this.assetRegistry,
this.loans
this.transactionAPI
);
this.amm = new DefaultAMMAPI(api, this.tokens, this.transactionAPI);
}

setAccount(account: AddressOrPair, signer?: Signer): void {
Expand Down
2 changes: 1 addition & 1 deletion src/json/parachain.json

Large diffs are not rendered by default.

Loading

0 comments on commit f7bfaf3

Please sign in to comment.