Simplify coordinator updates, automatic migrations and collect statics (#583)

This commit is contained in:
Reckless_Satoshi 2023-05-15 09:46:59 +00:00 committed by GitHub
parent fd8f64e93a
commit 7b6ebd0eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 8318 additions and 37 deletions

View File

@ -88,8 +88,7 @@ MAX_PUBLIC_ORDERS = 100
# Trade limits in satoshis
MIN_TRADE = 20000
MAX_TRADE = 3000000
MAX_TRADE_BONDLESS_TAKER = 50000
MAX_TRADE = 5000000
# For CLTV_expiry calculation
# Assume 8 min/block assumed
@ -106,8 +105,8 @@ 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
# Default time to provide a valid invoice and the trade escrow MINUTES
INVOICE_AND_ESCROW_DURATION = 180
# Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS
FIAT_EXCHANGE_DURATION = 24
@ -133,7 +132,7 @@ SWAP_LAMBDA = 8.8
# LINEAR. 4 parameters needed: min/max fees and min/max balance points. E.g. If 25% or more of liquidity
# is onchain the fee for swap is 2% (minimum), if it is 12% fee is 6%, and for 0% fee is 10%.
# Minimum swap fee as fraction (1%)
MIN_SWAP_FEE = 0.01
MIN_SWAP_FEE = 0.008
# Liquidity split point (LN/onchain) at which we use MIN_SWAP_FEE
MIN_SWAP_POINT = 0.35
# Maximum swap fee as fraction (~10%)

View File

@ -1,3 +1,4 @@
[flake8]
max-line-length = 88
extend-ignore = E501
exclude = ./*migrations*.py

View File

@ -5,4 +5,4 @@ This PR introduces/refactors/...
## Checklist before merging
- [ ] Install [pre-commit](https://pre-commit.com/#installation) and initialize it: `pip install pre-commit`, then `pre-commit install`. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.
- [ ] If I added new phrases to the user interface, I have ran prettier `cd frontend/static/locales; python collect_phrases.py` to collect them for translation.
- [ ] If I added new phrases to the user interface, I have ran `cd frontend/static/locales; python collect_phrases.py` to collect them for translation.

23
.gitignore vendored
View File

@ -257,18 +257,6 @@ cython_debug/
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json
# F#
*.fs.js
@ -635,9 +623,6 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# Django
*migrations*
# Celery
django
@ -649,15 +634,13 @@ docker/i2p
# robosats
frontend/static/assets/avatars*
api/lightning/lightning*
api/lightning/invoices*
api/lightning/router*
api/lightning/verrpc*
api/lightning/googleapis*
api/lightning/*_grpc.py
api/lightning/*_pb2.py
frontend/static/locales/collected_phrases.json
frontend/static/admin*
frontend/static/rest_framework*
frontend/static/import_export*
frontend/static/drf_spectacular_sidecar/
frontend/src/components/PaymentMethods/Icons/code*
frontend/src/components/PaymentMethods/Icons/webp*
frontend/static/frontend/**

View File

@ -1,6 +1,7 @@
# TODO
# add a hook which automatically generates the OpenApi schema on API changes
# and places them in an appropriate location
exclude: '(api|chat|control)/migrations/.*'
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v2.3.0

View File

@ -2,8 +2,6 @@ FROM python:3.11.3-slim-bullseye
ARG DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /usr/src/robosats
# specifying the working dir inside the container
WORKDIR /usr/src/robosats
RUN apt-get update -qq && \
@ -23,8 +21,10 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# install lnd/cln grpc services
RUN sh generate_grpc.sh
RUN sh scripts/generate_grpc.sh
RUN chmod +x scripts/entrypoint.sh
EXPOSE 8000
ENTRYPOINT [ "/usr/src/robosats/scripts/entrypoint.sh" ]
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]

View File

@ -0,0 +1,175 @@
syntax = "proto3";
import "lightning.proto";
package invoicesrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc";
// Invoices is a service that can be used to create, accept, settle and cancel
// invoices.
service Invoices {
/*
SubscribeSingleInvoice returns a uni-directional stream (server -> client)
to notify the client of state transitions of the specified invoice.
Initially the current invoice state is always sent out.
*/
rpc SubscribeSingleInvoice (SubscribeSingleInvoiceRequest)
returns (stream lnrpc.Invoice);
/*
CancelInvoice cancels a currently open invoice. If the invoice is already
canceled, this call will succeed. If the invoice is already settled, it will
fail.
*/
rpc CancelInvoice (CancelInvoiceMsg) returns (CancelInvoiceResp);
/*
AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
supplied in the request.
*/
rpc AddHoldInvoice (AddHoldInvoiceRequest) returns (AddHoldInvoiceResp);
/*
SettleInvoice settles an accepted invoice. If the invoice is already
settled, this call will succeed.
*/
rpc SettleInvoice (SettleInvoiceMsg) returns (SettleInvoiceResp);
/*
LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
using either its payment hash, payment address, or set ID.
*/
rpc LookupInvoiceV2 (LookupInvoiceMsg) returns (lnrpc.Invoice);
}
message CancelInvoiceMsg {
// Hash corresponding to the (hold) invoice to cancel. When using
// REST, this field must be encoded as base64.
bytes payment_hash = 1;
}
message CancelInvoiceResp {
}
message AddHoldInvoiceRequest {
/*
An optional memo to attach along with the invoice. Used for record keeping
purposes for the invoice's creator, and will also be set in the description
field of the encoded payment request if the description_hash field is not
being used.
*/
string memo = 1;
// The hash of the preimage
bytes hash = 2;
/*
The value of this invoice in satoshis
The fields value and value_msat are mutually exclusive.
*/
int64 value = 3;
/*
The value of this invoice in millisatoshis
The fields value and value_msat are mutually exclusive.
*/
int64 value_msat = 10;
/*
Hash (SHA-256) of a description of the payment. Used if the description of
payment (memo) is too long to naturally fit within the description field
of an encoded payment request.
*/
bytes description_hash = 4;
// Payment request expiry time in seconds. Default is 86400 (24 hours).
int64 expiry = 5;
// Fallback on-chain address.
string fallback_addr = 6;
// Delta to use for the time-lock of the CLTV extended to the final hop.
uint64 cltv_expiry = 7;
/*
Route hints that can each be individually used to assist in reaching the
invoice's destination.
*/
repeated lnrpc.RouteHint route_hints = 8;
// Whether this invoice should include routing hints for private channels.
bool private = 9;
}
message AddHoldInvoiceResp {
/*
A bare-bones invoice for a payment within the Lightning Network. With the
details of the invoice, the sender has all the data necessary to send a
payment to the recipient.
*/
string payment_request = 1;
/*
The "add" index of this invoice. Each newly created invoice will increment
this index making it monotonically increasing. Callers to the
SubscribeInvoices call can use this to instantly get notified of all added
invoices with an add_index greater than this one.
*/
uint64 add_index = 2;
/*
The payment address of the generated invoice. This value should be used
in all payments for this invoice as we require it for end to end
security.
*/
bytes payment_addr = 3;
}
message SettleInvoiceMsg {
// Externally discovered pre-image that should be used to settle the hold
// invoice.
bytes preimage = 1;
}
message SettleInvoiceResp {
}
message SubscribeSingleInvoiceRequest {
reserved 1;
// Hash corresponding to the (hold) invoice to subscribe to. When using
// REST, this field must be encoded as base64url.
bytes r_hash = 2;
}
enum LookupModifier {
// The default look up modifier, no look up behavior is changed.
DEFAULT = 0;
/*
Indicates that when a look up is done based on a set_id, then only that set
of HTLCs related to that set ID should be returned.
*/
HTLC_SET_ONLY = 1;
/*
Indicates that when a look up is done using a payment_addr, then no HTLCs
related to the payment_addr should be returned. This is useful when one
wants to be able to obtain the set of associated setIDs with a given
invoice, then look up the sub-invoices "projected" by that set ID.
*/
HTLC_SET_BLANK = 2;
}
message LookupInvoiceMsg {
oneof invoice_ref {
// When using REST, this field must be encoded as base64.
bytes payment_hash = 1;
bytes payment_addr = 2;
bytes set_id = 3;
}
LookupModifier lookup_modifier = 4;
}

File diff suppressed because it is too large Load Diff

952
api/lightning/router.proto Normal file
View File

