-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime-sdk/modules/evm: Add subcall precompile
- Loading branch information
Showing
29 changed files
with
1,681 additions
and
369 deletions.
There are no files selected for viewing
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,10 @@ | ||
package evm | ||
|
||
import ( | ||
"github.com/oasisprotocol/oasis-sdk/client-sdk/go/types" | ||
) | ||
|
||
// NewAddressFromEth creates a new address from an Eth-compatible address. | ||
func NewAddressFromEth(ethAddress []byte) types.Address { | ||
return types.NewAddressRaw(types.AddressV0Secp256k1EthContext, ethAddress) | ||
} |
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,20 @@ | ||
package evm | ||
|
||
import ( | ||
"encoding/hex" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNewAddressFromEth(t *testing.T) { | ||
ethAddr, err := hex.DecodeString("Dce075E1C39b1ae0b75D554558b6451A226ffe00") | ||
require.NoError(t, err, "hex.DecodeString") | ||
addr := NewAddressFromEth(ethAddr) | ||
require.Equal(t, addr.String(), "oasis1qrk58a6j2qn065m6p06jgjyt032f7qucy5wqeqpt") | ||
|
||
ethAddr, err = hex.DecodeString("709EEbd979328A2B3605A160915DEB26E186abF8") | ||
require.NoError(t, err, "hex.DecodeString") | ||
addr = NewAddressFromEth(ethAddr) | ||
require.Equal(t, addr.String(), "oasis1qqcd0qyda6gtwdrfcqawv3s8cr2kupzw9v967au6") | ||
} |
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
Oops, something went wrong.