|
23 | 23 | pub mod error;
|
24 | 24 | pub mod types;
|
25 | 25 |
|
26 |
| -/// A trait exposing the Radicle registry transactions described in the |
27 |
| -/// whitepaper. |
28 |
| -/// |
29 |
| -/// The methods here return `Result<types::TxHash, E>` for some error type `E` as they |
30 |
| -/// will be applying a modification on the Registry global state, and return |
31 |
| -/// the hash of the applied transaction if they succeed. |
32 |
| -pub trait RegistryTransactions { |
33 |
| - /// Transfer an amount of currency from one account to another. |
34 |
| - /// |
35 |
| - /// Method preconditions: |
36 |
| - /// * Amount to be transferred is greater than or equal to 1 (one) unit of |
37 |
| - /// currency. |
38 |
| - fn transfer_oscoin( |
39 |
| - // Account from which to send currency. |
40 |
| - from_acc: types::AccountId, |
41 |
| - // Account into which currency will be transferred. |
42 |
| - to_acc: types::AccountId, |
43 |
| - amount: types::Balance, |
44 |
| - ) -> Result<types::TxHash, error::TransferError>; |
45 |
| - |
46 |
| - /// Registers a project on the Radicle Registry and returns the new project’s ID. |
47 |
| - /// |
48 |
| - /// The transaction’s sender account becomes the initial maintainer of the |
49 |
| - /// project, once it has been accepted into the registry. |
50 |
| - /// |
51 |
| - /// After submitting this transaction, the project will enter the |
52 |
| - /// `PendingRegistrations` set, after which it can either be accepted or |
53 |
| - /// rejected by an account in the `ROOT_ACCOUNT`s set with the appropriate |
54 |
| - /// `accept_project/reject_project` transaction. |
55 |
| - /// |
56 |
| - /// Further, after submitting this transaction, regardless of whether the |
57 |
| - /// project is later accepted or rejected, the registration fee is deducted |
58 |
| - /// from the transaction sender's account - if no such available balance is |
59 |
| - /// found, it will result in an error. |
60 |
| - fn register_project( |
61 |
| - // Requested name of the project to be registered. |
62 |
| - project_id: types::ProjectId, |
63 |
| - project_checkpoint: types::CheckpointId, |
64 |
| - project_contract: types::Contract, |
65 |
| - project_ownership_proof: types::ProjectOwnershipProof, |
66 |
| - project_meta: types::Meta, |
67 |
| - ) -> Result<types::TxHash, error::RegisterProjectError>; |
68 |
| - |
69 |
| - /// Accept a project that has been submitted for registration. |
70 |
| - /// |
71 |
| - /// It is then removed from the pending registrations set, and can then be |
72 |
| - /// retrieved using the `get_project()` method from `RegistryView`. |
73 |
| - fn accept_project( |
74 |
| - // Hash of the `register_project` transaction for the `Project` in |
75 |
| - // question. |
76 |
| - t_hash: types::TxHash, |
77 |
| - ) -> Result<types::ProjectId, error::ProjectRegistrationVoteError>; |
78 |
| - |
79 |
| - /// Reject a project that has been submitted for registration. |
80 |
| - /// It is then removed from the pending registrations set. |
81 |
| - fn reject_project( |
82 |
| - // Hash of the `register_project` transaction for the `Project` in |
83 |
| - // question. |
84 |
| - t_hash: types::TxHash, |
85 |
| - ) -> Result<types::TxHash, error::ProjectRegistrationVoteError>; |
86 |
| - |
87 |
| - /// Transaction used to annul a previous `register_project` transaction, |
88 |
| - /// if it has not been approved/rejected yet. |
89 |
| - /// |
90 |
| - /// If successful, the project referred to will be removed from the |
91 |
| - /// pending registrations set |
92 |
| - /// (see RegistryView::get_pending_project_registrations). |
93 |
| - fn withdraw_project( |
94 |
| - // Hash of the `register_project` whose candidacy is being withdrawn. |
95 |
| - t_hash: types::TxHash, |
96 |
| - ) -> Result<types::TxHash, error::WithdrawProjectError>; |
97 |
| - |
98 |
| - /// Unregistering a project from the Radicle Registry. |
99 |
| - /// |
100 |
| - /// As is the case above, this transaction may also be handled outside the |
101 |
| - /// registry. |
102 |
| - fn unregister_project( |
103 |
| - id: types::ProjectId, |
104 |
| - ) -> Result<types::TxHash, error::UnregisterProjectError>; |
105 |
| - |
106 |
| - /// Checkpointing a project in Radicle's registry. |
107 |
| - fn checkpoint( |
108 |
| - // Hash of the previous `checkpoint` associated with this project. |
109 |
| - parent: Option<types::CheckpointId>, |
110 |
| - // New project hash - if `set-checkpoint` if used with this checkpoint, |
111 |
| - // this will become the project's current state hash. |
112 |
| - new_project_hash: types::Hash, |
113 |
| - new_project_version: types::Version, |
114 |
| - // Hash-linked list of the checkpoint's contributions. To see more |
115 |
| - // about this type, go to types::Contribution. |
116 |
| - contribution_list: types::ContributionList, |
117 |
| - // A vector of dependency updates. See types::DependencyUpdate |
118 |
| - // for more information. |
119 |
| - // |
120 |
| - // It is to be treated as a list i.e. processed from left to right. |
121 |
| - dependency_updates: Vec<types::DependencyUpdate>, |
122 |
| - ) -> Result<types::TxHash, error::CheckpointError>; |
123 |
| - |
124 |
| - /// Set a project's checkpoint in the Radicle registry. |
125 |
| - /// |
126 |
| - /// If a `set_checkpoint` transaction is successful, the project's new |
127 |
| - /// checkpoint in the Radicle Registry will be the one passed to the |
128 |
| - /// transaction. |
129 |
| - /// |
130 |
| - /// Anyone is allowed to execute this transaction. |
131 |
| - /// |
132 |
| - /// The project's first checkpoint, `k_0`, must be an ancestor of the |
133 |
| - /// supplied checkpoint. |
134 |
| - fn set_checkpoint( |
135 |
| - // Id of the project to be updated. |
136 |
| - project_id: types::ProjectId, |
137 |
| - // Id of the checkpoint to be associated to the above project. |
138 |
| - checkpoint_id: types::CheckpointId, |
139 |
| - ) -> Result<types::TxHash, error::SetCheckpointError>; |
140 |
| - |
141 |
| - /// Set a project's contract in the Radicle registry. |
142 |
| - /// |
143 |
| - /// If successful, it will set the project's contract to the one that was |
144 |
| - /// supplied in the transaction. |
145 |
| - fn set_contract( |
146 |
| - // Id of the project whose contract is to be updated. |
147 |
| - id: types::ProjectId, |
148 |
| - // |
149 |
| - // New contract to be associated to the project. |
150 |
| - contract: types::Contract, |
151 |
| - ) -> Result<types::TxHash, error::SetContractError>; |
152 |
| -} |
153 |
| - |
154 | 26 | /// Functions to access information from the registry state.
|
155 | 27 | pub trait RegistryView {
|
156 | 28 | /// Returns the project registered at the given address.
|
|
0 commit comments