web icon indicating copy to clipboard operation
web copied to clipboard

Composable THOR memo processing

Open gomesalexandre opened this issue 9 months ago • 1 comments

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

  • assertAndProcessMemo is able to do validation on parts to ensure that the memo is correct
  • Nice-to-have: either:
    • some building-specific util is added to consolidate the memo-building logic (i.e build a memo from parts) across addSlippageToMemo, addAggregatorAndDestinationToMemo.ts and THORChain LP's memo expression`
    • assertAndProcessMemo knows how to build a memo from parts

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

gomesalexandre avatar Apr 29 '24 22:04 gomesalexandre