Skip to content
Snippets Groups Projects
Unverified Commit d65acbdf authored by RJ Catalano's avatar RJ Catalano
Browse files

automate function signatures


Signed-off-by: default avatarRJ Catalano <rj@monax.io>
parent 19bb14e6
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment