Commit Graph

80 Commits

Author SHA1 Message Date
Bryan Stitt 581af0d596
stripe integration first mvp (replaces #140) (#154)
* stripe integration first mvp

* addressing some points from #140

* stripe endpoint needs testing

* addressed some comments

* added Json(payload)

* update toolchain

* lint (well, most of it)

---------

Co-authored-by: yenicelik <david.yenicelik@gmail.com>
2023-06-29 14:32:05 -07:00
Bryan Stitt be22521d88 nested dockerignore doesnt work 2023-06-27 11:09:38 -07:00
Bryan Stitt eab86c7ee8 automatic max_head_block_age 2023-06-17 10:13:40 -07:00
Bryan Stitt bf13e86a04 warn if no max_head_block_age 2023-06-17 09:19:05 -07:00
Bryan Stitt 2e85772dd4 remove tier from configs 2023-06-12 21:07:54 -07:00
Bryan Stitt 813d28c834 sed -i s/influxdb_bucketname/influxdb_bucket/g 2023-06-11 09:59:00 -07:00
Bryan Stitt 69dd8f0046 checksum address and no need for topic 2023-06-09 15:39:14 -07:00
David 34ed450fab
User Balance + Referral Logic (#44)
* will implement balance topup endpoint

* will quickly fix other PR reviews

* merging from master

* will finish up godmoe

* will finish up login

* added logic to top up balance (first iteration)

* should implement additional columns soon (currency, amount, tx-hash), as well as a new table for spend

* updated migrations, will account for spend next

* get back to this later

* will merge PR from stats-v2

* stats v2

rebased all my commits and squashed them down to one

* cargo upgrade

* added migrtation for spend in accounting table. will run test-deposit next

* trying to get request from polygon

* first iteration /user/balance/:tx_hash works, needs to add accepted tokens next

* creating the referral code seems to work

* will now check if spending enough credits will lead to both parties receiving credits

* rpcstats takes care of accounting for spend data

* removed track spend from table

* Revert "removed track spend from table"

This reverts commit a50802d6ae75f786864c5ec42d0ceb2cb27124ed.

* Revert "rpcstats takes care of accounting for spend data"

This reverts commit 1cec728bf241e4cfd24351134637ed81c1a5a10b.

* removed rpc request table entity

* updated referral code to use ulid s

* credits used are aggregated

* added a bunch of fields to referrer

* added database logic whenever an aggregate stats is added. will have to iterate over this a couple times i think. go to (1) detecting accepted stables next, (2) fix influxdb bug and (3) start to write test

* removed track spend as this will occur in the database

* will first work on "balance", then referral. these should really be treated as two separate PRs (although already convoluted)

* balance logic initial commit

* breaking WIP, changing the RPC call logic functions

* will start testing next

* got rid of warnings & lint

* will proceed with subtracting / adding to balance

* added decimal points, balance tracking seems to work

* will beautify code a bit

* removed deprecated dependency, and added topic + deposit contract to app.yaml

* brownie test suite does not rely on local contract files it pulls all from polygonscan

* will continue with referral

* should perhaps (in a future revision) recordhow much the referees got for free. marking referrals seems to work rn

* user is upgraded to premium if they deposit more than 10$. we dont accept more than $10M in a single tx

* will start PR, referral seems to be fine so far, perhaps up to some numbers that still may need tweaking

* will start PR

* removed rogue comments, cleaned up payments a bit

* changes before PR

* apply stats

* added unique constraint

* some refactoring such that the user file is not too bloated

* compiling

* progress with subusers, creating a table entry seems to work

* good response type is there as well now, will work on getters from primary user and secondary user next

* subuser logic also seems fine now

* downgrade logic

* fixed bug influxdb does not support different types in same query (which makes sense)

* WIP temporary commit

* merging with PR

* Delete daemon.rs

there are multiple daemons now, so this was moved to `proxyd`

* will remove request clone to &mut

* multiple request handles for payment

* making requests still seem fine

* removed redundant commented out bits

* added deposit endpoint, added deposit amount and deposit user, untested yet

* small bug with downgrade tier id

* will add authorization so balance can be received for users

* balance history should be set now too

* will check balance over time again

* subususer can see rpc key balance if admin or owner

* stats also seems to work fine now with historical balance

* things seem to be building and working

* removed clone from  OpenRequestHandle

* removed influxdb from workspace members

* changed config files

* reran sea-orm generate entities, added a foreign key, should be proper now

* removed contract from commit

* made deposit contract optional

* added topic in polygon dev

* changed deposit contract to deposit factory contract

* added selfrelation on user_tier

* added payment required

* changed chain id to u64

* add wss in polygon llamarpc

* removed origin and method from the table

* added onchain transactions naming (and forgot to add a migration before)

* changed foreign key to be the referrer (id), not the code itself

* forgot to add id as the target foreign key

* WIP adding cache to update role

* fixed merge conflicts

---------

Co-authored-by: Bryan Stitt <bryan@llamanodes.com>
Co-authored-by: Bryan Stitt <bryan@stitthappens.com>
2023-05-12 09:45:15 -07:00
Bryan Stitt 03ef27baa4 Merge branch 'main' into devel 2023-04-19 15:31:08 -07:00
Bryan Stitt 10d2d46512 more packages for kafka+ssl 2023-04-19 15:22:27 -07:00
yenicelik 8c8c183e65 trying to debug returning multiple files 2023-03-10 20:26:15 +01:00
Bryan Stitt eb4d05a520 stats v2
rebased all my commits and squashed them down to one
2023-03-04 20:48:49 +01:00
Bryan Stitt 4c18657387 more kafka things 2023-03-03 06:58:45 -08:00
Bryan Stitt c008f50943 use http and ws providers in a single config 2023-02-12 01:40:01 -08:00
Bryan Stitt 0b1929a820 add minimal config for quick testing 2023-02-06 15:20:36 -08:00
Bryan Stitt 045065986a move allowed_lag around 2023-01-04 12:07:53 -08:00
Bryan Stitt 1465ee355c add support for optional db replica
also add cleanup of expired login data
2022-12-16 00:48:24 -08:00
Bryan Stitt c5893e43f8 smarter config ignoring 2022-12-15 14:58:17 -08:00
Bryan Stitt c29a7118bb fix example config 2022-11-29 21:32:40 +00:00
Bryan Stitt 0406b0dc8d fix redirect. config for login domain 2022-11-28 19:59:42 +00:00
Bryan Stitt a70e8873da add comments about dev vs prod 2022-11-16 08:30:32 +00:00
Bryan Stitt 96a486866c add optional display name 2022-11-13 21:05:37 +00:00
Bryan Stitt 46c598515a more comments 2022-11-13 21:00:25 +00:00
Bryan Stitt f69e592b2a these docs should probably be in rust, but people check here first 2022-11-13 20:32:10 +00:00
Bryan Stitt 2f229e2d6e fix example port 2022-11-13 20:29:33 +00:00
Bryan Stitt 91b7d2efd3 improve development instructions 2022-11-13 18:39:49 +00:00
Bryan Stitt 8e3547bbd0 add test for checking the example.toml 2022-11-11 21:16:32 +00:00
Bryan Stitt c33342d9dd simplify authorization types so we can pass them deeper easily 2022-11-11 06:19:12 +00:00
Bryan Stitt 2c4586302d clean up rpc_key_id template change 2022-11-10 22:17:22 +00:00
Bryan Stitt 31395c9934 rpc_key_id in the redirect. weights in the /status page 2022-11-07 22:10:19 +00:00
Bryan Stitt 7d426413aa cleanup 2022-11-04 04:40:39 +00:00
Bryan Stitt f3e9f6c387 bug fixes 2022-11-03 22:16:27 +00:00
Bryan Stitt f859ed56fc period instead of minute in variable names 2022-11-01 19:24:29 +00:00
Bryan Stitt 337f5bc1f8 sort configs 2022-10-25 04:34:24 +00:00
Bryan Stitt d574ac9add have / work for the public rpc 2022-10-21 21:12:05 +00:00
Bryan Stitt 9422a335a7 allow origins on public entrypoints 2022-10-21 20:59:05 +00:00
Bryan Stitt 0cd899fd8e update config block 2022-10-18 23:31:40 +00:00
Bryan Stitt f6c2d29d0e stricter configs 2022-10-18 23:27:33 +00:00
Bryan Stitt 25aa68a5bf add per-user rpc accounting 2022-10-10 04:15:49 +00:00
Bryan Stitt c8fbf46885 stats in redis that actually work
we should still investigate a real time series db, but stats in redis is much simpler for now
2022-10-07 02:15:53 +00:00
Bryan Stitt 394f6a6d84
Update example.toml 2022-10-06 13:21:16 -07:00
Bryan Stitt 6905e9fd46 create a struct for authenticated requests that we need for per-key stats 2022-09-22 19:57:21 +00:00
Bryan Stitt c34e8ef383 improve rate limiting and request counters 2022-09-06 20:13:07 +00:00
Bryan Stitt e261886c60 user_address change not made yet 2022-09-05 06:29:27 +00:00
Bryan Stitt 6e12edd555 use sized Caches 2022-09-05 05:53:58 +00:00
Bryan Stitt 8225285bb8 bug fix and better logs 2022-09-03 02:59:30 +00:00
Bryan Stitt ac6296c5ac better connection pool sizing 2022-09-02 20:16:20 +00:00
Bryan Stitt 5e239c05c8 add min_sum_soft_limit to config 2022-08-27 03:13:23 +00:00
Bryan Stitt 8703532ed7 better logs and minor cleanup 2022-08-27 02:14:53 +00:00
Bryan Stitt c57c2249c0 load the redirected page from config 2022-08-12 19:08:28 +00:00