-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add new events * remove eip normalizer * move eip55 logic to elixir-omg * remove enriching * completely remove call_data * remove eip55 from mix.lock * update snapshots * Update apps/omg_watcher_info/lib/omg_watcher_info/db/eth_event.ex Co-authored-by: Ino Murko <[email protected]> * fix typespec Co-authored-by: Ino Murko <[email protected]>
- Loading branch information
Showing
46 changed files
with
403 additions
and
319 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
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
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
48 changes: 48 additions & 0 deletions
48
apps/omg_eth/lib/omg_eth/release_tasks/set_contract/eip55.ex
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,48 @@ | ||
defmodule OMG.Eth.ReleaseTasks.SetContract.EIP55 do | ||
@moduledoc """ | ||
Implements EIP 55 | ||
""" | ||
|
||
@spec encode!(String.t() | binary()) :: String.t() | ||
def encode!("0x" <> address) when byte_size(address) == 40 do | ||
address = String.downcase(address) | ||
|
||
hash = | ||
address | ||
|> :keccakf1600.sha3_256() | ||
|> Base.encode16(case: :lower) | ||
|> String.graphemes() | ||
|
||
encoded = | ||
address | ||
|> String.graphemes() | ||
|> Enum.zip(hash) | ||
|> Enum.map_join(fn | ||
{"0", _} -> "0" | ||
{"1", _} -> "1" | ||
{"2", _} -> "2" | ||
{"3", _} -> "3" | ||
{"4", _} -> "4" | ||
{"5", _} -> "5" | ||
{"6", _} -> "6" | ||
{"7", _} -> "7" | ||
{"8", _} -> "8" | ||
{"9", _} -> "9" | ||
{c, "8"} -> String.upcase(c) | ||
{c, "9"} -> String.upcase(c) | ||
{c, "a"} -> String.upcase(c) | ||
{c, "b"} -> String.upcase(c) | ||
{c, "c"} -> String.upcase(c) | ||
{c, "d"} -> String.upcase(c) | ||
{c, "e"} -> String.upcase(c) | ||
{c, "f"} -> String.upcase(c) | ||
{c, _} -> c | ||
end) | ||
|
||
"0x" <> encoded | ||
end | ||
|
||
def encode!(address) when byte_size(address) == 20 do | ||
encode!("0x" <> Base.encode16(address, case: :lower)) | ||
end | ||
end |
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.