@ -0,0 +1,952 @@
syntax = "proto3";
import "lightning.proto";
package routerrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
// Router is a service that offers advanced interaction with the router
// subsystem of the daemon.
service Router {
/*
SendPaymentV2 attempts to route a payment described by the passed
PaymentRequest to the final destination. The call returns a stream of
payment updates.
*/
rpc SendPaymentV2 (SendPaymentRequest) returns (stream lnrpc.Payment);
/*
TrackPaymentV2 returns an update stream for the payment identified by the
payment hash.
*/
rpc TrackPaymentV2 (TrackPaymentRequest) returns (stream lnrpc.Payment);
/*
TrackPayments returns an update stream for every payment that is not in a
terminal state. Note that if payments are in-flight while starting a new
subscription, the start of the payment stream could produce out-of-order
and/or duplicate events. In order to get updates for every in-flight
payment attempt make sure to subscribe to this method before initiating any
payments.
*/
rpc TrackPayments (TrackPaymentsRequest) returns (stream lnrpc.Payment);
/*
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
may cost to send an HTLC to the target end destination.
*/
rpc EstimateRouteFee (RouteFeeRequest) returns (RouteFeeResponse);
/*
Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
the specified route. This method differs from SendPayment in that it
allows users to specify a full route manually. This can be used for
things like rebalancing, and atomic swaps. It differs from the newer
SendToRouteV2 in that it doesn't return the full HTLC information.
*/
rpc SendToRoute (SendToRouteRequest) returns (SendToRouteResponse) {
option deprecated = true;
}
/*
SendToRouteV2 attempts to make a payment via the specified route. This
method differs from SendPayment in that it allows users to specify a full
route manually. This can be used for things like rebalancing, and atomic
swaps.
*/
rpc SendToRouteV2 (SendToRouteRequest) returns (lnrpc.HTLCAttempt);
/*
ResetMissionControl clears all mission control state and starts with a clean
slate.
*/
rpc ResetMissionControl (ResetMissionControlRequest)
returns (ResetMissionControlResponse);
/*
QueryMissionControl exposes the internal mission control state to callers.
It is a development feature.
*/
rpc QueryMissionControl (QueryMissionControlRequest)
returns (QueryMissionControlResponse);
/*
XImportMissionControl is an experimental API that imports the state provided
to the internal mission control's state, using all results which are more
recent than our existing values. These values will only be imported
in-memory, and will not be persisted across restarts.
*/
rpc XImportMissionControl (XImportMissionControlRequest)
returns (XImportMissionControlResponse);
/*
GetMissionControlConfig returns mission control's current config.
*/
rpc GetMissionControlConfig (GetMissionControlConfigRequest)
returns (GetMissionControlConfigResponse);
/*
SetMissionControlConfig will set mission control's config, if the config
provided is valid.
*/
rpc SetMissionControlConfig (SetMissionControlConfigRequest)
returns (SetMissionControlConfigResponse);
/*
Deprecated. QueryProbability returns the current success probability
estimate for a given node pair and amount. The call returns a zero success
probability if no channel is available or if the amount violates min/max
HTLC constraints.
*/
rpc QueryProbability (QueryProbabilityRequest)
returns (QueryProbabilityResponse);
/*
BuildRoute builds a fully specified route based on a list of hop public
keys. It retrieves the relevant channel policies from the graph in order to
calculate the correct fees and time locks.
*/
rpc BuildRoute (BuildRouteRequest) returns (BuildRouteResponse);
/*
SubscribeHtlcEvents creates a uni-directional stream from the server to
the client which delivers a stream of htlc events.
*/
rpc SubscribeHtlcEvents (SubscribeHtlcEventsRequest)
returns (stream HtlcEvent);
/*
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
described by the passed PaymentRequest to the final destination. The call
returns a stream of payment status updates.
*/
rpc SendPayment (SendPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
/*
Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
the payment identified by the payment hash.
*/
rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
/**
HtlcInterceptor dispatches a bi-directional streaming RPC in which
Forwarded HTLC requests are sent to the client and the client responds with
a boolean that tells LND if this htlc should be intercepted.
In case of interception, the htlc can be either settled, cancelled or
resumed later by using the ResolveHoldForward endpoint.
*/
rpc HtlcInterceptor (stream ForwardHtlcInterceptResponse)
returns (stream ForwardHtlcInterceptRequest);
/*
UpdateChanStatus attempts to manually set the state of a channel
(enabled, disabled, or auto). A manual "disable" request will cause the
channel to stay disabled until a subsequent manual request of either
"enable" or "auto".
*/
rpc UpdateChanStatus (UpdateChanStatusRequest)
returns (UpdateChanStatusResponse);
}
message SendPaymentRequest {
// The identity pubkey of the payment recipient
bytes dest = 1;
/*
Number of satoshis to send.
The fields amt and amt_msat are mutually exclusive.
*/
int64 amt = 2;
/*
Number of millisatoshis to send.
The fields amt and amt_msat are mutually exclusive.
*/
int64 amt_msat = 12;
// The hash to use within the payment's HTLC
bytes payment_hash = 3;
/*
The CLTV delta from the current height that should be used to set the
timelock for the final hop.
*/
int32 final_cltv_delta = 4;
// An optional payment addr to be included within the last hop of the route.
bytes payment_addr = 20;
/*
A bare-bones invoice for a payment within the Lightning Network. With the
details of the invoice, the sender has all the data necessary to send a
payment to the recipient. The amount in the payment request may be zero. In
that case it is required to set the amt field as well. If no payment request
is specified, the following fields are required: dest, amt and payment_hash.
*/
string payment_request = 5;
/*
An upper limit on the amount of time we should spend when attempting to
fulfill the payment. This is expressed in seconds. If we cannot make a
successful payment within this time frame, an error will be returned.
This field must be non-zero.
*/
int32 timeout_seconds = 6;
/*
The maximum number of satoshis that will be paid as a fee of the payment.
If this field is left to the default value of 0, only zero-fee routes will
be considered. This usually means single hop routes connecting directly to
the destination. To send the payment without a fee limit, use max int here.
The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
*/
int64 fee_limit_sat = 7;
/*
The maximum number of millisatoshis that will be paid as a fee of the
payment. If this field is left to the default value of 0, only zero-fee
routes will be considered. This usually means single hop routes connecting
directly to the destination. To send the payment without a fee limit, use
max int here.
The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
*/
int64 fee_limit_msat = 13;
/*
Deprecated, use outgoing_chan_ids. The channel id of the channel that must
be taken to the first hop. If zero, any channel may be used (unless
outgoing_chan_ids are set).
*/
uint64 outgoing_chan_id = 8 [jstype = JS_STRING, deprecated = true];
/*
The channel ids of the channels are allowed for the first hop. If empty,
any channel may be used.
*/
repeated uint64 outgoing_chan_ids = 19;
/*
The pubkey of the last hop of the route. If empty, any hop may be used.
*/
bytes last_hop_pubkey = 14;
/*
An optional maximum total time lock for the route. This should not exceed
lnd's `--max-cltv-expiry` setting. If zero, then the value of
`--max-cltv-expiry` is enforced.
*/
int32 cltv_limit = 9;
/*
Optional route hints to reach the destination through private channels.
*/
repeated lnrpc.RouteHint route_hints = 10;
/*
An optional field that can be used to pass an arbitrary set of TLV records
to a peer which understands the new records. This can be used to pass
application specific data during the payment attempt. Record types are
required to be in the custom range >= 65536. When using REST, the values
must be encoded as base64.
*/
map<uint64, bytes> dest_custom_records = 11;
// If set, circular payments to self are permitted.
bool allow_self_payment = 15;
/*
Features assumed to be supported by the final node. All transitive feature
dependencies must also be set properly. For a given feature bit pair, either
optional or remote may be set, but not both. If this field is nil or empty,
the router will try to load destination features from the graph as a
fallback.
*/
repeated lnrpc.FeatureBit dest_features = 16;
/*
The maximum number of partial payments that may be use to complete the full
amount.
*/
uint32 max_parts = 17;
/*
If set, only the final payment update is streamed back. Intermediate updates
that show which htlcs are still in flight are suppressed.
*/
bool no_inflight_updates = 18;
/*
The largest payment split that should be attempted when making a payment if
splitting is necessary. Setting this value will effectively cause lnd to
split more aggressively, vs only when it thinks it needs to. Note that this
value is in milli-satoshis.
*/
uint64 max_shard_size_msat = 21;
/*
If set, an AMP-payment will be attempted.
*/
bool amp = 22;
/*
The time preference for this payment. Set to -1 to optimize for fees
only, to 1 to optimize for reliability only or a value inbetween for a mix.
*/
double time_pref = 23;
}
message TrackPaymentRequest {
// The hash of the payment to look up.
bytes payment_hash = 1;
/*
If set, only the final payment update is streamed back. Intermediate updates
that show which htlcs are still in flight are suppressed.
*/
bool no_inflight_updates = 2;
}
message TrackPaymentsRequest {
/*
If set, only the final payment updates are streamed back. Intermediate
updates that show which htlcs are still in flight are suppressed.
*/
bool no_inflight_updates = 1;
}
message RouteFeeRequest {
/*
The destination once wishes to obtain a routing fee quote to.
*/
bytes dest = 1;
/*
The amount one wishes to send to the target destination.
*/
int64 amt_sat = 2;
}
message RouteFeeResponse {
/*
A lower bound of the estimated fee to the target destination within the
network, expressed in milli-satoshis.
*/
int64 routing_fee_msat = 1;
/*
An estimate of the worst case time delay that can occur. Note that callers
will still need to factor in the final CLTV delta of the last hop into this
value.
*/
int64 time_lock_delay = 2;
}
message SendToRouteRequest {
// The payment hash to use for the HTLC.
bytes payment_hash = 1;
// Route that should be used to attempt to complete the payment.
lnrpc.Route route = 2;
/*
Whether the payment should be marked as failed when a temporary error is
returned from the given route. Set it to true so the payment won't be
failed unless a terminal error is occurred, such as payment timeout, no
routes, incorrect payment details, or insufficient funds.
*/
bool skip_temp_err = 3;
}
message SendToRouteResponse {
// The preimage obtained by making the payment.
bytes preimage = 1;
// The failure message in case the payment failed.
lnrpc.Failure failure = 2;
}
message ResetMissionControlRequest {
}
message ResetMissionControlResponse {
}
message QueryMissionControlRequest {
}
// QueryMissionControlResponse contains mission control state.
message QueryMissionControlResponse {
reserved 1;
// Node pair-level mission control state.
repeated PairHistory pairs = 2;
}
message XImportMissionControlRequest {
// Node pair-level mission control state to be imported.
repeated PairHistory pairs = 1;
// Whether to force override MC pair history. Note that even with force
// override the failure pair is imported before the success pair and both
// still clamp existing failure/success amounts.
bool force = 2;
}
message XImportMissionControlResponse {
}
// PairHistory contains the mission control state for a particular node pair.
message PairHistory {
// The source node pubkey of the pair.
bytes node_from = 1;
// The destination node pubkey of the pair.
bytes node_to = 2;
reserved 3, 4, 5, 6;
PairData history = 7;
}
message PairData {
// Time of last failure.
int64 fail_time = 1;
/*
Lowest amount that failed to forward rounded to whole sats. This may be
set to zero if the failure is independent of amount.
*/
int64 fail_amt_sat = 2;
/*
Lowest amount that failed to forward in millisats. This may be
set to zero if the failure is independent of amount.
*/
int64 fail_amt_msat = 4;
reserved 3;
// Time of last success.
int64 success_time = 5;
// Highest amount that we could successfully forward rounded to whole sats.
int64 success_amt_sat = 6;
// Highest amount that we could successfully forward in millisats.
int64 success_amt_msat = 7;
}
message GetMissionControlConfigRequest {
}
message GetMissionControlConfigResponse {
/*
Mission control's currently active config.
*/
MissionControlConfig config = 1;
}
message SetMissionControlConfigRequest {
/*
The config to set for mission control. Note that all values *must* be set,
because the full config will be applied.
*/
MissionControlConfig config = 1;
}
message SetMissionControlConfigResponse {
}
message MissionControlConfig {
/*
Deprecated, use AprioriParameters. The amount of time mission control will
take to restore a penalized node or channel back to 50% success probability,
expressed in seconds. Setting this value to a higher value will penalize
failures for longer, making mission control less likely to route through
nodes and channels that we have previously recorded failures for.
*/
uint64 half_life_seconds = 1 [deprecated = true];
/*
Deprecated, use AprioriParameters. The probability of success mission
control should assign to hop in a route where it has no other information
available. Higher values will make mission control more willing to try hops
that we have no information about, lower values will discourage trying these
hops.
*/
float hop_probability = 2 [deprecated = true];
/*
Deprecated, use AprioriParameters. The importance that mission control
should place on historical results, expressed as a value in [0;1]. Setting
this value to 1 will ignore all historical payments and just use the hop
probability to assess the probability of success for each hop. A zero value
ignores hop probability completely and relies entirely on historical
results, unless none are available.
*/
float weight = 3 [deprecated = true];
/*
The maximum number of payment results that mission control will store.
*/
uint32 maximum_payment_results = 4;
/*
The minimum time that must have passed since the previously recorded failure
before we raise the failure amount.
*/
uint64 minimum_failure_relax_interval = 5;
enum ProbabilityModel {
APRIORI = 0;
BIMODAL = 1;
}
/*
ProbabilityModel defines which probability estimator should be used in
pathfinding. Note that the bimodal estimator is experimental.
*/
ProbabilityModel model = 6;
/*
EstimatorConfig is populated dependent on the estimator type.
*/
oneof EstimatorConfig {
AprioriParameters apriori = 7;
BimodalParameters bimodal = 8;
}
}
message BimodalParameters {
/*
NodeWeight defines how strongly other previous forwardings on channels of a
router should be taken into account when computing a channel's probability
to route. The allowed values are in the range [0, 1], where a value of 0
means that only direct information about a channel is taken into account.
*/
double node_weight = 1;
/*
ScaleMsat describes the scale over which channels statistically have some
liquidity left. The value determines how quickly the bimodal distribution
drops off from the edges of a channel. A larger value (compared to typical
channel capacities) means that the drop off is slow and that channel
balances are distributed more uniformly. A small value leads to the
assumption of very unbalanced channels.
*/
uint64 scale_msat = 2;
/*
DecayTime describes the information decay of knowledge about previous
successes and failures in channels. The smaller the decay time, the quicker
we forget about past forwardings.
*/
uint64 decay_time = 3;
}
message AprioriParameters {
/*
The amount of time mission control will take to restore a penalized node
or channel back to 50% success probability, expressed in seconds. Setting
this value to a higher value will penalize failures for longer, making
mission control less likely to route through nodes and channels that we
have previously recorded failures for.
*/
uint64 half_life_seconds = 1;
/*
The probability of success mission control should assign to hop in a route
where it has no other information available. Higher values will make mission
control more willing to try hops that we have no information about, lower
values will discourage trying these hops.
*/
double hop_probability = 2;
/*
The importance that mission control should place on historical results,
expressed as a value in [0;1]. Setting this value to 1 will ignore all
historical payments and just use the hop probability to assess the
probability of success for each hop. A zero value ignores hop probability
completely and relies entirely on historical results, unless none are
available.
*/
double weight = 3;
/*
The fraction of a channel's capacity that we consider to have liquidity. For
amounts that come close to or exceed the fraction, an additional penalty is
applied. A value of 1.0 disables the capacity factor. Allowed values are in
[0.75, 1.0].
*/
double capacity_fraction = 4;
}
message QueryProbabilityRequest {
// The source node pubkey of the pair.
bytes from_node = 1;
// The destination node pubkey of the pair.
bytes to_node = 2;
// The amount for which to calculate a probability.
int64 amt_msat = 3;
}
message QueryProbabilityResponse {
// The success probability for the requested pair.
double probability = 1;
// The historical data for the requested pair.
PairData history = 2;
}
message BuildRouteRequest {
/*
The amount to send expressed in msat. If set to zero, the minimum routable
amount is used.
*/
int64 amt_msat = 1;
/*
CLTV delta from the current height that should be used for the timelock
of the final hop
*/
int32 final_cltv_delta = 2;
/*
The channel id of the channel that must be taken to the first hop. If zero,
any channel may be used.
*/
uint64 outgoing_chan_id = 3 [jstype = JS_STRING];
/*
A list of hops that defines the route. This does not include the source hop
pubkey.
*/
repeated bytes hop_pubkeys = 4;
// An optional payment addr to be included within the last hop of the route.
bytes payment_addr = 5;
}
message BuildRouteResponse {
/*
Fully specified route that can be used to execute the payment.
*/
lnrpc.Route route = 1;
}
message SubscribeHtlcEventsRequest {
}
/*
HtlcEvent contains the htlc event that was processed. These are served on a
best-effort basis; events are not persisted, delivery is not guaranteed
(in the event of a crash in the switch, forward events may be lost) and
some events may be replayed upon restart. Events consumed from this package
should be de-duplicated by the htlc's unique combination of incoming and
outgoing channel id and htlc id. [EXPERIMENTAL]
*/
message HtlcEvent {
/*
The short channel id that the incoming htlc arrived at our node on. This
value is zero for sends.
*/
uint64 incoming_channel_id = 1;
/*
The short channel id that the outgoing htlc left our node on. This value
is zero for receives.
*/
uint64 outgoing_channel_id = 2;
/*
Incoming id is the index of the incoming htlc in the incoming channel.
This value is zero for sends.
*/
uint64 incoming_htlc_id = 3;
/*
Outgoing id is the index of the outgoing htlc in the outgoing channel.
This value is zero for receives.
*/
uint64 outgoing_htlc_id = 4;
/*
The time in unix nanoseconds that the event occurred.
*/
uint64 timestamp_ns = 5;
enum EventType {
UNKNOWN = 0;
SEND = 1;
RECEIVE = 2;
FORWARD = 3;
}
/*
The event type indicates whether the htlc was part of a send, receive or
forward.
*/
EventType event_type = 6;
oneof event {
ForwardEvent forward_event = 7;
ForwardFailEvent forward_fail_event = 8;
SettleEvent settle_event = 9;
LinkFailEvent link_fail_event = 10;
SubscribedEvent subscribed_event = 11;
FinalHtlcEvent final_htlc_event = 12;
}
}
message HtlcInfo {
// The timelock on the incoming htlc.
uint32 incoming_timelock = 1;
// The timelock on the outgoing htlc.
uint32 outgoing_timelock = 2;
// The amount of the incoming htlc.
uint64 incoming_amt_msat = 3;
// The amount of the outgoing htlc.
uint64 outgoing_amt_msat = 4;
}
message ForwardEvent {
// Info contains details about the htlc that was forwarded.
HtlcInfo info = 1;
}
message ForwardFailEvent {
}
message SettleEvent {
// The revealed preimage.
bytes preimage = 1;
}
message FinalHtlcEvent {
bool settled = 1;
bool offchain = 2;
}
message SubscribedEvent {
}
message LinkFailEvent {
// Info contains details about the htlc that we failed.
HtlcInfo info = 1;
// FailureCode is the BOLT error code for the failure.
lnrpc.Failure.FailureCode wire_failure = 2;
/*
FailureDetail provides additional information about the reason for the
failure. This detail enriches the information provided by the wire message
and may be 'no detail' if the wire message requires no additional metadata.
*/
FailureDetail failure_detail = 3;
// A string representation of the link failure.
string failure_string = 4;
}
enum FailureDetail {
UNKNOWN = 0;
NO_DETAIL = 1;
ONION_DECODE = 2;
LINK_NOT_ELIGIBLE = 3;
ON_CHAIN_TIMEOUT = 4;
HTLC_EXCEEDS_MAX = 5;
INSUFFICIENT_BALANCE = 6;
INCOMPLETE_FORWARD = 7;
HTLC_ADD_FAILED = 8;
FORWARDS_DISABLED = 9;
INVOICE_CANCELED = 10;
INVOICE_UNDERPAID = 11;
INVOICE_EXPIRY_TOO_SOON = 12;
INVOICE_NOT_OPEN = 13;
MPP_INVOICE_TIMEOUT = 14;
ADDRESS_MISMATCH = 15;
SET_TOTAL_MISMATCH = 16;
SET_TOTAL_TOO_LOW = 17;
SET_OVERPAID = 18;
UNKNOWN_INVOICE = 19;
INVALID_KEYSEND = 20;
MPP_IN_PROGRESS = 21;
CIRCULAR_ROUTE = 22;
}
enum PaymentState {
/*
Payment is still in flight.
*/
IN_FLIGHT = 0;
/*
Payment completed successfully.
*/
SUCCEEDED = 1;
/*
There are more routes to try, but the payment timeout was exceeded.
*/
FAILED_TIMEOUT = 2;
/*
All possible routes were tried and failed permanently. Or were no
routes to the destination at all.
*/
FAILED_NO_ROUTE = 3;
/*
A non-recoverable error has occurred.
*/
FAILED_ERROR = 4;
/*
Payment details incorrect (unknown hash, invalid amt or
invalid final cltv delta)
*/
FAILED_INCORRECT_PAYMENT_DETAILS = 5;
/*
Insufficient local balance.
*/
FAILED_INSUFFICIENT_BALANCE = 6;
}
message PaymentStatus {
// Current state the payment is in.
PaymentState state = 1;
/*
The pre-image of the payment when state is SUCCEEDED.
*/
bytes preimage = 2;
reserved 3;
/*
The HTLCs made in attempt to settle the payment [EXPERIMENTAL].
*/
repeated lnrpc.HTLCAttempt htlcs = 4;
}
message CircuitKey {
/// The id of the channel that the is part of this circuit.
uint64 chan_id = 1;
/// The index of the incoming htlc in the incoming channel.
uint64 htlc_id = 2;
}
message ForwardHtlcInterceptRequest {
/*
The key of this forwarded htlc. It defines the incoming channel id and
the index in this channel.
*/
CircuitKey incoming_circuit_key = 1;
// The incoming htlc amount.
uint64 incoming_amount_msat = 5;
// The incoming htlc expiry.
uint32 incoming_expiry = 6;
/*
The htlc payment hash. This value is not guaranteed to be unique per
request.
*/
bytes payment_hash = 2;
// The requested outgoing channel id for this forwarded htlc. Because of
// non-strict forwarding, this isn't necessarily the channel over which the
// packet will be forwarded eventually. A different channel to the same peer
// may be selected as well.
uint64 outgoing_requested_chan_id = 7;
// The outgoing htlc amount.
uint64 outgoing_amount_msat = 3;
// The outgoing htlc expiry.
uint32 outgoing_expiry = 4;
// Any custom records that were present in the payload.
map<uint64, bytes> custom_records = 8;
// The onion blob for the next hop
bytes onion_blob = 9;
// The block height at which this htlc will be auto-failed to prevent the
// channel from force-closing.
int32 auto_fail_height = 10;
}
/**
ForwardHtlcInterceptResponse enables the caller to resolve a previously hold
forward. The caller can choose either to:
- `Resume`: Execute the default behavior (usually forward).
- `Reject`: Fail the htlc backwards.
- `Settle`: Settle this htlc with a given preimage.
*/
message ForwardHtlcInterceptResponse {
/**
The key of this forwarded htlc. It defines the incoming channel id and
the index in this channel.
*/
CircuitKey incoming_circuit_key = 1;
// The resolve action for this intercepted htlc.
ResolveHoldForwardAction action = 2;
// The preimage in case the resolve action is Settle.
bytes preimage = 3;
// Encrypted failure message in case the resolve action is Fail.
//
// If failure_message is specified, the failure_code field must be set
// to zero.
bytes failure_message = 4;
// Return the specified failure code in case the resolve action is Fail. The
// message data fields are populated automatically.
//
// If a non-zero failure_code is specified, failure_message must not be set.
//
// For backwards-compatibility reasons, TEMPORARY_CHANNEL_FAILURE is the
// default value for this field.
lnrpc.Failure.FailureCode failure_code = 5;
}
enum ResolveHoldForwardAction {
SETTLE = 0;
FAIL = 1;
RESUME = 2;
}
message UpdateChanStatusRequest {
lnrpc.ChannelPoint chan_point = 1;
ChanStatusAction action = 2;
}
enum ChanStatusAction {
ENABLE = 0;
DISABLE = 1;
AUTO = 2;
}
message UpdateChanStatusResponse {
}

View File

@ -0,0 +1,47 @@
syntax = "proto3";
package verrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/verrpc";
// Versioner is a service that can be used to get information about the version
// and build information of the running daemon.
service Versioner {
/* lncli: `version`
GetVersion returns the current version and build information of the running
daemon.
*/
rpc GetVersion (VersionRequest) returns (Version);
}
message VersionRequest {
}
message Version {
// A verbose description of the daemon's commit.
string commit = 1;
// The SHA1 commit hash that the daemon is compiled with.
string commit_hash = 2;
// The semantic version.
string version = 3;
// The major application version.
uint32 app_major = 4;
// The minor application version.
uint32 app_minor = 5;
// The application patch number.
uint32 app_patch = 6;
// The application pre-release modifier, possibly empty.
string app_pre_release = 7;
// The list of build tags that were supplied during compilation.
repeated string build_tags = 8;
// The version of go that compiled the executable.
string go_version = 9;
}

View File

@ -0,0 +1,131 @@
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import re
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Currency',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('currency', models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'KRW'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (300, 'XAU'), (1000, 'BTC')], unique=True)),
('exchange_rate', models.DecimalField(decimal_places=4, default=None, max_digits=14, null=True, validators=[django.core.validators.MinValueValidator(0)])),
('timestamp', models.DateTimeField(auto_now_add=True)),
],
options={
'verbose_name': 'Cached market currency',
'verbose_name_plural': 'Currencies',
},
),
migrations.CreateModel(
name='LNPayment',
fields=[
('type', models.PositiveSmallIntegerField(choices=[(0, 'Regular invoice'), (1, 'hold invoice')], default=1)),
('concept', models.PositiveSmallIntegerField(choices=[(0, 'Maker bond'), (1, 'Taker bond'), (2, 'Trade escrow'), (3, 'Payment to buyer')], default=0)),
('status', models.PositiveSmallIntegerField(choices=[(0, 'Generated'), (1, 'Locked'), (2, 'Settled'), (3, 'Returned'), (4, 'Cancelled'), (5, 'Expired'), (6, 'Valid'), (7, 'In flight'), (8, 'Succeeded'), (9, 'Routing failed')], default=0)),
('payment_hash', models.CharField(blank=True, default=None, max_length=100, primary_key=True, serialize=False, unique=True)),
('invoice', models.CharField(blank=True, default=None, max_length=1200, null=True, unique=True)),
('preimage', models.CharField(blank=True, default=None, max_length=64, null=True, unique=True)),
('description', models.CharField(blank=True, default=None, max_length=500, null=True)),
('num_satoshis', models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100.0), django.core.validators.MaxValueValidator(506000.0)])),
('created_at', models.DateTimeField()),
('expires_at', models.DateTimeField()),
('cltv_expiry', models.PositiveSmallIntegerField(blank=True, default=None, null=True)),
('expiry_height', models.PositiveBigIntegerField(blank=True, default=None, null=True)),
('routing_attempts', models.PositiveSmallIntegerField(default=0)),
('last_routing_time', models.DateTimeField(blank=True, default=None, null=True)),
('receiver', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receiver', to=settings.AUTH_USER_MODEL)),
('sender', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sender', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Lightning payment',
'verbose_name_plural': 'Lightning payments',
},
),
migrations.CreateModel(
name='Profile',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('total_contracts', models.PositiveIntegerField(default=0)),
('total_ratings', models.PositiveIntegerField(default=0)),
('latest_ratings', models.CharField(blank=True, default=None, max_length=999, null=True, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')])),
('avg_rating', models.DecimalField(blank=True, decimal_places=1, default=None, max_digits=4, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)])),
('telegram_token', models.CharField(blank=True, max_length=20, null=True)),
('telegram_chat_id', models.BigIntegerField(blank=True, default=None, null=True)),
('telegram_enabled', models.BooleanField(default=False)),
('telegram_lang_code', models.CharField(blank=True, max_length=4, null=True)),
('telegram_welcomed', models.BooleanField(default=False)),
('num_disputes', models.PositiveIntegerField(default=0)),
('lost_disputes', models.PositiveIntegerField(default=0)),
('num_disputes_started', models.PositiveIntegerField(default=0)),
('orders_disputes_started', models.CharField(blank=True, default=None, max_length=999, null=True, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')])),
('avatar', models.ImageField(blank=True, default='static/assets/avatars/unknown_avatar.png', upload_to='', verbose_name='Avatar')),
('penalty_expiration', models.DateTimeField(blank=True, default=None, null=True)),
('platform_rating', models.PositiveIntegerField(blank=True, default=None, null=True)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Order',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.PositiveSmallIntegerField(choices=[(0, 'Waiting for maker bond'), (1, 'Public'), (2, 'Deleted'), (3, 'Waiting for taker bond'), (4, 'Cancelled'), (5, 'Expired'), (6, 'Waiting for trade collateral and buyer invoice'), (7, 'Waiting only for seller trade collateral'), (8, 'Waiting only for buyer invoice'), (9, 'Sending fiat - In chatroom'), (10, 'Fiat sent - In chatroom'), (11, 'In dispute'), (12, 'Collaboratively cancelled'), (13, 'Sending satoshis to buyer'), (14, 'Sucessful trade'), (15, 'Failed lightning network routing'), (16, 'Wait for dispute resolution'), (17, 'Maker lost dispute'), (18, 'Taker lost dispute')], default=0)),
('created_at', models.DateTimeField(auto_now_add=True)),
('expires_at', models.DateTimeField()),
('type', models.PositiveSmallIntegerField(choices=[(0, 'BUY'), (1, 'SELL')])),
('amount', models.DecimalField(decimal_places=8, max_digits=16, validators=[django.core.validators.MinValueValidator(1e-08)])),
('payment_method', models.CharField(blank=True, default='not specified', max_length=35)),
('is_explicit', models.BooleanField(default=False)),
('premium', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(-100), django.core.validators.MaxValueValidator(999)])),
('satoshis', models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(10000), django.core.validators.MaxValueValidator(500000)])),
('t0_satoshis', models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(10000), django.core.validators.MaxValueValidator(500000)])),
('last_satoshis', models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(1000000)])),
('maker_last_seen', models.DateTimeField(blank=True, default=None, null=True)),
('taker_last_seen', models.DateTimeField(blank=True, default=None, null=True)),
('maker_asked_cancel', models.BooleanField(default=False)),
('taker_asked_cancel', models.BooleanField(default=False)),
('is_fiat_sent', models.BooleanField(default=False)),
('is_disputed', models.BooleanField(default=False)),
('maker_statement', models.TextField(blank=True, default=None, max_length=5000, null=True)),
('taker_statement', models.TextField(blank=True, default=None, max_length=5000, null=True)),
('maker_rated', models.BooleanField(default=False)),
('taker_rated', models.BooleanField(default=False)),
('maker_platform_rated', models.BooleanField(default=False)),
('taker_platform_rated', models.BooleanField(default=False)),
('currency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.currency')),
('maker', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='maker', to=settings.AUTH_USER_MODEL)),
('maker_bond', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_made', to='api.lnpayment')),
('payout', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_paid', to='api.lnpayment')),
('taker', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taker', to=settings.AUTH_USER_MODEL)),
('taker_bond', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_taken', to='api.lnpayment')),
('trade_escrow', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_escrow', to='api.lnpayment')),
],
),
migrations.CreateModel(
name='MarketTick',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('price', models.DecimalField(decimal_places=2, default=None, max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(0)])),
('volume', models.DecimalField(decimal_places=8, default=None, max_digits=8, null=True, validators=[django.core.validators.MinValueValidator(0)])),
('premium', models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(-100), django.core.validators.MaxValueValidator(999)])),
('timestamp', models.DateTimeField(auto_now_add=True)),
('fee', models.DecimalField(decimal_places=4, default=0.002, max_digits=4, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(1)])),
('currency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.currency')),
],
options={
'verbose_name': 'Market tick',
'verbose_name_plural': 'Market ticks',
},
),
]

View File

@ -0,0 +1,912 @@
import api.models.onchain_payment
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import re
import uuid
class Migration(migrations.Migration):
replaces = [
("api", "0001_initial"),
("api", "0002_auto_20220307_0821"),
("api", "0003_auto_20220324_2230"),
("api", "0004_alter_currency_currency"),
("api", "0005_alter_order_payment_method"),
("api", "0006_alter_currency_currency"),
("api", "0007_lnpayment_in_flight"),
("api", "0008_auto_20220501_1923"),
("api", "0009_alter_currency_currency"),
("api", "0010_lnpayment_failure_reason"),
("api", "0011_auto_20220527_0057"),
("api", "0012_auto_20220601_2221"),
("api", "0013_auto_20220605_1156"),
("api", "0014_auto_20220619_0535"),
("api", "0015_auto_20220702_1500"),
("api", "0016_alter_onchainpayment_swap_fee_rate"),
("api", "0017_auto_20220710_1127"),
("api", "0018_order_last_satoshis_time"),
("api", "0019_order_contract_finalization_time"),
("api", "0020_auto_20220731_1425"),
("api", "0021_auto_20220813_1333"),
("api", "0022_alter_profile_wants_stealth"),
("api", "0023_alter_currency_currency"),
("api", "0024_auto_20221109_2250"),
("api", "0025_auto_20221127_1135"),
("api", "0026_auto_20230213_2023"),
("api", "0027_auto_20230314_1801"),
("api", "0028_onchainpayment_broadcasted"),
("api", "0029_alter_currency_currency"),
("api", "0030_auto_20230410_1850"),
("api", "0031_auto_20230425_1211"),
("api", "0032_auto_20230430_1419"),
("api", "0033_auto_20230430_1603"),
("api", "0034_auto_20230430_1640"),
("api", "0035_rename_profile_robot"),
("api", "0036_remove_order_maker_last_seen_and_more"),
]
initial = True
dependencies = [
("control", "0002_auto_20220619_0535"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="Currency",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"currency",
models.PositiveSmallIntegerField(
choices=[
(1, "USD"),
(2, "EUR"),
(3, "JPY"),
(4, "GBP"),
(5, "AUD"),
(6, "CAD"),
(7, "CHF"),
(8, "CNY"),
(9, "HKD"),
(10, "NZD"),
(11, "SEK"),
(12, "KRW"),
(13, "SGD"),
(14, "NOK"),
(15, "MXN"),
(16, "BYN"),
(17, "RUB"),
(18, "ZAR"),
(19, "TRY"),
(20, "BRL"),
(21, "CLP"),
(22, "CZK"),
(23, "DKK"),
(24, "HRK"),
(25, "HUF"),
(26, "INR"),
(27, "ISK"),
(28, "PLN"),
(29, "RON"),
(30, "ARS"),
(31, "VES"),
(32, "COP"),
(33, "PEN"),
(34, "UYU"),
(35, "PYG"),
(36, "BOB"),
(37, "IDR"),
(38, "ANG"),
(39, "CRC"),
(40, "CUP"),
(41, "DOP"),
(42, "GHS"),
(43, "GTQ"),
(44, "ILS"),
(45, "JMD"),
(46, "KES"),
(47, "KZT"),
(48, "MYR"),
(49, "NAD"),
(50, "NGN"),
(51, "AZN"),
(52, "PAB"),
(53, "PHP"),
(54, "PKR"),
(55, "QAR"),
(56, "SAR"),
(57, "THB"),
(58, "TTD"),
(59, "VND"),
(60, "XOF"),
(61, "TWD"),
(62, "TZS"),
(63, "XAF"),
(64, "UAH"),
(65, "EGP"),
(66, "LKR"),
(67, "MAD"),
(68, "AED"),
(69, "TND"),
(70, "ETB"),
(71, "GEL"),
(72, "UGX"),
(73, "RSD"),
(74, "IRT"),
(300, "XAU"),
(1000, "BTC"),
],
unique=True,
),
),
(
"exchange_rate",
models.DecimalField(
decimal_places=4,
default=None,
max_digits=18,
null=True,
validators=[django.core.validators.MinValueValidator(0)],
),
),
("timestamp", models.DateTimeField(default=django.utils.timezone.now)),
],
options={
"verbose_name": "Cached market currency",
"verbose_name_plural": "Currencies",
},
),
migrations.CreateModel(
name="LNPayment",
fields=[
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "Regular invoice"), (1, "hold invoice")], default=1
),
),
(
"concept",
models.PositiveSmallIntegerField(
choices=[
(0, "Maker bond"),
(1, "Taker bond"),
(2, "Trade escrow"),
(3, "Payment to buyer"),
(4, "Withdraw rewards"),
],
default=0,
),
),
(
"status",
models.PositiveSmallIntegerField(
choices=[
(0, "Generated"),
(1, "Locked"),
(2, "Settled"),
(3, "Returned"),
(4, "Cancelled"),
(5, "Expired"),
(6, "Valid"),
(7, "In flight"),
(8, "Succeeded"),
(9, "Routing failed"),
],
default=0,
),
),
(
"payment_hash",
models.CharField(
blank=True,
default=None,
max_length=100,
primary_key=True,
serialize=False,
unique=True,
),
),
(
"invoice",
models.CharField(
blank=True,
default=None,
max_length=1200,
null=True,
unique=True,
),
),
(
"preimage",
models.CharField(
blank=True, default=None, max_length=64, null=True, unique=True
),
),
(
"description",
models.CharField(
blank=True, default=None, max_length=500, null=True
),
),
(
"num_satoshis",
models.PositiveBigIntegerField(
validators=[
django.core.validators.MinValueValidator(100),
django.core.validators.MaxValueValidator(7500000.0),
]
),
),
("created_at", models.DateTimeField()),
("expires_at", models.DateTimeField()),
(
"cltv_expiry",
models.PositiveSmallIntegerField(
blank=True, default=None, null=True
),
),
(
"expiry_height",
models.PositiveBigIntegerField(blank=True, default=None, null=True),
),
("routing_attempts", models.PositiveSmallIntegerField(default=0)),
(
"last_routing_time",
models.DateTimeField(blank=True, default=None, null=True),
),
(
"receiver",
models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="receiver",
to=settings.AUTH_USER_MODEL,
),
),
(
"sender",
models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="sender",
to=settings.AUTH_USER_MODEL,
),
),
(
"fee",
models.DecimalField(decimal_places=3, default=0, max_digits=10),
),
("in_flight", models.BooleanField(default=False)),
(
"failure_reason",
models.PositiveSmallIntegerField(
choices=[
(0, "Payment isn't failed (yet)"),
(
1,
"There are more routes to try, but the payment timeout was exceeded.",
),
(
2,
"All possible routes were tried and failed permanently. Or there were no routes to the destination at all.",
),
(3, "A non-recoverable error has occurred."),
(
4,
"Payment details are incorrect (unknown hash, invalid amount or invalid final CLTV delta).",
),
(5, "Insufficient unlocked balance in RoboSats' node."),
],
default=None,
null=True,
),
),
(
"routing_budget_ppm",
models.PositiveBigIntegerField(
default=0,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(100000),
],
),
),
(
"routing_budget_sats",
models.DecimalField(decimal_places=3, default=0, max_digits=10),
),
],
options={
"verbose_name": "Lightning payment",
"verbose_name_plural": "Lightning payments",
},
),
migrations.CreateModel(
name="MarketTick",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
(
"price",
models.DecimalField(
decimal_places=2,
default=None,
max_digits=16,
null=True,
validators=[django.core.validators.MinValueValidator(0)],
),
),
(
"volume",
models.DecimalField(
decimal_places=8,
default=None,
max_digits=8,
null=True,
validators=[django.core.validators.MinValueValidator(0)],
),
),
(
"premium",
models.DecimalField(
blank=True,
decimal_places=2,
default=None,
max_digits=5,
null=True,
validators=[
django.core.validators.MinValueValidator(-100),
django.core.validators.MaxValueValidator(999),
],
),
),
("timestamp", models.DateTimeField(default=django.utils.timezone.now)),
(
"fee",
models.DecimalField(
decimal_places=4,
default=0.002,
max_digits=4,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(1),
],
),
),
(
"currency",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="api.currency",
),
),
],
options={
"verbose_name": "Market tick",
"verbose_name_plural": "Market ticks",
},
),
migrations.CreateModel(
name="OnchainPayment",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"concept",
models.PositiveSmallIntegerField(
choices=[(3, "Payment to buyer")], default=3
),
),
(
"status",
models.PositiveSmallIntegerField(
choices=[
(0, "Created"),
(1, "Valid"),
(2, "In mempool"),
(3, "Confirmed"),
(4, "Cancelled"),
(5, "Queued"),
],
default=0,
),
),
(
"address",
models.CharField(
blank=True, default=None, max_length=100, null=True
),
),
(
"txid",
models.CharField(
blank=True, default=None, max_length=64, null=True, unique=True
),
),
(
"num_satoshis",
models.PositiveBigIntegerField(
null=True,
validators=[
django.core.validators.MinValueValidator(5000.0),
django.core.validators.MaxValueValidator(7500000.0),
],
),
),
(
"sent_satoshis",
models.PositiveBigIntegerField(
null=True,
validators=[
django.core.validators.MinValueValidator(5000.0),
django.core.validators.MaxValueValidator(7500000.0),
],
),
),
(
"suggested_mining_fee_rate",
models.DecimalField(
decimal_places=3,
default=2.05,
max_digits=6,
validators=[
django.core.validators.MinValueValidator(1),
django.core.validators.MaxValueValidator(999),
],
),
),
(
"mining_fee_rate",
models.DecimalField(
decimal_places=3,
default=2.05,
max_digits=6,
validators=[
django.core.validators.MinValueValidator(1),
django.core.validators.MaxValueValidator(999),
],
),
),
("mining_fee_sats", models.PositiveBigIntegerField(default=0)),
(
"swap_fee_rate",
models.DecimalField(decimal_places=2, default=0.8, max_digits=4),
),
("created_at", models.DateTimeField(default=django.utils.timezone.now)),
(
"balance",
models.ForeignKey(
default=api.models.onchain_payment.OnchainPayment.get_balance,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="balance",
to="control.balancelog",
),
),
(
"receiver",
models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="tx_receiver",
to=settings.AUTH_USER_MODEL,
),
),
("broadcasted", models.BooleanField(default=False)),
],
options={
"verbose_name": "Onchain payment",
"verbose_name_plural": "Onchain payments",
},
),
migrations.CreateModel(
name="Robot",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("total_contracts", models.PositiveIntegerField(default=0)),
(
"telegram_token",
models.CharField(blank=True, max_length=20, null=True),
),
(
"telegram_chat_id",
models.BigIntegerField(blank=True, default=None, null=True),
),
("telegram_enabled", models.BooleanField(default=False)),
(
"telegram_lang_code",
models.CharField(blank=True, max_length=10, null=True),
),
("telegram_welcomed", models.BooleanField(default=False)),
("num_disputes", models.PositiveIntegerField(default=0)),
("lost_disputes", models.PositiveIntegerField(default=0)),
("num_disputes_started", models.PositiveIntegerField(default=0)),
(
"orders_disputes_started",
models.CharField(
blank=True,
default=None,
max_length=999,
null=True,
validators=[
django.core.validators.RegexValidator(
re.compile("^\\d+(?:,\\d+)*\\Z"),
code="invalid",
message="Enter only digits separated by commas.",
)
],
),
),
(
"avatar",
models.ImageField(
blank=True,
default="static/assets/avatars/unknown_avatar.png",
upload_to="",
verbose_name="Avatar",
),
),
(
"penalty_expiration",
models.DateTimeField(blank=True, default=None, null=True),
),
(
"platform_rating",
models.PositiveIntegerField(blank=True, default=None, null=True),
),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
("claimed_rewards", models.PositiveIntegerField(default=0)),
("earned_rewards", models.PositiveIntegerField(default=0)),
(
"encrypted_private_key",
models.TextField(
blank=True, default=None, max_length=2000, null=True
),
),
(
"public_key",
models.TextField(
blank=True, default=None, max_length=2000, null=True
),
),
("wants_stealth", models.BooleanField(default=True)),
],
),
migrations.CreateModel(
name="Order",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"status",
models.PositiveSmallIntegerField(
choices=[
(0, "Waiting for maker bond"),
(1, "Public"),
(2, "Paused"),
(3, "Waiting for taker bond"),
(4, "Cancelled"),
(5, "Expired"),
(6, "Waiting for trade collateral and buyer invoice"),
(7, "Waiting only for seller trade collateral"),
(8, "Waiting only for buyer invoice"),
(9, "Sending fiat - In chatroom"),
(10, "Fiat sent - In chatroom"),
(11, "In dispute"),
(12, "Collaboratively cancelled"),
(13, "Sending satoshis to buyer"),
(14, "Sucessful trade"),
(15, "Failed lightning network routing"),
(16, "Wait for dispute resolution"),
(17, "Maker lost dispute"),
(18, "Taker lost dispute"),
],
default=0,
),
),
("created_at", models.DateTimeField(default=django.utils.timezone.now)),
("expires_at", models.DateTimeField()),
(
"type",
models.PositiveSmallIntegerField(choices=[(0, "BUY"), (1, "SELL")]),
),
(
"amount",
models.DecimalField(
blank=True, decimal_places=8, max_digits=18, null=True
),
),
(
"payment_method",
models.CharField(
blank=True, default="not specified", max_length=70
),
),
("is_explicit", models.BooleanField(default=False)),
(
"premium",
models.DecimalField(
blank=True,
decimal_places=2,
default=0,
max_digits=5,
null=True,
validators=[
django.core.validators.MinValueValidator(-100),
django.core.validators.MaxValueValidator(999),
],
),
),
(
"satoshis",
models.PositiveBigIntegerField(
blank=True,
null=True,
validators=[
django.core.validators.MinValueValidator(20000),
django.core.validators.MaxValueValidator(5000000),
],
),
),
(
"t0_satoshis",
models.PositiveBigIntegerField(
blank=True,
null=True,
validators=[
django.core.validators.MinValueValidator(20000),
django.core.validators.MaxValueValidator(5000000),
],
),
),
(
"last_satoshis",
models.PositiveBigIntegerField(
blank=True,
null=True,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(10000000),
],
),
),
("maker_asked_cancel", models.BooleanField(default=False)),
("taker_asked_cancel", models.BooleanField(default=False)),
("is_fiat_sent", models.BooleanField(default=False)),
("is_disputed", models.BooleanField(default=False)),
(
"maker_statement",
models.TextField(
blank=True, default=None, max_length=50000, null=True
),
),
(
"taker_statement",
models.TextField(
blank=True, default=None, max_length=50000, null=True
),
),
("maker_rated", models.BooleanField(default=False)),
("taker_rated", models.BooleanField(default=False)),
("maker_platform_rated", models.BooleanField(default=False)),
("taker_platform_rated", models.BooleanField(default=False)),
(
"currency",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="api.currency",
),
),
(
"maker",
models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="maker",
to=settings.AUTH_USER_MODEL,
),
),
(
"maker_bond",
models.OneToOneField(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="order_made",
to="api.lnpayment",
),
),
(
"payout",
models.OneToOneField(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="order_paid_LN",
to="api.lnpayment",
),
),
(
"taker",
models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="taker",
to=settings.AUTH_USER_MODEL,
),
),
(
"taker_bond",
models.OneToOneField(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="order_taken",
to="api.lnpayment",
),
),
(
"trade_escrow",
models.OneToOneField(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="order_escrow",
to="api.lnpayment",
),
),
(
"bond_size",
models.DecimalField(
decimal_places=2,
default=3.0,
max_digits=4,
validators=[
django.core.validators.MinValueValidator(2.0),
django.core.validators.MaxValueValidator(15.0),
],
),
),
("has_range", models.BooleanField(default=False)),
(
"max_amount",
models.DecimalField(
blank=True, decimal_places=8, max_digits=18, null=True
),
),
(
"min_amount",
models.DecimalField(
blank=True, decimal_places=8, max_digits=18, null=True
),
),
(
"public_duration",
models.PositiveBigIntegerField(
default=86399,
validators=[
django.core.validators.MinValueValidator(597.6),
django.core.validators.MaxValueValidator(86400.0),
],
),
),
(
"escrow_duration",
models.PositiveBigIntegerField(
default=10799,
validators=[
django.core.validators.MinValueValidator(1800),
django.core.validators.MaxValueValidator(28800),
],
),
),
(
"expiry_reason",
models.PositiveSmallIntegerField(
blank=True,
choices=[
(0, "Expired not taken"),
(1, "Maker bond not locked"),
(2, "Escrow not locked"),
(3, "Invoice not submitted"),
(4, "Neither escrow locked or invoice submitted"),
],
default=None,
null=True,
),
),
("is_swap", models.BooleanField(default=False)),
(
"payout_tx",
models.OneToOneField(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="order_paid_TX",
to="api.onchainpayment",
),
),
(
"last_satoshis_time",
models.DateTimeField(blank=True, default=None, null=True),
),
(
"contract_finalization_time",
models.DateTimeField(blank=True, default=None, null=True),
),
("reference", models.UUIDField(default=uuid.uuid4, editable=False)),
("reverted_fiat_sent", models.BooleanField(default=False)),
(
"proceeds",
models.PositiveBigIntegerField(
blank=True,
default=0,
null=True,
validators=[django.core.validators.MinValueValidator(0)],
),
),
],
),
]

