public BridgeManager(NeoAPI api, ISwarm swarm, KeyPair owner_keys, UInt160 contract_hash, uint lastBlock) { this.neo_api = api; this.swarm = swarm; this.owner_keys = owner_keys; this.bluzelle_contract_hash = contract_hash; this.listenerVM = new SnapshotVM(this); // TODO: The last block should persistent between multiple sessions, in order to not miss any block this.lastBlock = lastBlock; }
public BridgeManager(NeoAPI api, ISwarm swarm, string ownerWIF, string contractPath) { this.neo_api = api; this.swarm = swarm; this.owner_keys = KeyPair.FromWIF(ownerWIF); if (File.Exists(contractPath)) { this.contract_bytecode = File.ReadAllBytes(contractPath); this.bluzelle_contract_hash = contract_bytecode.ToScriptHash(); } else { throw new Exception($"Could not find contract avm at location {contractPath}"); } this.listenerVM = new SnapshotVM(this); }
public KademliaProtocol( ISwarm swarm, Address address, int appProtocolVersion, ILogger logger, int?tableSize, int?bucketSize, TimeSpan?requestTimeout = null) { _swarm = swarm; _appProtocolVersion = appProtocolVersion; _logger = logger; _address = address; _random = new System.Random(); _tableSize = tableSize ?? Kademlia.TableSize; _bucketSize = bucketSize ?? Kademlia.BucketSize; _routing = new RoutingTable(_address, _tableSize, _bucketSize, _random, _logger); _requestTimeout = requestTimeout ?? TimeSpan.FromMilliseconds(Kademlia.IdleRequestTimeout); }
public TestEnviroment() { debugger = new DebugClient(); // this is the key for the NEO "issuer" in the virtual chain used for testing owner_keys = KeyPair.GenerateAddress(); this.api = new Emulator(owner_keys); this.api.SetLogger(x => { if (api.Chain.HasDebugger) { debugger.WriteLine(x); } Debug.WriteLine(x); }); this.swarm = new TestSwarm(); Transaction tx; // create a random key for the team admin_keys = KeyPair.GenerateAddress(); // since the real admin address is hardcoded in the contract, use BypassKey to give same permissions to this key this.api.Chain.BypassKey(new UInt160(BluzelleContract.Admin_Address), new UInt160(admin_keys.address.AddressToScriptHash())); tx = api.SendAsset(owner_keys, admin_keys.address, "GAS", 800); Assert.IsNotNull(tx); var balances = api.GetAssetBalancesOf(admin_keys.address); Assert.IsTrue(balances.ContainsKey("GAS")); Assert.IsTrue(balances["GAS"] == 800); tx = api.DeployContract(admin_keys, ContractTests.contract_script_bytes, "0710".HexToBytes(), 5, ContractPropertyState.HasStorage, "Bluzelle", "1.0", "http://bluzelle.com", "*****@*****.**", "Bluzelle Smart Contract"); Assert.IsNotNull(tx); }
public SimpleParticle(ISwarm swarm, int dimensions, object info) { mSwarm = swarm; mData = new double[dimensions, 2]; mParticleGeneratorContext = info; }