fix: link memo
This commit is contained in:
@@ -53,6 +53,41 @@ class EthDriver implements ChainDriver
|
||||
return EthAddress::isValid($address);
|
||||
}
|
||||
|
||||
public function isActivated(string $address): bool
|
||||
{
|
||||
if (! $this->isValidAddress($address)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$hex = $this->rpc('eth_getTransactionCount', [EthAddress::normalize($address), 'latest']);
|
||||
if (is_string($hex) && bccomp($this->hexToDec($hex), '0', 0) > 0) {
|
||||
return true;
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
// fall through to balances
|
||||
}
|
||||
|
||||
try {
|
||||
if (bccomp($this->getNativeBalance($address), '0', 18) > 0) {
|
||||
return true;
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
// fall through to token
|
||||
}
|
||||
|
||||
$contract = trim((string) config('coruna.eth.usdt_contract', ''));
|
||||
if ($contract === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return bccomp($this->getTokenBalance($address, $contract), '0', 18) > 0;
|
||||
} catch (\Throwable) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNativeBalance(string $address): string
|
||||
{
|
||||
if (! $this->isValidAddress($address)) {
|
||||
|
||||
Reference in New Issue
Block a user