View File

@ -0,0 +1,53 @@
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='profile',
name='claimed_rewards',
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name='profile',
name='earned_rewards',
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name='profile',
name='is_referred',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='profile',
name='pending_rewards',
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name='profile',
name='referral_code',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='profile',
name='referred_by',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='referee', to='api.profile'),
),
migrations.AlterField(
model_name='lnpayment',
name='concept',
field=models.PositiveSmallIntegerField(choices=[(0, 'Maker bond'), (1, 'Taker bond'), (2, 'Trade escrow'), (3, 'Payment to buyer'), (4, 'Withdraw rewards')], default=0),
),
migrations.AlterField(
model_name='markettick',
name='price',
field=models.DecimalField(decimal_places=2, default=None, max_digits=16, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
]

View File

@ -0,0 +1,93 @@
import django.core.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20220307_0821'),
]
operations = [
migrations.AddField(
model_name='lnpayment',
name='fee',
field=models.DecimalField(decimal_places=3, default=0, max_digits=10),
),
migrations.AddField(
model_name='order',
name='bond_size',
field=models.DecimalField(decimal_places=2, default=1.0, max_digits=4, validators=[django.core.validators.MinValueValidator(1.0), django.core.validators.MaxValueValidator(15.0)]),
),
migrations.AddField(
model_name='order',
name='bondless_taker',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='order',
name='has_range',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='order',
name='max_amount',
field=models.DecimalField(blank=True, decimal_places=8, max_digits=18, null=True),
),
migrations.AddField(
model_name='order',
name='min_amount',
field=models.DecimalField(blank=True, decimal_places=8, max_digits=18, null=True),
),
migrations.AddField(
model_name='order',
name='public_duration',
field=models.PositiveBigIntegerField(default=86399, validators=[django.core.validators.MinValueValidator(597.6), django.core.validators.MaxValueValidator(86400.0)]),
),
migrations.AlterField(
model_name='currency',
name='timestamp',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(1601599.9999999998)]),
),
migrations.AlterField(
model_name='markettick',
name='timestamp',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='order',
name='amount',
field=models.DecimalField(blank=True, decimal_places=8, max_digits=18, null=True),
),
migrations.AlterField(
model_name='order',
name='created_at',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(1600000)]),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(800000)]),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(800000)]),
),
migrations.AlterField(
model_name='profile',
name='telegram_lang_code',
field=models.CharField(blank=True, max_length=10, null=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20220324_2230'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'KRW'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0004_alter_currency_currency'),
]
operations = [
migrations.AlterField(
model_name='order',
name='payment_method',
field=models.CharField(blank=True, default='not specified', max_length=70),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_alter_order_payment_method'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'KRW'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0006_alter_currency_currency'),
]
operations = [
migrations.AddField(
model_name='lnpayment',
name='in_flight',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,60 @@
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('api', '0007_lnpayment_in_flight'),
]
operations = [
migrations.AddField(
model_name='order',
name='escrow_duration',
field=models.PositiveBigIntegerField(default=10799, validators=[django.core.validators.MinValueValidator(1800), django.core.validators.MaxValueValidator(28800)]),
),
migrations.AddField(
model_name='order',
name='expiry_reason',
field=models.PositiveSmallIntegerField(blank=True, choices=[(0, 'Expired not taken'), (1, 'Maker bond not locked'), (2, 'Escrow not locked'), (3, 'Invoice not submitted'), (4, 'Neither escrow locked or invoice submitted')], default=None, null=True),
),
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(2402399.9999999995)]),
),
migrations.AlterField(
model_name='lnpayment',
name='receiver',
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='receiver', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='lnpayment',
name='sender',
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sender', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(2400000)]),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(1200000)]),
),
migrations.AlterField(
model_name='order',
name='status',
field=models.PositiveSmallIntegerField(choices=[(0, 'Waiting for maker bond'), (1, 'Public'), (2, 'Paused'), (3, 'Waiting for taker bond'), (4, 'Cancelled'), (5, 'Expired'), (6, 'Waiting for trade collateral and buyer invoice'), (7, 'Waiting only for seller trade collateral'), (8, 'Waiting only for buyer invoice'), (9, 'Sending fiat - In chatroom'), (10, 'Fiat sent - In chatroom'), (11, 'In dispute'), (12, 'Collaboratively cancelled'), (13, 'Sending satoshis to buyer'), (14, 'Sucessful trade'), (15, 'Failed lightning network routing'), (16, 'Wait for dispute resolution'), (17, 'Maker lost dispute'), (18, 'Taker lost dispute')], default=0),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(1200000)]),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0008_auto_20220501_1923'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'KRW'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0009_alter_currency_currency'),
]
operations = [
migrations.AddField(
model_name='lnpayment',
name='failure_reason',
field=models.PositiveSmallIntegerField(choices=[(0, "Payment isn't failed (yet)"), (1, 'There are more routes to try, but the payment timeout was exceeded.'), (2, 'All possible routes were tried and failed permanently. Or there were no routes to the destination at all.'), (3, 'A non-recoverable error has occurred.'), (4, 'Payment details are incorrect (unknown hash, invalid amount or invalid final CLTV delta).'), (5, "Insufficient unlocked balance in RoboSats' node.")], default=None, null=True),
),
]

