@@ -40,7 +40,7 @@ redeploying the code. This eliminates one of the key motivations for using a fac
40
40
interface would be implemented by `MySqlDatabaseConnectionFactory ` and
41
41
`SQLiteDatabaseConnectionFactory ` (and potentially others). Which specific database connection
42
42
is constructed depends on which factory is provided.
43
-
43
+
44
44
In the factory method pattern, the code resides in an base class that has an abstract method
45
45
for constructing `DatabaseConnection ` objects. The base class is then subclassed to provide
46
46
different implementation of the factory method.
@@ -56,7 +56,7 @@ redeploying the code. This eliminates one of the key motivations for using a fac
56
56
On Concordium, the same problem does not really exist (viewing contract instances as the
57
57
analogue of objects). Contract instances are always created by top-level transactions, and
58
58
the contract being instantiated is always explicitly determined.
59
-
59
+
60
60
61
61
Another motiviation for using a factory pattern might be for the factory to have some on-going
62
62
relationship with the products that it produces. In particular, the factory could maintain an
@@ -185,7 +185,7 @@ identify the code of the smart contract instance.
185
185
186
186
Getting the module reference and contract name is done using the host functions
187
187
``contract_module_reference `` and ``contract_name ``, respectively. Note: both of these functions
188
- are introduced in protocol version 7, and will not work while the chain is running an earlier
188
+ are introduced in protocol version 7, and will not work while the chain is running an earlier
189
189
protocol version.
190
190
191
191
In this example, the factory and product contracts are defined in the same module.
@@ -330,7 +330,7 @@ the invoker Adversary does not match the owner User), but success for User:
330
330
331
331
.. image :: images/factory-tricked.svg
332
332
:alt: sequence diagram showing how a hijacking attempt may succeed if the user is deceived into signing a bad transaction
333
-
333
+
334
334
This is hopefully unlikely. Moreover, the effect of
335
335
such a hijacking should typically be that the product cannot be used as the
336
336
user intended, but the user would still be able to create another product
@@ -354,7 +354,7 @@ At this point, it just remains to initialize the state of the product:
354
354
factory,
355
355
};
356
356
*state = ProductState::Initialized(product);
357
-
357
+
358
358
359
359
.. Note ::
360
360
@@ -389,4 +389,4 @@ product contract must:
389
389
390
390
It is important to always consider the risks presented by malicious third
391
391
parties and to evaluate if any given solution is appropriate to the
392
- application at hand.
392
+ application at hand.
0 commit comments