diff --git a/cmd/abi/native/auth.json b/cmd/abi/native/auth.json new file mode 100644 index 0000000000..86de99d8a6 --- /dev/null +++ b/cmd/abi/native/auth.json @@ -0,0 +1,296 @@ +{ + "hash":"0600000000000000000000000000000000000000", + "functions":[ + { + "name":"initContractAdmin", + "parameters":[ + { + "name":"adminOntID", + "type":"ByteArray" + } + ], + "returntype":"Bool" + }, + { + "name":"transfer", + "parameters":[ + { + "name":"contractAddr", + "type":"Address" + }, + { + "name":"newAdminOntID", + "type":"ByteArray" + }, + { + "name":"keyNo", + "type":"Int" + } + ], + "returntype":"Bool" + }, + { + "name":"assignFuncsToRole", + "parameters":[ + { + "name":"contractAddr", + "type":"Address" + }, + { + "name":"adminOntID", + "type":"ByteArray" + }, + { + "name":"role", + "type":"ByteArray" + }, + { + "name":"funcNames", + "type":"Array", + "subType": [ + { + "name": "", + "type": "String" + } + ] + }, + { + "name":"keyNo", + "type":"Int" + } + ], + "returntype":"Bool" + }, + { + "name":"assignOntIDsToRole", + "parameters":[ + { + "name":"contractAddr", + "type":"Address" + }, + { + "name":"adminOntID", + "type":"ByteArray" + }, + { + "name":"role", + "type":"ByteArray" + }, + { + "name":"persons", + "type":"Array", + "subType": [ + { + "name": "", + "type": "ByteArray" + } + ] + }, + { + "name":"keyNo", + "type":"Int" + } + ], + "returntype":"Bool" + }, + { + "name":"delegate", + "parameters":[ + { + "name":"contractAddr", + "type":"Address" + }, + { + "name":"from", + "type":"ByteArray" + }, + { + "name":"to", + "type":"ByteArray" + }, + { + "name":"role", + "type":"ByteArray" + }, + { + "name":"period", + "type":"Int" + }, + { + "name":"level", + "type":"Int" + }, + { + "name":"keyNo", + "type":"Int" + } + ], + "returntype":"Bool" + }, + { + "name":"withdraw", + "parameters":[ + { + "name":"contractAddr", + "type":"Address" + }, + { + "name":"initiator", + "type":"ByteArray" + }, + { + "name":"delegate", + "type":"ByteArray" + }, + { + "name":"role", + "type":"ByteArray" + }, + { + "name":"keyNo", + "type":"Int" + } + ], + "returntype":"Bool" + }, + { + "name":"verifyToken", + "parameters":[ + { + "name":"contractAddr", + "type":"Address" + }, + { + "name":"caller", + "type":"ByteArray" + }, + { + "name":"fn", + "type":"String" + }, + { + "name":"keyNo", + "type":"Int" + } + ], + "returntype":"Bool" + } + ], + "events": [ + { + "name": "initContractAdmin", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "adminOntID", + "type": "ByteArray" + } + ] + }, + { + "name": "transfer", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "ret", + "type": "Bool" + } + ] + }, + { + "name": "assignFuncsToRole", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "ret", + "type": "Bool" + } + ] + }, + { + "name": "assignOntIDsToRole", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "ret", + "type": "Bool" + } + ] + }, + { + "name": "delegate", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "from", + "type": "ByteArray" + }, + { + "name": "to", + "type": "ByteArray" + }, + { + "name": "ret", + "type": "Bool" + } + ] + }, + { + "name": "withdraw", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "initiator", + "type": "ByteArray" + }, + { + "name": "delegate", + "type": "ByteArray" + }, + { + "name": "ret", + "type": "Bool" + } + ] + }, + { + "name": "verifyToken", + "parameters": [ + { + "name": "contractAddr", + "type": "String" + }, + { + "name": "caller", + "type": "ByteArray" + }, + { + "name": "function", + "type": "String" + }, + { + "name": "ret", + "type": "Bool" + } + ] + } + ] +} diff --git a/cmd/abi/native/global_param.json b/cmd/abi/native/global_param.json new file mode 100644 index 0000000000..8f06e177d1 --- /dev/null +++ b/cmd/abi/native/global_param.json @@ -0,0 +1,142 @@ +{ + "address":"0400000000000000000000000000000000000000", + "functions": + [ + { + "name":"init", + "parameters": + [ + { + "name":"initParams", + "type":"Array", + "subType": + [ + { + "name":"", + "type":"Struct", + "subType": + [ + { + "name":"Key", + "type":"String" + }, + { + "name":"Value", + "type":"String" + } + ] + } + ] + }, + { + "name":"adminAddress", + "type":"Address" + } + ], + "returntype":"Bool" + }, + { + "name":"acceptAdmin", + "parameters": + [ + { + "name":"adminAddress", + "type":"Address" + } + ], + "returntype":"Bool" + }, + { + "name":"transferAdmin", + "parameters": + [ + { + "name":"adminAddress", + "type":"Address" + } + ], + "returntype":"Bool" + }, + { + "name":"setOperator", + "parameters": + [ + { + "name":"operatorAddress", + "type":"Address" + } + ], + "returntype":"Bool" + }, + { + "name":"setGlobalParam", + "parameters": + [ + { + "name":"params", + "type":"Array", + "subType": + [ + { + "name":"", + "type":"Struct", + "subType": + [ + { + "name":"Key", + "type":"String" + }, + { + "name":"Value", + "type":"String" + } + ] + } + ] + } + ], + "returntype":"Bool" + }, + { + "name":"getGlobalParam", + "parameters": + [ + { + "name":"paramNameList", + "type":"Array", + "subType":"String" + } + ], + "returntype":"Array", + "subType": + { + "type":"Struct", + "subType": + [ + { + "name":"", + "type":"Struct", + "subType": + [ + { + "name":"Key", + "type":"String" + }, + { + "name":"Value", + "type":"String" + } + ] + } + ] + } + }, + { + "name":"createSnapshot", + "parameters": + [ + ], + "returntype":"Bool" + } + ] +} diff --git a/cmd/abi/native/governance.json b/cmd/abi/native/governance.json new file mode 100644 index 0000000000..8778f5422f --- /dev/null +++ b/cmd/abi/native/governance.json @@ -0,0 +1,333 @@ +{ + "hash":"0700000000000000000000000000000000000000", + "functions": + [ + { + "name":"initConfig", + "parameters": + [ + ], + "returnType":"Bool" + }, + { + "name":"registerCandidate", + "parameters": + [ + { + "name":"PeerPubkey", + "type":"String" + }, + { + "name":"Address", + "type":"Address" + }, + { + "name":"InitPos", + "type":"Int" + }, + { + "name":"Caller", + "type":"ByteArray" + }, + { + "name":"KeyNo", + "type":"Int" + } + ], + "returnType":"Bool" + }, + { + "name":"approveCandidate", + "parameters": + [ + { + "name":"PeerPubkey", + "type":"String" + } + ], + "returnType":"Bool" + }, + { + "name":"rejectCandidate", + "parameters": + [ + { + "name":"PeerPubkey", + "type":"String" + } + ], + "returnType":"Bool" + }, + { + "name":"blackNode", + "parameters": + [ + { + "name":"PeerPubkeyList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "String" + } + ] + } + ], + "returnType":"Bool" + }, + { + "name":"whiteNode", + "parameters": + [ + { + "name":"PeerPubkey", + "type":"String" + } + ], + "returnType":"Bool" + }, + { + "name":"quitNode", + "parameters": + [ + { + "name":"PeerPubkey", + "type":"String" + }, + { + "name":"Address", + "type":"Address" + } + ], + "returnType":"Bool" + }, + { + "name":"voteForPeer", + "parameters": + [ + { + "name":"Address", + "type":"Address" + }, + { + "name":"PeerPubkeyList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "String" + } + ] + }, + { + "name":"PosList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "Int" + } + ] + } + ], + "returnType":"Bool" + }, + { + "name":"unVoteForPeer", + "parameters": + [ + { + "name":"Address", + "type":"Address" + }, + { + "name":"PeerPubkeyList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "String" + } + ] + }, + { + "name":"PosList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "Int" + } + ] + } + ], + "returnType":"Bool" + }, + { + "name":"withdraw", + "parameters": + [ + { + "name":"Address", + "type":"Address" + }, + { + "name":"PeerPubkeyList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "String" + } + ] + }, + { + "name":"WithdrawList", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "String" + } + ] + } + ], + "returnType":"Bool" + }, + { + "name":"commitDpos", + "parameters": + [ + ], + "returnType":"Bool" + }, + { + "name":"updateConfig", + "parameters": + [ + { + "name":"N", + "type":"Int" + }, + { + "name":"C", + "type":"Int" + }, + { + "name":"K", + "type":"Int" + }, + { + "name":"L", + "type":"Int" + }, + { + "name":"BlockMsgDelay", + "type":"Int" + }, + { + "name":"HashMsgDelay", + "type":"Int" + }, + { + "name":"PeerHandshakeTimeout", + "type":"Int" + }, + { + "name":"MaxBlockChangeView", + "type":"Int" + } + ], + "returnType":"Bool" + }, + { + "name":"updateGlobalParam", + "parameters": + [ + { + "name":"CandidateFee", + "type":"Int" + }, + { + "name":"MinInitStake", + "type":"Int" + }, + { + "name":"CandidateNum", + "type":"Int" + }, + { + "name":"PosLimit", + "type":"Int" + }, + { + "name":"A", + "type":"Int" + }, + { + "name":"B", + "type":"Int" + }, + { + "name":"Yita", + "type":"Int" + }, + { + "name":"Penalty", + "type":"Int" + } + ], + "returnType":"Bool" + }, + { + "name":"updateSplitCurve", + "parameters": + [ + { + "name":"Yi", + "type":"Array", + "subType": + [ + { + "name": "", + "type": "Int" + } + ] + } + ], + "returnType":"Bool" + }, + { + "name":"callSplit", + "parameters": + [ + ], + "returnType":"Bool" + }, + { + "name":"transferPenalty", + "parameters": + [ + { + "name":"PeerPubkey", + "type":"String" + }, + { + "name":"Address", + "type":"Address" + } + ], + "returnType":"Bool" + } + ], + "events": + [ + ] +} diff --git a/cmd/abi/native/ong.json b/cmd/abi/native/ong.json index 7554d5647b..bb2d3f3432 100644 --- a/cmd/abi/native/ong.json +++ b/cmd/abi/native/ong.json @@ -1,139 +1,156 @@ { - "hash": "0200000000000000000000000000000000000000", - "functions": [ + "hash":"0200000000000000000000000000000000000000", + "functions": + [ { - "name": "init", - "parameters": [], - "returntype": "Bool" + "name":"init", + "parameters": + [ + ], + "returntype":"Bool" }, { - "name": "transfer", - "parameters": [ + "name":"transfer", + "parameters": + [ { "name": "transfers", - "type": "Array", - "subType": [ + "type": "Struct", + "subType": + [ + { + "name":"from", + "type":"Address" + }, + { + "name":"to", + "type":"Address" + }, { - "name": "", - "type": "Struct", - "subType": [ - { - "name": "from", - "type": "Address" - }, - { - "name": "to", - "type": "Address" - }, - { - "name": "value", - "type": "Int" - } - ] + "name":"value", + "type":"Int" } ] } ], - "returntype": "Bool" + "returntype":"Bool" }, { - "name": "approve", - "parameters": [ + "name":"approve", + "parameters": + [ { - "name": "from", - "type": "Address" + "name":"from", + "type":"Address" }, { - "name": "to", - "type": "Address" + "name":"to", + "type":"Address" }, { - "name": "value", - "type": "Int" + "name":"value", + "type":"Int" } ], - "returntype": "Bool" + "returntype":"Bool" }, { - "name": "transferFrom", - "parameters": [ + "name":"transferFrom", + "parameters": + [ { - "name": "sender", - "type": "Address" + "name":"sender", + "type":"Address" }, { - "name": "from", - "type": "Address" + "name":"from", + "type":"Address" }, { - "name": "to", - "type": "Address" + "name":"to", + "type":"Address" }, { - "name": "value", - "type": "Int" + "name":"value", + "type":"Int" } ], - "returntype": "Bool" + "returntype":"Bool" }, { - "name": "name", - "parameters": [], - "returntype": "String" + "name":"name", + "parameters": + [ + ], + "returntype":"String" }, { - "name": "symbol", - "parameters": [], - "returntype": "String" + "name":"symbol", + "parameters": + [ + ], + "returntype":"String" }, { - "name": "decimals", - "parameters": [], - "returntype": "Int" + "name":"decimals", + "parameters": + [ + ], + "returntype":"Int" }, { - "name": "totalSupply", - "parameters": [], - "returntype": "Int" + "name":"totalSupply", + "parameters": + [ + ], + "returntype":"Int" }, { - "name": "balanceOf", - "parameters": [ + "name":"balanceOf", + "parameters": + [ { - "name": "account", - "type": "Address" + "name":"account", + "type":"Address" } ], - "returntype": "Int" + "returntype":"Int" }, { - "name": "allowance", - "parameters": [ + "name":"allowance", + "parameters": + [ + { + "name":"from", + "type":"Address" + }, { - "name": "account", - "type": "Address" + "name":"to", + "type":"Address" } ], - "returntype": "Int" + "returntype":"Int" } ], - "events": [ + "events": + [ { - "name": "transfer", - "parameters": [ + "name":"transfer", + "parameters": + [ { - "name": "from", - "type": "Address" + "name":"from", + "type":"Address" }, { - "name": "to", - "type": "Address" + "name":"to", + "type":"Address" }, { - "name": "value", - "type": "Int" + "name":"value", + "type":"Int" } ] } ] -} \ No newline at end of file +} diff --git a/cmd/abi/native/ont.json b/cmd/abi/native/ont.json index 44f226cea9..7d7c890ea4 100644 --- a/cmd/abi/native/ont.json +++ b/cmd/abi/native/ont.json @@ -1,139 +1,156 @@ { - "hash": "0100000000000000000000000000000000000000", - "functions": [ + "hash":"0100000000000000000000000000000000000000", + "functions": + [ { - "name": "init", - "parameters": [], - "returntype": "Bool" + "name":"init", + "parameters": + [ + ], + "returntype":"Bool" }, { - "name": "transfer", - "parameters": [ + "name":"transfer", + "parameters": + [ { "name": "transfers", - "type": "Array", - "subType": [ + "type": "Struct", + "subType": + [ + { + "name":"from", + "type":"Address" + }, + { + "name":"to", + "type":"Address" + }, { - "name": "", - "type": "Struct", - "subType": [ - { - "name": "from", - "type": "Address" - }, - { - "name": "to", - "type": "Address" - }, - { - "name": "value", - "type": "Int" - } - ] + "name":"value", + "type":"Int" } ] } ], - "returntype": "Bool" + "returntype":"Bool" }, { - "name": "approve", - "parameters": [ + "name":"approve", + "parameters": + [ { - "name": "from", - "type": "Address" + "name":"from", + "type":"Address" }, { - "name": "to", - "type": "Address" + "name":"to", + "type":"Address" }, { - "name": "value", - "type": "Int" + "name":"value", + "type":"Int" } ], - "returntype": "Bool" + "returntype":"Bool" }, { - "name": "transferFrom", - "parameters": [ + "name":"transferFrom", + "parameters": + [ { - "name": "sender", - "type": "Address" + "name":"sender", + "type":"Address" }, { - "name": "from", - "type": "Address" + "name":"from", + "type":"Address" }, { - "name": "to", - "type": "Address" + "name":"to", + "type":"Address" }, { - "name": "value", - "type": "Int" + "name":"value", + "type":"Int" } ], - "returntype": "Bool" + "returntype":"Bool" }, { - "name": "name", - "parameters": [], - "returntype": "String" + "name":"name", + "parameters": + [ + ], + "returntype":"String" }, { - "name": "symbol", - "parameters": [], - "returntype": "String" + "name":"symbol", + "parameters": + [ + ], + "returntype":"String" }, { - "name": "decimals", - "parameters": [], - "returntype": "Int" + "name":"decimals", + "parameters": + [ + ], + "returntype":"Int" }, { - "name": "totalSupply", - "parameters": [], - "returntype": "Int" + "name":"totalSupply", + "parameters": + [ + ], + "returntype":"Int" }, { - "name": "balanceOf", - "parameters": [ + "name":"balanceOf", + "parameters": + [ { - "name": "account", - "type": "Address" + "name":"account", + "type":"Address" } ], - "returntype": "Int" + "returntype":"Int" }, { - "name": "allowance", - "parameters": [ + "name":"allowance", + "parameters": + [ + { + "name":"from", + "type":"Address" + }, { - "name": "account", - "type": "Address" + "name":"to", + "type":"Address" } ], - "returntype": "Int" + "returntype":"Int" } ], - "events": [ + "events": + [ { - "name": "transfer", - "parameters": [ + "name":"transfer", + "parameters": + [ { - "name": "from", - "type": "Address" + "name":"from", + "type":"Address" }, { - "name": "to", - "type": "Address" + "name":"to", + "type":"Address" }, { - "name": "value", - "type": "Int" + "name":"value", + "type":"Int" } ] } ] -} \ No newline at end of file +} diff --git a/cmd/abi/native/ontid.json b/cmd/abi/native/ontid.json new file mode 100644 index 0000000000..433dc0f2b4 --- /dev/null +++ b/cmd/abi/native/ontid.json @@ -0,0 +1,313 @@ +{ + "hash":"0300000000000000000000000000000000000000", + "functions":[ + { + "name":"regIDWithPublicKey", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"publicKey", + "type":"ByteArray" + } + ], + "returnType":"Bool" + }, + { + "name":"addKey", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"newPublicKey", + "type":"ByteArray" + }, + { + "name":"userxPublicKey", + "type":"ByteArray" + } + ], + "returnType":"Bool" + }, + { + "name":"removeKey", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"removedKey", + "type":"ByteArray" + }, + { + "name":"userPublicKey", + "type":"ByteArray" + } + ], + "returnType":"Bool" + }, + { + "name":"addRecovery", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"recovery", + "type":"Address" + }, + { + "name":"userPublicKey", + "type":"ByteArray" + } + ], + "returnType":"Bool" + }, + { + "name":"changeRecovery", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"newRecovery", + "type":"Address" + }, + { + "name":"oldRecovery", + "type":"Address" + } + ], + "returnType":"Bool" + }, + { + "name":"regIDWithAttributes", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"publicKey", + "type":"ByteArray" + }, + { + "name":"attributes", + "type":"Array", + "subType":[ + { + "name":"", + "type":"Struct", + "subType":[ + { + "name":"key", + "type":"ByteArray" + }, + { + "name":"type", + "type":"ByteArray" + }, + { + "name":"value", + "type":"ByteArray" + } + ] + } + ] + } + ], + "returnType":"Bool" + }, + { + "name":"addAttributes", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"attributes", + "type":"Array", + "subType":[ + { + "name":"", + "type":"Struct", + "subType":[ + { + "name":"path", + "type":"ByteArray" + }, + { + "name":"type", + "type":"ByteArray" + }, + { + "name":"value", + "type":"ByteArray" + } + ] + } + ] + }, + { + "name":"userPublicKey", + "type":"ByteArray" + } + ], + "returnType":"Bool" + }, + { + "name":"removeAttribute", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"attributePath", + "type":"ByteArray" + }, + { + "name":"userPublicKey", + "type":"ByteArray" + } + ], + "returnType":"Bool" + }, + { + "name":"getPublicKeys", + "parameters":[ + { + "name":"id", + "type":"String" + } + ], + "returnType":"ByteArray" + }, + { + "name":"getKeyState", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"keyIndex", + "type":"Int" + } + ], + "returnType":"String" + }, + { + "name":"getAttributes", + "parameters":[ + { + "name":"id", + "type":"String" + } + ], + "returnType":"ByteArray" + }, + { + "name":"getDDO", + "parameters":[ + { + "name":"id", + "type":"String" + } + ], + "returnType":"ByteArray" + }, + { + "name":"verifySignature", + "parameters":[ + { + "name":"id", + "type":"String" + }, + { + "name":"keyIndex", + "type":"Int" + } + ], + "returnType":"Bool" + } + ], + "events":[ + { + "name":"Register", + "parameters":[ + { + "name":"operation", + "type":"String" + }, + { + "name":"id", + "type":"String" + } + ] + }, + { + "name":"PublicKey", + "parameters":[ + { + "name":"operation", + "type":"String" + }, + { + "name":"id", + "type":"String" + }, + { + "name":"index", + "type":"Int" + }, + { + "name":"publicKey", + "type":"ByteArray" + } + ] + }, + { + "name":"Attribute", + "parameters":[ + { + "name":"operation", + "type":"String" + }, + { + "name":"id", + "type":"String" + }, + { + "name":"attributePath", + "type":"ByteArray" + } + ] + }, + { + "name":"Recovery", + "parameters":[ + { + "name":"operation", + "type":"String" + }, + { + "name":"id", + "type":"String" + }, + { + "name":"recoveryAddress", + "type":"Address" + } + ] + } + ] +} diff --git a/cmd/utils/native_param.go b/cmd/utils/native_param.go index daed96b7ea..413af949a7 100644 --- a/cmd/utils/native_param.go +++ b/cmd/utils/native_param.go @@ -64,6 +64,7 @@ func ParseNativeFuncParam(builder *neovm.ParamsBuilder, funName string, params [ Type: abi.NATIVE_PARAM_TYPE_STRUCT, SubType: paramsAbi, } + params = []interface{}{params} paramsAbi = []*abi.NativeContractParamAbi{paramRoot} } return ParseNativeParams(builder, params, paramsAbi)