1
This commit is contained in:
parent
eb682da7ff
commit
0f4e6cc563
@ -16,6 +16,8 @@ class Transfer extends BaseEventProcess {
|
||||
if (bcutils.isSysAddress(from)) {
|
||||
const airDropMeta = metaFactory.getAirDrop(tokenId);
|
||||
if (airDropMeta) {
|
||||
const exists = await this.exists721Nft(tokenId, this.getContractAddress());
|
||||
if (!exists) {
|
||||
await this.mint721Nft(
|
||||
to,
|
||||
tokenId,
|
||||
@ -24,6 +26,7 @@ class Transfer extends BaseEventProcess {
|
||||
this.getContractAddress(),
|
||||
this.getBlockNumber()
|
||||
);
|
||||
}
|
||||
await this.apiMint(airDropMeta);
|
||||
}
|
||||
}
|
||||
|
@ -300,6 +300,23 @@ class BaseEventProcess {
|
||||
}
|
||||
}
|
||||
|
||||
async exists721Nft(tokenId, contractAddress) {
|
||||
const logHead = this.genLogHead(' exists721Nft ');
|
||||
const {err, row} = await this.bcNftDbConn(
|
||||
'ormSelectOne',
|
||||
't_nft',
|
||||
[
|
||||
['net_id', this.getNetId()],
|
||||
['contract_address', contractAddress],
|
||||
['token_id', tokenId],
|
||||
]
|
||||
);
|
||||
if (err) {
|
||||
this.throwError(logHead + err);
|
||||
}
|
||||
return row ? true : false;
|
||||
}
|
||||
|
||||
async mint721Nft(address, tokenId, itemId, tokenType,
|
||||
contractAddress, blockNumber) {
|
||||
const logHead = this.genLogHead(' mint721Nft ');
|
||||
|
Loading…
x
Reference in New Issue
Block a user