Skip to content

Commit

Permalink
blocknumber type changed to Uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
steel-feel committed Aug 2, 2024
1 parent dc27872 commit 4de9240
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
25 changes: 10 additions & 15 deletions x/xarchain/abci/fetch-transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewProvider(supportedProviders map[string]string) map[string]Provider {

}

func (p *Provider) FetchEvents(prevFrom int64, prevTo int64) (EventsResp, error) {
func (p *Provider) FetchEvents(prevFrom uint64, prevTo uint64) (EventsResp, error) {
var evtResponse EventsResp
// Get the current block number
client, err := ethclient.Dial(p.rpcUrl)
Expand All @@ -67,36 +67,31 @@ func (p *Provider) FetchEvents(prevFrom int64, prevTo int64) (EventsResp, error)

}


iCurrentBlock := int64(currentBlock)
log.Default().Printf("block number: %v", iCurrentBlock)

if prevTo == iCurrentBlock {
if prevTo == currentBlock {
return evtResponse, nil
}

var From int64
var From uint64
if prevFrom == 0 {
From = iCurrentBlock
From = currentBlock
} else {
From = prevTo + 1
}

To := iCurrentBlock
if From+999 < iCurrentBlock {
To := currentBlock
if From+999 < currentBlock {
To = From + 999
}

// Define the event signature (you can get this from the ABI or Etherscan)
eventSignature := []byte("IntentFulfiled(address,bytes32)")
eventSignatureHash := common.BytesToHash(crypto.Keccak256Hash(eventSignature).Bytes())


contractAddress := common.HexToAddress(p.contractAddress)
query := ethereum.FilterQuery{
Topics: [][]common.Hash{{eventSignatureHash}},
FromBlock: big.NewInt(From),
ToBlock: big.NewInt(To),
FromBlock:new(big.Int).SetUint64(From),
ToBlock: new(big.Int).SetUint64(To),
Addresses: []common.Address{
contractAddress,
},
Expand Down Expand Up @@ -247,8 +242,8 @@ type EmittedIntents struct {

type EventsResp struct {
Intents []EmittedIntents
From int64
To int64
From uint64
To uint64
}

func (p *ProviderAggregator) SetIntentData(chainId string, iEvent EventsResp) bool {
Expand Down
4 changes: 2 additions & 2 deletions x/xarchain/abci/vote_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type CAVoteExtension struct {
}

type IntentData struct {
From int64
To int64
From uint64
To uint64
IDs []string
}

Expand Down

0 comments on commit 4de9240

Please sign in to comment.