shapeshift / web

ShapeShift Web
https://app.shapeshift.com
MIT License
157 stars 180 forks source link

Composable THOR memo processing #6777

Open gomesalexandre opened 2 weeks ago

gomesalexandre commented 2 weeks ago

Overview

Follows-up on https://github.com/shapeshift/web/issues/6683 / https://github.com/shapeshift/web/issues/6679

See e.g https://github.com/shapeshift/web/pull/6700#discussion_r1582421070, https://github.com/shapeshift/web/blob/5a7fc2e28761a823e0c2a6e6a126d21ddf822628/src/lib/swapper/swappers/ThorchainSwapper/utils/addAggregatorAndDestinationToMemo.ts#L89-L114, or https://github.com/shapeshift/web/blob/6566b6525d060e4db72370c695e8b7992046224e/src/lib/swapper/swappers/ThorchainSwapper/utils/addSlippageToMemo.ts#L39-L44

For places that do memo mutation. #6755 brought an assertAndProcessMemo util.

At the moment, it's very dumb and takes whichever memo is passed in, splits it into parts, and adds the affiliate name if needed.

We want to improve our current memo-building (addSlippageToMemo, addAggregatorAndDestinationToMemo.ts and THORChain LP's memo expression) to be composable and pass parts to assertAndProcessMemo (or a new building-focused util instead), to benefit from its validation feature.

References and additional details

See overview

Acceptance Criteria

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response