congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Contract.copy
Code IndexAdd Tabnine to your IDE (free)

How to use
copy
method
in
com.icodici.universa.contract.Contract

Best Java code snippets using com.icodici.universa.contract.Contract.copy (Showing top 10 results out of 315)

origin: UniversaBlockchain/universa

@Override
protected Object clone() throws CloneNotSupportedException {
  return copy();
}
origin: UniversaBlockchain/universa

private Contract joinAndRemoveFromContracts(List<Contract> selectedContracts) throws Exception {
  Contract result = selectedContracts.get(0).copy();
  result.getRevokingItems().addAll(selectedContracts);
  this.contracts.removeAll(selectedContracts);
  result.setKeysToSignWith(selectedContracts.get(0).getKeysToSignWith());
  return result;
}
origin: UniversaBlockchain/universa

Contract newRevision = copy();
origin: UniversaBlockchain/universa

for (int i = 0; i < count; i++) {
  Contract c = copy();
origin: UniversaBlockchain/universa

  @Test
  public void serializeToBinder() throws Exception {
    Contract c = Contract.fromDslFile(rootPath + "simple_root_contract.yml");
    Binder b = BossBiMapper.serialize(c);
    Contract c1 = DefaultBiMapper.deserialize(b);
//        System.out.println(yaml.dump(b));
//        System.out.println(yaml.dump(c1.serializeToBinder()));
    assertProperSimpleRootContract(c1);
    Contract c2 = c.copy();
    assertProperSimpleRootContract(c2);
  }

origin: UniversaBlockchain/universa

@Test
public void dupesWrongTest() throws Exception {
  PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
  Set<PrivateKey> keys = new HashSet<>();
  keys.add(key);
  Contract c_1 = Contract.fromDslFile(rootPath + "coin100.yml");
  c_1.addSignerKey(key);
  c_1.seal();
  assertTrue(c_1.check());
  c_1.traceErrors();
  Contract c_2_1 = ContractsService.createSplit(c_1, new BigDecimal("20"), "amount", keys);
  Contract c_2_2 = c_2_1.getNew().get(0);
  if(c_2_2 != null) {
    Contract c_2_3 = c_2_2.copy();
    c_2_3.addSignerKey(key);
    c_2_3.seal();
    c_2_1.addNewItems(c_2_3);
  }
  assertEquals(2, c_2_1.getNewItems().size());
  c_2_1.check();
  c_2_1.traceErrors();
  assertFalse(c_2_1.isOk());
  // should be BAD_VALUE duplicated revision id
  assertEquals(2, c_2_1.getErrors().size());
}
origin: UniversaBlockchain/universa

assertTrue(((FollowerContract) desContract).isCallbackURLUsed("http://localhost:7777/follow.callback"));
Contract copiedContract = smartContract.copy();
assertSameContracts(smartContract, copiedContract);
origin: UniversaBlockchain/universa

Contract copiedContract = smartContract.copy();
assertSameContracts(smartContract, copiedContract);
assertEquals(NSmartContract.SmartContractType.SLOT1.name(), copiedContract.getDefinition().getExtendedType());
origin: UniversaBlockchain/universa

  @Test
  public void serializeSmartContract() throws Exception {
    final PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
    Contract smartContract = new NSmartContract(key);
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    Binder b = BossBiMapper.serialize(smartContract);
    Contract desContract = DefaultBiMapper.deserialize(b);
    assertSameContracts(smartContract, desContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.get("definition.extended_type"));
    assertTrue(desContract instanceof NSmartContract);
    assertTrue(desContract instanceof NContract);

    Contract copiedContract = smartContract.copy();
    assertSameContracts(smartContract, copiedContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.get("definition.extended_type"));
    assertTrue(copiedContract instanceof NSmartContract);
    assertTrue(copiedContract instanceof NContract);
  }
}
origin: UniversaBlockchain/universa

  @Test
  public void serializeNSmartContract() throws Exception {
    final PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
    Contract smartContract = new NSmartContract(key);
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    Binder b = BossBiMapper.serialize(smartContract);
    Contract desContract = DefaultBiMapper.deserialize(b);
    assertSameContracts(smartContract, desContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.get("definition.extended_type"));
    assertTrue(desContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);

    Contract copiedContract = smartContract.copy();
    assertSameContracts(smartContract, copiedContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.get("definition.extended_type"));
    assertTrue(copiedContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);
  }
}
com.icodici.universa.contractContractcopy

Javadoc

Make a valid deep copy of a contract

Popular methods of Contract

  • <init>
    Extract old, deprecated v2 self-contained binary partially unpacked by the TransactionPack, and fill
  • addNewItems
    Add one or more siblings to the contract. Note that those must be sealed before calling #seal() or #
  • addSignerKey
    Add private key to keys contract binary to be signed with when sealed next time. It is called before
  • getExpiresAt
    Get contract expiration time
  • getId
    Get the id sealing self if need
  • getPackedTransaction
    Pack the contract to the most modern .unicon format, same as TransactionPack#pack(). Uses bounded Tr
  • registerRole
    Register new role. Name must be unique otherwise existing role will be overwritten
  • seal
    Seal contract to binary. This call adds signatures from #getKeysToSignWith()
  • addSignatureToSeal
    Add signature to sealed (before) contract. Do not deserializing or changing contract bytes, but will
  • check
  • createRevision
    Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contr
  • fromDslFile
    Create contract importing its parameters with passed .yaml file. No signatures are added automatical
  • createRevision,
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • String (java.lang)
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Notification (javax.management)
  • JLabel (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now