Skip to content
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

Remove un-necessary restriction to pointer contracts on EVM -> CW calls for CW20/CW721 pointers #1846

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions precompiles/wasmd/wasmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@ func (p PrecompileExecutor) executeBatch(ctx sdk.Context, method *abi.Method, ca

// type assertion will always succeed because it's already validated in p.Prepare call in Run()
contractAddrStr := executeMsg.ContractAddress
if caller.Cmp(callingContract) != 0 {
erc20pointer, _, erc20exists := p.evmKeeper.GetERC20CW20Pointer(ctx, contractAddrStr)
erc721pointer, _, erc721exists := p.evmKeeper.GetERC721CW721Pointer(ctx, contractAddrStr)
if (!erc20exists || erc20pointer.Cmp(callingContract) != 0) && (!erc721exists || erc721pointer.Cmp(callingContract) != 0) {
return nil, 0, fmt.Errorf("%s is not a pointer of %s", callingContract.Hex(), contractAddrStr)
}
}

contractAddr, err := sdk.AccAddressFromBech32(contractAddrStr)
if err != nil {
Expand Down Expand Up @@ -347,13 +340,7 @@ func (p PrecompileExecutor) execute(ctx sdk.Context, method *abi.Method, caller

// type assertion will always succeed because it's already validated in p.Prepare call in Run()
contractAddrStr := args[0].(string)
if caller.Cmp(callingContract) != 0 {
erc20pointer, _, erc20exists := p.evmKeeper.GetERC20CW20Pointer(ctx, contractAddrStr)
erc721pointer, _, erc721exists := p.evmKeeper.GetERC721CW721Pointer(ctx, contractAddrStr)
if (!erc20exists || erc20pointer.Cmp(callingContract) != 0) && (!erc721exists || erc721pointer.Cmp(callingContract) != 0) {
return nil, 0, fmt.Errorf("%s is not a pointer of %s", callingContract.Hex(), contractAddrStr)
}
}

// addresses will be sent in Sei format
contractAddr, err := sdk.AccAddressFromBech32(contractAddrStr)
if err != nil {
Expand Down
Loading