-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from MaxMustermann2/refactor/dogfood-compat
refactor(dogfood): prepare for `app` addition
- Loading branch information
Showing
12 changed files
with
271 additions
and
581 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package keeper | ||
|
||
import ( | ||
"github.com/ExocoreNetwork/exocore/utils" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
erc20types "github.com/evmos/evmos/v14/x/erc20/types" | ||
evmtypes "github.com/evmos/evmos/v14/x/evm/types" | ||
) | ||
|
||
// interface guards | ||
var ( | ||
_ erc20types.StakingKeeper = Keeper{} | ||
_ evmtypes.StakingKeeper = Keeper{} | ||
) | ||
|
||
// GetValidatorByConsAddr is an implementation of the StakingKeeper interface | ||
// expected by the EVM module. It returns a validator given a consensus address. | ||
// The EVM module uses it to determine the proposer's AccAddress for the block. | ||
// ConsAddress -> lookup AccAddress -> convert to ValAddress -> bech32ify. | ||
// ValAddress string is then decoded back by the EVM module to get bytes, which | ||
// make the 0x address of the coinbase. | ||
func (k Keeper) GetValidatorByConsAddr( | ||
ctx sdk.Context, consAddr sdk.ConsAddress, | ||
) (validator stakingtypes.Validator, found bool) { | ||
val := k.ValidatorByConsAddr(ctx, consAddr) | ||
if val == nil { | ||
return stakingtypes.Validator{}, false | ||
} | ||
return val.(stakingtypes.Validator), true | ||
} | ||
|
||
// BondDenom is an implementation of the StakingKeeper interface expected by the | ||
// ERC20 module. It returns the bond denom for the module. The ERC20 module uses | ||
// this function to determine whether a token sent (or received) over IBC is the | ||
// staking (==native) token. If it is, then the module lets the token through. | ||
// That is the behavior we wish to retain with our chain as well. | ||
func (k Keeper) BondDenom(sdk.Context) string { | ||
return utils.BaseDenom | ||
} |
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
Oops, something went wrong.