Last active
October 3, 2017 17:48
-
-
Save kelsos/08c2fd77b9bbabfd01ee0f9c99d227f2 to your computer and use it in GitHub Desktop.
Abigen Result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is an automatically generated Java binding. Do not modify as any | |
// change will likely be lost upon the next re-generation! | |
package io.sikorka.android.contract; | |
import org.ethereum.geth.*; | |
import org.ethereum.geth.internal.*; | |
public class SikorkaRegistry { | |
// ABI is the input ABI used to generate the binding from. | |
public final static String ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"channel\",\"type\":\"address\"}],\"name\":\"contractExists\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"contract_address\",\"type\":\"address\"},{\"name\":\"latitude\",\"type\":\"uint256\"},{\"name\":\"longitude\",\"type\":\"uint256\"}],\"name\":\"addContract\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getContractAddresses\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"contract_address\",\"type\":\"address\"}],\"name\":\"removeContract\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getContractCoordinates\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sikorka_contracts\",\"outputs\":[{\"name\":\"contract_address\",\"type\":\"address\"},{\"name\":\"latitude\",\"type\":\"uint256\"},{\"name\":\"longitude\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"contract_address\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"latitude\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"longitude\",\"type\":\"uint256\"}],\"name\":\"ContractAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"contract_address\",\"type\":\"address\"}],\"name\":\"ContractRemoved\",\"type\":\"event\"}]"; | |
// BYTECODE is the compiled bytecode used for deploying new contracts. | |
public final static byte[] BYTECODE = "0x6060604052341561000f57600080fd5b6105ff8061001e6000396000f300606060405236156100755763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416637709bc78811461007a5780638f33221e146100ad578063953874d2146100d4578063c375c2ef1461013a578063de866a7014610159578063f7d2b1011461016c575b600080fd5b341561008557600080fd5b610099600160a060020a03600435166101b8565b604051901515815260200160405180910390f35b34156100b857600080fd5b6100d2600160a060020a03600435166024356044356101c0565b005b34156100df57600080fd5b6100e76102e2565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561012657808201518382015260200161010e565b505050509050019250505060405180910390f35b341561014557600080fd5b6100d2600160a060020a0360043516610382565b341561016457600080fd5b6100e761044e565b341561017757600080fd5b61018260043561050f565b6040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390f35b6000903b1190565b60006101cb846101b8565b15156101d657600080fd5b60008054600181016101e8838261054a565b9160005260206000209060030201600060606040519081016040908152600160a060020a03891682526020820188905281018690529190508151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151600290910155505060008054600160a060020a0386168252600160205260409182902081905591507f416a85ad46a79c0c8942d936d910a83796d3d0d516990461d23b9f19073715ca90859085908590518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150505050565b6102ea61057b565b60006102f461057b565b6000546040518059106103045750595b90808252806020026020018201604052509050600091505b60005482101561037c57600080548390811061033457fe5b6000918252602090912060039091020154600160a060020a031681838151811061035a57fe5b600160a060020a0390921660209283029091019091015260019091019061031c565b92915050565b600160a060020a0381166000908152600160205260409020548015156103a757600080fd5b6000805460001983019081106103b957fe5b600091825260208083206003909202909101805473ffffffffffffffffffffffffffffffffffffffff1916815560018082018490556002909101839055600160a060020a038516835290526040808220919091557f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56590839051600160a060020a03909116815260200160405180910390a15050565b61045661057b565b600061046061057b565b6000546002026040518059106104735750595b90808252806020026020018201604052509050600091505b60005482101561037c5760008054839081106104a357fe5b9060005260206000209060030201600101548183815181106104c157fe5b6020908102909101015260008054839081106104d957fe5b9060005260206000209060030201600201548183600101815181106104fa57fe5b6020908102909101015260019091019061048b565b600080548290811061051d57fe5b6000918252602090912060039091020180546001820154600290920154600160a060020a03909116925083565b81548183558181151161057657600302816003028360005260206000209182019101610576919061058d565b505050565b60206040519081016040526000815290565b6105d091905b808211156105cc57805473ffffffffffffffffffffffffffffffffffffffff191681556000600182018190556002820155600301610593565b5090565b905600a165627a7a72305820eda3cffbb15c32b53145a33d3f74f9deda9faf0ce17c9667992994a72da17e4e0029".getBytes(); | |
// deploy deploys a new Ethereum contract, binding an instance of SikorkaRegistry to it. | |
public static SikorkaRegistry deploy(TransactOpts auth, EthereumClient client) throws Exception { | |
Interfaces args = Geth.newInterfaces(0); | |
return new SikorkaRegistry(Geth.deployContract(auth, ABI, BYTECODE, client, args)); | |
} | |
// Internal constructor used by contract deployment. | |
private SikorkaRegistry(BoundContract deployment) { | |
this.Address = deployment.getAddress(); | |
this.Deployer = deployment.getDeployer(); | |
this.Contract = deployment; | |
} | |
// Ethereum address where this contract is located at. | |
public final Address Address; | |
// Ethereum transaction in which this contract was deployed (if known!). | |
public final Transaction Deployer; | |
// Contract instance bound to a blockchain address. | |
private final BoundContract Contract; | |
// Creates a new instance of SikorkaRegistry, bound to a specific deployed contract. | |
public SikorkaRegistry(Address address, EthereumClient client) throws Exception { | |
this(Geth.bindContract(address, ABI, client)); | |
} | |
// contractExists is a free data retrieval call binding the contract method 0x7709bc78. | |
// | |
// Solidity: function contractExists(channel address) constant returns(bool) | |
public bool contractExists(CallOpts opts, Address channel) throws Exception { | |
Interfaces args = Geth.newInterfaces(1); | |
args.set(0, Geth.newInterface()); args.get(0).setAddress(channel); | |
Interfaces results = Geth.newInterfaces(1); | |
Interface result0 = Geth.newInterface(); result0.setDefaultBool(); results.set(0, result0); | |
if (opts == null) { | |
opts = Geth.newCallOpts(); | |
} | |
this.Contract.call(opts, results, "contractExists", args); | |
return results.get(0).getBool(); | |
} | |
// getContractAddresses is a free data retrieval call binding the contract method 0x953874d2. | |
// | |
// Solidity: function getContractAddresses() constant returns(address[]) | |
public Addresses getContractAddresses(CallOpts opts) throws Exception { | |
Interfaces args = Geth.newInterfaces(0); | |
Interfaces results = Geth.newInterfaces(1); | |
Interface result0 = Geth.newInterface(); result0.setDefaultAddresses(); results.set(0, result0); | |
if (opts == null) { | |
opts = Geth.newCallOpts(); | |
} | |
this.Contract.call(opts, results, "getContractAddresses", args); | |
return results.get(0).getAddresses(); | |
} | |
// getContractCoordinates is a free data retrieval call binding the contract method 0xde866a70. | |
// | |
// Solidity: function getContractCoordinates() constant returns(uint256[]) | |
public BigInts getContractCoordinates(CallOpts opts) throws Exception { | |
Interfaces args = Geth.newInterfaces(0); | |
Interfaces results = Geth.newInterfaces(1); | |
Interface result0 = Geth.newInterface(); result0.setDefaultBigInts(); results.set(0, result0); | |
if (opts == null) { | |
opts = Geth.newCallOpts(); | |
} | |
this.Contract.call(opts, results, "getContractCoordinates", args); | |
return results.get(0).getBigInts(); | |
} | |
// Sikorka_contractsResults is the output of a call to sikorka_contracts. | |
public class Sikorka_contractsResults { | |
public Address Contract_address; | |
public BigInt Latitude; | |
public BigInt Longitude; | |
} | |
// sikorka_contracts is a free data retrieval call binding the contract method 0xf7d2b101. | |
// | |
// Solidity: function sikorka_contracts( uint256) constant returns(contract_address address, latitude uint256, longitude uint256) | |
public Sikorka_contractsResults sikorka_contracts(CallOpts opts, BigInt arg0) throws Exception { | |
Interfaces args = Geth.newInterfaces(1); | |
args.set(0, Geth.newInterface()); args.get(0).setBigInt(arg0); | |
Interfaces results = Geth.newInterfaces(3); | |
Interface result0 = Geth.newInterface(); result0.setDefaultAddress(); results.set(0, result0); | |
Interface result1 = Geth.newInterface(); result1.setDefaultBigInt(); results.set(1, result1); | |
Interface result2 = Geth.newInterface(); result2.setDefaultBigInt(); results.set(2, result2); | |
if (opts == null) { | |
opts = Geth.newCallOpts(); | |
} | |
this.Contract.call(opts, results, "sikorka_contracts", args); | |
Sikorka_contractsResults result = new Sikorka_contractsResults(); | |
result.Contract_address = results.get(0).getAddress(); | |
result.Latitude = results.get(1).getBigInt(); | |
result.Longitude = results.get(2).getBigInt(); | |
return result; | |
} | |
// addContract is a paid mutator transaction binding the contract method 0x8f33221e. | |
// | |
// Solidity: function addContract(contract_address address, latitude uint256, longitude uint256) returns() | |
public Transaction addContract(TransactOpts opts, Address contract_address, BigInt latitude, BigInt longitude) throws Exception { | |
Interfaces args = Geth.newInterfaces(3); | |
args.set(0, Geth.newInterface()); args.get(0).setAddress(contract_address); | |
args.set(1, Geth.newInterface()); args.get(1).setBigInt(latitude); | |
args.set(2, Geth.newInterface()); args.get(2).setBigInt(longitude); | |
return this.Contract.transact(opts, "addContract" , args); | |
} | |
// removeContract is a paid mutator transaction binding the contract method 0xc375c2ef. | |
// | |
// Solidity: function removeContract(contract_address address) returns() | |
public Transaction removeContract(TransactOpts opts, Address contract_address) throws Exception { | |
Interfaces args = Geth.newInterfaces(1); | |
args.set(0, Geth.newInterface()); args.get(0).setAddress(contract_address); | |
return this.Contract.transact(opts, "removeContract" , args); | |
} | |
} | |
public class Utils { | |
// ABI is the input ABI used to generate the binding from. | |
public final static String ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"channel\",\"type\":\"address\"}],\"name\":\"contractExists\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]"; | |
// BYTECODE is the compiled bytecode used for deploying new contracts. | |
public final static byte[] BYTECODE = "0x6060604052341561000f57600080fd5b60ac8061001d6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416637709bc788114603b57600080fd5b3415604557600080fd5b606473ffffffffffffffffffffffffffffffffffffffff600435166078565b604051901515815260200160405180910390f35b6000903b11905600a165627a7a72305820aeb2afd5933f3f4bc03ab6febb39bd7f91d5ddc47ed0158c055987accc7c11a80029".getBytes(); | |
// deploy deploys a new Ethereum contract, binding an instance of Utils to it. | |
public static Utils deploy(TransactOpts auth, EthereumClient client) throws Exception { | |
Interfaces args = Geth.newInterfaces(0); | |
return new Utils(Geth.deployContract(auth, ABI, BYTECODE, client, args)); | |
} | |
// Internal constructor used by contract deployment. | |
private Utils(BoundContract deployment) { | |
this.Address = deployment.getAddress(); | |
this.Deployer = deployment.getDeployer(); | |
this.Contract = deployment; | |
} | |
// Ethereum address where this contract is located at. | |
public final Address Address; | |
// Ethereum transaction in which this contract was deployed (if known!). | |
public final Transaction Deployer; | |
// Contract instance bound to a blockchain address. | |
private final BoundContract Contract; | |
// Creates a new instance of Utils, bound to a specific deployed contract. | |
public Utils(Address address, EthereumClient client) throws Exception { | |
this(Geth.bindContract(address, ABI, client)); | |
} | |
// contractExists is a free data retrieval call binding the contract method 0x7709bc78. | |
// | |
// Solidity: function contractExists(channel address) constant returns(bool) | |
public bool contractExists(CallOpts opts, Address channel) throws Exception { | |
Interfaces args = Geth.newInterfaces(1); | |
args.set(0, Geth.newInterface()); args.get(0).setAddress(channel); | |
Interfaces results = Geth.newInterfaces(1); | |
Interface result0 = Geth.newInterface(); result0.setDefaultBool(); results.set(0, result0); | |
if (opts == null) { | |
opts = Geth.newCallOpts(); | |
} | |
this.Contract.call(opts, results, "contractExists", args); | |
return results.get(0).getBool(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment