feat: app

This commit is contained in:
hashbro
2026-10-10 01:53:17 +08:00
parent af714468ee
commit ea82eddbf0
8 changed files with 320 additions and 182 deletions
+40
View File
@@ -24,4 +24,44 @@ class TransferRecord extends Model
'status',
'error',
];
/**
* Addresses that already have a successful outbound sweep.
*
* @param list<string> $addresses
* @return array<string, true>
*/
public static function successfulSweepSet(array $addresses): array
{
$addresses = array_values(array_unique(array_filter(
$addresses,
static fn ($address) => is_string($address) && $address !== ''
)));
if ($addresses === []) {
return [];
}
$found = static::query()
->whereIn('from_address', $addresses)
->where('status', self::STATUS_SUCCESS)
->where('type', self::TYPE_OUT)
->distinct()
->pluck('from_address');
$set = [];
foreach ($found as $address) {
$set[(string) $address] = true;
$set[strtolower((string) $address)] = true;
}
return $set;
}
/**
* @param array<string, true> $set
*/
public static function addressInSweepSet(string $address, array $set): bool
{
return isset($set[$address]) || isset($set[strtolower($address)]);
}
}