| | |
| | | @Component |
| | | public class ContractInit { |
| | | |
| | | @Autowired |
| | | private ContractMain contractMain; |
| | | // @Autowired |
| | | // private ContractMain contractMain; |
| | | |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | |
| | | private RedisService redisService; |
| | | |
| | | |
| | | @PostConstruct |
| | | public void init(){ |
| | | // 设置起始区块编号 TODO |
| | | BigInteger start = new BigInteger("23886625"); |
| | | // 需要打开 获取最新区块编号 |
| | | Object bnb_block_number = redisService.get("BNB_BLOCK_NUMBER"); |
| | | if(bnb_block_number !=null){ |
| | | start = BigInteger.valueOf(Long.valueOf(bnb_block_number.toString())); |
| | | } |
| | | // DataDictionaryCustom feeAddressKey = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.FEE_ADDRESS_KEY.getType(), DataDictionaryEnum.FEE_ADDRESS_KEY.getCode()); |
| | | // AppContants.FEE_ADDRESS_KEY.put("feeAddressKey",feeAddressKey.getValue()); |
| | | // feeAddressKey.setValue("已初始化"); |
| | | // dataDictionaryCustomMapper.updateById(feeAddressKey); |
| | | System.out.println("启动区块事件监听,监听起始:"+start); |
| | | // System.out.println("启动区块事件监听,监听起始:"+AppContants.FEE_ADDRESS_KEY.get("feeAddressKey").toString() ); |
| | | contractMain.listenBetting(start); |
| | | } |
| | | // @PostConstruct |
| | | // public void init(){ |
| | | // // 设置起始区块编号 TODO |
| | | // BigInteger start = new BigInteger("28282373"); |
| | | // // 需要打开 获取最新区块编号 |
| | | // Object bnb_block_number = redisService.get("BNB_BLOCK_NUMBER"); |
| | | // if(bnb_block_number !=null){ |
| | | // start = BigInteger.valueOf(Long.valueOf(bnb_block_number.toString())); |
| | | // } |
| | | // System.out.println("启动区块事件监听,监听起始:"+start); |
| | | //// contractMain.listenBetting(start); |
| | | // } |
| | | } |