congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Contract.createRevision
Code IndexAdd Tabnine to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: UniversaBlockchain/universa

/**
 * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy
 * of this contract, with all fields and references correctly set. After this call one need to change mutable
 * fields, add signing keys, seal it and then apss to Universa network for approval.
 *
 * @param keys initially added and signer keys. Role "creator" is set to these keys for new revision
 * @return new revision of this contract, identical to this one, to be modified.
 */
public synchronized Contract createRevision(Collection<PrivateKey> keys) {
  return createRevision(keys, null);
}
origin: UniversaBlockchain/universa

/**
 * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy
 * of this contract, with all fields and references correctly set. After this call one need to change mutable
 * fields, add signing keys, seal it and then apss to Universa network for approval.
 *
 * @param keys initially added and signer keys. Role "creator" is set to these keys for new revision
 * @return new revision of this contract, identical to this one, to be modified.
 */
public Contract createRevision(PrivateKey... keys) {
  return createRevision(null, keys);
}
origin: UniversaBlockchain/universa

/**
 * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy
 * of this contract, with all fields and references correctly set. After this call one need to change mutable
 * fields, add signing keys, seal it and then apss to Universa network for approval.
 *
 * @return new revision of this contract, identical to this one, to be modified.
 */
public Contract createRevision() {
  return createRevision((Transactional)null);
}
origin: UniversaBlockchain/universa

/**
 * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy
 * of this contract, with all fields and references correctly set. After this call one need to change mutable
 * fields, add signing keys, seal it and then apss to Universa network for approval.
 *
 * @param keys initially added and signer keys. Role "creator" is set to these keys for new revision
 * @param transactional is {@link Transactional} section to create new revision with
 * @return new revision of this contract, identical to this one, to be modified.
 */
public Contract createRevision(Transactional transactional, PrivateKey... keys) {
  return createRevision(Do.list(keys), transactional);
}
origin: UniversaBlockchain/universa

public JSApiContract createRevision() {
  return new JSApiContract(this.currentContract.createRevision());
}
origin: UniversaBlockchain/universa

  public Contract createUnsPayment() throws IOException {

    PrivateKey ownerKey = new PrivateKey(Do.read(rootPath + "keys/stepan_mamontov.private.unikey"));
    Set<PublicKey> keys = new HashSet();
    keys.add(ownerKey.getPublicKey());
    Contract stepaU = InnerContractsService.createFreshU(100000000, keys);
    Contract paymentDecreased = stepaU.createRevision(ownerKey);
    paymentDecreased.getStateData().set("transaction_units", stepaU.getStateData().getIntOrThrow("transaction_units") - 2000);
    paymentDecreased.seal();

    return paymentDecreased;
  }
}
origin: UniversaBlockchain/universa

  public Contract createSlotPayment() throws IOException {

    PrivateKey ownerKey = new PrivateKey(Do.read(rootPath + "keys/stepan_mamontov.private.unikey"));
    Set<PublicKey> keys = new HashSet();
    keys.add(ownerKey.getPublicKey());
    Contract stepaU = InnerContractsService.createFreshU(100000000, keys);
    Contract paymentDecreased = stepaU.createRevision(ownerKey);
    paymentDecreased.getStateData().set("transaction_units", stepaU.getStateData().getIntOrThrow("transaction_units") - 100);
    paymentDecreased.seal();

    return paymentDecreased;
  }
}
origin: UniversaBlockchain/universa

@Test
public void shouldModifyStateDataValues() throws  Exception {
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "An example of smart contract.";
  final String newValue = "UniversaSmartContract";
  final String field = "description";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, true);
}
origin: UniversaBlockchain/universa

@Test
public void shouldModifyAnyValueForKey() throws  Exception {
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "35";
  final String newValue = "303434935245";
  final String field = "units";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, true);
}
origin: UniversaBlockchain/universa

@Test
public void shouldPopulateWithEmptyStateDataValues() throws  Exception {
  PrivateKey ownerKey2 = TestKeys.privateKey(1);
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "An example of smart contract.";
  final String newValue = "";
  final String field = "description";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, true);
}
origin: UniversaBlockchain/universa

@Test
public void shouldModifyDescNullStateDataValues() throws  Exception {
  PrivateKey ownerKey2 = TestKeys.privateKey(1);
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "An example of smart contract.";
  final String newValue = null;
  final String field = "description";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, true);
}
origin: UniversaBlockchain/universa

@Test
public void shouldNotModifyStateDataValues() throws  Exception {
  PrivateKey ownerKey2 = TestKeys.privateKey(1);
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "1";
  final String newValue = "2";
  final String field = "option";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, false);
}
origin: UniversaBlockchain/universa

