forked from forbole/callisto
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'chains/cheqd/testnet' into chains/cheqd/mainnet
- Loading branch information
Showing
13 changed files
with
97 additions
and
115 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,5 +100,5 @@ select_permissions: | |
- consensus_address | ||
- consensus_pubkey | ||
filter: {} | ||
limit: 100 | ||
limit: 1000 | ||
role: anonymous |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package top_accounts | ||
|
||
import ( | ||
"fmt" | ||
|
||
tmctypes "github.com/cometbft/cometbft/rpc/core/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
|
||
"github.com/forbole/juno/v5/types" | ||
|
||
eventsutil "github.com/forbole/callisto/v4/utils/events" | ||
) | ||
|
||
// HandleMsg implements BlockModule | ||
func (m *Module) HandleBlock(block *tmctypes.ResultBlock, results *tmctypes.ResultBlockResults, txs []*types.Tx, vals *tmctypes.ResultValidators) error { | ||
// handle complete unbonding event | ||
events := sdk.StringifyEvents(results.EndBlockEvents) | ||
height := block.Block.Height | ||
|
||
completeUnbondingEvents := eventsutil.FilterEvents(events, stakingtypes.EventTypeCompleteUnbonding) | ||
|
||
for _, event := range completeUnbondingEvents { | ||
// get the delegator address | ||
delAttr, found := eventsutil.FindAttributeByKey(event, stakingtypes.AttributeKeyDelegator) | ||
if !found { | ||
continue | ||
} | ||
|
||
address := delAttr.Value | ||
err := m.stakingModule.RefreshDelegations(address, height) | ||
if err != nil { | ||
return fmt.Errorf("error while refreshing delegations of account %s, error: %s", address, err) | ||
} | ||
|
||
err = m.stakingModule.RefreshUnbondings(address, height) | ||
if err != nil { | ||
return fmt.Errorf("error while refreshing unbonding delegations of account %s, error: %s", address, err) | ||
} | ||
|
||
err = m.bankModule.UpdateBalances([]string{address}, height) | ||
if err != nil { | ||
return fmt.Errorf("error while refreshing balance of account %s, error: %s", address, err) | ||
} | ||
|
||
err = m.refreshTopAccountsSum([]string{address}, height) | ||
if err != nil { | ||
return fmt.Errorf("error while refreshing top accounts sum %s, error: %s", address, err) | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters