public static async Task <dynamic> DeployContract() { conflux = new NConflux(url, privateKey); //var contractInfo = await conflux.DeployContract(abi, byteCode.Trim()); return(await conflux.DeployContract($@"608060405234801561001057600080fd5b506102d7806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634ed3885e146100515780636d4ce63c146100ba575b600080fd5b34801561005d57600080fd5b506100b8600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061014a565b005b3480156100c657600080fd5b506100cf610164565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561010f5780820151818401526020810190506100f4565b50505050905090810190601f16801561013c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b8060009080519060200190610160929190610206565b5050565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101fc5780601f106101d1576101008083540402835291602001916101fc565b820191906000526020600020905b8154815290600101906020018083116101df57829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061024757805160ff1916838001178555610275565b82800160010185558215610275579182015b82811115610274578251825591602001919060010190610259565b5b5090506102829190610286565b5090565b6102a891905b808211156102a457600081600090555060010161028c565b5090565b905600a165627a7a7230582059693bf86b17e86ee8a4642d91c7e648e799745cd855b24d1b12cde75e3c5dfc0029")); }
public async Task <int> GetAmount() { var privateKey = txtKey.Text; if (!privateKey.Contains("0x")) { privateKey = "0x" + privateKey; } var ABI = @" [ { ""inputs"": [], ""name"": ""getTicketAmount"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" } ] "; NConflux c = new NConflux("http://main.confluxrpc.org", privateKey); var amout = await c.CallContract(CallType.NoGas, ABI, txtAllIn.Text, "getTicketAmount"); return(Convert.ToInt32(((decimal)amout / 1000000000000000000))); }
public async Task <JsonResult> ApplyContractSetValue(string value, string privateKey, string contractAddress, string abi) { conflux = new NConflux(url, privateKey.Trim()); await conflux.CallContract(CallType.Gas, abi, contractAddress, "set", new object[] { value }); return(Json("ok")); }
public async Task <JsonResult> DeployContract(string abi, string byteCode, string privateKey) { conflux = new NConflux(url, privateKey.Trim()); //var contractInfo = await conflux.DeployContract(abi, byteCode.Trim()); var c = await conflux.DeployContract(byteCode.Trim()); return(Json(c.ContractAddress)); }
public async Task <JsonResult> Transfer(string privateKey, string acceptWallet, decimal amount) { try { conflux = new NConflux(url, privateKey); await conflux.Transfer(acceptWallet, amount); return(Json("ok")); } catch (Exception ex) { return(Json("网络异常,请稍后重试!")); } }
async void Go() { try { var amount = await GetAmount(); txtAmount.Text = amount.ToString(); lblStatus.Text = $@"第{count}次," + "运行开始"; Tool.Log(lblStatus.Text); var privateKey = txtKey.Text; if (!privateKey.Contains("0x")) { privateKey = "0x" + privateKey; } NConflux c = new NConflux("http://main.confluxrpc.org", privateKey); _lock = true; var api = $@"https://confluxscan.io/v1/transfer?accountAddress=0x815ba914df462565179567d651b24ef5567ae20d&limit=100&skip=0"; var result = http.GetAsync(api).Result; var data = result.Content.ReadAsStringAsync().Result; var parsedData = JsonConvert.DeserializeObject <Outer>(data); Record record = null; foreach (var pd in parsedData.list) { record = pd; if (pd.from.StartsWith("0x1") && pd.value == $@"{amount}000000000000000000") { break; } } if (record == null) { return; } var createdAt = Tool.UnixTimeStampToDateTime(record.timestamp); List <string> ourAddress = new List <string>(); ourAddress.Add(c.address); ourAddress.AddRange(txtWe.Text.Replace(" ", "").Split('|')); var notMyAddress = !ourAddress.Contains(record.from); lblPublicAddress.Text = "钱包地址:" + c.address; try { lblStatus.Text = $@"上一个人的地址:{record.from} 下注时间 :{ createdAt},时间过去了:{DateTime.Now.Subtract(createdAt).TotalMinutes }分钟"; Tool.Log(lblStatus.Text); if (DateTime.Now.Subtract(createdAt).TotalSeconds > Convert.ToInt32(txtTime.Text) * 60 && notMyAddress) { lblStatus.Text = $@"第{count}次," + "开始发送转账"; Tool.Log(lblStatus.Text); #region ABI var FCContract = "0x8e2f2e68eb75bb8b18caafe9607242d4748f8d98"; var ABI = @"[ { ""inputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""constructor"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""owner"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""spender"", ""type"": ""address"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""value"", ""type"": ""uint256"" } ], ""name"": ""Approval"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""tokenHolder"", ""type"": ""address"" } ], ""name"": ""AuthorizedOperator"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""from"", ""type"": ""address"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""indexed"": false, ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" }, { ""indexed"": false, ""internalType"": ""bytes"", ""name"": ""operatorData"", ""type"": ""bytes"" } ], ""name"": ""Burned"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""to"", ""type"": ""address"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""indexed"": false, ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" }, { ""indexed"": false, ""internalType"": ""bytes"", ""name"": ""operatorData"", ""type"": ""bytes"" } ], ""name"": ""Minted"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": false, ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""Paused"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""tokenHolder"", ""type"": ""address"" } ], ""name"": ""RevokedOperator"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""indexed"": true, ""internalType"": ""bytes32"", ""name"": ""previousAdminRole"", ""type"": ""bytes32"" }, { ""indexed"": true, ""internalType"": ""bytes32"", ""name"": ""newAdminRole"", ""type"": ""bytes32"" } ], ""name"": ""RoleAdminChanged"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""sender"", ""type"": ""address"" } ], ""name"": ""RoleGranted"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""sender"", ""type"": ""address"" } ], ""name"": ""RoleRevoked"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""from"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""to"", ""type"": ""address"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""indexed"": false, ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" }, { ""indexed"": false, ""internalType"": ""bytes"", ""name"": ""operatorData"", ""type"": ""bytes"" } ], ""name"": ""Sent"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""id"", ""type"": ""uint256"" } ], ""name"": ""Snapshot"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""from"", ""type"": ""address"" }, { ""indexed"": true, ""internalType"": ""address"", ""name"": ""to"", ""type"": ""address"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""value"", ""type"": ""uint256"" } ], ""name"": ""Transfer"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": false, ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""Unpaused"", ""type"": ""event"" }, { ""anonymous"": false, ""inputs"": [ { ""indexed"": true, ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""CPool"", ""type"": ""uint256"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""PPool"", ""type"": ""uint256"" }, { ""indexed"": false, ""internalType"": ""uint256"", ""name"": ""PPoolLocked"", ""type"": ""uint256"" } ], ""name"": ""Write"", ""type"": ""event"" }, { ""inputs"": [], ""name"": ""CAP"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""DEFAULT_ADMIN_ROLE"", ""outputs"": [ { ""internalType"": ""bytes32"", ""name"": """", ""type"": ""bytes32"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""MINTER_ROLE"", ""outputs"": [ { ""internalType"": ""bytes32"", ""name"": """", ""type"": ""bytes32"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""PAUSER_ROLE"", ""outputs"": [ { ""internalType"": ""bytes32"", ""name"": """", ""type"": ""bytes32"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""RECORDER_ROLE"", ""outputs"": [ { ""internalType"": ""bytes32"", ""name"": """", ""type"": ""bytes32"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""SPONSOR"", ""outputs"": [ { ""internalType"": ""contract SponsorWhitelistControl"", ""name"": """", ""type"": ""address"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": """", ""type"": ""address"" } ], ""name"": ""_balances"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""_totalSupply"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""addAdmin"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""addMinter"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""addPauser"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""addRecorder"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""holder"", ""type"": ""address"" }, { ""internalType"": ""address"", ""name"": ""spender"", ""type"": ""address"" } ], ""name"": ""allowance"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""spender"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""value"", ""type"": ""uint256"" } ], ""name"": ""approve"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" } ], ""name"": ""authorizeOperator"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""tokenHolder"", ""type"": ""address"" } ], ""name"": ""balanceOf"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""snapshotId"", ""type"": ""uint256"" } ], ""name"": ""balanceOfAt"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" } ], ""name"": ""burn"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""decimals"", ""outputs"": [ { ""internalType"": ""uint8"", ""name"": """", ""type"": ""uint8"" } ], ""stateMutability"": ""pure"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""defaultOperators"", ""outputs"": [ { ""internalType"": ""address[]"", ""name"": """", ""type"": ""address[]"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" } ], ""name"": ""getRoleAdmin"", ""outputs"": [ { ""internalType"": ""bytes32"", ""name"": """", ""type"": ""bytes32"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""internalType"": ""uint256"", ""name"": ""index"", ""type"": ""uint256"" } ], ""name"": ""getRoleMember"", ""outputs"": [ { ""internalType"": ""address"", ""name"": """", ""type"": ""address"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" } ], ""name"": ""getRoleMemberCount"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""grantRole"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""granularity"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""hasRole"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""isAdmin"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""isMinter"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" }, { ""internalType"": ""address"", ""name"": ""tokenHolder"", ""type"": ""address"" } ], ""name"": ""isOperatorFor"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""isPauser"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""isRecorder"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""name"", ""outputs"": [ { ""internalType"": ""string"", ""name"": """", ""type"": ""string"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""onlyAdminMock"", ""outputs"": [], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""onlyMinterMock"", ""outputs"": [], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""onlyPauserMock"", ""outputs"": [], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""onlyRecorderMock"", ""outputs"": [], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" }, { ""internalType"": ""bytes"", ""name"": ""operatorData"", ""type"": ""bytes"" } ], ""name"": ""operatorBurn"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""sender"", ""type"": ""address"" }, { ""internalType"": ""address"", ""name"": ""recipient"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" }, { ""internalType"": ""bytes"", ""name"": ""operatorData"", ""type"": ""bytes"" } ], ""name"": ""operatorSend"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""paused"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""removeMinter"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""removePauser"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""removeRecorder"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""renounceAdmin"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""renounceMinter"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""renouncePauser"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""renounceRecorder"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""renounceRole"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""operator"", ""type"": ""address"" } ], ""name"": ""revokeOperator"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""bytes32"", ""name"": ""role"", ""type"": ""bytes32"" }, { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" } ], ""name"": ""revokeRole"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""recipient"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" }, { ""internalType"": ""bytes"", ""name"": ""data"", ""type"": ""bytes"" } ], ""name"": ""send"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""setupExpiryTime"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""symbol"", ""outputs"": [ { ""internalType"": ""string"", ""name"": """", ""type"": ""string"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""totalSupply"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""uint256"", ""name"": ""snapshotId"", ""type"": ""uint256"" } ], ""name"": ""totalSupplyAt"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""view"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""recipient"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" } ], ""name"": ""transfer"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""holder"", ""type"": ""address"" }, { ""internalType"": ""address"", ""name"": ""recipient"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""amount"", ""type"": ""uint256"" } ], ""name"": ""transferFrom"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""cap"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""pure"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address[]"", ""name"": ""accounts"", ""type"": ""address[]"" }, { ""internalType"": ""uint256[]"", ""name"": ""ConfluxPools"", ""type"": ""uint256[]"" }, { ""internalType"": ""uint256[]"", ""name"": ""Personals"", ""type"": ""uint256[]"" }, { ""internalType"": ""uint256[]"", ""name"": ""Lockeds"", ""type"": ""uint256[]"" } ], ""name"": ""batchSetStateOf"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""ConfluxPool"", ""type"": ""uint256"" }, { ""internalType"": ""uint256"", ""name"": ""Personal"", ""type"": ""uint256"" }, { ""internalType"": ""uint256"", ""name"": ""Locked"", ""type"": ""uint256"" } ], ""name"": ""setStateOf"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""uint256"", ""name"": ""total"", ""type"": ""uint256"" } ], ""name"": ""setTotalSupply"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [ { ""internalType"": ""address"", ""name"": ""account"", ""type"": ""address"" }, { ""internalType"": ""uint256"", ""name"": ""value"", ""type"": ""uint256"" } ], ""name"": ""mint"", ""outputs"": [ { ""internalType"": ""bool"", ""name"": """", ""type"": ""bool"" } ], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""pause"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""unpause"", ""outputs"": [], ""stateMutability"": ""nonpayable"", ""type"": ""function"" }, { ""inputs"": [], ""name"": ""snapshot"", ""outputs"": [ { ""internalType"": ""uint256"", ""name"": """", ""type"": ""uint256"" } ], ""stateMutability"": ""nonpayable"", ""type"": ""function"" } ] "; //var balance = await c.CallContract(CallType.NoGas, ABI, FCContract, "balanceOf", new object[] { "0x14a540499C6e0A98EAC18D4c195e59FB75E8d824" }); decimal b = 1000000000000000000m; var contractResult = await c.CallContract(CallType.Gas, ABI, FCContract, "transfer", new object[] { txtAllIn.Text, new BigInteger(b *amount) }); lblStatus.Text = $@"****第{count}次," + $@"已经完成转账, hash:{contractResult} ,我们的地址包括:{txtWe.Text}"; Tool.Log(lblStatus.Text); #endregion } else { if (DateTime.Now.Subtract(createdAt).TotalSeconds < Convert.ToInt32(txtTime.Text) * 60) { lblStatus.Text = $@"第{count}次," + "时间阈值未到"; } if (!notMyAddress) { lblStatus.Text += $@"第{count}次," + $@"是我们的地址{record.from},不用下注,我们的地址包括:{txtWe.Text}"; } Tool.Log(lblStatus.Text); } } catch (Exception ex) { lblStatus.Text = $@"第{count}次," + ex.StackTrace; _lock = false; Tool.Log(lblStatus.Text); } _lock = false; count++; } catch (Exception ex) { Tool.Log(ex.StackTrace); } }
public static void CallContract(string contractAddress) { conflux = new NConflux(url, privateKey.Trim()); conflux.CallContract(CallType.Gas, " [ { \"constant\": false, \"inputs\": [ { \"name\": \"field\", \"type\": \"string\" } ], \"name\": \"set\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"get\", \"outputs\": [ { \"name\": \"\", \"type\": \"string\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" } ]", contractAddress, "set", new object[] { "test conflux" }).Wait(); }
public static void Transfer() { conflux = new NConflux(url, privateKey); conflux.Transfer("cfxtest:aatutrr8egewvwsu22f3gsh2yezhysemhuuv6py0tz", 3.1415m).Wait(); }