Skip to content
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

solana: pay the original payers back #193

Merged
merged 10 commits into from
Sep 30, 2024
Merged

solana: pay the original payers back #193

merged 10 commits into from
Sep 30, 2024

Conversation

a5-pickle
Copy link
Contributor

@a5-pickle a5-pickle commented Aug 9, 2024

  • Add prepared_by to Auction account to save original rent payer when placing the initial offer
  • Enforce beneficiary to always be prepared_by on PreparedOrderResponse when settling a complete auction
    • If there is no penalty when executing the order, which this settlement is based on, the total repayment (including base fee) will go to the best offer token still
    • If there is a penalty, we want to pay the "liquidator" (beneficiary), who will have specified which token account to send the base fee to
  • Fix tests

Copy link
Contributor

@livthomas livthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest making one of these two changes:

  1. Either do not enforce executor to be the owner of executor_token
  2. Or do not enforce executor to be equal to prepared_order_response.prepared_by. Instead, add another field that will be linked to this account and to which the SOL from closed account will be returned.

Our requirement is simple, we just need SOL to be returned to a wallet that pays for tx fees and rent (across all transactions) and USDC returned to a token account which is not owned by this wallet.

@livthomas
Copy link
Contributor

We have found another issue in add_auction_history_entry. There are two parameters:

  • beneficiary
    • receives SOL from closed auction account
  • beneficiary_token
    • needs to be owned by beneficiary
    • needs to be equal to initial_offer_token

I think after changes made in this PR, beneficiary_token is no longer needed. You can add a constraint directly on beneficiary so it would need to be equal to auction. prepared_by.

@a5-pickle
Copy link
Contributor Author

We have found another issue in add_auction_history_entry. There are two parameters:

  • beneficiary

    • receives SOL from closed auction account
  • beneficiary_token

    • needs to be owned by beneficiary
    • needs to be equal to initial_offer_token

I think after changes made in this PR, beneficiary_token is no longer needed. You can add a constraint directly on beneficiary so it would need to be equal to auction. prepared_by.

Very good catch! How does this look? c6bd633

gator-boi
gator-boi previously approved these changes Aug 16, 2024
@a5-pickle a5-pickle merged commit ddded3b into main Sep 30, 2024
6 checks passed
@a5-pickle a5-pickle deleted the solana/fee-payer branch September 30, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants