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

Advanced maker options v1 #76

Merged
merged 30 commits into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a3b19d8
Add UI, switch rewards, switch advanced, allow bondless, robologo
Reckless-Satoshi Mar 15, 2022
5c5e791
Add datetime picker for public order expiration
Reckless-Satoshi Mar 15, 2022
fce2bbd
Add time picker and fidelity bond slider to advanced options
Reckless-Satoshi Mar 15, 2022
2e5d2ff
Add range amount slider
Reckless-Satoshi Mar 16, 2022
73c489a
Disable new features, add robosatsTextIcon and amboss svg
Reckless-Satoshi Mar 16, 2022
26e0664
Minor stylish fixes
Reckless-Satoshi Mar 17, 2022
967c441
Alert when using clearnet
Reckless-Satoshi Mar 17, 2022
a36f23b
Add maker selects public duration
Reckless-Satoshi Mar 18, 2022
d31bd63
Add maker selects fidelity bond size
Reckless-Satoshi Mar 18, 2022
5730ec0
Add any-domain referral, ontop UnsafeAlert and control panel(app)
Reckless-Satoshi Mar 19, 2022
ca79ea9
Init accounting panel, add import/export
Reckless-Satoshi Mar 20, 2022
3d9ef5f
Add limits API endpoint
Reckless-Satoshi Mar 20, 2022
d4023bf
Add preliminary daily accounting
Reckless-Satoshi Mar 21, 2022
2998c26
Add smart amount range picker with limits
Reckless-Satoshi Mar 21, 2022
bf80986
Implement min_amount max_amount model props and validation
Reckless-Satoshi Mar 21, 2022
8ae2406
Implement backend handle range amounts, order take amount input and o…
Reckless-Satoshi Mar 22, 2022
ffee6f4
Fix do_accounting, safe adjust maxRange
Reckless-Satoshi Mar 22, 2022
7c3c775
Update favicons
Reckless-Satoshi Mar 22, 2022
7a90c23
Fix bug in accounting when no pending disputes
Reckless-Satoshi Mar 23, 2022
5ee28f9
Add dark mode, text input for amount range, basic/advance tabs
Reckless-Satoshi Mar 24, 2022
93da756
Fix maker order tab alignment, fix typo on info text
Reckless-Satoshi Mar 24, 2022
5aa0304
Improve amount specification UI
Reckless-Satoshi Mar 24, 2022
cb7dcab
Remove input numeric arrows
Reckless-Satoshi Mar 24, 2022
0be7bcc
Fix dark theme chat and qr margins
Reckless-Satoshi Mar 24, 2022
dc5f228
Fix percentile computing for ranges, fix limit adjusts by premium
Reckless-Satoshi Mar 25, 2022
6ce9957
mend
Reckless-Satoshi Mar 25, 2022
d5e5879
Add css app loading page
Reckless-Satoshi Mar 25, 2022
261cb46
Add app loading message slider
Reckless-Satoshi Mar 25, 2022
b89df02
Minify main.js, improve spinner and loader page
Reckless-Satoshi Mar 25, 2022
fae1f13
Fix TG retry welcome bug
Reckless-Satoshi Mar 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ FEE = 0.002
# Shall incentivize order making
MAKER_FEE_SPLIT=0.125

# Default bond size as fraction
BOND_SIZE = 0.01
# Bond size as percentage (%)
DEFAULT_BOND_SIZE = 1
MIN_BOND_SIZE = 1
MAX_BOND_SIZE = 15

# Time out penalty for canceling takers in SECONDS
PENALTY_TIMEOUT = 60
Expand All @@ -69,6 +71,7 @@ MAX_PUBLIC_ORDERS = 100
# Trade limits in satoshis
MIN_TRADE = 20000
MAX_TRADE = 800000
MAX_TRADE_BONDLESS_TAKER = 50000

