Here is a complement to Arvid's answer regarding Archetype:
Reuse and modularity
Indeed Archetype's extensions are reusable codes to add features to a contract. For example, using the 'transferable' extension on a role adds to the contract the necessary actions (ie entry points) to transfer the role to another address.
For example, invoking the 'transferable' extension on an admin role:
variable admin[%transferable%] role := @tz1iawHeddgggn6P5r5jtq2wDRqcJVksGVSa
will generate the two entry points assign_new_admin
and confirm_new_admin
.
From a design perspective, we have tried to keep the contract in a single source file as much as possible, for ease of reading and trust-carrying purposes.
Most of Ethereum's contracts, for example, are usually shattered in literally dozens of source files by inheritance mechanisms, and we thought it was the opposite as what a smart contract should look like.
Extensions are not available yet in the current version (0.1.12) but will be soon (they are a few pull requests away ...).
Inter contract communication
There is support for contract calling in Archetype. For example, the following Archetype contract calls a contract at address KT1RNB9PXsnp7KMkiMrWNMRzPjuefSWojBAm
archetype contract_caller
contract contract_called_sig {
action set_value (n : int)
action add_value (a : int, b : int)
}
variable c : contract_called_sig = @KT1RNB9PXsnp7KMkiMrWNMRzPjuefSWojBAm
action update_value(n : int) {
effect {
c.set_value(n)
}
}
action add_one(n : int) {
effect {
c.add_value(n, 2)
}
}
We see that the contract signature must be provided with the contract keyword and that the call to the contract is similar to invoking a method on an object.
This feature is available in the dev branch and will be available soon in the next release (0.1.13 typically in a couple of weeks).