Transformer
ITransformer will be the interface that a smart contract will need to comply with to be considered a Transformer inside our architecture.
This interface's idea is to describe the behavior we expect from a transformer, and it's relationship with the dependent-underlying tokens. Because the goal of the transformers is helping convert from one token to many, or vice-versa, there are a lot of functions that have similar behaviors to known dexes functions: swaps, exactIn, exactOut, etc.
getUnderlyingwill return the array of addresses of the underlying tokens.calculateTransformToUnderlyingCalculates how much would the transformation from a dependent token and amount to the underlying tokens return. If you are familiar with dexes, you can think of this as angetAmountsOutview function.calculateTransformToDependentCalculates how much would the transformation from underlying tokens and amounts to the dependent token return. If you are familiar with dexes, you can think of this as angetAmountOutview function.calculateNeededToTransformToUnderlyingCalculates how many dependent tokens are needed to transform to the expected amount of underlying. If you are familiar with dexes, you can think of this as angetAmountInview function.calculateNeededToTransformToDependentCalculates how many underlying tokens are needed to transform to the expected amount of dependent. If you are familiar with dexes, you can think of this as angetAmountsInview function.transformToUnderlyingExecutes the transformation to the underlying tokens. If you are familiar with dexes, you can think of this as anexactInswap function.transformToDependentExecutes the transformation to the dependent token. If you are familiar with dexes, you can think of this as anexactInswap function.transformToExpectedUnderlyingTransforms dependent tokens to an expected amount of underlying tokens. If you are familiar with dexes, you can think of this as anexactOutswap function.transformToExpectedDependentTransformsTransforms underlying tokens to an expected amount of dependent tokens. If you are familiar with dexes, you can think of this as anexactOutswap function.
Last updated
Was this helpful?