Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
vite.utils.ContractsUtil Maven / Gradle / Ivy
package vite.utils;
import vite.utils.abi.Abi;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ContractsUtil {
public static final Map abiMap = new HashMap<>(3);
static {
abiMap.put("vite_0000000000000000000000000000000000000004d28108e76b", Abi.fromJson(
"[\n" +
" {\"type\":\"function\",\"name\":\"CreateConsensusGroup\", \"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"},{\"name\":\"nodeCount\",\"type\":\"uint8\"},{\"name\":\"interval\",\"type\":\"int64\"}, {\"name\":\"perCount\",\"type\":\"int64\"},{\"name\":\"randCount\",\"type\":\"uint8\"},{\"name\":\"randRank\",\"type\":\"uint8\"},{\"name\":\"repeat\",\"type\":\"uint16\"},{\"name\":\"checkLevel\",\"type\":\"uint8\"},{\"name\":\"countingTokenId\",\"type\":\"tokenId\"},{\"name\":\"registerConditionId\",\"type\":\"uint8\"},{\"name\":\"registerConditionParam\",\"type\":\"bytes\"},{\"name\":\"voteConditionId\",\"type\":\"uint8\"},{\"name\":\"voteConditionParam\",\"type\":\"bytes\"}]},\n" +
" {\"type\":\"function\",\"name\":\"CancelConsensusGroup\", \"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"}]},\n" +
" {\"type\":\"function\",\"name\":\"ReCreateConsensusGroup\", \"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"}]},\n" +
" \n" +
" {\"type\":\"function\",\"name\":\"Register\", \"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"nodeAddr\",\"type\":\"address\"}]},\n" +
" {\"type\":\"function\",\"name\":\"UpdateRegistration\", \"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"},{\"Name\":\"name\",\"type\":\"string\"},{\"name\":\"nodeAddr\",\"type\":\"address\"}]},\n" +
" {\"type\":\"function\",\"name\":\"CancelRegister\",\"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"}, {\"name\":\"name\",\"type\":\"string\"}]},\n" +
" {\"type\":\"function\",\"name\":\"Reward\",\"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"beneficialAddr\",\"type\":\"address\"}]},\n" +
" \n" +
" {\"type\":\"function\",\"name\":\"Vote\", \"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"},{\"name\":\"nodeName\",\"type\":\"string\"}]},\n" +
" {\"type\":\"function\",\"name\":\"CancelVote\",\"inputs\":[{\"name\":\"gid\",\"type\":\"gid\"}]}\n" +
"]"
));
abiMap.put("vite_0000000000000000000000000000000000000003f6af7459b9", Abi.fromJson(
"[\n" +
" {\"type\":\"function\",\"name\":\"Pledge\", \"inputs\":[{\"name\":\"beneficial\",\"type\":\"address\"}]},\n" +
" {\"type\":\"function\",\"name\":\"CancelPledge\",\"inputs\":[{\"name\":\"beneficial\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"}]},\n" +
" {\"type\":\"function\",\"name\":\"AgentPledge\", \"inputs\":[{\"name\":\"pledgeAddress\",\"type\":\"address\"},{\"name\":\"beneficial\",\"type\":\"address\"},{\"name\":\"bid\",\"type\":\"uint8\"}]},\n" +
" {\"type\":\"function\",\"name\":\"AgentCancelPledge\",\"inputs\":[{\"name\":\"pledgeAddress\",\"type\":\"address\"},{\"name\":\"beneficial\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"bid\",\"type\":\"uint8\"}]}\n" +
"]"
));
abiMap.put("vite_000000000000000000000000000000000000000595292d996d", Abi.fromJson(
"[\n" +
" {\"type\":\"function\",\"name\":\"Mint\",\"inputs\":[{\"name\":\"isReIssuable\",\"type\":\"bool\"},{\"name\":\"tokenName\",\"type\":\"string\"},{\"name\":\"tokenSymbol\",\"type\":\"string\"}, {\"name\":\"totalSupply\",\"type\":\"uint256\"},{\"name\":\"decimals\",\"type\":\"uint8\"},{\"name\":\"maxSupply\",\"type\":\"uint256\"},{\"name\":\"ownerBurnOnly\",\"type\":\"bool\"}]},\n" +
" {\"type\":\"function\",\"name\":\"Issue\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"beneficial\",\"type\":\"address\"}]},\n" +
" {\"type\":\"function\",\"name\":\"Burn\",\"inputs\":[]},\n" +
" {\"type\":\"function\",\"name\":\"TransferOwner\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\"},{\"name\":\"newOwner\",\"type\":\"address\"}]},\n" +
" {\"type\":\"function\",\"name\":\"ChangeTokenType\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\"}]},\n" +
" {\"type\":\"function\",\"name\":\"GetTokenInfo\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\"}]},\n" +
" {\"type\":\"event\",\"name\":\"mint\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\",\"indexed\":true}]},\n" +
" {\"type\":\"event\",\"name\":\"issue\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\",\"indexed\":true}]},\n" +
" {\"type\":\"event\",\"name\":\"burn\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\",\"indexed\":true},{\"name\":\"address\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"}]},\n" +
" {\"type\":\"event\",\"name\":\"transferOwner\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\",\"indexed\":true},{\"name\":\"owner\",\"type\":\"address\"}]},\n" +
" {\"type\":\"event\",\"name\":\"changeTokenType\",\"inputs\":[{\"name\":\"tokenId\",\"type\":\"tokenId\",\"indexed\":true}]}\n" +
"]"
));
}
public static String getMethodNameByAddressAndData(String address, String data) {
if (data.length() < 8) {
return null;
}
Abi abi = abiMap.get(address);
if (abi == null) {
return null;
}
Abi.Function f = abi.findFunctionByData(ByteUtil.hexStringToBytes(data));
if (f != null) {
return f.name;
} else {
return null;
}
}
public static List getParamsByAddress(String address, String data) {
if (data.length() < 8) {
return null;
}
Abi abi = abiMap.get(address);
List params = (List) abi.decodeFunction(ByteUtil.hexStringToBytes(data));
return params;
}
public static void main(String []args) {
}
}