View File

@ -0,0 +1,21 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0010_lnpayment_failure_reason'),
]
operations = [
migrations.AddField(
model_name='profile',
name='encrypted_private_key',
field=models.TextField(blank=True, default=None, max_length=999, null=True),
),
migrations.AddField(
model_name='profile',
name='public_key',
field=models.TextField(blank=True, default=None, max_length=999, null=True),
),
]

View File

@ -0,0 +1,26 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0011_auto_20220527_0057'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'BYN'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (65, 'EGP'), (66, 'LKR'), (67, 'MAD'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
migrations.AlterField(
model_name='profile',
name='encrypted_private_key',
field=models.TextField(blank=True, default=None, max_length=2000, null=True),
),
migrations.AlterField(
model_name='profile',
name='public_key',
field=models.TextField(blank=True, default=None, max_length=2000, null=True),
),
]

View File

@ -0,0 +1,42 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0012_auto_20220601_2221'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'BYN'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (65, 'EGP'), (66, 'LKR'), (67, 'MAD'), (68, 'AED'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(6003000.0)]),
),
migrations.AlterField(
model_name='order',
name='bond_size',
field=models.DecimalField(decimal_places=2, default=3.0, max_digits=4, validators=[django.core.validators.MinValueValidator(2.0), django.core.validators.MaxValueValidator(15.0)]),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(3000000)]),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(1500000)]),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(1500000)]),
),
]

