Skip to content

Commit

Permalink
removed all TOODs
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeNervoXS committed Sep 22, 2023
1 parent 4911355 commit 3da4e7e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 25 deletions.
2 changes: 0 additions & 2 deletions src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,5 @@ describe('AngleStakedStable E2E', () => {
tokenBAmount,
nativeTokenAmount,
);

// TODO: Add any additional test cases required to test AngleStakedStable
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ async function fetchPoolState(
blockNumber: number,
poolAddress: string,
): Promise<PoolState> {
// TODO: complete me!
return angleStakedStablePools.generateState(blockNumber);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function getReaderCalldata(
readerIface: Interface,
amounts: bigint[],
funcName: string,
// TODO: Put here additional arguments you need
) {
return amounts.map(amount => ({
target: exchangeAddress,
Expand All @@ -48,7 +47,6 @@ function decodeReaderResult(
readerIface: Interface,
funcName: string,
) {
// TODO: Adapt this function for your needs
return results.map(result => {
const parsed = readerIface.decodeFunctionResult(funcName, result);
return BigInt(parsed[0]._hex);
Expand All @@ -62,9 +60,8 @@ async function checkOnChainPricing(
prices: bigint[],
amounts: bigint[],
) {
const exchangeAddress = '0x004626a008b1acdc4c74ab51644093b155e59a23'; // TODO: Put here the real exchange address
const exchangeAddress = '0x004626a008b1acdc4c74ab51644093b155e59a23';

// TODO: Replace dummy interface with the real one
// Normally you can get it from angleStakedStable.Iface or from eventPool.
// It depends on your implementation
const readerIface = AngleStakedStableEventPool.angleStakedStableIface;
Expand Down Expand Up @@ -161,7 +158,6 @@ describe('AngleStakedStable', function () {

const tokens = Tokens[network];

// TODO: Put here token Symbol to check against
// Don't forget to update relevant tokens in constant-e2e.ts
const srcTokenSymbol = 'agEUR';
const destTokenSymbol = 'stEUR';
Expand Down Expand Up @@ -219,7 +215,7 @@ describe('AngleStakedStable', function () {
destTokenSymbol,
SwapSide.SELL,
amountsForSell,
funcNameSell, // TODO: Put here proper function name to check pricing
funcNameSell,
);
});

Expand All @@ -233,7 +229,7 @@ describe('AngleStakedStable', function () {
destTokenSymbol,
SwapSide.BUY,
amountsForBuy,
funcNameBuy, // TODO: Put here proper function name to check pricing
funcNameBuy,
);
});

Expand Down
9 changes: 1 addition & 8 deletions src/dex/angle-staked-stable/angle-staked-stable-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber<PoolStat
protected network: number,
protected dexHelper: IDexHelper,
logger: Logger,
protected config: DexParams, // TODO: add any additional params required for event subscriber
protected config: DexParams,
) {
// TODO: Add pool name
super(parentName, 'Staked_Stable', dexHelper, logger);

// TODO: make logDecoder decode logs that
this.logDecoder = (log: Log) =>
AngleStakedStableEventPool.angleStakedStableIface.parseLog(log);
this.addressesSubscribed = [config.stEUR];
Expand Down Expand Up @@ -90,7 +88,6 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber<PoolStat
* @returns state of the event subscriber at blocknumber
*/
async generateState(blockNumber: number): Promise<DeepReadonly<PoolState>> {
// TODO: complete me!
let poolState = {
totalAssets: 0n,
totalSupply: 0n,
Expand Down Expand Up @@ -166,15 +163,13 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber<PoolStat
}

getRateDeposit(amount: bigint, state: PoolState): bigint {
// TODO should not be needed if events are taken in the order triggered
const newTotalAssets = this._accrue(state);
return amount == 0n || state.totalSupply == 0n
? amount
: (amount * state.totalSupply) / newTotalAssets;
}

getRateMint(shares: bigint, state: PoolState): bigint {
// TODO should not be needed
const newTotalAssets = this._accrue(state);
const roundUp =
(shares * newTotalAssets) % state.totalSupply > 0n ? 1n : 0n;
Expand All @@ -184,15 +179,13 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber<PoolStat
}

getRateRedeem(shares: bigint, state: PoolState): bigint {
// TODO should not be needed
const newTotalAssets = this._accrue(state);
return state.totalSupply == 0n
? shares
: (shares * newTotalAssets) / state.totalSupply;
}

getRateWithdraw(amount: bigint, state: PoolState): bigint {
// TODO should not be needed
const newTotalAssets = this._accrue(state);
const roundUp =
(amount * state.totalSupply) % newTotalAssets > 0n ? 1n : 0n;
Expand Down
8 changes: 1 addition & 7 deletions src/dex/angle-staked-stable/angle-staked-stable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AngleStakedStable
readonly network: Network,
readonly dexKey: string,
readonly dexHelper: IDexHelper,
protected adapters = Adapters[network] || {}, // TODO: add any additional optional params to support other fork DEXes
protected adapters = Adapters[network] || {},
) {
super(dexHelper, dexKey);
const config = AngleStakedStableConfig[dexKey][network];
Expand All @@ -63,7 +63,6 @@ export class AngleStakedStable
// for pricing requests. It is optional for a DEX to
// implement this function
async initializePricing(blockNumber: number) {
// TODO: complete me!
this.eventPools = new AngleStakedStableEventPool(
this.dexKey,
this.network,
Expand All @@ -90,7 +89,6 @@ export class AngleStakedStable
side: SwapSide,
blockNumber: number,
): Promise<string[]> {
// TODO: complete me!
if (!this._knownAddress(srcToken, destToken)) return [];
else return [this.dexKey];
}
Expand All @@ -107,7 +105,6 @@ export class AngleStakedStable
blockNumber: number,
limitPools?: string[],
): Promise<null | ExchangePrices<AngleStakedStableData>> {
// TODO: complete me!
const srcTokenAddress = srcToken.address.toLowerCase();
const destTokenAddress = destToken.address.toLowerCase();
if (!this._knownAddress(srcToken, destToken)) return null;
Expand Down Expand Up @@ -173,7 +170,6 @@ export class AngleStakedStable
getCalldataGasCost(
poolPrices: PoolPrices<AngleStakedStableData>,
): number | number[] {
// TODO: update if there is any payload in getAdapterParam
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
}

Expand All @@ -188,7 +184,6 @@ export class AngleStakedStable
data: AngleStakedStableData,
side: SwapSide,
): AdapterExchangeParam {
// TODO: complete me!
const { exchange } = data;

// Encode here the payload for adapter
Expand Down Expand Up @@ -250,7 +245,6 @@ export class AngleStakedStable
// getTopPoolsForToken. It is optional for a DEX
// to implement this
async updatePoolState(): Promise<void> {
// TODO: complete me!
const tokenBalanceMultiCall = [
{
target: this.config.stEUR,
Expand Down

0 comments on commit 3da4e7e

Please sign in to comment.