Separates hbit_herc20 into hbit_herc20_alice and hbit_herc20_bob (same for herc20_hbit).
The value of having a single function for both parties (less code to maintain) was outweighed by the difficulty of modelling executing an action and watching for the event produced by the execution of an action through the same function/trait. These new functions can differentiate between acting and watching, which makes them easier to understand and makes it easier for us to handle edge cases e.g. not having to wait for the other party to refund if we have aborted the swap execution.
I've tried to separate out things that could be upstreamed to COMIT lib into the module swap/comit. Interestingly, the function try_do_it_once stays within Nectar. The idea is that instead of using this function directly within the swap execution functions, implementations of {hbit, herc20}::ExecuteACTION traits in Nectar use it to ensure that swap execution is idempotent and that performing an action for the first time fails if Beta has expired. Other applications may end up needing similar logic, but the previous model was too complex and abusing traits.
Separates
hbit_herc20
intohbit_herc20_alice
andhbit_herc20_bob
(same forherc20_hbit
).The value of having a single function for both parties (less code to maintain) was outweighed by the difficulty of modelling executing an action and watching for the event produced by the execution of an action through the same function/trait. These new functions can differentiate between acting and watching, which makes them easier to understand and makes it easier for us to handle edge cases e.g. not having to wait for the other party to refund if we have aborted the swap execution.
I've tried to separate out things that could be upstreamed to COMIT lib into the module
swap/comit
. Interestingly, the functiontry_do_it_once
stays within Nectar. The idea is that instead of using this function directly within the swap execution functions, implementations of{hbit, herc20}::ExecuteACTION
traits in Nectar use it to ensure that swap execution is idempotent and that performing an action for the first time fails if Beta has expired. Other applications may end up needing similar logic, but the previous model was too complex and abusing traits.