View File

@ -0,0 +1,76 @@
import api.models
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('control', '0002_auto_20220619_0535'),
('api', '0013_auto_20220605_1156'),
]
operations = [
migrations.AddField(
model_name='order',
name='is_swap',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(3300000.0)]),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(4400000)]),
),
migrations.AlterField(
model_name='order',
name='payout',
field=models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_paid_LN', to='api.lnpayment'),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(2200000)]),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(2200000)]),
),
migrations.CreateModel(
name='OnchainPayment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('concept', models.PositiveSmallIntegerField(choices=[(3, 'Payment to buyer')], default=3)),
('status', models.PositiveSmallIntegerField(choices=[(0, 'Created'), (1, 'Valid'), (2, 'In mempool'), (3, 'Confirmed'), (4, 'Cancelled')], default=0)),
('address', models.CharField(blank=True, default=None, max_length=100, null=True)),
('txid', models.CharField(blank=True, default=None, max_length=64, null=True, unique=True)),
('num_satoshis', models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(25000.0), django.core.validators.MaxValueValidator(3300000.0)])),
('sent_satoshis', models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(25000.0), django.core.validators.MaxValueValidator(3300000.0)])),
('suggested_mining_fee_rate', models.DecimalField(decimal_places=3, default=1.05, max_digits=6)),
('mining_fee_rate', models.DecimalField(decimal_places=3, default=1.05, max_digits=6)),
('mining_fee_sats', models.PositiveBigIntegerField(default=0)),
('swap_fee_rate', models.DecimalField(decimal_places=2, default=1.0, max_digits=4)),
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
('balance', models.ForeignKey(default=api.models.OnchainPayment.get_balance, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='balance', to='control.balancelog')),
('receiver', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tx_receiver', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Onchain payment',
'verbose_name_plural': 'Onchain payments',
},
),
migrations.AddField(
model_name='order',
name='payout_tx',
field=models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_paid_TX', to='api.onchainpayment'),
),
]

