-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into chains/mainnet
- Loading branch information
Showing
23 changed files
with
940 additions
and
132 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
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,12 @@ | ||
syntax = "proto3"; | ||
package rarimo.rarimocore.rarimocore; | ||
|
||
import "rarimocore/params.proto"; | ||
|
||
option go_package = "github.com/rarimo/rarimo-core/x/rarimocore/types"; | ||
|
||
message Arbitrary { | ||
// Hex encoded data to be signed. AWARE do not make collisions with existing operations. | ||
string data = 1; | ||
} | ||
|
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ enum NetworkType { | |
Near = 2; | ||
Other = 3; | ||
Rarimo = 4; | ||
RarimoEVM = 5; | ||
} | ||
|
||
enum NetworkParamType { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
package operation | ||
|
||
import ( | ||
"bytes" | ||
|
||
eth "github.com/ethereum/go-ethereum/crypto" | ||
merkle "github.com/rarimo/go-merkle" | ||
) | ||
|
||
// ArbitraryContent implements the Content interface provided by go-merkle and represents the content stored in the tree. | ||
type ArbitraryContent struct { | ||
Data []byte | ||
} | ||
|
||
var _ merkle.Content = ArbitraryContent{} | ||
|
||
func (c ArbitraryContent) CalculateHash() []byte { | ||
return eth.Keccak256(c.Data) | ||
} | ||
|
||
// Equals tests for equality of two Contents | ||
func (c ArbitraryContent) Equals(other merkle.Content) bool { | ||
return bytes.Equal(other.CalculateHash(), c.CalculateHash()) | ||
} |
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,24 @@ | ||
package pkg | ||
|
||
import ( | ||
"cosmossdk.io/errors" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
"github.com/gogo/protobuf/proto" | ||
"github.com/rarimo/rarimo-core/x/rarimocore/crypto/operation" | ||
"github.com/rarimo/rarimo-core/x/rarimocore/types" | ||
) | ||
|
||
func GetArbitrary(operation types.Operation) (*types.Arbitrary, error) { | ||
if operation.OperationType == types.OpType_ARBITRARY { | ||
op := new(types.Arbitrary) | ||
return op, proto.Unmarshal(operation.Details.Value, op) | ||
} | ||
return nil, errors.Wrap(sdkerrors.ErrInvalidType, "invalid operation type") | ||
} | ||
|
||
func GetArbitraryContent(op *types.Arbitrary) (*operation.ArbitraryContent, error) { | ||
return &operation.ArbitraryContent{ | ||
Data: hexutil.MustDecode(op.Data), | ||
}, nil | ||
} |
Oops, something went wrong.