commit 0b76e366b5e632a73a39855720225177dd444820
parent 2b207135d7a31afbcda438331998ecfa9196b4ff
Author: nolash <dev@holbrook.no>
Date: Tue, 29 Dec 2020 16:11:32 +0100
Refactor interfaces
Diffstat:
1 file changed, 44 insertions(+), 48 deletions(-)
diff --git a/solidity/AddressDeclarator.sol b/solidity/AddressDeclarator.sol
@@ -4,52 +4,48 @@ pragma solidity >=0.6.12;
contract AddressDeclarator {
- struct declaratorItem {
- address signer;
- bytes32[] content;
- }
-
- mapping( address => uint256[] ) declaratorItemsIndex;
- mapping( address => uint256 ) public declaratorCount;
- mapping( address => mapping ( address => declaratorItem ) ) declarationByDeclaratorIndex;
- declaratorItem[] declaratorItems;
-
- constructor(bytes32[] memory _descriptions) {
- for (uint i; i < _descriptions.length; i++) {
- addDeclaration(msg.sender, _descriptions[i]);
- }
- }
-
- function addDeclaration(address _subject, bytes32 _proof) public returns ( bool ) {
- declaratorItem storage item;
-
- item = declarationByDeclaratorIndex[msg.sender][_subject];
- if (item.signer == address(0)) {
- item.signer = msg.sender;
- declaratorItemsIndex[_subject].push(declaratorItems.length);
- declaratorItems.push(item);
- declaratorCount[_subject]++;
- }
- item.content.push(_proof);
-
- return true;
- }
-
- function declarator(address _target, uint256 _idx) public view returns ( address ) {
- uint256 idx;
- declaratorItem storage item;
-
- idx = declaratorItemsIndex[_target][_idx];
- item = declaratorItems[idx];
-
- return item.signer;
- }
-
- function declaration(address _declarator, address _target) public view returns ( bytes32[] memory ) {
- declaratorItem storage item;
-
- item = declarationByDeclaratorIndex[_declarator][_target];
-
- return item.content;
- }
+ mapping( bytes32 => uint256[] )
+ //mapping( address => uint256[] ) declaratorItemsIndex;
+ //mapping( address => uint256 ) public declaratorCount;
+ //mapping( address => mapping ( address => declaratorItem ) ) declarationByDeclaratorIndex;
+ bytes32[][] contents;
+
+// constructor(bytes32[] memory _descriptions) {
+// for (uint i; i < _descriptions.length; i++) {
+// addDeclaration(msg.sender, _descriptions[i]);
+// }
+// }
+//
+// function addDeclaration(address _subject, bytes32 _proof) public returns ( bool ) {
+// declaratorItem storage item;
+//
+// item = declarationByDeclaratorIndex[msg.sender][_subject];
+// if (item.signer == address(0)) {
+// item.signer = msg.sender;
+// declaratorItemsIndex[_subject].push(declaratorItems.length);
+// declaratorItems.push(item);
+// declaratorCount[_subject]++;
+// }
+// item.content.push(_proof);
+//
+// return true;
+// }
+//
+// function declarator(address _target, uint256 _idx) public view returns ( address ) {
+// uint256 idx;
+// declaratorItem storage item;
+//
+// idx = declaratorItemsIndex[_target][_idx];
+// item = declaratorItems[idx];
+//
+// return item.signer;
+// }
+//
+// function declaration(address _declarator, address _target) public view returns ( bytes32[] memory ) {
+// declaratorItem storage item;
+//
+// item = declarationByDeclaratorIndex[_declarator][_target];
+//
+// return item.content;
+// }
}