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.

561 lines
20 KiB

  1. package eth
  2. import (
  3. "math/big"
  4. ethCommon "github.com/ethereum/go-ethereum/common"
  5. "github.com/ethereum/go-ethereum/core/types"
  6. "github.com/ethereum/go-ethereum/ethclient"
  7. HermezAuctionProtocol "github.com/hermeznetwork/hermez-node/eth/contracts/auction"
  8. "github.com/hermeznetwork/hermez-node/log"
  9. )
  10. // AuctionConstants are the constants of the Rollup Smart Contract
  11. type AuctionConstants struct {
  12. // Blocks to wait before starting with the first slot
  13. DelayGenesis uint16
  14. // Blocks per slot
  15. BlocksPerSlot uint8
  16. // Minimum bid when no one has bid yet
  17. InitialMinimalBidding *big.Int
  18. // First block where the first slot begins
  19. GenesisBlockNum int64
  20. // Hermez Governanze Token smartcontract address who controls some parameters and collects HEZ fee
  21. GovernanceAddress ethCommon.Address
  22. // ERC777 token with which the bids will be made
  23. TokenHEZ ethCommon.Address
  24. // HermezRollup smartcontract address
  25. HermezRollup ethCommon.Address
  26. }
  27. // SlotState is the state of a slot
  28. type SlotState struct {
  29. Forger ethCommon.Address
  30. BidAmount *big.Int
  31. ClosedMinBid *big.Int
  32. Fulfilled bool
  33. }
  34. // NewSlotState returns an empty SlotState
  35. func NewSlotState() *SlotState {
  36. return &SlotState{
  37. Forger: ethCommon.Address{},
  38. BidAmount: big.NewInt(0),
  39. ClosedMinBid: big.NewInt(0),
  40. Fulfilled: false,
  41. }
  42. }
  43. // Coordinator is the details of the Coordinator identified by the forger address
  44. type Coordinator struct {
  45. WithdrawalAddress ethCommon.Address
  46. URL string
  47. }
  48. // AuctionVariables are the variables of the Auction Smart Contract
  49. type AuctionVariables struct {
  50. // Boot Coordinator Address
  51. DonationAddress ethCommon.Address
  52. // Boot Coordinator Address
  53. BootCoordinator ethCommon.Address
  54. // The minimum bid value in a series of 6 slots
  55. DefaultSlotSetBid [6]*big.Int
  56. // Distance (#slots) to the closest slot to which you can bid ( 2 Slots = 2 * 40 Blocks = 20 min )
  57. ClosedAuctionSlots uint16
  58. // Distance (#slots) to the farthest slot to which you can bid (30 days = 4320 slots )
  59. OpenAuctionSlots uint16
  60. // How the HEZ tokens deposited by the slot winner are distributed (Burn: 40% - Donation: 40% - HGT: 20%)
  61. AllocationRatio [3]uint16
  62. // Minimum outbid (percentage) over the previous one to consider it valid
  63. Outbidding uint16
  64. // Number of blocks at the end of a slot in which any coordinator can forge if the winner has not forged one before
  65. SlotDeadline uint8
  66. }
  67. // AuctionState represents the state of the Rollup in the Smart Contract
  68. type AuctionState struct {
  69. // Mapping to control slot state
  70. Slots map[int64]*SlotState
  71. // Mapping to control balances pending to claim
  72. PendingBalances map[ethCommon.Address]*big.Int
  73. // Mapping to register all the coordinators. The address used for the mapping is the forger address
  74. Coordinators map[ethCommon.Address]*Coordinator
  75. }
  76. // AuctionEventNewBid is an event of the Auction Smart Contract
  77. type AuctionEventNewBid struct {
  78. Slot int64
  79. BidAmount *big.Int
  80. CoordinatorForger ethCommon.Address
  81. }
  82. // AuctionEventNewSlotDeadline is an event of the Auction Smart Contract
  83. type AuctionEventNewSlotDeadline struct {
  84. NewSlotDeadline uint8
  85. }
  86. // AuctionEventNewClosedAuctionSlots is an event of the Auction Smart Contract
  87. type AuctionEventNewClosedAuctionSlots struct {
  88. NewClosedAuctionSlots uint16
  89. }
  90. // AuctionEventNewOutbidding is an event of the Auction Smart Contract
  91. type AuctionEventNewOutbidding struct {
  92. NewOutbidding uint16
  93. }
  94. // AuctionEventNewDonationAddress is an event of the Auction Smart Contract
  95. type AuctionEventNewDonationAddress struct {
  96. NewDonationAddress ethCommon.Address
  97. }
  98. // AuctionEventNewBootCoordinator is an event of the Auction Smart Contract
  99. type AuctionEventNewBootCoordinator struct {
  100. NewBootCoordinator ethCommon.Address
  101. }
  102. // AuctionEventNewOpenAuctionSlots is an event of the Auction Smart Contract
  103. type AuctionEventNewOpenAuctionSlots struct {
  104. NewOpenAuctionSlots uint16
  105. }
  106. // AuctionEventNewAllocationRatio is an event of the Auction Smart Contract
  107. type AuctionEventNewAllocationRatio struct {
  108. NewAllocationRatio [3]uint16
  109. }
  110. // AuctionEventNewCoordinator is an event of the Auction Smart Contract
  111. type AuctionEventNewCoordinator struct {
  112. ForgerAddress ethCommon.Address
  113. WithdrawalAddress ethCommon.Address
  114. URL string
  115. }
  116. // AuctionEventCoordinatorUpdated is an event of the Auction Smart Contract
  117. type AuctionEventCoordinatorUpdated struct {
  118. ForgerAddress ethCommon.Address
  119. WithdrawalAddress ethCommon.Address
  120. URL string
  121. }
  122. // AuctionEventNewForgeAllocated is an event of the Auction Smart Contract
  123. type AuctionEventNewForgeAllocated struct {
  124. Forger ethCommon.Address
  125. CurrentSlot int64
  126. BurnAmount *big.Int
  127. DonationAmount *big.Int
  128. GovernanceAmount *big.Int
  129. }
  130. // AuctionEventNewDefaultSlotSetBid is an event of the Auction Smart Contract
  131. type AuctionEventNewDefaultSlotSetBid struct {
  132. SlotSet int64
  133. NewInitialMinBid *big.Int
  134. }
  135. // AuctionEventNewForge is an event of the Auction Smart Contract
  136. type AuctionEventNewForge struct {
  137. Forger ethCommon.Address
  138. CurrentSlot int64
  139. }
  140. // AuctionEventHEZClaimed is an event of the Auction Smart Contract
  141. type AuctionEventHEZClaimed struct {
  142. Owner ethCommon.Address
  143. Amount *big.Int
  144. }
  145. // AuctionEvents is the list of events in a block of the Auction Smart Contract
  146. type AuctionEvents struct { //nolint:structcheck
  147. NewBid []AuctionEventNewBid
  148. NewSlotDeadline []AuctionEventNewSlotDeadline
  149. NewClosedAuctionSlots []AuctionEventNewClosedAuctionSlots
  150. NewOutbidding []AuctionEventNewOutbidding
  151. NewDonationAddress []AuctionEventNewDonationAddress
  152. NewBootCoordinator []AuctionEventNewBootCoordinator
  153. NewOpenAuctionSlots []AuctionEventNewOpenAuctionSlots
  154. NewAllocationRatio []AuctionEventNewAllocationRatio
  155. NewCoordinator []AuctionEventNewCoordinator
  156. CoordinatorUpdated []AuctionEventCoordinatorUpdated
  157. NewForgeAllocated []AuctionEventNewForgeAllocated
  158. NewDefaultSlotSetBid []AuctionEventNewDefaultSlotSetBid
  159. NewForge []AuctionEventNewForge
  160. HEZClaimed []AuctionEventHEZClaimed
  161. }
  162. // NewAuctionEvents creates an empty AuctionEvents with the slices initialized.
  163. func NewAuctionEvents() AuctionEvents {
  164. return AuctionEvents{
  165. NewBid: make([]AuctionEventNewBid, 0),
  166. NewSlotDeadline: make([]AuctionEventNewSlotDeadline, 0),
  167. NewClosedAuctionSlots: make([]AuctionEventNewClosedAuctionSlots, 0),
  168. NewOutbidding: make([]AuctionEventNewOutbidding, 0),
  169. NewDonationAddress: make([]AuctionEventNewDonationAddress, 0),
  170. NewBootCoordinator: make([]AuctionEventNewBootCoordinator, 0),
  171. NewOpenAuctionSlots: make([]AuctionEventNewOpenAuctionSlots, 0),
  172. NewAllocationRatio: make([]AuctionEventNewAllocationRatio, 0),
  173. NewCoordinator: make([]AuctionEventNewCoordinator, 0),
  174. CoordinatorUpdated: make([]AuctionEventCoordinatorUpdated, 0),
  175. NewForgeAllocated: make([]AuctionEventNewForgeAllocated, 0),
  176. NewDefaultSlotSetBid: make([]AuctionEventNewDefaultSlotSetBid, 0),
  177. NewForge: make([]AuctionEventNewForge, 0),
  178. HEZClaimed: make([]AuctionEventHEZClaimed, 0),
  179. }
  180. }
  181. // AuctionInterface is the inteface to to Auction Smart Contract
  182. type AuctionInterface interface {
  183. //
  184. // Smart Contract Methods
  185. //
  186. // Getter/Setter, where Setter is onlyOwner
  187. AuctionSetSlotDeadline(newDeadline uint8) (*types.Transaction, error)
  188. AuctionGetSlotDeadline() (uint8, error)
  189. AuctionSetOpenAuctionSlots(newOpenAuctionSlots uint16) (*types.Transaction, error)
  190. AuctionGetOpenAuctionSlots() (uint16, error)
  191. AuctionSetClosedAuctionSlots(newClosedAuctionSlots uint16) (*types.Transaction, error)
  192. AuctionGetClosedAuctionSlots() (uint16, error)
  193. AuctionSetOutbidding(newOutbidding uint16) (*types.Transaction, error)
  194. AuctionGetOutbidding() (uint16, error)
  195. AuctionSetAllocationRatio(newAllocationRatio [3]uint16) (*types.Transaction, error)
  196. AuctionGetAllocationRatio() ([3]uint16, error)
  197. AuctionSetDonationAddress(newDonationAddress ethCommon.Address) (*types.Transaction, error)
  198. AuctionGetDonationAddress() (*ethCommon.Address, error)
  199. AuctionSetBootCoordinator(newBootCoordinator ethCommon.Address) (*types.Transaction, error)
  200. AuctionGetBootCoordinator() (*ethCommon.Address, error)
  201. AuctionChangeDefaultSlotSetBid(slotSet int64, newInitialMinBid *big.Int) (*types.Transaction, error)
  202. // Coordinator Management
  203. AuctionRegisterCoordinator(forgerAddress ethCommon.Address, URL string) (*types.Transaction, error)
  204. AuctionIsRegisteredCoordinator(forgerAddress ethCommon.Address) (bool, error)
  205. AuctionUpdateCoordinatorInfo(forgerAddress ethCommon.Address, newWithdrawAddress ethCommon.Address, newURL string) (*types.Transaction, error)
  206. // Slot Info
  207. AuctionGetCurrentSlotNumber() (int64, error)
  208. AuctionGetMinBidBySlot(slot int64) (*big.Int, error)
  209. AuctionGetDefaultSlotSetBid(slotSet uint8) (*big.Int, error)
  210. // Bidding
  211. // AuctionTokensReceived(operator, from, to ethCommon.Address, amount *big.Int,
  212. // userData, operatorData []byte) error // Only called from another smart contract
  213. AuctionBid(slot int64, bidAmount *big.Int, forger ethCommon.Address) (*types.Transaction, error)
  214. AuctionMultiBid(startingSlot int64, endingSlot int64, slotSet [6]bool,
  215. maxBid, closedMinBid, budget *big.Int, forger ethCommon.Address) (*types.Transaction, error)
  216. // Forge
  217. AuctionCanForge(forger ethCommon.Address) (bool, error)
  218. // AuctionForge(forger ethCommon.Address) (bool, error) // Only called from another smart contract
  219. // Fees
  220. AuctionClaimHEZ() (*types.Transaction, error)
  221. //
  222. // Smart Contract Status
  223. //
  224. AuctionConstants() (*AuctionConstants, error)
  225. AuctionEventsByBlock(blockNum int64) (*AuctionEvents, *ethCommon.Hash, error)
  226. }
  227. //
  228. // Implementation
  229. //
  230. // AuctionClient is the implementation of the interface to the Auction Smart Contract in ethereum.
  231. type AuctionClient struct {
  232. client *EthereumClient
  233. address ethCommon.Address
  234. }
  235. // NewAuctionClient creates a new AuctionClient
  236. func NewAuctionClient(client *EthereumClient, address ethCommon.Address) *AuctionClient {
  237. return &AuctionClient{
  238. client: client,
  239. address: address,
  240. }
  241. }
  242. // AuctionSetSlotDeadline is the interface to call the smart contract function
  243. func (c *AuctionClient) AuctionSetSlotDeadline(newDeadline uint8) (*types.Transaction, error) {
  244. log.Error("TODO")
  245. return nil, errTODO
  246. }
  247. // AuctionGetSlotDeadline is the interface to call the smart contract function
  248. func (c *AuctionClient) AuctionGetSlotDeadline() (uint8, error) {
  249. var slotDeadline uint8
  250. if err := c.client.Call(func(ec *ethclient.Client) error {
  251. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  252. if err != nil {
  253. return err
  254. }
  255. slotDeadline, err = auction.GetSlotDeadline(nil)
  256. return err
  257. }); err != nil {
  258. return 0, err
  259. }
  260. return slotDeadline, nil
  261. }
  262. // AuctionSetOpenAuctionSlots is the interface to call the smart contract function
  263. func (c *AuctionClient) AuctionSetOpenAuctionSlots(newOpenAuctionSlots uint16) (*types.Transaction, error) {
  264. log.Error("TODO")
  265. return nil, errTODO
  266. }
  267. // AuctionGetOpenAuctionSlots is the interface to call the smart contract function
  268. func (c *AuctionClient) AuctionGetOpenAuctionSlots() (uint16, error) {
  269. var openAuctionSlots uint16
  270. if err := c.client.Call(func(ec *ethclient.Client) error {
  271. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  272. if err != nil {
  273. return err
  274. }
  275. openAuctionSlots, err = auction.GetOpenAuctionSlots(nil)
  276. return err
  277. }); err != nil {
  278. return 0, err
  279. }
  280. return openAuctionSlots, nil
  281. }
  282. // AuctionSetClosedAuctionSlots is the interface to call the smart contract function
  283. func (c *AuctionClient) AuctionSetClosedAuctionSlots(newClosedAuctionSlots uint16) (*types.Transaction, error) {
  284. log.Error("TODO")
  285. return nil, errTODO
  286. }
  287. // AuctionGetClosedAuctionSlots is the interface to call the smart contract function
  288. func (c *AuctionClient) AuctionGetClosedAuctionSlots() (uint16, error) {
  289. var closedAuctionSlots uint16
  290. if err := c.client.Call(func(ec *ethclient.Client) error {
  291. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  292. if err != nil {
  293. return err
  294. }
  295. closedAuctionSlots, err = auction.GetClosedAuctionSlots(nil)
  296. return err
  297. }); err != nil {
  298. return 0, err
  299. }
  300. return closedAuctionSlots, nil
  301. }
  302. // AuctionSetOutbidding is the interface to call the smart contract function
  303. func (c *AuctionClient) AuctionSetOutbidding(newOutbidding uint16) (*types.Transaction, error) {
  304. log.Error("TODO")
  305. return nil, errTODO
  306. }
  307. // AuctionGetOutbidding is the interface to call the smart contract function
  308. func (c *AuctionClient) AuctionGetOutbidding() (uint16, error) {
  309. // TODO: Update
  310. // var outbidding uint8
  311. // if err := c.client.Call(func(ec *ethclient.Client) error {
  312. // auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  313. // if err != nil {
  314. // return err
  315. // }
  316. // outbidding, err = auction.GetOutbidding(nil)
  317. // return err
  318. // }); err != nil {
  319. // return 0, err
  320. // }
  321. // return outbidding, nil
  322. log.Error("TODO")
  323. return 0, errTODO
  324. }
  325. // AuctionSetAllocationRatio is the interface to call the smart contract function
  326. func (c *AuctionClient) AuctionSetAllocationRatio(newAllocationRatio [3]uint16) (*types.Transaction, error) {
  327. log.Error("TODO")
  328. return nil, errTODO
  329. }
  330. // AuctionGetAllocationRatio is the interface to call the smart contract function
  331. func (c *AuctionClient) AuctionGetAllocationRatio() ([3]uint16, error) {
  332. // TODO: Update
  333. // var allocationRation [3]uint8
  334. // if err := c.client.Call(func(ec *ethclient.Client) error {
  335. // auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  336. // if err != nil {
  337. // return err
  338. // }
  339. // allocationRation, err = auction.GetAllocationRatio(nil)
  340. // return err
  341. // }); err != nil {
  342. // return [3]uint8{}, err
  343. // }
  344. // return allocationRation, nil
  345. log.Error("TODO")
  346. return [3]uint16{}, errTODO
  347. }
  348. // AuctionSetDonationAddress is the interface to call the smart contract function
  349. func (c *AuctionClient) AuctionSetDonationAddress(newDonationAddress ethCommon.Address) (*types.Transaction, error) {
  350. log.Error("TODO")
  351. return nil, errTODO
  352. }
  353. // AuctionGetDonationAddress is the interface to call the smart contract function
  354. func (c *AuctionClient) AuctionGetDonationAddress() (*ethCommon.Address, error) {
  355. var donationAddress ethCommon.Address
  356. if err := c.client.Call(func(ec *ethclient.Client) error {
  357. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  358. if err != nil {
  359. return err
  360. }
  361. donationAddress, err = auction.GetDonationAddress(nil)
  362. return err
  363. }); err != nil {
  364. return nil, err
  365. }
  366. return &donationAddress, nil
  367. }
  368. // AuctionSetBootCoordinator is the interface to call the smart contract function
  369. func (c *AuctionClient) AuctionSetBootCoordinator(newBootCoordinator ethCommon.Address) (*types.Transaction, error) {
  370. log.Error("TODO")
  371. return nil, errTODO
  372. }
  373. // AuctionGetBootCoordinator is the interface to call the smart contract function
  374. func (c *AuctionClient) AuctionGetBootCoordinator() (*ethCommon.Address, error) {
  375. var bootCoordinator ethCommon.Address
  376. if err := c.client.Call(func(ec *ethclient.Client) error {
  377. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  378. if err != nil {
  379. return err
  380. }
  381. bootCoordinator, err = auction.GetBootCoordinator(nil)
  382. return err
  383. }); err != nil {
  384. return nil, err
  385. }
  386. return &bootCoordinator, nil
  387. }
  388. // AuctionChangeDefaultSlotSetBid is the interface to call the smart contract function
  389. func (c *AuctionClient) AuctionChangeDefaultSlotSetBid(slotSet int64, newInitialMinBid *big.Int) (*types.Transaction, error) {
  390. log.Error("TODO")
  391. return nil, errTODO
  392. }
  393. // AuctionRegisterCoordinator is the interface to call the smart contract function
  394. func (c *AuctionClient) AuctionRegisterCoordinator(forgerAddress ethCommon.Address, URL string) (*types.Transaction, error) {
  395. log.Error("TODO")
  396. return nil, errTODO
  397. }
  398. // AuctionIsRegisteredCoordinator is the interface to call the smart contract function
  399. func (c *AuctionClient) AuctionIsRegisteredCoordinator(forgerAddress ethCommon.Address) (bool, error) {
  400. log.Error("TODO")
  401. return false, errTODO
  402. }
  403. // AuctionUpdateCoordinatorInfo is the interface to call the smart contract function
  404. func (c *AuctionClient) AuctionUpdateCoordinatorInfo(forgerAddress ethCommon.Address, newWithdrawAddress ethCommon.Address, newURL string) (*types.Transaction, error) {
  405. log.Error("TODO")
  406. return nil, errTODO
  407. }
  408. // AuctionGetCurrentSlotNumber is the interface to call the smart contract function
  409. func (c *AuctionClient) AuctionGetCurrentSlotNumber() (int64, error) {
  410. var _currentSlotNumber *big.Int
  411. if err := c.client.Call(func(ec *ethclient.Client) error {
  412. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  413. if err != nil {
  414. return err
  415. }
  416. _currentSlotNumber, err = auction.GetCurrentSlotNumber(nil)
  417. return err
  418. }); err != nil {
  419. return 0, err
  420. }
  421. currentSlotNumber := _currentSlotNumber.Int64()
  422. return currentSlotNumber, nil
  423. }
  424. // AuctionGetMinBidBySlot is the interface to call the smart contract function
  425. func (c *AuctionClient) AuctionGetMinBidBySlot(slot int64) (*big.Int, error) {
  426. var minBid *big.Int
  427. if err := c.client.Call(func(ec *ethclient.Client) error {
  428. auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  429. if err != nil {
  430. return err
  431. }
  432. slotToSend := big.NewInt(slot)
  433. minBid, err = auction.GetMinBidBySlot(nil, slotToSend)
  434. return err
  435. }); err != nil {
  436. return big.NewInt(0), err
  437. }
  438. return minBid, nil
  439. }
  440. // AuctionGetDefaultSlotSetBid is the interface to call the smart contract function
  441. func (c *AuctionClient) AuctionGetDefaultSlotSetBid(slotSet uint8) (*big.Int, error) {
  442. // TODO: Update
  443. // var DefaultSlotSetBid *big.Int
  444. // if err := c.client.Call(func(ec *ethclient.Client) error {
  445. // auction, err := HermezAuctionProtocol.NewHermezAuctionProtocol(c.address, ec)
  446. // if err != nil {
  447. // return err
  448. // }
  449. // defaultSlotSetBid, err = auction.GetDefaultSlotSetBid(nil, slotSet)
  450. // return err
  451. // }); err != nil {
  452. // return big.NewInt(0), err
  453. // }
  454. // return defaultSlotSetBid, nil
  455. log.Error("TODO")
  456. return nil, errTODO
  457. }
  458. // AuctionTokensReceived is the interface to call the smart contract function
  459. // func (c *AuctionClient) AuctionTokensReceived(operator, from, to ethCommon.Address, amount *big.Int, userData, operatorData []byte) error {
  460. // return errTODO
  461. // }
  462. // AuctionBid is the interface to call the smart contract function
  463. func (c *AuctionClient) AuctionBid(slot int64, bidAmount *big.Int, forger ethCommon.Address) (*types.Transaction, error) {
  464. log.Error("TODO")
  465. return nil, errTODO
  466. }
  467. // AuctionMultiBid is the interface to call the smart contract function
  468. func (c *AuctionClient) AuctionMultiBid(startingSlot int64, endingSlot int64, slotSet [6]bool, maxBid, closedMinBid, budget *big.Int, forger ethCommon.Address) (*types.Transaction, error) {
  469. log.Error("TODO")
  470. return nil, errTODO
  471. }
  472. // AuctionCanForge is the interface to call the smart contract function
  473. func (c *AuctionClient) AuctionCanForge(forger ethCommon.Address) (bool, error) {
  474. log.Error("TODO")
  475. return false, errTODO
  476. }
  477. // AuctionForge is the interface to call the smart contract function
  478. // func (c *AuctionClient) AuctionForge(forger ethCommon.Address) (bool, error) {
  479. // return false, errTODO
  480. // }
  481. // AuctionClaimHEZ is the interface to call the smart contract function
  482. func (c *AuctionClient) AuctionClaimHEZ() (*types.Transaction, error) {
  483. log.Error("TODO")
  484. return nil, errTODO
  485. }
  486. // AuctionConstants returns the Constants of the Auction Smart Contract
  487. func (c *AuctionClient) AuctionConstants() (*AuctionConstants, error) {
  488. log.Error("TODO")
  489. return nil, errTODO
  490. }
  491. // AuctionEventsByBlock returns the events in a block that happened in the Auction Smart Contract
  492. func (c *AuctionClient) AuctionEventsByBlock(blockNum int64) (*AuctionEvents, *ethCommon.Hash, error) {
  493. log.Error("TODO")
  494. return nil, nil, errTODO
  495. }