-
Notifications
You must be signed in to change notification settings - Fork 40
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
Premium #264
base: master
Are you sure you want to change the base?
Premium #264
Conversation
dc5b87f
to
8870169
Compare
6f44cbc
to
4c591cc
Compare
Asking for opinions: Should we have fine grained configuration to allow for setting certain peers a different premium fee rate? |
I think no. But allow separate premiums for received swap ins and swap outs, including negative values. This will allow managing liquidity among BTC, LBTC and Lightning. |
In the future, it may be better to allow premiums to be set according to the degree of use, such as channels that flow easily in both directions or channels that flow only in one direction. |
It is possible to configure swap in and swap out in |
Yes I think so. Channels may have different characteristics that would benefit from having individual premium/discount rates to incentivize swapping in one direction or the other, similar to how routing fee rates can be used to influence how a channel is used? |
e49ad78
to
65dcce8
Compare
Looks like the premium info is missing from the CLN
|
Would it be useful to have the premium rate limit be a config option in |
Hitting this with CLN as sender:
|
CLN plugin crashed when trying a
Looks like
The logs appear to show that the swap I attempted succeeded however.
|
Thanks for the test. |
FIXED. SwapInPremiumRatePPM and SwapInPremiumRatePPM are added to the ListPeers. I rearranged the order of commands. The source of the information was an error, which I corrected. |
@YusukeShimizu Hello. Do you plan RPC endpoints to configure premium rates? |
I have no definite plan. There are some opinions that a fine-grained premium setting is needed, so I may need to think about an appropriate design for that (such as having RPC endpoints, etc.) |
At 9c34c47 my
|
75fb65c
to
d8b683d
Compare
I fixed it on d8b683d |
When the reload policy was executed, the configuration values were updated, but they were not being displayed, which was causing this behavior. Definitions are being added so that they are displayed. |
Idea: being able to set separate premiums for BTC and L-BTC. If I receive BTC from swaps, maybe I want to add a higher premium to offset the cost of moving it in the future? |
I think we need configurable premium different for each peer. |
It would make sense to have different premiums for different assets too. And, for different peers as well. With defaults to fall back on. |
The required premium rates for in and out swaps should be advertised by the receiver in its response to REQUEST_POLL message. So that the initiator can see these rates in Attempting swaps blindly with 'max acceptable premium rate' is a no go. Peerswap is already suffering from uncertainty about available balances, additional uncertainty about fees will kill it. People hate attempting and seeing constant probing in swaps history. |
I totally agree here! |
Hello. Is this PR abandoned, or still in the works? No one keeps any Liquid balance because it can be snatched cheaply. There is a need for a swap out premium. |
Thank you for the feedback. |
This commit adds protocol update and impl of premium. * Swap In * Responder/Taker requests Premium, Maker adds it to Opening Tx (Taker collects Premium in Claim tx) * Swap Out * Responder/Maker requests Premium and Taker tops it up on Claim invoice (Maker collects Premium on Claim invoice)
This commit includes the premium rate in the poll message so that the premium set for each peer can be confirmed.
This commit adds premium options. Also, the sample settings and document have been updated accordingly.
82d3121
to
b86afcc
Compare
This commit is to modify and add integration tests for the addition of premium.
Add item to peerSwapPeer to display Premium Rate Ppm. Set the value retrieved from the poll so that it can be checked with the ListPeers command.
Corrected where to get premium limit at swapout in CheckPremiumAmount and OnSwapOutRequestReceived. Also, unit tests for CheckPremiumAmount have been added.
I rearranged the order of commands for swapin.
When the reload policy was done, the configuration values were updated, but they were not displayed. Definitions are being added so that they are displayed.
5f32ed3
to
2b776da
Compare
I have made it possible to set premiums individually for BTC and LBTC.
|
Allow setting different premium values for BTC and LBTC. This change also enables users to configure individual premiums for each peer, providing more granular control over pricing and liquidity. - Added separate premium fields for BTC and LBTC. - Implemented logic to apply peer-specific premiums.
2b776da
to
2e68c35
Compare
|
The current code only supports direct editing of The |
I did not specify anything in policy yet, but listpeers shows 10000 ppm for my other node. I think 0 is a better default.
|
after updating the policy file, it is necessary to restart |
It seems that setting the base premium to 0 would indeed be better in terms of compatibility issues. I will make the correction. Although the internal values are being updated due to the reload policy, it seems that it is taking some time for these changes to be reflected. I believe there is an advantage in addressing this because, with immediate polling when the premium is updated, the changes will be reflected quickly for list peers and the latest premium will also be sent to peers. Therefore, I will take action on this. |
In summary, I am planning the following updates:
|
This PR adds premium to peerswap.
design doc
Usage
doing swap
A premium limit will be added to the existing swap command.
If not set, default is 0.
cln
lnd
configure premium rate
The premium rate is pert per million and can be set for swapin and swapout respectively.
swap_amount * premium_rate_ppm / 1000000
is the premium.Negative values can also be set to give a discount
policy.conf
You can check the premium rate set for each peer by using listpeers.
examples
If the max_acceptable_premium is lower than responder.
./bin/pscli peerswap1 swapout --channel_id $CHANID --sat_amt 1000000 --asset btc --premium_limit 1 2023/12/23 02:02:36 rpc error: code = Unknown desc = from the LND peer: unacceptable premium: 100, limit: 1
success