Skip to content

Commit

Permalink
Merge pull request #259 from gmbronco/develop
Browse files Browse the repository at this point in the history
improvement: return tokens passed by a user on top of used in relayers
  • Loading branch information
John Grant committed May 18, 2022
2 parents 0dd1dbc + 0684865 commit cc4ef94
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export const EMPTY_SWAPINFO: SwapInfo = {
swapAmount: Zero,
swapAmountForSwaps: Zero,
tokenIn: '',
tokenInForSwaps: '',
tokenOut: '',
tokenOutFromSwaps: '',
returnAmount: Zero,
returnAmountConsideringFees: Zero,
returnAmountFromSwaps: Zero,
Expand Down
2 changes: 2 additions & 0 deletions src/formatSwaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export function formatSwaps(

const swapInfo: SwapInfo = {
swapAmount,
swapAmountForSwaps: swapAmount,
returnAmount,
returnAmountFromSwaps: returnAmount,
returnAmountConsideringFees,
swaps,
tokenAddresses,
Expand Down
6 changes: 4 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ export interface SwapInfo {
tokenAddresses: string[];
swaps: SwapV2[];
swapAmount: BigNumber;
swapAmountForSwaps?: BigNumber; // Used with stETH/wstETH
swapAmountForSwaps: BigNumber; // Used with stETH/wstETH
returnAmount: BigNumber;
returnAmountFromSwaps?: BigNumber; // Used with stETH/wstETH
returnAmountFromSwaps: BigNumber; // Used with stETH/wstETH
returnAmountConsideringFees: BigNumber;
tokenIn: string;
tokenInForSwaps?: string; // Used with stETH/wstETH
tokenOut: string;
tokenOutFromSwaps?: string; // Used with stETH/wstETH
marketSp: string;
}

Expand Down
3 changes: 3 additions & 0 deletions src/wrapInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ export function setWrappedInfo(
swapInfo.swapAmountForSwaps = swapInfo.swapAmount;
swapInfo.returnAmountFromSwaps = swapInfo.returnAmount;

swapInfo.tokenInForSwaps = wrappedInfo.tokenIn.addressForSwaps;
swapInfo.tokenOutFromSwaps = wrappedInfo.tokenOut.addressForSwaps;

// No wrapping required
if (
wrappedInfo.tokenIn.wrapType === WrapTypes.None &&
Expand Down

0 comments on commit cc4ef94

Please sign in to comment.