Approvable
, NContract
, HashIdentifiable
, java.lang.Cloneable
, net.sergeych.biserializer.BiSerializable
public class FollowerContract extends NSmartContract
NSmartContract.NodeInfoProvider, NSmartContract.SmartContractType
Contract.Context, Contract.ContractDev, Contract.Definition, Contract.State, Contract.Transactional, Contract.UnicapsuleExpectedException
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
CALLBACK_KEYS_FIELD_NAME |
|
static java.lang.String |
CALLBACK_RATE_FIELD_NAME |
|
static java.lang.String |
FOLLOWED_ORIGINS_FIELD_NAME |
|
static java.lang.String |
FOLLOWER_ROLES_FIELD_NAME |
|
static java.lang.String |
PREPAID_FROM_TIME_FIELD_NAME |
|
static java.lang.String |
PREPAID_OD_FIELD_NAME |
|
static java.lang.String |
SPENT_OD_FIELD_NAME |
|
static java.lang.String |
SPENT_OD_TIME_FIELD_NAME |
|
static java.lang.String |
TRACKING_ORIGINS_FIELD_NAME |
PAID_U_FIELD_NAME
JSAPI_SCRIPT_FIELD
Constructor | Description |
---|---|
FollowerContract() |
|
FollowerContract(byte[] sealed,
@NonNull TransactionPack pack) |
Follower contract is one of several types of smarts contracts that can be run on the node.
|
FollowerContract(com.icodici.crypto.PrivateKey key) |
Follower contract is one of several types of smarts contracts that can be run on the node.
|
FollowerContract(net.sergeych.tools.Binder unpacked,
@NonNull TransactionPack pack) |
Modifier and Type | Method | Description |
---|---|---|
void |
addFollowerSpecific() |
Method adds follower's specific to contract:
definition.extended_type is sets to FOLLOWER1
adds permission modify_data with needed fields
|
boolean |
beforeCreate(ImmutableEnvironment c) |
Check the smart contract could be created
|
boolean |
beforeRevoke(ImmutableEnvironment c) |
Check the smart contract could be revoked
|
boolean |
beforeUpdate(ImmutableEnvironment c) |
Check the smart contract could be updated (e.g.
|
boolean |
canFollowContract(Contract contract) |
Checks the contract for traceability by this follower contract.
|
void |
deserialize(net.sergeych.tools.Binder data,
net.sergeych.biserializer.BiDeserializer deserializer) |
|
static FollowerContract |
fromDslFile(java.lang.String fileName) |
Method creates
FollowerContract contract from dsl file where contract is described. |
java.util.Map<java.lang.String,com.icodici.crypto.PublicKey> |
getCallbackKeys() |
|
java.math.BigDecimal |
getPrepaidOriginsDays() |
Get calculated prepaid origins*days for this follower contract
|
double |
getPrepaidOriginsForDays() |
Deprecated.
|
java.util.Map<HashId,java.lang.String> |
getTrackingOrigins() |
|
protected FollowerContract |
initializeWithDsl(net.sergeych.tools.Binder root) |
Method calls from
fromDslFile(String) and initialize contract from given binder. |
boolean |
isCallbackURLUsed(java.lang.String URL) |
Check whether the callback URL is used in tracking origins of follower contract
|
boolean |
isOriginTracking(HashId origin) |
Check whether the origin is tracked in the follower contract
|
void |
onContractSubscriptionEvent(ContractSubscription.Event event) |
For the
ContractSubscription the instance will receive event notifications with this callback |
@Nullable net.sergeych.tools.Binder |
onCreated(MutableEnvironment me) |
Called after the new contract is approved by the network.
|
void |
onRevoked(ImmutableEnvironment ime) |
Called when the contract is just revoked by the network
|
net.sergeych.tools.Binder |
onUpdated(MutableEnvironment me) |
Called after the new contract revision is approved by the network.
|
void |
putTrackingOrigin(HashId origin,
java.lang.String URL,
com.icodici.crypto.PublicKey key) |
Put new tracking origin and his callback data (URL and callback public key) to the follower contract.
|
void |
removeTrackingOrigin(HashId origin) |
Removes tracking origin from the follower contract.
|
byte[] |
seal() |
Seal contract to binary.
|
boolean |
updateCallbackKey(java.lang.String URL,
com.icodici.crypto.PublicKey key) |
Updates the callback key by callback URL
|
addError, attachToNetwork, check, getAdditionalKeysAddressesToSignWith, getExtendedType, getExtraResultForApprove, getMinPayment, getNodeInfoProvider, getPaidU, getPaidU, getRate, getRate, query, setNodeInfoProvider, toBinder
addError, addError, addNewItems, addPermission, addReference, addRevokingItems, addRole, addRole, addSignatureToSeal, addSignatureToSeal, addSignatureToSeal, addSignatureToSeal, addSignerKey, addSignerKeyFromFile, addSignerKeys, anonymizeRole, canBeRevoked, check, checkApplicablePermissionQuantized, checkReferencedItems, checkSubItemQuantized, clone, copy, createRevision, createRevision, createRevision, createRevision, createRevision, createRevision, createRevisionAnonymously, createRevisionAnonymously, createRevisionWithAddress, createRevisionWithAddress, createRevocation, createRole, createRole, createTransactionalSection, decodeDslTime, execJS, execJS, execJSByName, execJSByName, execJSByScriptHash, execJSByScriptHash, extractJSNames, extractTheContract, findReferenceByName, findReferenceByName, findSignatureInSeal, fromDslStream, fromDslString, fromPackedTransaction, fromSealedBinary, fromSealedBinary, fromSealedFile, get, getAllContractInTree, getApiLevel, getContext, getContract, getContractBytes, getCreatedAt, getCreator, getCustomRoles, getDefinition, getEarliestCreationTime, getEffectiveKeys, getErrors, getErrorsString, getExpiresAt, getId, getId, getIssuedAt, getIssuer, getKeysToSignWith, getLastSealedBinary, getLastSealedBinary, getNew, getNewItems, getOrigin, getOwner, getPackedTransaction, getParent, getPermissions, getPredefinedRoles, getProcessedCost, getProcessedCostTU, getProcessedCostU, getQuantiser, getRawOrigin, getReferenceContextKeys, getReferenced, getReferencedItems, getReferences, getRevision, getRevisionId, getRevoking, getRevokingItem, getRevokingItems, getRole, getRoleAddresses, getRoles, getRootId, getSealedByKeys, getSiblings, getState, getStateData, getTestQuantaLimit, getTransactional, getTransactionalData, getTransactionPack, getValidRoleReferences, isInWhiteList, isLimitedForTestnet, isOk, isPermitted, isPermitted, isPermitted, isRoleReference, isSuitableForTestnet, isU, isUnlimitKeyContract, paymentCheck, prepareForReferenceMatching, registerRole, removeAllReferencedItems, removeAllSignatures, removeReference, removeReferencedItem, sealAsV2, serialize, set, setApiLevel, setCreator, setCreator, setCreatorKeys, setCreatorKeys, setExpiresAt, setIssuerKeys, setIssuerKeys, setKeysToSignWith, setLimitedForTestnet, setOwnerKey, setOwnerKeys, setOwnerKeys, setReferenceContextKeys, setRoleKeys, setRoleKeys, setShouldBeU, setTestQuantaLimit, setTransactionPack, setVotedByKeys, shouldBeU, split, splitValue, testGetOwner, traceErrors, verifySealedKeys, verifySignatureQuantized
public static final java.lang.String PREPAID_OD_FIELD_NAME
public static final java.lang.String PREPAID_FROM_TIME_FIELD_NAME
public static final java.lang.String FOLLOWED_ORIGINS_FIELD_NAME
public static final java.lang.String SPENT_OD_FIELD_NAME
public static final java.lang.String SPENT_OD_TIME_FIELD_NAME
public static final java.lang.String CALLBACK_RATE_FIELD_NAME
public static final java.lang.String TRACKING_ORIGINS_FIELD_NAME
public static final java.lang.String CALLBACK_KEYS_FIELD_NAME
public static final java.lang.String FOLLOWER_ROLES_FIELD_NAME
public FollowerContract()
public FollowerContract(com.icodici.crypto.PrivateKey key)
This constructor adds key as sealing signature so it is ready to seal()
just after construction, thought
it is necessary to put real data to it first. It is allowed to change owner, expiration and data fields after
creation (but before sealing).
key
- is PrivateKey
for creating roles "issuer", "owner", "creator" and sign contractpublic FollowerContract(byte[] sealed, @NonNull TransactionPack pack) throws java.io.IOException
It is recommended to call NSmartContract.check()
after construction to see the errors.
sealed
- binary sealed contract.pack
- the transaction pack to resolve dependencies again.java.io.IOException
- on the various format errorspublic FollowerContract(net.sergeych.tools.Binder unpacked, @NonNull TransactionPack pack) throws java.io.IOException
java.io.IOException
public void addFollowerSpecific()
protected FollowerContract initializeWithDsl(net.sergeych.tools.Binder root) throws com.icodici.crypto.EncryptionError
fromDslFile(String)
and initialize contract from given binder.initializeWithDsl
in class NSmartContract
root
- id binder with initialized dataFollowerContract
contract.com.icodici.crypto.EncryptionError
- if something went wrongpublic static FollowerContract fromDslFile(java.lang.String fileName) throws java.io.IOException
FollowerContract
contract from dsl file where contract is described.fileName
- is path to dsl file with yaml structure of data for contract.FollowerContract
contract.java.io.IOException
- if something went wrongpublic java.util.Map<HashId,java.lang.String> getTrackingOrigins()
getTrackingOrigins
in class NSmartContract
public java.util.Map<java.lang.String,com.icodici.crypto.PublicKey> getCallbackKeys()
getCallbackKeys
in class NSmartContract
public boolean isOriginTracking(HashId origin)
origin
- to checkpublic void putTrackingOrigin(HashId origin, java.lang.String URL, com.icodici.crypto.PublicKey key)
origin
- for tracking HashId
.URL
- for callback if registered new revision with tracking originkey
- for checking receipt from callback by Universa networkpublic void removeTrackingOrigin(HashId origin)
origin
- for remove HashId
.public boolean isCallbackURLUsed(java.lang.String URL)
URL
- to checkpublic boolean updateCallbackKey(java.lang.String URL, com.icodici.crypto.PublicKey key)
URL
- is updated callback URLkey
- is new PublicKey
for update by callback URLpublic boolean canFollowContract(Contract contract)
canFollowContract
in class NSmartContract
contract
- id Contract
for traceability checkingContract
can be follow by this FollowerContract
@Deprecated public double getPrepaidOriginsForDays()
public java.math.BigDecimal getPrepaidOriginsDays()
public void onContractSubscriptionEvent(ContractSubscription.Event event)
NContract
ContractSubscription
the instance will receive event notifications with this callbackonContractSubscriptionEvent
in interface NContract
onContractSubscriptionEvent
in class NSmartContract
public byte[] seal()
Contract
Contract.getKeysToSignWith()
public void deserialize(net.sergeych.tools.Binder data, net.sergeych.biserializer.BiDeserializer deserializer)
deserialize
in interface net.sergeych.biserializer.BiSerializable
deserialize
in class Contract
public boolean beforeCreate(ImmutableEnvironment c)
NContract
beforeCreate
in interface NContract
beforeCreate
in class NSmartContract
public boolean beforeUpdate(ImmutableEnvironment c)
NContract
beforeUpdate
in interface NContract
beforeUpdate
in class NSmartContract
public boolean beforeRevoke(ImmutableEnvironment c)
NContract
beforeRevoke
in interface NContract
beforeRevoke
in class NSmartContract
public @Nullable net.sergeych.tools.Binder onCreated(MutableEnvironment me)
NContract
onCreated
in interface NContract
onCreated
in class NSmartContract
public net.sergeych.tools.Binder onUpdated(MutableEnvironment me)
NContract
onUpdated
in interface NContract
onUpdated
in class NSmartContract
public void onRevoked(ImmutableEnvironment ime)
NContract
onRevoked
in interface NContract
onRevoked
in class NSmartContract