increase founders fee to 70% and zap sybil fee to 30% (#1388)
* increase founders fee to 70% and zap sybil fee to 30% * more sybil fee changes
This commit is contained in:
		
							parent
							
								
									020b4c5eea
								
							
						
					
					
						commit
						3310925155
					
				| @ -252,8 +252,8 @@ export async function createLightningInvoice (actionType, args, context) { | ||||
|     try { | ||||
|       const description = await paidActions[actionType].describe(args, context) | ||||
|       const { invoice: bolt11, wallet } = await createUserInvoice(userId, { | ||||
|         // this is the amount the stacker will receive, the other 1/10th is the fee
 | ||||
|         msats: cost * BigInt(9) / BigInt(10), | ||||
|         // this is the amount the stacker will receive, the other 3/10ths is the sybil fee
 | ||||
|         msats: cost * BigInt(7) / BigInt(10), | ||||
|         description, | ||||
|         expiry: INVOICE_EXPIRE_SECS | ||||
|       }, { models }) | ||||
|  | ||||
| @ -28,7 +28,7 @@ export async function invoiceablePeer ({ id }, { models }) { | ||||
| } | ||||
| 
 | ||||
| export async function perform ({ invoiceId, sats, id: itemId, ...args }, { me, cost, tx }) { | ||||
|   const feeMsats = cost / BigInt(10) // 10% fee
 | ||||
|   const feeMsats = 3n * (cost / BigInt(10)) // 30% fee
 | ||||
|   const zapMsats = cost - feeMsats | ||||
|   itemId = parseInt(itemId) | ||||
| 
 | ||||
|  | ||||
| @ -0,0 +1,52 @@ | ||||
| UPDATE "Sub" SET "rewardsPct" = 30; | ||||
| 
 | ||||
| -- account for comments in rewards | ||||
| CREATE OR REPLACE FUNCTION rewards(min TIMESTAMP(3), max TIMESTAMP(3), ival INTERVAL, date_part TEXT) | ||||
| RETURNS TABLE ( | ||||
|     t TIMESTAMP(3), total BIGINT, donations BIGINT, fees BIGINT, boost BIGINT, jobs BIGINT, anons_stack BIGINT | ||||
| ) | ||||
| LANGUAGE plpgsql | ||||
| AS $$ | ||||
| DECLARE | ||||
| BEGIN | ||||
|     RETURN QUERY | ||||
|     SELECT period.t, | ||||
|         coalesce(FLOOR(sum(msats)), 0)::BIGINT as total, | ||||
|         coalesce(FLOOR(sum(msats) FILTER(WHERE type = 'DONATION')), 0)::BIGINT as donations, | ||||
|         coalesce(FLOOR(sum(msats) FILTER(WHERE type NOT IN ('BOOST', 'STREAM', 'DONATION', 'ANON'))), 0)::BIGINT as fees, | ||||
|         coalesce(FLOOR(sum(msats) FILTER(WHERE type = 'BOOST')), 0)::BIGINT as boost, | ||||
|         coalesce(FLOOR(sum(msats) FILTER(WHERE type = 'STREAM')), 0)::BIGINT as jobs, | ||||
|         coalesce(FLOOR(sum(msats) FILTER(WHERE type = 'ANON')), 0)::BIGINT as anons_stack | ||||
|     FROM generate_series(min, max, ival) period(t), | ||||
|     LATERAL | ||||
|     ( | ||||
|         (SELECT | ||||
|             ("ItemAct".msats - COALESCE("ReferralAct".msats, 0)) * COALESCE("Sub"."rewardsPct", 100) * 0.01  as msats, | ||||
|             act::text as type | ||||
|           FROM "ItemAct" | ||||
|           JOIN "Item" ON "Item"."id" = "ItemAct"."itemId" | ||||
|           LEFT JOIN "Item" root ON "Item"."rootId" = root.id | ||||
|           JOIN "Sub" ON "Sub"."name" = COALESCE(root."subName", "Item"."subName") | ||||
|           LEFT JOIN "ReferralAct" ON "ReferralAct"."itemActId" = "ItemAct".id | ||||
|           WHERE date_trunc(date_part, "ItemAct".created_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Chicago') = period.t | ||||
|             AND "ItemAct".act <> 'TIP' | ||||
|             AND ("ItemAct"."invoiceActionState" IS NULL OR "ItemAct"."invoiceActionState" = 'PAID')) | ||||
|           UNION ALL | ||||
|         (SELECT sats * 1000 as msats, 'DONATION' as type | ||||
|           FROM "Donation" | ||||
|           WHERE date_trunc(date_part, "Donation".created_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Chicago') = period.t) | ||||
|           UNION ALL | ||||
|         -- any earnings from anon's stack that are not forwarded to other users | ||||
|         (SELECT "ItemAct".msats, 'ANON' as type | ||||
|           FROM "Item" | ||||
|           JOIN "ItemAct" ON "ItemAct"."itemId" = "Item".id | ||||
|           LEFT JOIN "ItemForward" ON "ItemForward"."itemId" = "Item".id | ||||
|           WHERE "Item"."userId" = 27 AND "ItemAct".act = 'TIP' | ||||
|           AND date_trunc(date_part, "ItemAct".created_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Chicago') = period.t | ||||
|           AND ("ItemAct"."invoiceActionState" IS NULL OR "ItemAct"."invoiceActionState" = 'PAID') | ||||
|           GROUP BY "ItemAct".id, "ItemAct".msats | ||||
|           HAVING COUNT("ItemForward".id) = 0) | ||||
|     ) x | ||||
|     GROUP BY period.t; | ||||
| END; | ||||
| $$; | ||||
| @ -10,7 +10,7 @@ const MAX_OUTGOING_CLTV_DELTA = 500 // the maximum cltv delta we'll allow for th | ||||
| export const MIN_SETTLEMENT_CLTV_DELTA = 80 // the minimum blocks we'll leave for settling the incoming invoice
 | ||||
| const FEE_ESTIMATE_TIMEOUT_SECS = 5 // the timeout for the fee estimate request
 | ||||
| const MAX_FEE_ESTIMATE_PERCENT = 0.025 // the maximum fee relative to outgoing we'll allow for the fee estimate
 | ||||
| const ZAP_SYBIL_FEE_MULT = 10 / 9 // the fee for the zap sybil service
 | ||||
| const ZAP_SYBIL_FEE_MULT = 10 / 7 // the fee for the zap sybil service
 | ||||
| 
 | ||||
| /* | ||||
|   The wrapInvoice function is used to wrap an outgoing invoice with the necessary parameters for an incoming hold invoice. | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user