Skip to content

Commit

Permalink
Added ABI support for the EVM message job (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vizualni authored Jun 2, 2022
1 parent 3570ee5 commit bb1d780
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 30 deletions.
2 changes: 2 additions & 0 deletions proto/evm/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ message ArbitrarySmartContractCall {

bytes payload = 2;
string hexAddress = 3;

bytes abi = 4;
}
2 changes: 2 additions & 0 deletions proto/evm/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ message MsgSubmitNewJob {
string creator = 1;
string hexSmartContractAddress = 2;
string hexPayload = 3;

string abi = 4;
}

message MsgSubmitNewJobResponse {
Expand Down
5 changes: 3 additions & 2 deletions x/evm/client/cli/tx_submit_new_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ type submitNewJobPayloadJson struct {

func CmdSubmitNewJob() *cobra.Command {
cmd := &cobra.Command{
Use: "submit-new-job [smart contract address] [smart contract payload]",
Use: "submit-new-job [smart contract address] [smart contract payload] [smart contract JSON abi]",
Short: "Broadcast message SubmitNewJob",
Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {

clientCtx, err := client.GetClientTxContext(cmd)
Expand All @@ -31,6 +31,7 @@ func CmdSubmitNewJob() *cobra.Command {
Creator: clientCtx.GetFromAddress().String(),
HexSmartContractAddress: args[0],
HexPayload: args[1],
Abi: args[2],
}
if err := msg.ValidateBasic(); err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion x/evm/keeper/msg_server_submit_new_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ func (k msgServer) SubmitNewJob(goCtx context.Context, msg *types.MsgSubmitNewJo
err := k.AddSmartContractExecutionToConsensus(ctx, &types.ArbitrarySmartContractCall{
HexAddress: msg.HexSmartContractAddress,
ChainID: "test",
Payload: common.Hex2Bytes(msg.HexPayload),
Payload: common.Hex2Bytes(msg.GetHexPayload()),
Abi: []byte(msg.GetAbi()),
})

if err != nil {
Expand Down
78 changes: 66 additions & 12 deletions x/evm/types/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 67 additions & 15 deletions x/evm/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bb1d780

Please sign in to comment.