Skip to content

Commit cbdf348

Browse files
author
Michael Dietrich
committed
add project
1 parent 1ea7f76 commit cbdf348

275 files changed

Lines changed: 53141 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.metadata/
2+

.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>SolidityMetaModel</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>edu.kit.kastel.smartcontracts.demonstrator.auctionhouse</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<rbac:AccessControlRepository xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:rbac="http://sdq.kastel.kit.edu/SolidityMetaModel/rbac">
3+
<accessibleOperationsByRole roles="//@roles.0">
4+
<operation href="auctionhouse.core#_H8eR4c9TEeuxxNqFj6C9Cw"/>
5+
</accessibleOperationsByRole>
6+
<accessibleOperationsByRole roles="//@roles.0 //@roles.1">
7+
<operation href="auctionhouse.core#_H8eR5c9TEeuxxNqFj6C9Cw"/>
8+
</accessibleOperationsByRole>
9+
<accessibleOperationsByRole roles="//@roles.2">
10+
<operation href="auctionhouse.core#_H8eR489TEeuxxNqFj6C9Cw"/>
11+
</accessibleOperationsByRole>
12+
<accessibleOperationsByRole roles="//@roles.0">
13+
<operation href="auctionhouse.core#_H8eR4s9TEeuxxNqFj6C9Cw"/>
14+
</accessibleOperationsByRole>
15+
<accessibleOperationsByRole roles="//@roles.1">
16+
<operation href="auctionhouse.core#_H8eR4M9TEeuxxNqFj6C9Cw"/>
17+
</accessibleOperationsByRole>
18+
<accessibleVariablesByRole roles="//@roles.0 //@roles.1">
19+
<variable href="auctionhouse.core#_q-PzQNf-EeujbKPtjBydBQ"/>
20+
</accessibleVariablesByRole>
21+
<accessibleVariablesByRole>
22+
<variable href="auctionhouse.core#_q-PzQdf-EeujbKPtjBydBQ"/>
23+
</accessibleVariablesByRole>
24+
<accessibleVariablesByRole>
25+
<variable href="auctionhouse.core#_dYVJUPk-Eeut0PJH8yPPjQ"/>
26+
</accessibleVariablesByRole>
27+
<accessOperationDef>
28+
<operation href="auctionhouse.core#_H8eR5s9TEeuxxNqFj6C9Cw"/>
29+
<identity href="auctionhouse.core#_q-SPgdf-EeujbKPtjBydBQ"/>
30+
<roleDetermining href="auctionhouse.core#_q-SPgtf-EeujbKPtjBydBQ"/>
31+
</accessOperationDef>
32+
<roles entityName="Bidder"/>
33+
<roles entityName="Seller"/>
34+
<roles entityName="Manager"/>
35+
</rbac:AccessControlRepository>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<soliditycontracts:Repository xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soliditycontracts="http://sdq.kastel.kit.edu/SolidityMetaModel/soliditycontracts">
3+
<contracts entityName="AuctionManager" providedFunctions="_H8eR5M9TEeuxxNqFj6C9Cw" requiredFunctions="_H8eR489TEeuxxNqFj6C9Cw"/>
4+
<contracts entityName="SingleAuction" providedFunctions="_H8eR4c9TEeuxxNqFj6C9Cw _H8eR5c9TEeuxxNqFj6C9Cw _H8eR489TEeuxxNqFj6C9Cw _H8eR4M9TEeuxxNqFj6C9Cw _H8eR4s9TEeuxxNqFj6C9Cw" requiredFunctions="_H8eR5s9TEeuxxNqFj6C9Cw">
5+
<variables id="_q-PzQNf-EeujbKPtjBydBQ" entityName="auctionClosed" type="_H8eR589TEeuxxNqFj6C9Cw"/>
6+
<variables id="_q-PzQdf-EeujbKPtjBydBQ" entityName="managerAddress" type="_H8fgAc9TEeuxxNqFj6C9Cw"/>
7+
<variables id="_dYVJUPk-Eeut0PJH8yPPjQ" entityName="sellerAddress" type="_H8fgAc9TEeuxxNqFj6C9Cw"/>
8+
</contracts>
9+
<globalFunctions id="_H8eR4M9TEeuxxNqFj6C9Cw" entityName="sellerWithdraw"/>
10+
<globalFunctions id="_H8eR4c9TEeuxxNqFj6C9Cw" entityName="bid">
11+
<parameters id="_q-RBYNf-EeujbKPtjBydBQ" name="value" type="_H8eR6M9TEeuxxNqFj6C9Cw"/>
12+
</globalFunctions>
13+
<globalFunctions id="_H8eR4s9TEeuxxNqFj6C9Cw" entityName="withdraw"/>
14+
<globalFunctions id="_H8eR489TEeuxxNqFj6C9Cw" entityName="emergencyShutdown"/>
15+
<globalFunctions id="_H8eR5M9TEeuxxNqFj6C9Cw" entityName="createNewAuction">
16+
<parameters id="_q-RBZNf-EeujbKPtjBydBQ" name="item" type="_H8e48M9TEeuxxNqFj6C9Cw"/>
17+
<parameters id="_q-RBZdf-EeujbKPtjBydBQ" name="expiration" type="_H8eR6M9TEeuxxNqFj6C9Cw"/>
18+
</globalFunctions>
19+
<globalFunctions id="_H8eR5c9TEeuxxNqFj6C9Cw" entityName="close">
20+
<returnVariables name="res" type="_H8eR589TEeuxxNqFj6C9Cw"/>
21+
</globalFunctions>
22+
<globalFunctions id="_H8eR5s9TEeuxxNqFj6C9Cw" entityName="checkId" mutability="view">
23+
<parameters id="_q-SPgdf-EeujbKPtjBydBQ" name="identityToCheck" type="_H8fgAc9TEeuxxNqFj6C9Cw"/>
24+
<parameters id="_q-SPgtf-EeujbKPtjBydBQ" name="roleToCheck" type="_H8gHEM9TEeuxxNqFj6C9Cw"/>
25+
</globalFunctions>
26+
<globalTypes xsi:type="soliditycontracts:PrimitiveType" id="_H8eR589TEeuxxNqFj6C9Cw"/>
27+
<globalTypes xsi:type="soliditycontracts:PrimitiveType" id="_H8eR6M9TEeuxxNqFj6C9Cw" type="int"/>
28+
<globalTypes xsi:type="soliditycontracts:Struct" id="_H8e48M9TEeuxxNqFj6C9Cw" entityName="Item" dataLocation="memory">
29+
<members entityName="tokenLink" type="_H8fgAM9TEeuxxNqFj6C9Cw"/>
30+
</globalTypes>
31+
<globalTypes xsi:type="soliditycontracts:DefaultArray" id="_H8fgAM9TEeuxxNqFj6C9Cw" type="string"/>
32+
<globalTypes xsi:type="soliditycontracts:PrimitiveType" id="_H8fgAc9TEeuxxNqFj6C9Cw" type="address"/>
33+
<globalTypes xsi:type="soliditycontracts:Enum" id="_H8gHEM9TEeuxxNqFj6C9Cw" entityName="Roles">
34+
<members value="Bidder"/>
35+
<members value="Seller"/>
36+
<members value="Manager"/>
37+
</globalTypes>
38+
</soliditycontracts:Repository>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<system:SystemAssembly xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:system="http://sdq.kastel.kit.edu/SolidityMetaModel/soliditysystem" id="_HVOrsM9TEeuxxNqFj6C9Cw" entityName="A">
3+
<instances id="_lTrkEM6xEeuKb_715mVIbA">
4+
<contract href="auctionhouse.core#//@contracts.0"/>
5+
<providedInterfaces id="_4_9E8M6yEeuump1BGsrP3A">
6+
<function href="auctionhouse.core#//@globalFunctions.4"/>
7+
</providedInterfaces>
8+
<requiredInterfaces id="_4_9E8c6yEeuump1BGsrP3A">
9+
<function href="auctionhouse.core#//@globalFunctions.3"/>
10+
</requiredInterfaces>
11+
</instances>
12+
<instances id="_lTsyMM6xEeuKb_715mVIbA">
13+
<contract href="auctionhouse.core#//@contracts.1"/>
14+
<providedInterfaces id="_4_9E886yEeuump1BGsrP3A">
15+
<function href="auctionhouse.core#//@globalFunctions.1"/>
16+
</providedInterfaces>
17+
<providedInterfaces id="_4_9E9M6yEeuump1BGsrP3A">
18+
<function href="auctionhouse.core#//@globalFunctions.3"/>
19+
</providedInterfaces>
20+
<providedInterfaces id="_4_9E9c6yEeuump1BGsrP3A">
21+
<function href="auctionhouse.core#//@globalFunctions.2"/>
22+
</providedInterfaces>
23+
<providedInterfaces id="_4_9E9s6yEeuump1BGsrP3A">
24+
<function href="auctionhouse.core#//@globalFunctions.0"/>
25+
</providedInterfaces>
26+
<providedInterfaces id="_4_9sAM6yEeuump1BGsrP3A">
27+
<function href="auctionhouse.core#//@globalFunctions.5"/>
28+
</providedInterfaces>
29+
<requiredInterfaces id="_4_9sAc6yEeuump1BGsrP3A">
30+
<function href="auctionhouse.core#//@globalFunctions.6"/>
31+
</requiredInterfaces>
32+
</instances>
33+
<connectors id="_4_9sBc6yEeuump1BGsrP3A" providedInterface="//@instances.1/@providedInterfaces.1" requiredInterface="//@instances.0/@requiredInterfaces.0"/>
34+
</system:SystemAssembly>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
pragma solidity ^0.8.5;
2+
3+
4+
contract AccessCtrl {
5+
enum Roles {BIDDER, SELLER, MANAGER, ADMIN}
6+
7+
8+
9+
mapping(address => bool) bidders;
10+
mapping(address => bool) sellers;
11+
mapping(address => bool) managers;
12+
mapping(address => bool) admins;
13+
14+
constructor(address admin){
15+
admins[admin] = true;
16+
}
17+
18+
function checkAccess(address entity, Roles role) public returns (bool) {
19+
if(role == Roles.BIDDER){
20+
return bidders[entity];
21+
}
22+
if(role == Roles.SELLER){
23+
return sellers[entity];
24+
}
25+
if(role == Roles.MANAGER){
26+
return managers[entity];
27+
}
28+
if(role == Roles.ADMIN){
29+
return admins[entity];
30+
}
31+
}
32+
33+
function addToRole(address entity, Roles role) public onlyAdmin {
34+
if(role == Roles.BIDDER){
35+
bidders[entity] = true;
36+
}
37+
if(role == Roles.SELLER){
38+
sellers[entity] = true;
39+
}
40+
if(role == Roles.MANAGER){
41+
managers[entity] = true;
42+
}
43+
if(role == Roles.ADMIN){
44+
admins[entity] = true;
45+
}
46+
}
47+
48+
function removeFromRole(address entity, Roles role) public onlyAdmin {
49+
if(role == Roles.BIDDER){
50+
bidders[entity] = false;
51+
}
52+
if(role == Roles.SELLER){
53+
sellers[entity] = false;
54+
}
55+
if(role == Roles.MANAGER){
56+
managers[entity] = false;
57+
}
58+
if(role == Roles.ADMIN){
59+
admins[entity] = false;
60+
}
61+
}
62+
63+
modifier onlyAdmin {
64+
require(admins[msg.sender] == true, "Access denied");
65+
_;
66+
}
67+
68+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pragma solidity ^0.8.5;
2+
3+
4+
5+
contract AuctionManager {
6+
7+
struct Item {
8+
string tokenLink;
9+
}
10+
11+
12+
13+
14+
15+
16+
function createNewAuction(Item memory item, int expiration) public {
17+
// TODO: implement and verify auto-generated method stub
18+
revert("TODO: auto-generated method stub");
19+
}
20+
21+
22+
23+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
pragma solidity ^0.8.5;
2+
3+
4+
5+
contract SingleAuction {
6+
7+
8+
9+
10+
11+
bool public auctionClosed; //TODO: Auto-generated Field
12+
address public managerAddress; //TODO: Auto-generated Field
13+
address public sellerAddress; //TODO: Auto-generated Field
14+
15+
16+
function bid(int value) public {
17+
// TODO: implement and verify auto-generated method stub
18+
revert("TODO: auto-generated method stub");
19+
}
20+
21+
function close() public returns (bool res) {
22+
// TODO: implement and verify auto-generated method stub
23+
revert("TODO: auto-generated method stub");
24+
}
25+
26+
function emergencyShutdown() public {
27+
// TODO: implement and verify auto-generated method stub
28+
revert("TODO: auto-generated method stub");
29+
}
30+
31+
function sellerWithdraw() public {
32+
// TODO: implement and verify auto-generated method stub
33+
revert("TODO: auto-generated method stub");
34+
}
35+
36+
function withdraw() public {
37+
// TODO: implement and verify auto-generated method stub
38+
revert("TODO: auto-generated method stub");
39+
}
40+
41+
42+
43+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>edu.kit.kastel.smartcontracts.demonstrator.everything</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

0 commit comments

Comments
 (0)