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.
getUnderlying
will return the array of addresses of the underlying tokens.calculateTransformToUnderlying
Calculates 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 angetAmountsOut
view function.calculateTransformToDependent
Calculates 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 angetAmountOut
view function.calculateNeededToTransformToUnderlying
Calculates 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 angetAmountIn
view function.calculateNeededToTransformToDependent
Calculates 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 angetAmountsIn
view function.transformToUnderlying
Executes the transformation to the underlying tokens. If you are familiar with dexes, you can think of this as anexactIn
swap function.transformToDependent
Executes the transformation to the dependent token. If you are familiar with dexes, you can think of this as anexactIn
swap function.transformToExpectedUnderlying
Transforms dependent tokens to an expected amount of underlying tokens. If you are familiar with dexes, you can think of this as anexactOut
swap function.transformToExpectedDependent
TransformsTransforms underlying tokens to an expected amount of dependent tokens. If you are familiar with dexes, you can think of this as anexactOut
swap function.
Last updated
Was this helpful?