View File

@ -0,0 +1,32 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0014_auto_20220619_0535'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'BYN'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (65, 'EGP'), (66, 'LKR'), (67, 'MAD'), (68, 'AED'), (69, 'TND'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
migrations.AlterField(
model_name='onchainpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(3300000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='sent_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(3300000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='swap_fee_rate',
field=models.DecimalField(decimal_places=2, default=1.4000000000000001, max_digits=4),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0015_auto_20220702_1500'),
]
operations = [
migrations.AlterField(
model_name='onchainpayment',
name='swap_fee_rate',
field=models.DecimalField(decimal_places=2, default=0.8, max_digits=4),
),
]

View File

@ -0,0 +1,42 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0016_alter_onchainpayment_swap_fee_rate'),
]
operations = [
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(4500000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(4500000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='sent_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(4500000.0)]),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(6000000)]),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(3000000)]),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(3000000)]),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0017_auto_20220710_1127'),
]
operations = [
migrations.AddField(
model_name='order',
name='last_satoshis_time',
field=models.DateTimeField(blank=True, default=None, null=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0018_order_last_satoshis_time'),
]
operations = [
migrations.AddField(
model_name='order',
name='contract_finalization_time',
field=models.DateTimeField(blank=True, default=None, null=True),
),
]

View File

@ -0,0 +1,42 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0019_order_contract_finalization_time'),
]
operations = [
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(6000000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(6000000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='sent_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(6000000.0)]),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(8000000)]),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(4000000)]),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(4000000)]),
),
]

View File

@ -0,0 +1,22 @@
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('api', '0020_auto_20220731_1425'),
]
operations = [
migrations.AddField(
model_name='order',
name='reference',
field=models.UUIDField(default=uuid.uuid4, editable=False),
),
migrations.AddField(
model_name='profile',
name='wants_stealth',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0021_auto_20220813_1333'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='wants_stealth',
field=models.BooleanField(default=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0022_alter_profile_wants_stealth'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'BYN'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (65, 'EGP'), (66, 'LKR'), (67, 'MAD'), (68, 'AED'), (69, 'TND'), (70, 'ETB'), (71, 'GEL'), (72, 'UGX'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
]

View File

@ -0,0 +1,42 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0023_alter_currency_currency'),
]
operations = [
migrations.AlterField(
model_name='lnpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(validators=[django.core.validators.MinValueValidator(100), django.core.validators.MaxValueValidator(7500000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(7500000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='sent_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(10000.0), django.core.validators.MaxValueValidator(7500000.0)]),
),
migrations.AlterField(
model_name='order',
name='last_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(10000000)]),
),
migrations.AlterField(
model_name='order',
name='satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(5000000)]),
),
migrations.AlterField(
model_name='order',
name='t0_satoshis',
field=models.PositiveBigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(20000), django.core.validators.MaxValueValidator(5000000)]),
),
]

View File

@ -0,0 +1,22 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0024_auto_20221109_2250'),
]
operations = [
migrations.AddField(
model_name='lnpayment',
name='routing_budget_ppm',
field=models.PositiveBigIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100000)]),
),
migrations.AddField(
model_name='lnpayment',
name='routing_budget_sats',
field=models.DecimalField(decimal_places=3, default=0, max_digits=10),
),
]

View File

@ -0,0 +1,22 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0025_auto_20221127_1135'),
]
operations = [
migrations.AlterField(
model_name='onchainpayment',
name='mining_fee_rate',
field=models.DecimalField(decimal_places=3, default=2.05, max_digits=6, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(999)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='suggested_mining_fee_rate',
field=models.DecimalField(decimal_places=3, default=2.05, max_digits=6, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(999)]),
),
]

View File

@ -0,0 +1,26 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0026_auto_20230213_2023'),
]
operations = [
migrations.AlterField(
model_name='onchainpayment',
name='status',
field=models.PositiveSmallIntegerField(choices=[(0, 'Created'), (1, 'Valid'), (2, 'In mempool'), (3, 'Confirmed'), (4, 'Cancelled'), (5, 'Queued')], default=0),
),
migrations.AlterField(
model_name='order',
name='maker_statement',
field=models.TextField(blank=True, default=None, max_length=10000, null=True),
),
migrations.AlterField(
model_name='order',
name='taker_statement',
field=models.TextField(blank=True, default=None, max_length=10000, null=True),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0027_auto_20230314_1801'),
]
operations = [
migrations.AddField(
model_name='onchainpayment',
name='broadcasted',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0028_onchainpayment_broadcasted'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'BYN'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (65, 'EGP'), (66, 'LKR'), (67, 'MAD'), (68, 'AED'), (69, 'TND'), (70, 'ETB'), (71, 'GEL'), (72, 'UGX'), (73, 'RSD'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
]

View File

@ -0,0 +1,22 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0029_alter_currency_currency'),
]
operations = [
migrations.AlterField(
model_name='currency',
name='currency',
field=models.PositiveSmallIntegerField(choices=[(1, 'USD'), (2, 'EUR'), (3, 'JPY'), (4, 'GBP'), (5, 'AUD'), (6, 'CAD'), (7, 'CHF'), (8, 'CNY'), (9, 'HKD'), (10, 'NZD'), (11, 'SEK'), (12, 'KRW'), (13, 'SGD'), (14, 'NOK'), (15, 'MXN'), (16, 'BYN'), (17, 'RUB'), (18, 'ZAR'), (19, 'TRY'), (20, 'BRL'), (21, 'CLP'), (22, 'CZK'), (23, 'DKK'), (24, 'HRK'), (25, 'HUF'), (26, 'INR'), (27, 'ISK'), (28, 'PLN'), (29, 'RON'), (30, 'ARS'), (31, 'VES'), (32, 'COP'), (33, 'PEN'), (34, 'UYU'), (35, 'PYG'), (36, 'BOB'), (37, 'IDR'), (38, 'ANG'), (39, 'CRC'), (40, 'CUP'), (41, 'DOP'), (42, 'GHS'), (43, 'GTQ'), (44, 'ILS'), (45, 'JMD'), (46, 'KES'), (47, 'KZT'), (48, 'MYR'), (49, 'NAD'), (50, 'NGN'), (51, 'AZN'), (52, 'PAB'), (53, 'PHP'), (54, 'PKR'), (55, 'QAR'), (56, 'SAR'), (57, 'THB'), (58, 'TTD'), (59, 'VND'), (60, 'XOF'), (61, 'TWD'), (62, 'TZS'), (63, 'XAF'), (64, 'UAH'), (65, 'EGP'), (66, 'LKR'), (67, 'MAD'), (68, 'AED'), (69, 'TND'), (70, 'ETB'), (71, 'GEL'), (72, 'UGX'), (73, 'RSD'), (74, 'IRT'), (300, 'XAU'), (1000, 'BTC')], unique=True),
),
migrations.AlterField(
model_name='currency',
name='exchange_rate',
field=models.DecimalField(decimal_places=4, default=None, max_digits=18, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
]

View File

@ -0,0 +1,32 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0030_auto_20230410_1850'),
]
operations = [
migrations.AlterField(
model_name='onchainpayment',
name='num_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(5000.0), django.core.validators.MaxValueValidator(7500000.0)]),
),
migrations.AlterField(
model_name='onchainpayment',
name='sent_satoshis',
field=models.PositiveBigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(5000.0), django.core.validators.MaxValueValidator(7500000.0)]),
),
migrations.AlterField(
model_name='order',
name='maker_statement',
field=models.TextField(blank=True, default=None, max_length=50000, null=True),
),
migrations.AlterField(
model_name='order',
name='taker_statement',
field=models.TextField(blank=True, default=None, max_length=50000, null=True),
),
]

