Skip to content

Commit

Permalink
feat!: Remove Mangrove.getTokenAndAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
espendk committed Nov 24, 2023
1 parent ec8bc21 commit d4446f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- feat!: Removed `configuration.tokens.fetchDecimalsFromAddress`. Instead, use `MgvToken.createTokenFromAddress` and read the decimals from that token.
- feat!: `Mangrove.toUnits|fromUnits` no longer accepts a token name/symbol as this was ambiguous. Instead, use `MgvToken.createToken` and call `toUnits|fromUnits` on that.
- feat!: Static token configuration getters and setters have been removed from `Mangrove`. Instead, use the methods on `MgvToken`.
- feat!: `Mangrove.getTokenAndAddress` has been removed. Instead, use `Mangrove.tokenFromAddress` and read the address from there.

# 2.0.0-4

Expand Down
16 changes: 8 additions & 8 deletions src/kandel/kandelFarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ class KandelFarm {
const olKeyStruct = this.mgv.getOlKeyStruct(
x.args.baseQuoteOlKeyHash,
);
const baseToken = await this.mgv.getTokenAndAddress(
const baseToken = await this.mgv.tokenFromAddress(
await olKeyStruct!.outbound_tkn,
);
const quoteToken = await this.mgv.getTokenAndAddress(
const quoteToken = await this.mgv.tokenFromAddress(
await olKeyStruct!.inbound_tkn,
);
return {
kandelAddress: x.args.kandel,
ownerAddress: x.args.owner,
onAave: false,
baseAddress: baseToken.address,
base: baseToken.token,
base: baseToken,
quoteAddress: quoteToken.address,
quote: quoteToken.token,
quote: quoteToken,
};
})
: [];
Expand All @@ -116,20 +116,20 @@ class KandelFarm {
const olKeyStruct = this.mgv.getOlKeyStruct(
x.args.baseQuoteOlKeyHash,
);
const baseToken = await this.mgv.getTokenAndAddress(
const baseToken = await this.mgv.tokenFromAddress(
await olKeyStruct!.outbound_tkn,
);
const quoteToken = await this.mgv.getTokenAndAddress(
const quoteToken = await this.mgv.tokenFromAddress(
await olKeyStruct!.inbound_tkn,
);
return {
kandelAddress: x.args.aaveKandel,
ownerAddress: x.args.owner,
onAave: true,
baseAddress: baseToken.address,
base: baseToken.token,
base: baseToken,
quoteAddress: quoteToken.address,
quote: quoteToken.token,
quote: quoteToken,
};
})
: [];
Expand Down
12 changes: 0 additions & 12 deletions src/mangrove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,6 @@ class Mangrove {
);
}

/** Gets the token corresponding to the address if it is known; otherwise, undefined.
*/
async getTokenAndAddress(
address: string,
): Promise<{ address: string; token?: MgvToken }> {
const name = this.getNameFromAddress(address);
return {
address,
token: name === undefined ? undefined : await this.token(name),
};
}

/** Convert public token amount to internal token representation.
*
* For convenience, has a static and an instance version.
Expand Down

0 comments on commit d4446f1

Please sign in to comment.