diff --git a/manager/eris-mint/evm/snative.go b/manager/eris-mint/evm/snative.go index e428e02d8b88745d8ccc450fdcd839f960ce523b..758e53aa547bb19691a51999c8c90f69f7b96458 100644 --- a/manager/eris-mint/evm/snative.go +++ b/manager/eris-mint/evm/snative.go @@ -4,7 +4,9 @@ import ( "encoding/hex" "fmt" + "github.com/eris-ltd/eris-db/manager/eris-mint/evm/sha3" ptypes "github.com/eris-ltd/eris-db/permission/types" + . "github.com/tendermint/go-common" ) @@ -53,17 +55,18 @@ contract Permissions { // function identifiers from the solidity abi var PermsMap = map[string]SNativeFuncDescription{ - "e8145855": SNativeFuncDescription{"has_role", 2, ptypes.HasRole, has_role}, - "180d26f2": SNativeFuncDescription{"unset_base", 2, ptypes.UnsetBase, unset_base}, - "3a3fcc59": SNativeFuncDescription{"set_global", 2, ptypes.SetGlobal, set_global}, - "3fbf7da5": SNativeFuncDescription{"add_role", 2, ptypes.AddRole, add_role}, - "9ea53314": SNativeFuncDescription{"set_base", 3, ptypes.SetBase, set_base}, - "bb37737a": SNativeFuncDescription{"has_base", 2, ptypes.HasBase, has_base}, - "28fd0194": SNativeFuncDescription{"rm_role", 2, ptypes.RmRole, rm_role}, -} - -func getFuncIdentifiersFromSignature(string) string { - + getFuncIdentifiersFromSignature("has_role(address,bytes32)"): SNativeFuncDescription{"has_role", 2, ptypes.HasRole, has_role}, + getFuncIdentifiersFromSignature("unset_base(address,int256)"): SNativeFuncDescription{"unset_base", 2, ptypes.UnsetBase, unset_base}, + getFuncIdentifiersFromSignature("set_global(int256,bool)"): SNativeFuncDescription{"set_global", 2, ptypes.SetGlobal, set_global}, + getFuncIdentifiersFromSignature("add_role(address,bytes32)"): SNativeFuncDescription{"add_role", 2, ptypes.AddRole, add_role}, + getFuncIdentifiersFromSignature("set_base(address,int256,bool"): SNativeFuncDescription{"set_base", 3, ptypes.SetBase, set_base}, + getFuncIdentifiersFromSignature("has_base(address,int256)"): SNativeFuncDescription{"has_base", 2, ptypes.HasBase, has_base}, + getFuncIdentifiersFromSignature("rm_role(address,bytes32)"): SNativeFuncDescription{"rm_role", 2, ptypes.RmRole, rm_role}, +} + +func getFuncIdentifiersFromSignature(signature string) string { + identifier := sha3.Sha3([]byte(signature)) + return string(identifier[:4]) } func permissionsContract(appState AppState, caller *Account, args []byte, gas *int64) (output []byte, err error) {