-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core,eth: handle redemption funding #1314
Conversation
buck54321
commented
Nov 29, 2021
•
edited
Loading
edited
I was imagining a |
Not 100% sure I follow, but you should try it out. This is maybe the third different direction I started down, and the others got messy. I think |
I will consider it more. I do appreciate some of the issues you've addressed by tracking amounts instead of coins or lots independently. |
Still need match revocation handling, but if nobody objects, I'll work on getting this out of draft. |
OK.
…On Wed, Dec 22, 2021, 8:34 AM buck54321 ***@***.***> wrote:
Still need match revocation handling, but if nobody objects, I'll work on
getting this out of draft.
—
Reply to this email directly, view it on GitHub
<#1314 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACHQOSICJKESRAGXCFHKH2LUSHOYJANCNFSM5JAJPS6Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
f47c250
to
c919f53
Compare
c919f53
to
8abbe51
Compare
Order Completion
Match Revoked
|
85764f3
to
bee8fc3
Compare
pubKey, err = recoverPubkey(crypto.Keccak256(data), sig) | ||
if err != nil { | ||
return nil, nil, fmt.Errorf("SignMessage: error recovering pubkey %w", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could get the pubkey at start-up and there would not be a need to recover every time? But if we ever have more than one address being used, it will be needed, I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually had it that way at one point.
@@ -227,6 +227,20 @@ type Wallet interface { | |||
RegFeeConfirmations(ctx context.Context, coinID dex.Bytes) (confs uint32, err error) | |||
} | |||
|
|||
type AccountRedeemer interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at how funding swaps will work, they will also need special care, and I guess will need a similar interface. For example, the entire funding msg is signed rather than just the funding coin ids. Could the naming here be changed to include more than just redeems? Maybe just Accounter
or is that wierd.
Also, could use a doc above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you mean the problems you're addressing in #1392? I don't think we'll need any new Wallet
methods for swap funding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just minor comments
client/asset: Add AccounterRedeemer interface with methods for locking and unlocking funds for redemption. ReserveN is used to reserve funds for an order. Only the amount reserved is returned. All accounting from there is handled by Core, who will return funds proportionally according to match quantities and order size. The amount reserved is persisted in the OrderMetaData so that accounting can be picked up exactly as it was on restarts. This pattern was chosen over trying to figure out how much to lock on restart with calculations based on order info because you would need to consider changes in asset configuration and therefore persist more data and ... it gets messy. client/core: Add RedeemSig to orders redeeming to and AccountRedeemer. Track and return reserved redemption funds. Return funds manually for refunds and revocations. Handle dust that can arise from rounding error. Log inconsistencies. client/asset/eth: Implement asset.AccountRedeemer. Track redemption reserves separately than swap reserves, but add them when calculating locked balance.