-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add default denom resolver (#175)
Co-authored-by: Mantrachain Development Support <[email protected]>
- Loading branch information
1 parent
3dc7912
commit 8b6e6c6
Showing
3 changed files
with
33 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" | ||
) | ||
|
||
var _ feemarkettypes.DenomResolver = &DefaultFeemarketDenomResolver{} | ||
|
||
type DefaultFeemarketDenomResolver struct{} | ||
|
||
// ConvertToDenom returns "coin.Amount denom" for all coins that are not the denom. | ||
func (r *DefaultFeemarketDenomResolver) ConvertToDenom(_ sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { | ||
if coin.Denom == denom { | ||
return coin, nil | ||
} | ||
|
||
return sdk.DecCoin{}, fmt.Errorf("error resolving denom") | ||
} | ||
|
||
func (r *DefaultFeemarketDenomResolver) ExtraDenoms(_ sdk.Context) ([]string, error) { | ||
return []string{}, nil | ||
} |