Created by
Riccardo Sibani
last modified
|
class user {
pubkey;
}
class container {
key tuid;
created_by: user;
}
class linked_to_container {
key tuid;
mutable container;
created_by: user;
}
operation create_user(pubkey) {
create user (pubkey);
}
operation create_container(pubkey, tuid) {
create container(
tuid,
created_by = user@{
pubkey
}
);
}
operation link_to_container(tuid, pubkey, container_tuid: tuid) {
create linked_to_container (
tuid,
container = container@{
container.tuid = container_tuid,
created_by = user@{
pubkey
}
},
created_by = user@{
pubkey
}
);
}
operation update_link_to_container(tuid, pubkey, new_container_tuid: tuid) {
update linked_to_container@{
tuid,
container@{
created_by = user@{pubkey}
}
} (
container = container@{
container.tuid = new_container_tuid,
created_by = user@{
pubkey
}
}
);
}
|
| <?xml version='1.0' encoding='UTF-8'?>
<test>
<block>
<transaction failure='false'>
<signers><param type='bytea' key='Alice' /></signers>
<operations>
<operation name='create_user'><param type='bytea' key='Alice' /></operation>
</operations>
</transaction>
</block>
<block>
<transaction failure='false'>
<signers><param type='bytea' key='Alice' /></signers>
<operations>
<operation name='create_container'>
<param type='bytea' key='Alice' />
<string>12345</string>
</operation>
</operations>
</transaction>
<transaction failure='false'>
<signers><param type='bytea' key='Alice' /></signers>
<operations>
<operation name='create_container'>
<param type='bytea' key='Alice' />
<string>2345</string>
</operation>
</operations>
</transaction>
</block>
<block>
<transaction failure='false'>
<signers><param type='bytea' key='Alice' /></signers>
<operations>
<operation name='link_to_container'>
<string>12345</string>
<param type='bytea' key='Alice' />
<string>2345</string>
</operation>
</operations>
</transaction>
<transaction failure='false'>
<signers><param type='bytea' key='Alice' /></signers>
<operations>
<operation name='link_to_container'>
<string>123456</string>
<param type='bytea' key='Alice' />
<string>12345</string>
</operation>
</operations>
</transaction>
</block>
<block>
<transaction>
<signers><param type="bytea" key="Alice" /></signers>
<operations>
<operation name="update_link_to_container">
<string>123456</string>
<param type="bytea" key="Alice" />
<string>2345</string>
</operation>
</operations>
</transaction>
</block>
</test>
|