Skip to content

Commit

Permalink
Calculate send slash function
Browse files Browse the repository at this point in the history
  • Loading branch information
youngkidwarrior committed Nov 24, 2024
1 parent 153e68a commit a6b50d6
Show file tree
Hide file tree
Showing 4 changed files with 581 additions and 17 deletions.
135 changes: 121 additions & 14 deletions packages/snaplet/.snaplet/dataModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,6 @@
"schemaName": "public",
"tableName": "affiliate_stats",
"fields": [
{
"id": "public.affiliate_stats.paymaster_tx_count",
"name": "paymaster_tx_count",
"columnName": "paymaster_tx_count",
"type": "int8",
"isRequired": true,
"kind": "scalar",
"isList": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": true,
"isId": false,
"maxLength": null
},
{
"id": "public.affiliate_stats.user_id",
"name": "user_id",
Expand Down Expand Up @@ -357,6 +343,20 @@
"isId": false,
"maxLength": null
},
{
"id": "public.affiliate_stats.send_plus_minus",
"name": "send_plus_minus",
"columnName": "send_plus_minus",
"type": "int8",
"isRequired": true,
"kind": "scalar",
"isList": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": true,
"isId": false,
"maxLength": null
},
{
"name": "profiles",
"type": "profiles",
Expand Down Expand Up @@ -978,6 +978,20 @@
"isId": true,
"maxLength": null
},
{
"id": "public.distribution_shares.amount_after_slash",
"name": "amount_after_slash",
"columnName": "amount_after_slash",
"type": "numeric",
"isRequired": true,
"kind": "scalar",
"isList": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": false,
"isId": false,
"maxLength": null
},
{
"name": "users",
"type": "users",
Expand Down Expand Up @@ -1631,6 +1645,20 @@
"isGenerated": false,
"sequence": false,
"hasDefaultValue": false
},
{
"name": "send_slash",
"type": "send_slash",
"isRequired": false,
"kind": "object",
"relationName": "send_slashTodistributions",
"relationFromFields": [],
"relationToFields": [],
"isList": true,
"isId": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": false
}
],
"uniqueConstraints": [
Expand Down Expand Up @@ -6513,6 +6541,82 @@
}
]
},
"send_slash": {
"id": "public.send_slash",
"schemaName": "public",
"tableName": "send_slash",
"fields": [
{
"id": "public.send_slash.distribution_number",
"name": "distribution_number",
"columnName": "distribution_number",
"type": "int4",
"isRequired": true,
"kind": "scalar",
"isList": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": false,
"isId": true,
"maxLength": null
},
{
"id": "public.send_slash.minimum_sends",
"name": "minimum_sends",
"columnName": "minimum_sends",
"type": "int2",
"isRequired": true,
"kind": "scalar",
"isList": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": true,
"isId": false,
"maxLength": null
},
{
"id": "public.send_slash.scaling_divisor",
"name": "scaling_divisor",
"columnName": "scaling_divisor",
"type": "int2",
"isRequired": true,
"kind": "scalar",
"isList": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": true,
"isId": false,
"maxLength": null
},
{
"name": "distributions",
"type": "distributions",
"isRequired": true,
"kind": "object",
"relationName": "send_slashTodistributions",
"relationFromFields": [
"distribution_number"
],
"relationToFields": [
"number"
],
"isList": false,
"isId": false,
"isGenerated": false,
"sequence": false,
"hasDefaultValue": false
}
],
"uniqueConstraints": [
{
"name": "send_slash_pkey",
"fields": [
"distribution_number"
],
"nullNotDistinct": false
}
]
},
"send_token_transfers": {
"id": "public.send_token_transfers",
"schemaName": "public",
Expand Down Expand Up @@ -9165,6 +9269,9 @@
{
"name": "create_passkey"
},
{
"name": "send_ceiling"
},
{
"name": "send_one_hundred"
},
Expand Down
50 changes: 47 additions & 3 deletions supabase/database-generated.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export type Database = {
Row: {
address: string
amount: number
amount_after_slash: number
bonus_pool_amount: number
created_at: string
distribution_id: number
Expand All @@ -150,6 +151,7 @@ export type Database = {
Insert: {
address: string
amount: number
amount_after_slash: number
bonus_pool_amount: number
created_at?: string
distribution_id: number
Expand All @@ -163,6 +165,7 @@ export type Database = {
Update: {
address?: string
amount?: number
amount_after_slash?: number
bonus_pool_amount?: number
created_at?: string
distribution_id?: number
Expand Down Expand Up @@ -856,6 +859,32 @@ export type Database = {
}
Relationships: []
}
send_slash: {
Row: {
distribution_number: number
minimum_sends: number
scaling_divisor: number
}
Insert: {
distribution_number: number
minimum_sends?: number
scaling_divisor?: number
}
Update: {
distribution_number?: number
minimum_sends?: number
scaling_divisor?: number
}
Relationships: [
{
foreignKeyName: "send_slash_distribution_number_fkey"
columns: ["distribution_number"]
isOneToOne: true
referencedRelation: "distributions"
referencedColumns: ["number"]
},
]
}
send_token_transfers: {
Row: {
abi_idx: number
Expand Down Expand Up @@ -1138,6 +1167,12 @@ export type Database = {
}
}
Functions: {
calculate_and_insert_send_ceiling_verification: {
Args: {
distribution_number: number
}
Returns: undefined
}
citext:
| {
Args: {
Expand Down Expand Up @@ -1244,10 +1279,7 @@ export type Database = {
id: string
created_at: string
user_id: string
send_plus_minus: number
referral_count: number
network_plus_minus: number
affiliate_send_score: number
}[]
}
insert_challenge: {
Expand Down Expand Up @@ -1307,6 +1339,17 @@ export type Database = {
user_id: string
}
}
sum_qualification_sends: {
Args: {
distribution_number: number
send_ceiling: number
}
Returns: {
user_id: string
amount: number
sent_to: string[]
}[]
}
tag_search: {
Args: {
query: string
Expand Down Expand Up @@ -1343,6 +1386,7 @@ export type Database = {
| "send_one_hundred"
| "total_tag_referrals"
| "send_streak"
| "send_ceiling"
verification_value_mode: "individual" | "aggregate"
}
CompositeTypes: {
Expand Down
Loading

0 comments on commit a6b50d6

Please sign in to comment.