# Expiration (CLTV_expiry) time for HODL invoices in HOURS // 7 min/block assumed
BOND_EXPIRY = 54
Expand All @@ -79,7 +82,10 @@ EXP_MAKER_BOND_INVOICE = 300
EXP_TAKER_BOND_INVOICE = 200

# Time a order is public in the book HOURS
PUBLIC_ORDER_DURATION = 6
DEFAULT_PUBLIC_ORDER_DURATION = 24
MAX_PUBLIC_ORDER_DURATION = 24
MIN_PUBLIC_ORDER_DURATION = 0.166

# Time to provide a valid invoice and the trade escrow MINUTES
INVOICE_AND_ESCROW_DURATION = 30
# Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -651,4 +651,5 @@ api/lightning/invoices*
api/lightning/router*
api/lightning/googleapis*
frontend/static/admin*
frontend/static/rest_framework*
frontend/static/rest_framework*
frontend/static/import_export*
24 changes: 18 additions & 6 deletions api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ class ProfileInline(admin.StackedInline):
can_delete = False
fields = ("avatar_tag", )
readonly_fields = ["avatar_tag"]

show_change_link = True

# extended users with avatars
@admin.register(User)
class EUserAdmin(UserAdmin):
class EUserAdmin(AdminChangeLinksMixin, UserAdmin):
inlines = [ProfileInline]
list_display = (
"avatar_tag",
"id",
"profile_link",
"username",
"last_login",
"date_joined",
"is_staff",
)
list_display_links = ("id", "username")
change_links = (
"profile",
)
ordering = ("-id", )

def avatar_tag(self, obj):
Expand All @@ -42,7 +46,7 @@ class OrderAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
"maker_link",
"taker_link",
"status",
"amount",
"amt",
"currency_link",
"t0_satoshis",
"is_disputed",
Expand All @@ -65,7 +69,13 @@ class OrderAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
"trade_escrow",
)
list_filter = ("is_disputed", "is_fiat_sent", "type", "currency", "status")
search_fields = ["id","amount"]
search_fields = ["id","amount","min_amount","max_amount"]

def amt(self, obj):
if obj.has_range and obj.amount == None:
return str(float(obj.min_amount))+"-"+ str(float(obj.max_amount))
else:
return float(obj.amount)

@admin.register(LNPayment)
class LNPaymentAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
Expand All @@ -74,6 +84,7 @@ class LNPaymentAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
"concept",
"status",
"num_satoshis",
"fee",
"type",
"expires_at",
"expiry_height",
Expand All @@ -95,7 +106,7 @@ class LNPaymentAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
)
list_filter = ("type", "concept", "status")
ordering = ("-expires_at", )
search_fields = ["payment_hash","num_satoshis"]
search_fields = ["payment_hash","num_satoshis","sender__username","receiver__username","description"]


@admin.register(Profile)
Expand All @@ -116,9 +127,11 @@ class UserProfileAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
"num_disputes",
"lost_disputes",
)
list_editable = ["pending_rewards", "earned_rewards"]
list_display_links = ("avatar_tag", "id")
change_links = ["user"]
readonly_fields = ["avatar_tag"]
search_fields = ["user__username","id"]


@admin.register(Currency)
Expand All @@ -128,7 +141,6 @@ class CurrencieAdmin(admin.ModelAdmin):
readonly_fields = ("currency", "exchange_rate", "timestamp")
ordering = ("id", )


@admin.register(MarketTick)
class MarketTickAdmin(admin.ModelAdmin):
list_display = ("timestamp", "price", "volume", "premium", "currency",
Expand Down
1 change: 1 addition & 0 deletions api/lightning/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def pay_invoice(cls, lnpayment):

if response.status == 2: # STATUS 'SUCCEEDED'
lnpayment.status = LNPayment.Status.SUCCED
lnpayment.fee = float(response.fee_msat)/1000
lnpayment.save()
return True, None

Expand Down
Loading