View File

@ -0,0 +1,20 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0031_auto_20230425_1211'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='bondless_taker',
),
migrations.AddField(
model_name='order',
name='reverted_fiat_sent',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,20 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0032_auto_20230430_1419'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='reverted_fiat_sent',
),
migrations.AddField(
model_name='order',
name='bondless_taker',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,20 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0033_auto_20230430_1603'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='bondless_taker',
),
migrations.AddField(
model_name='order',
name='reverted_fiat_sent',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,17 @@
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('api', '0034_auto_20230430_1640'),
]
operations = [
migrations.RenameModel(
old_name='Profile',
new_name='Robot',
),
]

View File

@ -0,0 +1,57 @@
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0035_rename_profile_robot"),
]
operations = [
migrations.RemoveField(
model_name="order",
name="maker_last_seen",
),
migrations.RemoveField(
model_name="order",
name="taker_last_seen",
),
migrations.RemoveField(
model_name="robot",
name="avg_rating",
),
migrations.RemoveField(
model_name="robot",
name="is_referred",
),
migrations.RemoveField(
model_name="robot",
name="latest_ratings",
),
migrations.RemoveField(
model_name="robot",
name="pending_rewards",
),
migrations.RemoveField(
model_name="robot",
name="referral_code",
),
migrations.RemoveField(
model_name="robot",
name="referred_by",
),
migrations.RemoveField(
model_name="robot",
name="total_ratings",
),
migrations.AddField(
model_name="order",
name="proceeds",
field=models.PositiveBigIntegerField(
blank=True,
default=0,
null=True,
validators=[django.core.validators.MinValueValidator(0)],
),
),
]

View File

@ -0,0 +1,30 @@
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('api', '__first__'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ChatRoom',
fields=[
('id', models.PositiveBigIntegerField(blank=True, default=None, primary_key=True, serialize=False)),
('maker_connected', models.BooleanField(default=False)),
('taker_connected', models.BooleanField(default=False)),
('maker_connect_date', models.DateTimeField(auto_now_add=True)),
('taker_connect_date', models.DateTimeField(auto_now_add=True)),
('room_group_name', models.CharField(blank=True, default=None, max_length=50, null=True)),
('maker', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='chat_maker', to=settings.AUTH_USER_MODEL)),
('order', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order', to='api.order')),
('taker', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='chat_taker', to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -0,0 +1,37 @@
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('api', '0011_auto_20220527_0057'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('chat', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='chatroom',
name='order',
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='chatroom', to='api.order'),
),
migrations.CreateModel(
name='Message',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('index', models.PositiveIntegerField(blank=True, default=None)),
('PGP_message', models.TextField(blank=True, default=None, max_length=5000, null=True)),
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
('chatroom', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='chatroom', to='chat.chatroom')),
('order', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='message', to='api.order')),
('receiver', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='message_receiver', to=settings.AUTH_USER_MODEL)),
('sender', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='message_sender', to=settings.AUTH_USER_MODEL)),
],
options={
'get_latest_by': 'index',
},
),
]

View File

View File

@ -0,0 +1,151 @@
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="AccountingDay",
fields=[
("day", models.DateTimeField(primary_key=True, serialize=False)),
(
"contracted",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
("num_contracts", models.BigIntegerField(default=0)),
(
"net_settled",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"net_paid",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"net_balance",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"inflow",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"outflow",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"routing_fees",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"cashflow",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"outstanding_earned_rewards",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"outstanding_pending_disputes",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"lifetime_rewards_claimed",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"earned_rewards",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"disputes",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"rewards_claimed",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
],
),
migrations.CreateModel(
name="AccountingMonth",
fields=[
("month", models.DateTimeField(primary_key=True, serialize=False)),
(
"contracted",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
("num_contracts", models.BigIntegerField(default=0)),
(
"net_settled",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"net_paid",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"net_balance",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"inflow",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"outflow",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"routing_fees",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"cashflow",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"outstanding_earned_rewards",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"outstanding_pending_disputes",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"lifetime_rewards_claimed",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"earned_rewards",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"pending_disputes",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
(
"rewards_claimed",
models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
],
),
migrations.CreateModel(
name="Dispute",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
],
),
]

View File

@ -0,0 +1,91 @@
import django.utils.timezone
from django.db import migrations, models
import control.models
class Migration(migrations.Migration):
dependencies = [
("control", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="BalanceLog",
fields=[
(
"time",
models.DateTimeField(
default=django.utils.timezone.now,
primary_key=True,
serialize=False,
),
),
(
"total",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_total
),
),
(
"onchain_fraction",
models.DecimalField(
decimal_places=5,
default=control.models.BalanceLog.get_frac,
max_digits=6,
),
),
(
"onchain_total",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_oc_total
),
),
(
"onchain_confirmed",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_oc_conf
),
),
(
"onchain_unconfirmed",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_oc_unconf
),
),
(
"ln_local",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_ln_local
),
),
(
"ln_remote",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_ln_remote
),
),
(
"ln_local_unsettled",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_ln_local_unsettled
),
),
(
"ln_remote_unsettled",
models.PositiveBigIntegerField(
default=control.models.BalanceLog.get_ln_remote_unsettled
),
),
],
),
migrations.DeleteModel(
name="AccountingMonth",
),
migrations.AddField(
model_name="accountingday",
name="mining_fees",
field=models.DecimalField(decimal_places=3, default=0, max_digits=15),
),
]

View File

View File

@ -53,7 +53,6 @@ services:
environment:
TOR_PROXY_IP: 127.0.0.1
TOR_PROXY_PORT: 9050
ROBOSATS_ONION: robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion
network_mode: service:tor
volumes:
- ./nodeapp/:/usr/src/robosats/
@ -64,6 +63,8 @@ services:
image: backend
restart: always
container_name: clord-dev
environment:
SKIP_COLLECT_STATIC: "true"
command: python3 manage.py clean_orders
volumes:
- .:/usr/src/robosats
@ -77,6 +78,8 @@ services:
depends_on:
- bitcoind
- lnd
environment:
SKIP_COLLECT_STATIC: "true"
command: python3 manage.py follow_invoices
volumes:
- .:/usr/src/robosats
@ -87,6 +90,8 @@ services:
image: backend
container_name: tg-dev
restart: always
environment:
SKIP_COLLECT_STATIC: "true"
command: python3 manage.py telegram_watcher
volumes:
- .:/usr/src/robosats
@ -99,6 +104,7 @@ services:
restart: always
environment:
REDIS_URL: redis://localhost:6379
SKIP_COLLECT_STATIC: "true"
volumes:
- .:/usr/src/robosats
- ./node/lnd:/lnd
@ -113,6 +119,7 @@ services:
restart: always
environment:
REDIS_URL: redis://localhost:6379
SKIP_COLLECT_STATIC: "true"
command: celery -A robosats beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
volumes:
- .:/usr/src/robosats

View File

@ -103,7 +103,7 @@ INSTALLED_APPS = [
"api",
"chat",
"control",
"frontend.apps.FrontendConfig",
"frontend",
"drf_spectacular",
"drf_spectacular_sidecar", # required for Django collectstatic discovery
]

20
scripts/entrypoint.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Apply migrations
python manage.py migrate
# Collect static files
if [ $SKIP_COLLECT_STATIC ]; then
echo "Skipping collection of static files."
else
python manage.py collectstatic --noinput
fi
# Copy pb2/grpc files if they do exist
if [ ! -f "/usr/src/robosats/api/lightning/lightning_pb2.py" ]; then
echo "Looks like the first run of this container. pb2 and gRPC files were not detected on the attached volume, copying them into the attached volume /robosats/api/node ."
cp -R /tmp/* /usr/src/robosats/api/lightning/
fi
# Start server / gunicorn / daphne / command
exec "$@"

View File

@ -30,4 +30,10 @@ sed -i 's/^import .*_pb2 as/from . \0/' verrpc_pb2.py
sed -i 's/^import .*_pb2 as/from . \0/' router_pb2_grpc.py
sed -i 's/^import .*_pb2 as/from . \0/' lightning_pb2_grpc.py
sed -i 's/^import .*_pb2 as/from . \0/' invoices_pb2_grpc.py
sed -i 's/^import .*_pb2 as/from . \0/' verrpc_pb2_grpc.py
sed -i 's/^import .*_pb2 as/from . \0/' verrpc_pb2_grpc.py
# On development environments the local volume will be mounted over these files. We copy pb2 and grpc files to /tmp/.
# This way, we can find if these files are missing with our entrypoint.sh and copy them into the volume.
cp -r *_pb2.py /tmp/
cp -r *_grpc.py /tmp/

View File

@ -67,12 +67,7 @@ Then visit `127.0.0.1:4000` on your browser. Once you save changes on a file it
Spinning up docker for the first time
```bash
docker-compose build --no-cache
# Install LND python dependencies into local repository
docker run --mount type=bind,src=$(pwd),dst=/usr/src/robosats backend sh generate_grpc.sh
docker-compose up -d
docker exec -it django-dev python3 manage.py makemigrations api control chat
docker exec -it django-dev python3 manage.py migrate
docker exec -it django-dev python3 manage.py createsuperuser
# Once requested for the new superuser name, make sure to use the same name you have in the .env-sample variable ESCROW_USERNAME. By default 'admin'.
docker-compose restart