This commit is contained in:
aozhiwei 2023-08-31 19:15:06 +08:00
parent 6e2d8196c9
commit f93de9047b
3 changed files with 67 additions and 0 deletions

View File

@ -6,6 +6,7 @@ const BC_NFT_BLIND_BOX = 4;
const BC_NFT_FRAGMENT = 5;
const BC_NFT_CLAIM_BOX = 6;
const BC_NFT_GENESIS = 7;
const BC_NFT_PLANET = 8;
const BC_FUNC_CREATION = 1;
const BC_FUNC_GUILD = 3;
@ -30,6 +31,7 @@ exports.BC_NFT_BLIND_BOX = BC_NFT_BLIND_BOX;
exports.BC_NFT_FRAGMENT = BC_NFT_FRAGMENT;
exports.BC_NFT_CLAIM_BOX = BC_NFT_CLAIM_BOX;
exports.BC_NFT_GENESIS = BC_NFT_GENESIS;
exports.BC_NFT_PLANET = BC_NFT_PLANET;
exports.BC_FUNC_CREATION = BC_FUNC_CREATION;
exports.BC_FUNC_GUILD = BC_FUNC_GUILD;

View File

@ -0,0 +1,64 @@
const log = require('j7/log');
const utils = require('j7/utils');
const bcutils = require('j7/bcutils');
const bcconst = require('common/bcconst');
const constant = require('common/constant');
const BaseEventProcess = require('../common/BaseEventProcess');
class Transfer extends BaseEventProcess {
async start() {
const returnValues = this.getReturnValues();
//if (bcutils.isSysAddress(returnValues['from'])) {
await this.mint(returnValues['from'],
returnValues['to'],
returnValues['tokenId']
);
//}
/*
await this.add721NftRefresh
(
this.getNetId(),
this.getContractAddress(),
this.getContractName(),
returnValues['tokenId']
);*/
await this.markOk();
}
async mint(from, to, tokenId) {
const logHead = this.genLogHead(' mint ');
const nowTime = utils.getUtcTime();
const fieldList = [
['token_id', tokenId],
['token_type', bcconst.BC_NFT_PLANET],
['item_id', tokenId],
['owner_address', bcutils.toNormalAddress(to)],
['creator_address', bcutils.toNormalAddress(to)],
['confirm_block_number', this.getBlockNumber()],
['net_id', this.getNetId()],
['contract_address', this.getContractAddress()],
['createtime', nowTime],
['modifytime', nowTime],
];
const {err} = await this.bcNftDbConn(
'upsert',
't_nft',
[
['token_id', tokenId],
['net_id', this.getNetId()],
['contract_address', this.getContractAddress()],
],
[
['owner_address', bcutils.toNormalAddress(to)],
],
fieldList
);
if (err) {
this.throwError('mintNft ' + err);
}
}
}
module.exports = Transfer;

View File

@ -22,6 +22,7 @@ async function init() {
await add('CHIP.Transfer', 'CHIP/transfer');
await add('Gacha.Transfer', 'Gacha/transfer');
await add('Genesis.Transfer', 'Genesis/transfer');
await add('PLANET.Transfer', 'PLANET/transfer');
await add('UserMinterFactory.TokenMinted', 'UserMinterFactory/activate721nft');
await add('BENftMarket.SellOrder', 'BENftMarket/sell_order');
await add('BENftMarket.CancelOrder', 'BENftMarket/cancel_order');