/** * Create revocation contract. To revoke the contract it is necessary that it has "revoke" permission, and one need * the keys to be able to play the role assigned to it. * <p> * So, to revoke some contract: * <p> * - call {@link #createRevocation(PrivateKey...)} with key or keys that can play the role for "revoke" permission * <p> * - register it in the Universa network, see {@link com.icodici.universa.node2.network.Client#register(byte[], long)}. * Upon the successful registration the source contract will be revoked. Use transaction contract's {@link * #getPackedTransaction()} to obtain a binary to submit to the client. * * @param keys one or more keys that together can play the role assigned to the revoke permission. * * @return ready sealed contract that revokes this contract on registration */ public Contract createRevocation(PrivateKey... keys) { return ContractsService.createRevocation(this, keys); }
/** * Revoke specified contract and create a revocation transactional contract. * * @param contract * * @return Contract - revoking transaction contract. */ @Deprecated public static Contract revokeContract(Contract contract, PrivateKey... key) throws IOException { report("keys num: " + key.length); Contract tc = ContractsService.createRevocation(contract, key); registerContract(tc, 0, true); return tc; }
/** * Revoke specified contract and create a revocation transactional contract. * * @param contract * * @return Parcel - revoking transaction contract. */ public static Parcel revokeContract(Contract contract, Contract u, int amount, Set<PrivateKey> uKeys, boolean withTestPayment, PrivateKey... key) throws IOException { report("keys num: " + key.length); Contract tc = ContractsService.createRevocation(contract, key); Parcel parcel = prepareForRegisterContract(tc, u, amount, uKeys, withTestPayment); if (parcel != null) registerParcel(parcel, 0); return parcel; }
Contract tc = ContractsService.createRevocation(c, issuer1, goodKey);
@Test public void testRevocationContractsApi() throws Exception { List<Main> mm = new ArrayList<>(); for (int i = 0; i < 4; i++) mm.add(createMain("node" + (i + 1), false)); Main main = mm.get(0); main.config.setIsFreeRegistrationsAllowedFromYaml(true); Client client = new Client(TestKeys.privateKey(20), main.myInfo, null); Set<PrivateKey> issuerPrivateKeys = new HashSet<>(Arrays.asList(TestKeys.privateKey(1))); Set<PublicKey> ownerPublicKeys = new HashSet<>(Arrays.asList(TestKeys.publicKey(2))); Contract sourceContract = ContractsService.createShareContract(issuerPrivateKeys, ownerPublicKeys, new BigDecimal("100")); sourceContract.check(); sourceContract.traceErrors(); ItemResult itemResult = client.register(sourceContract.getPackedTransaction(), 5000); System.out.println("sourceContract : " + itemResult); assertEquals(ItemState.APPROVED, client.getState(sourceContract.getId()).state); Contract revokeContract = ContractsService.createRevocation(sourceContract, TestKeys.privateKey(1)); revokeContract.check(); revokeContract.traceErrors(); itemResult = client.register(revokeContract.getPackedTransaction(), 5000); System.out.println("revokeContract : " + itemResult); assertEquals(ItemState.APPROVED, client.getState(revokeContract.getId()).state); assertEquals(ItemState.REVOKED, client.getState(sourceContract.getId()).state); mm.forEach(x -> x.shutdown()); }
Contract llcProperty2 = ContractsService.createRevocation(llcProperty, stepaPrivateKeys.iterator().next()); llcProperty2.check(); llcProperty2.traceErrors();
Contract llcProperty2 = ContractsService.createRevocation(llcProperty, stepaPrivateKeys.iterator().next()); llcProperty2.check(); llcProperty2.traceErrors();
Contract c2 = ContractsService.createRevocation(c, stepaPrivateKeys.iterator().next()); c2.getRevoking().get(0).removeReferencedItem(referencedItem); assertEquals(c2.getRevoking().get(0), c2.getRevoking().get(0).getPermissions().getFirst("revoke").getRole().getContract()); Contract c3 = ContractsService.createRevocation(c, stepaPrivateKeys.iterator().next()); Reference ref = new Reference(); ref.name = "certification_contract";
Contract revokeContract = ContractsService.createRevocation(revisionContract, manufacturePrivateKey); revokeContract.seal();
Contract revocation = ContractsService.createRevocation(consent, universaAdminKey); ir = testSpace.client.register(revocation.getPackedTransaction()); while(ir.state.isPending()) {
Contract revokeContract = ContractsService.createRevocation(revisionContract, manufacturePrivateKey); revokeContract.seal();
Contract llcProperty2 = ContractsService.createRevocation(llcProperty, stepaPrivateKeys.iterator().next()); llcProperty2.check(); llcProperty2.traceErrors(); Contract revokingJobCertificate = ContractsService.createRevocation(jobCertificate, stepaPrivateKeys.iterator().next()); revokingJobCertificate.check(); revokingJobCertificate.traceErrors();
Contract revokeContract = ContractsService.createRevocation(revisionContract, manufacturePrivateKey); revokeContract.seal();
Contract revokingJobCertificate = ContractsService.createRevocation(jobCertificate, stepaPrivateKeys.iterator().next()); revokingJobCertificate.check(); revokingJobCertificate.traceErrors();
Contract revokingJobCertificate = ContractsService.createRevocation(jobCertificate, stepaPrivateKeys.iterator().next()); revokingJobCertificate.check(); revokingJobCertificate.traceErrors();
Contract revokingJobCertificate = ContractsService.createRevocation(jobCertificate, stepaPrivateKeys.iterator().next()); revokingJobCertificate.check(); revokingJobCertificate.traceErrors();
Contract revokingFollowerContract = ContractsService.createRevocation(refilledFollowerContract2, key);
Contract revokingSlotContract = ContractsService.createRevocation(refilledSlotContract2, key);
Contract revokingSlotContract = ContractsService.createRevocation(refilledSlotContract, key);
Contract revokingSlotContract = ContractsService.createRevocation(refilledSlotContract, key);