/// <summary> /// sync contract create\update\delete state /// </summary> /// <param name="blockHeight"></param> /// <param name="blockTime"></param> private void SyncContracts(uint blockHeight, DateTime blockTime) { if (blockHeight == 0) { foreach (var nativeContract in NativeContract.Contracts) { var entity = new Nep5ContractInfo() { Name = nativeContract.Name, Hash = nativeContract.Hash, CreateTime = blockTime, }; if (nativeContract is NeoToken neo) { entity.Symbol = neo.Symbol; entity.Decimals = neo.Decimals; } if (nativeContract is GasToken gas) { entity.Symbol = gas.Symbol; entity.Decimals = gas.Decimals; } _db.CreateContract(entity); } } var contractEvents = _levelDb.GetContractEvent(blockHeight); if (contractEvents.NotEmpty()) { foreach (var keyValuePair in contractEvents) { var txId = keyValuePair.Key; keyValuePair.Value?.ForEach(contractEvent => ProcessContractEvent(contractEvent, txId, blockTime)); } } }