@Test
public void shouldNotPopulateWithNullStateDataValues() throws  Exception {
  PrivateKey ownerKey2 = TestKeys.privateKey(1);
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "2";
  final String newValue = null;
  final String field = "direction";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, false);
}
origin: UniversaBlockchain/universa

@Test
public void shouldNotPopulateWithEmptyStateDataValues() throws  Exception {
  PrivateKey ownerKey2 = TestKeys.privateKey(1);
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "2";
  final String newValue = "";
  final String field = "direction";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, false);
}
origin: UniversaBlockchain/universa

@Test
public void shouldNotModifyDescEmptyStateDataValues() throws  Exception {
  PrivateKey ownerKey2 = TestKeys.privateKey(1);
  Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
  Binder d = c.getStateData();
  Contract c1 = c.createRevision(ownerKey2);
  Binder d1 = c1.getStateData();
  final String oldValue = "An example of smart contract.";
  final String newValue = "wrong value.";
  final String field = "description";
  setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
  sealCheckTrace(c1, false);
}
origin: UniversaBlockchain/universa

@Test
public void splitLessThanMinValue() throws Exception {
  Contract root = createCoinWithAmount("200", FIELD_NAME);
  root = root.createRevision();
  root.addSignerKeyFromFile(PRIVATE_KEY_PATH);
  Contract c1 = root.splitValue(FIELD_NAME, new Decimal("0.00001"));
  root.addSignerKey(ownerKey2);
  c1.addSignerKey(ownerKey2);
  sealCheckTrace(c1, false);
  sealCheckTrace(root, false);
}
origin: UniversaBlockchain/universa

  public TestContracts invoke() throws EncryptionError, Quantiser.QuantiserException {
    r0 = new Contract(TestKeys.privateKey(0));
    r0.seal();
    c = r0.createRevision(TestKeys.privateKey(0));
    n0 = new Contract(TestKeys.privateKey(0));
    n1 = new Contract(TestKeys.privateKey(0));
    c.addNewItems(n0);
    c.addNewItems(n1);
    c.seal();
    return this;
  }
}
origin: UniversaBlockchain/universa

@Test
public void cheatCreateValue2() throws Exception {
  Contract c = createCoin();
  c.addSignerKeyFromFile(PRIVATE_KEY_PATH);
  Binder d = c.getStateData();
  int a = 1000000;
  assertEquals(a, d.getIntOrThrow(FIELD_NAME));
  c.seal();
  assertTrue(c.check());
  Contract c1 = c.createRevision(ownerKey2);
  c1.getStateData().set(FIELD_NAME, "500.00000001");
  sealCheckTrace(c1, false);
}
origin: UniversaBlockchain/universa

@Test
public void defaultParameters() throws Exception {
  Contract contract = new Contract(TestKeys.privateKey(0));
  contract.getStateData().put("field1", "33.000000000000000001");
  ChangeNumberPermission changeNumberPermission = new ChangeNumberPermission(contract.getRole("owner"), Binder.of("field_name", "field1"));
  contract.addPermission(changeNumberPermission);
  contract.seal();
  Contract changed = contract.createRevision();
  changed.addSignerKey(TestKeys.privateKey(0));
  changed.getStateData().set("field1", "33.000000000000000002");
  changed.seal();
  changed.check();
  assertTrue(changed.isOk());
}
origin: UniversaBlockchain/universa

@Test
public void modifyDataDeclined() throws Exception {
  Contract contract = new Contract(TestKeys.privateKey(0));
  contract.getStateData().put("field_to_be_changed", "value1");
  ModifyDataPermission modifyDataPermission = new ModifyDataPermission(contract.getRole("owner"), new Binder());
  contract.addPermission(modifyDataPermission);
  contract.seal();
  Contract changed = contract.createRevision();
  changed.addSignerKey(TestKeys.privateKey(0));
  changed.getStateData().set("field_to_be_changed", "value2");
  changed.seal();
  changed.check();
  assertTrue(!changed.isOk());
}
com.icodici.universa.contractContractcreateRevision

Javadoc

Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy of this contract, with all fields and references correctly set. After this call one need to change mutable fields, add signing keys, seal it and then apss to Universa network for approval.

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
  • fromDslFile
    Create contract importing its parameters with passed .yaml file. No signatures are added automatical
  • fromPackedTransaction
    Main .unicon read routine. Load any .unicon version and construct a linked Contract with counterpart
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Path (java.nio.file)
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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