You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

527 lines
19 KiB

  1. package eth
  2. import (
  3. "context"
  4. "fmt"
  5. "math/big"
  6. "strings"
  7. "github.com/ethereum/go-ethereum"
  8. "github.com/ethereum/go-ethereum/accounts/abi"
  9. "github.com/ethereum/go-ethereum/accounts/abi/bind"
  10. ethCommon "github.com/ethereum/go-ethereum/common"
  11. "github.com/ethereum/go-ethereum/core/types"
  12. "github.com/ethereum/go-ethereum/crypto"
  13. "github.com/ethereum/go-ethereum/ethclient"
  14. WithdrawalDelayer "github.com/hermeznetwork/hermez-node/eth/contracts/withdrawdelayer"
  15. )
  16. // WDelayerConstants are the constants of the Rollup Smart Contract
  17. type WDelayerConstants struct {
  18. // Max Withdrawal Delay
  19. MaxWithdrawalDelay uint64
  20. // Max Emergency mode time
  21. MaxEmergencyModeTime uint64
  22. // HermezRollup smartcontract address
  23. HermezRollup ethCommon.Address
  24. }
  25. // DepositState is the state of Deposit
  26. type DepositState struct {
  27. Amount *big.Int
  28. DepositTimestamp uint64
  29. }
  30. // WDelayerEventDeposit is an event of the WithdrawalDelayer Smart Contract
  31. type WDelayerEventDeposit struct {
  32. Owner ethCommon.Address
  33. Token ethCommon.Address
  34. Amount *big.Int
  35. DepositTimestamp uint64
  36. }
  37. // WDelayerEventWithdraw is an event of the WithdrawalDelayer Smart Contract
  38. type WDelayerEventWithdraw struct {
  39. Owner ethCommon.Address
  40. Token ethCommon.Address
  41. Amount *big.Int
  42. }
  43. // WDelayerEventEmergencyModeEnabled an event of the WithdrawalDelayer Smart Contract
  44. type WDelayerEventEmergencyModeEnabled struct {
  45. }
  46. // WDelayerEventNewWithdrawalDelay an event of the WithdrawalDelayer Smart Contract
  47. type WDelayerEventNewWithdrawalDelay struct {
  48. WithdrawalDelay uint64
  49. }
  50. // WDelayerEventEscapeHatchWithdrawal an event of the WithdrawalDelayer Smart Contract
  51. type WDelayerEventEscapeHatchWithdrawal struct {
  52. Who ethCommon.Address
  53. To ethCommon.Address
  54. Token ethCommon.Address
  55. }
  56. // WDelayerEventNewHermezKeeperAddress an event of the WithdrawalDelayer Smart Contract
  57. type WDelayerEventNewHermezKeeperAddress struct {
  58. NewHermezKeeperAddress ethCommon.Address
  59. }
  60. // WDelayerEventNewWhiteHackGroupAddress an event of the WithdrawalDelayer Smart Contract
  61. type WDelayerEventNewWhiteHackGroupAddress struct {
  62. NewWhiteHackGroupAddress ethCommon.Address
  63. }
  64. // WDelayerEventNewHermezGovernanceDAOAddress an event of the WithdrawalDelayer Smart Contract
  65. type WDelayerEventNewHermezGovernanceDAOAddress struct {
  66. NewHermezGovernanceDAOAddress ethCommon.Address
  67. }
  68. // WDelayerEvents is the lis of events in a block of the WithdrawalDelayer Smart Contract
  69. type WDelayerEvents struct { //nolint:structcheck
  70. Deposit []WDelayerEventDeposit
  71. Withdraw []WDelayerEventWithdraw
  72. EmergencyModeEnabled []WDelayerEventEmergencyModeEnabled
  73. NewWithdrawalDelay []WDelayerEventNewWithdrawalDelay
  74. EscapeHatchWithdrawal []WDelayerEventEscapeHatchWithdrawal
  75. NewHermezKeeperAddress []WDelayerEventNewHermezKeeperAddress
  76. NewWhiteHackGroupAddress []WDelayerEventNewWhiteHackGroupAddress
  77. NewHermezGovernanceDAOAddress []WDelayerEventNewHermezGovernanceDAOAddress
  78. }
  79. // NewWDelayerEvents creates an empty WDelayerEvents with the slices initialized.
  80. func NewWDelayerEvents() WDelayerEvents {
  81. return WDelayerEvents{
  82. Deposit: make([]WDelayerEventDeposit, 0),
  83. Withdraw: make([]WDelayerEventWithdraw, 0),
  84. EmergencyModeEnabled: make([]WDelayerEventEmergencyModeEnabled, 0),
  85. NewWithdrawalDelay: make([]WDelayerEventNewWithdrawalDelay, 0),
  86. EscapeHatchWithdrawal: make([]WDelayerEventEscapeHatchWithdrawal, 0),
  87. NewHermezKeeperAddress: make([]WDelayerEventNewHermezKeeperAddress, 0),
  88. NewWhiteHackGroupAddress: make([]WDelayerEventNewWhiteHackGroupAddress, 0),
  89. NewHermezGovernanceDAOAddress: make([]WDelayerEventNewHermezGovernanceDAOAddress, 0),
  90. }
  91. }
  92. // WDelayerInterface is the inteface to WithdrawalDelayer Smart Contract
  93. type WDelayerInterface interface {
  94. //
  95. // Smart Contract Methods
  96. //
  97. WDelayerGetHermezGovernanceDAOAddress() (*ethCommon.Address, error)
  98. WDelayerSetHermezGovernanceDAOAddress(newAddress ethCommon.Address) (*types.Transaction, error)
  99. WDelayerGetHermezKeeperAddress() (*ethCommon.Address, error)
  100. WDelayerSetHermezKeeperAddress(newAddress ethCommon.Address) (*types.Transaction, error)
  101. WDelayerGetWhiteHackGroupAddress() (*ethCommon.Address, error)
  102. WDelayerSetWhiteHackGroupAddress(newAddress ethCommon.Address) (*types.Transaction, error)
  103. WDelayerIsEmergencyMode() (bool, error)
  104. WDelayerGetWithdrawalDelay() (*big.Int, error)
  105. WDelayerGetEmergencyModeStartingTime() (*big.Int, error)
  106. WDelayerEnableEmergencyMode() (*types.Transaction, error)
  107. WDelayerChangeWithdrawalDelay(newWithdrawalDelay uint64) (*types.Transaction, error)
  108. WDelayerDepositInfo(owner, token ethCommon.Address) (*big.Int, uint64)
  109. WDelayerDeposit(onwer, token ethCommon.Address, amount *big.Int) (*types.Transaction, error)
  110. WDelayerWithdrawal(owner, token ethCommon.Address) (*types.Transaction, error)
  111. WDelayerEscapeHatchWithdrawal(to, token ethCommon.Address) (*types.Transaction, error)
  112. }
  113. //
  114. // Implementation
  115. //
  116. // WDelayerClient is the implementation of the interface to the WithdrawDelayer Smart Contract in ethereum.
  117. type WDelayerClient struct {
  118. client *EthereumClient
  119. address ethCommon.Address
  120. gasLimit uint64
  121. contractAbi abi.ABI
  122. }
  123. // NewWDelayerClient creates a new WDelayerClient
  124. func NewWDelayerClient(client *EthereumClient, address ethCommon.Address) (*WDelayerClient, error) {
  125. contractAbi, err := abi.JSON(strings.NewReader(string(WithdrawalDelayer.WithdrawalDelayerABI)))
  126. if err != nil {
  127. return nil, err
  128. }
  129. return &WDelayerClient{
  130. client: client,
  131. address: address,
  132. gasLimit: 1000000, //nolint:gomnd
  133. contractAbi: contractAbi,
  134. }, nil
  135. }
  136. // WDelayerGetHermezGovernanceDAOAddress is the interface to call the smart contract function
  137. func (c *WDelayerClient) WDelayerGetHermezGovernanceDAOAddress() (*ethCommon.Address, error) {
  138. var hermezGovernanceDAOAddress ethCommon.Address
  139. if err := c.client.Call(func(ec *ethclient.Client) error {
  140. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  141. if err != nil {
  142. return err
  143. }
  144. hermezGovernanceDAOAddress, err = wdelayer.GetHermezGovernanceDAOAddress(nil)
  145. return err
  146. }); err != nil {
  147. return nil, err
  148. }
  149. return &hermezGovernanceDAOAddress, nil
  150. }
  151. // WDelayerSetHermezGovernanceDAOAddress is the interface to call the smart contract function
  152. func (c *WDelayerClient) WDelayerSetHermezGovernanceDAOAddress(newAddress ethCommon.Address) (*types.Transaction, error) {
  153. var tx *types.Transaction
  154. var err error
  155. if tx, err = c.client.CallAuth(
  156. c.gasLimit,
  157. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  158. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  159. if err != nil {
  160. return nil, err
  161. }
  162. return wdelayer.SetHermezGovernanceDAOAddress(auth, newAddress)
  163. },
  164. ); err != nil {
  165. return nil, fmt.Errorf("Failed setting hermezGovernanceDAOAddress: %w", err)
  166. }
  167. return tx, nil
  168. }
  169. // WDelayerGetHermezKeeperAddress is the interface to call the smart contract function
  170. func (c *WDelayerClient) WDelayerGetHermezKeeperAddress() (*ethCommon.Address, error) {
  171. var hermezKeeperAddress ethCommon.Address
  172. if err := c.client.Call(func(ec *ethclient.Client) error {
  173. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  174. if err != nil {
  175. return err
  176. }
  177. hermezKeeperAddress, err = wdelayer.GetHermezKeeperAddress(nil)
  178. return err
  179. }); err != nil {
  180. return nil, err
  181. }
  182. return &hermezKeeperAddress, nil
  183. }
  184. // WDelayerSetHermezKeeperAddress is the interface to call the smart contract function
  185. func (c *WDelayerClient) WDelayerSetHermezKeeperAddress(newAddress ethCommon.Address) (*types.Transaction, error) {
  186. var tx *types.Transaction
  187. var err error
  188. if tx, err = c.client.CallAuth(
  189. c.gasLimit,
  190. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  191. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  192. if err != nil {
  193. return nil, err
  194. }
  195. return wdelayer.SetHermezKeeperAddress(auth, newAddress)
  196. },
  197. ); err != nil {
  198. return nil, fmt.Errorf("Failed setting hermezKeeperAddress: %w", err)
  199. }
  200. return tx, nil
  201. }
  202. // WDelayerGetWhiteHackGroupAddress is the interface to call the smart contract function
  203. func (c *WDelayerClient) WDelayerGetWhiteHackGroupAddress() (*ethCommon.Address, error) {
  204. var whiteHackGroupAddress ethCommon.Address
  205. if err := c.client.Call(func(ec *ethclient.Client) error {
  206. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  207. if err != nil {
  208. return err
  209. }
  210. whiteHackGroupAddress, err = wdelayer.GetWhiteHackGroupAddress(nil)
  211. return err
  212. }); err != nil {
  213. return nil, err
  214. }
  215. return &whiteHackGroupAddress, nil
  216. }
  217. // WDelayerSetWhiteHackGroupAddress is the interface to call the smart contract function
  218. func (c *WDelayerClient) WDelayerSetWhiteHackGroupAddress(newAddress ethCommon.Address) (*types.Transaction, error) {
  219. var tx *types.Transaction
  220. var err error
  221. if tx, err = c.client.CallAuth(
  222. c.gasLimit,
  223. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  224. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  225. if err != nil {
  226. return nil, err
  227. }
  228. return wdelayer.SetWhiteHackGroupAddress(auth, newAddress)
  229. },
  230. ); err != nil {
  231. return nil, fmt.Errorf("Failed setting whiteHackGroupAddress: %w", err)
  232. }
  233. return tx, nil
  234. }
  235. // WDelayerIsEmergencyMode is the interface to call the smart contract function
  236. func (c *WDelayerClient) WDelayerIsEmergencyMode() (bool, error) {
  237. var ermergencyMode bool
  238. if err := c.client.Call(func(ec *ethclient.Client) error {
  239. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  240. if err != nil {
  241. return err
  242. }
  243. ermergencyMode, err = wdelayer.IsEmergencyMode(nil)
  244. return err
  245. }); err != nil {
  246. return false, err
  247. }
  248. return ermergencyMode, nil
  249. }
  250. // WDelayerGetWithdrawalDelay is the interface to call the smart contract function
  251. func (c *WDelayerClient) WDelayerGetWithdrawalDelay() (*big.Int, error) {
  252. var withdrawalDelay *big.Int
  253. if err := c.client.Call(func(ec *ethclient.Client) error {
  254. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  255. if err != nil {
  256. return err
  257. }
  258. withdrawalDelay, err = wdelayer.GetWithdrawalDelay(nil)
  259. return err
  260. }); err != nil {
  261. return nil, err
  262. }
  263. return withdrawalDelay, nil
  264. }
  265. // WDelayerGetEmergencyModeStartingTime is the interface to call the smart contract function
  266. func (c *WDelayerClient) WDelayerGetEmergencyModeStartingTime() (*big.Int, error) {
  267. var emergencyModeStartingTime *big.Int
  268. if err := c.client.Call(func(ec *ethclient.Client) error {
  269. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  270. if err != nil {
  271. return err
  272. }
  273. emergencyModeStartingTime, err = wdelayer.GetEmergencyModeStartingTime(nil)
  274. return err
  275. }); err != nil {
  276. return nil, err
  277. }
  278. return emergencyModeStartingTime, nil
  279. }
  280. // WDelayerEnableEmergencyMode is the interface to call the smart contract function
  281. func (c *WDelayerClient) WDelayerEnableEmergencyMode() (*types.Transaction, error) {
  282. var tx *types.Transaction
  283. var err error
  284. if tx, err = c.client.CallAuth(
  285. c.gasLimit,
  286. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  287. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  288. if err != nil {
  289. return nil, err
  290. }
  291. return wdelayer.EnableEmergencyMode(auth)
  292. },
  293. ); err != nil {
  294. return nil, fmt.Errorf("Failed setting enable emergency mode: %w", err)
  295. }
  296. return tx, nil
  297. }
  298. // WDelayerChangeWithdrawalDelay is the interface to call the smart contract function
  299. func (c *WDelayerClient) WDelayerChangeWithdrawalDelay(newWithdrawalDelay uint64) (*types.Transaction, error) {
  300. var tx *types.Transaction
  301. var err error
  302. if tx, err = c.client.CallAuth(
  303. c.gasLimit,
  304. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  305. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  306. if err != nil {
  307. return nil, err
  308. }
  309. return wdelayer.ChangeWithdrawalDelay(auth, newWithdrawalDelay)
  310. },
  311. ); err != nil {
  312. return nil, fmt.Errorf("Failed setting withdrawal delay: %w", err)
  313. }
  314. return tx, nil
  315. }
  316. // WDelayerDepositInfo is the interface to call the smart contract function
  317. func (c *WDelayerClient) WDelayerDepositInfo(owner, token ethCommon.Address) (DepositState, error) {
  318. var depositInfo DepositState
  319. if err := c.client.Call(func(ec *ethclient.Client) error {
  320. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  321. if err != nil {
  322. return err
  323. }
  324. amount, depositTimestamp, err := wdelayer.DepositInfo(nil, owner, token)
  325. depositInfo.Amount = amount
  326. depositInfo.DepositTimestamp = depositTimestamp
  327. return err
  328. }); err != nil {
  329. return depositInfo, err
  330. }
  331. return depositInfo, nil
  332. }
  333. // WDelayerDeposit is the interface to call the smart contract function
  334. func (c *WDelayerClient) WDelayerDeposit(owner, token ethCommon.Address, amount *big.Int) (*types.Transaction, error) {
  335. var tx *types.Transaction
  336. var err error
  337. if tx, err = c.client.CallAuth(
  338. c.gasLimit,
  339. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  340. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  341. if err != nil {
  342. return nil, err
  343. }
  344. return wdelayer.Deposit(auth, owner, token, amount)
  345. },
  346. ); err != nil {
  347. return nil, fmt.Errorf("Failed deposit: %w", err)
  348. }
  349. return tx, nil
  350. }
  351. // WDelayerWithdrawal is the interface to call the smart contract function
  352. func (c *WDelayerClient) WDelayerWithdrawal(owner, token ethCommon.Address) (*types.Transaction, error) {
  353. var tx *types.Transaction
  354. var err error
  355. if tx, err = c.client.CallAuth(
  356. c.gasLimit,
  357. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  358. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  359. if err != nil {
  360. return nil, err
  361. }
  362. return wdelayer.Withdrawal(auth, owner, token)
  363. },
  364. ); err != nil {
  365. return nil, fmt.Errorf("Failed withdrawal: %w", err)
  366. }
  367. return tx, nil
  368. }
  369. // WDelayerEscapeHatchWithdrawal is the interface to call the smart contract function
  370. func (c *WDelayerClient) WDelayerEscapeHatchWithdrawal(to, token ethCommon.Address) (*types.Transaction, error) {
  371. var tx *types.Transaction
  372. var err error
  373. if tx, err = c.client.CallAuth(
  374. c.gasLimit,
  375. func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
  376. wdelayer, err := WithdrawalDelayer.NewWithdrawalDelayer(c.address, ec)
  377. if err != nil {
  378. return nil, err
  379. }
  380. return wdelayer.EscapeHatchWithdrawal(auth, to, token)
  381. },
  382. ); err != nil {
  383. return nil, fmt.Errorf("Failed escapeHatchWithdrawal: %w", err)
  384. }
  385. return tx, nil
  386. }
  387. var (
  388. logDeposit = crypto.Keccak256Hash([]byte("Deposit(address,address,uint192,uint64)"))
  389. logWithdraw = crypto.Keccak256Hash([]byte("Withdraw(address,address,uint192)"))
  390. logEmergencyModeEnabled = crypto.Keccak256Hash([]byte("EmergencyModeEnabled()"))
  391. logNewWithdrawalDelay = crypto.Keccak256Hash([]byte("NewWithdrawalDelay(uint64)"))
  392. logEscapeHatchWithdrawal = crypto.Keccak256Hash([]byte("EscapeHatchWithdrawal(address,address,address)"))
  393. logNewHermezKeeperAddress = crypto.Keccak256Hash([]byte("NewHermezKeeperAddress(address)"))
  394. logNewWhiteHackGroupAddress = crypto.Keccak256Hash([]byte("NewWhiteHackGroupAddress(address)"))
  395. logNewHermezGovernanceDAOAddress = crypto.Keccak256Hash([]byte("NewHermezGovernanceDAOAddress(address)"))
  396. )
  397. // WDelayerEventsByBlock returns the events in a block that happened in the
  398. // WDelayer Smart Contract and the blockHash where the eents happened. If
  399. // there are no events in that block, blockHash is nil.
  400. func (c *WDelayerClient) WDelayerEventsByBlock(blockNum int64) (*WDelayerEvents, *ethCommon.Hash, error) {
  401. var wdelayerEvents WDelayerEvents
  402. var blockHash ethCommon.Hash
  403. query := ethereum.FilterQuery{
  404. FromBlock: big.NewInt(blockNum),
  405. ToBlock: big.NewInt(blockNum),
  406. Addresses: []ethCommon.Address{
  407. c.address,
  408. },
  409. BlockHash: nil,
  410. Topics: [][]ethCommon.Hash{},
  411. }
  412. logs, err := c.client.client.FilterLogs(context.Background(), query)
  413. if err != nil {
  414. return nil, nil, err
  415. }
  416. if len(logs) > 0 {
  417. blockHash = logs[0].BlockHash
  418. }
  419. for _, vLog := range logs {
  420. if vLog.BlockHash != blockHash {
  421. return nil, nil, ErrBlockHashMismatchEvent
  422. }
  423. switch vLog.Topics[0] {
  424. case logDeposit:
  425. var deposit WDelayerEventDeposit
  426. err := c.contractAbi.Unpack(&deposit, "Deposit", vLog.Data)
  427. if err != nil {
  428. return nil, nil, err
  429. }
  430. deposit.Owner = ethCommon.BytesToAddress(vLog.Topics[1].Bytes())
  431. deposit.Token = ethCommon.BytesToAddress(vLog.Topics[2].Bytes())
  432. wdelayerEvents.Deposit = append(wdelayerEvents.Deposit, deposit)
  433. case logWithdraw:
  434. var withdraw WDelayerEventWithdraw
  435. err := c.contractAbi.Unpack(&withdraw, "Withdraw", vLog.Data)
  436. if err != nil {
  437. return nil, nil, err
  438. }
  439. withdraw.Token = ethCommon.BytesToAddress(vLog.Topics[1].Bytes())
  440. withdraw.Owner = ethCommon.BytesToAddress(vLog.Topics[2].Bytes())
  441. wdelayerEvents.Withdraw = append(wdelayerEvents.Withdraw, withdraw)
  442. case logEmergencyModeEnabled:
  443. var emergencyModeEnabled WDelayerEventEmergencyModeEnabled
  444. wdelayerEvents.EmergencyModeEnabled = append(wdelayerEvents.EmergencyModeEnabled, emergencyModeEnabled)
  445. case logNewWithdrawalDelay:
  446. var withdrawalDelay WDelayerEventNewWithdrawalDelay
  447. err := c.contractAbi.Unpack(&withdrawalDelay, "NewWithdrawalDelay", vLog.Data)
  448. if err != nil {
  449. return nil, nil, err
  450. }
  451. wdelayerEvents.NewWithdrawalDelay = append(wdelayerEvents.NewWithdrawalDelay, withdrawalDelay)
  452. case logEscapeHatchWithdrawal:
  453. var escapeHatchWithdrawal WDelayerEventEscapeHatchWithdrawal
  454. escapeHatchWithdrawal.Who = ethCommon.BytesToAddress(vLog.Topics[1].Bytes())
  455. escapeHatchWithdrawal.To = ethCommon.BytesToAddress(vLog.Topics[2].Bytes())
  456. escapeHatchWithdrawal.Token = ethCommon.BytesToAddress(vLog.Topics[3].Bytes())
  457. wdelayerEvents.EscapeHatchWithdrawal = append(wdelayerEvents.EscapeHatchWithdrawal, escapeHatchWithdrawal)
  458. case logNewHermezKeeperAddress:
  459. var keeperAddress WDelayerEventNewHermezKeeperAddress
  460. err := c.contractAbi.Unpack(&keeperAddress, "NewHermezKeeperAddress", vLog.Data)
  461. if err != nil {
  462. return nil, nil, err
  463. }
  464. wdelayerEvents.NewHermezKeeperAddress = append(wdelayerEvents.NewHermezKeeperAddress, keeperAddress)
  465. case logNewWhiteHackGroupAddress:
  466. var whiteHackGroupAddress WDelayerEventNewWhiteHackGroupAddress
  467. err := c.contractAbi.Unpack(&whiteHackGroupAddress, "NewWhiteHackGroupAddress", vLog.Data)
  468. if err != nil {
  469. return nil, nil, err
  470. }
  471. wdelayerEvents.NewWhiteHackGroupAddress = append(wdelayerEvents.NewWhiteHackGroupAddress, whiteHackGroupAddress)
  472. case logNewHermezGovernanceDAOAddress:
  473. var governanceDAOAddress WDelayerEventNewHermezGovernanceDAOAddress
  474. err := c.contractAbi.Unpack(&governanceDAOAddress, "NewHermezGovernanceDAOAddress", vLog.Data)
  475. if err != nil {
  476. return nil, nil, err
  477. }
  478. wdelayerEvents.NewHermezGovernanceDAOAddress = append(wdelayerEvents.NewHermezGovernanceDAOAddress, governanceDAOAddress)
  479. }
  480. }
  481. return &wdelayerEvents, &blockHash, nil
  482. }