-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add IBC support for 0x addresses #2051
Changes from all commits
8d11f3f
75a6ce1
aef4ec0
17c2ec8
b0d71f1
d8d1182
6520ead
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,3 +84,23 @@ func (k *Keeper) CanAddressReceive(ctx sdk.Context, addr sdk.AccAddress) bool { | |
// if the associated address is the cast address itself, allow the address to receive (e.g. EVM contract addresses) | ||
return associatedAddr.Equals(addr) || !isAssociated // this means it's either a cast address that's not associated yet, or not a cast address at all. | ||
} | ||
|
||
type EvmAddressHandler struct { | ||
evmKeeper *Keeper | ||
} | ||
|
||
func NewEvmAddressHandler(evmKeeper *Keeper) EvmAddressHandler { | ||
return EvmAddressHandler{evmKeeper: evmKeeper} | ||
} | ||
|
||
func (h EvmAddressHandler) GetSeiAddressFromString(ctx sdk.Context, address string) (sdk.AccAddress, error) { | ||
if common.IsHexAddress(address) { | ||
parsedAddress := common.HexToAddress(address) | ||
return h.evmKeeper.GetSeiAddressOrDefault(ctx, parsedAddress), nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @codchen is assumption correct here that if address is not associated yet, the funds would go to an "escrow" account and then will be migrated after association? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upd: Was able to test scenario e2e and it works There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes this is correct |
||
} | ||
parsedAddress, err := sdk.AccAddressFromBech32(address) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return parsedAddress, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to add checks that the address is valid? i.e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did have the bech32 check before, but i was too restrictive. In fact this address is propagated as string all the way up the stack without any checks. I guess the assumption is that it could any type of address, not only bech32 or EVM.