Skip to content

Commit

Permalink
Merge branch 'release/v1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Winkler committed Sep 26, 2018
2 parents d5d55b2 + b0e6c7b commit 55d9a77
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 88 deletions.
8 changes: 7 additions & 1 deletion VERSIONS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# smart-contracts
# smart-contracts-core

## Next Version
### Features
### Fixes
### Deprecations

## Version 1.1.1
### Fixes
- use `keccak256` instead of `sha3` for hashing
- add `dst` argument to `lib/solc.js` functions to bypass config for destination path

## Version 1.1.0
### Fixes
- update hasing to `keccak256`
Expand All @@ -20,6 +25,7 @@
- add factory for `MultiSigWallet` contracts
- change call and answer storage formate in `ServiceContract.sol` to structs
- add more properties to result of `getCalls` and `getAnswers` in `ServiceContract.sol`
- add `registerFactory(address factoryId)` to `BusinessCenterInterface`

### Fixes
- remove `MultiSigWallet` dependency by copying `.sol` file into contracts folder, to prevent `npm install` issues, when used as a subdependency
Expand Down
6 changes: 3 additions & 3 deletions contracts/BaseContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import "./ProfileIndexInterface.sol";

contract BaseContract is BaseContractInterface, EnsReader {
uint8 private constant MEMBER_ROLE = 1;
// web3.sha3('contacts')
// web3.utils.soliditySha3('contacts')
bytes32 private constant CONTACTS_LABEL = 0x8417ef2e3e7bb6630d90a4cdcc188db4bcc27d6b2d8891b376ef771499bb4299;
// web3.sha3('eventhub')
// web3.utils.soliditySha3('eventhub')
bytes32 private constant EVENTHUB_LABEL = 0xea14ea6d138254c1a2931c6a19f6888c7b52f512d165cfa428183a53dd9dfb8c;
// web3.sha3('profile')
// web3.utils.soliditySha3('profile')
bytes32 private constant PROFILE_LABEL = 0xe3dd854eb9d23c94680b3ec632b9072842365d9a702ab0df7da8bc398ee52c7d;

function BaseContract(address _provider, bytes32 _contractType, bytes32 _contractDescription, address ensAddress) {
Expand Down
1 change: 1 addition & 0 deletions contracts/BusinessCenterInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ contract BusinessCenterInterface is Owned {
function migrateTo(address) public;
function sendContractEvent(uint evetType, bytes32 contractType, address member) public;
function getProfile(address account) public constant returns (bytes32);
function registerFactory(address factoryId) public;
function setMyProfile(bytes32 profile) public;
function setJoinSchema(JoinSchema) public;

Expand Down
46 changes: 23 additions & 23 deletions contracts/DataContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ import "./DSRolesPerContract.sol";
/// @notice this is a contract with abstract functions that is used as an interface for DataContracts
/// @dev requires calling "init" before usage
contract DataContract is DataContractInterface, BaseContract {
//// labels for buildig sha3 keys
// web3.sha3('subcontracts')
//// labels for buildig keccak256 keys
// web3.utils.soliditySha3('subcontracts')
bytes32 public constant SUBCONTRACTS_LABEL = 0x33baa6f316fab89cb11f57cf36f92fc446eeabbee455d30c346989e18dba49c4;
// web3.sha3('entry')
// web3.utils.soliditySha3('entry')
bytes32 public constant ENTRY_LABEL = 0x84f3db82fb6cd291ed32c6f64f7f5eda656bda516d17c6bc146631a1f05a1833;
// web3.sha3('listentry')
// web3.utils.soliditySha3('listentry')
bytes32 public constant LISTENTRY_LABEL = 0x7da2a80303fd8a8b312bb0f3403e22702ece25aa85a5e213371a770a74a50106;
// web3.sha3('mappingentry')
// web3.utils.soliditySha3('mappingentry')
bytes32 public constant MAPPINGENTRY_LABEL = 0xd9234c2c276ff426c50a259dd40abb4cdd9767973f4a72f6e032e829f681e0b4;
// web3.sha3('contractstate')
// web3.utils.soliditySha3('contractstate')
bytes32 public constant CONTRACTSTATE_LABEL = 0xf0af2cee3e7130dfb5ef02ebfaf64a30da17e9c9c26d3d40ece69a2e0ee1d69e;
// web3.sha3('ownstate')
// web3.utils.soliditySha3('ownstate')
bytes32 public constant OWNSTATE_LABEL = 0x56ead3438bd16b0aaea9b0b78119b1db8a5382b496db7a1989fe7a32f9890f7c;
// web3.sha3('othersstate')
// web3.utils.soliditySha3('othersstate')
bytes32 public constant OTHERSSTATE_LABEL = 0xa287c88bf56474b8c2de2568111316e26d1b3572718b1a8cdf0c881a767e4cb7;
// web3.sha3('count')
// web3.utils.soliditySha3('count')
bytes32 public constant COUNT_LABEL = 0xc82306b6ab1b4c67429442feb1e6d238135a6cfcaa471a01b0e336f01b048e38;
// web3.sha3('set')
// web3.utils.soliditySha3('set')
bytes32 public constant SET_LABEL = 0xd2f67e6aeaad1ab7487a680eb9d3363a597afa7a3de33fa9bf3ae6edcb88435d;
// web3.sha3('remove')
// web3.utils.soliditySha3('remove')
bytes32 public constant REMOVE_LABEL = 0x8dd27a19ebb249760a6490a8d33442a54b5c3c8504068964b74388bfe83458be;

// data storage
Expand All @@ -73,7 +73,7 @@ contract DataContract is DataContractInterface, BaseContract {
/// @notice add entries to a list
/// @dev keep in mind that list do not provide a fixed order;
/// they can be iterated, but deleting entries repositions items
/// @param keys sha3 hashes of the list names
/// @param keys keccak256 hashes of the list names
/// @param values values to add to this list
function addListEntries(bytes32[] keys, bytes32[] values) public auth {
for (uint256 i = 0; i < keys.length; i++) {
Expand Down Expand Up @@ -133,9 +133,9 @@ contract DataContract is DataContractInterface, BaseContract {
}

/// @notice move a list entry from a list into one or multiple lists
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @param index index of the element to delete
/// @param keys sha3 hashes of the list names
/// @param keys keccak256 hashes of the list names
function moveListEntry(bytes32 key, uint256 index, bytes32[] keys) public auth {
bytes32[] memory values = new bytes32[](1);
values[0] = getListEntry(key, index);
Expand All @@ -145,7 +145,7 @@ contract DataContract is DataContractInterface, BaseContract {

/// @notice remove a list entry from a list
/// @dev moves last element from list into the slot where the deleted entry was placed
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @param index index of the element to delete
function removeListEntry(bytes32 key, uint256 index) public auth {
// create key for list ('$KEY.listentry')
Expand All @@ -166,7 +166,7 @@ contract DataContract is DataContractInterface, BaseContract {
}

/// @notice set a value of an entry in the contract
/// @param key sha3 hash of a key
/// @param key keccak256 hash of a key
/// @param value value to set for this key
function setEntry(bytes32 key, bytes32 value) public auth {
// create key for entry
Expand All @@ -179,8 +179,8 @@ contract DataContract is DataContractInterface, BaseContract {
}

/// @notice set a value of a mapping property in the contract
/// @param mappingHash sha3 hash of the mapping name
/// @param key sha3 hash of the mappings entry/property name
/// @param mappingHash keccak256 hash of the mapping name
/// @param key keccak256 hash of the mappings entry/property name
/// @param value value to set for this key
function setMappingValue(bytes32 mappingHash, bytes32 key, bytes32 value) public auth {
// create key for mapping ('$KEY.listentry')
Expand All @@ -194,23 +194,23 @@ contract DataContract is DataContractInterface, BaseContract {
}

/// @notice retrieve entry value for a key
/// @param key sha3 hash of a key
/// @param key keccak256 hash of a key
/// @return value for this key
function getEntry(bytes32 key) public constant returns(bytes32) {
// return entry
return hashMapping[keccak256(ENTRY_LABEL, key)];
}

/// @notice get number of elements in a list
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @return number of elements
function getListEntryCount(bytes32 key) public constant returns(uint256) {
// return entry ('listcount.$KEY.listentry')
return uint256(hashMapping[keccak256(keccak256(LISTENTRY_LABEL, key), COUNT_LABEL)]);
}

/// @notice retrieve a single entry from a list
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @param index index of the element to retrieve
/// @return value for this list entry
function getListEntry(bytes32 key, uint256 index) public constant returns(bytes32) {
Expand All @@ -219,8 +219,8 @@ contract DataContract is DataContractInterface, BaseContract {
}

/// @notice retrieve a single entry from a mapping
/// @param mappingHash sha3 hash of the mapping name
/// @param key sha3 hash of the mappings entry/property name
/// @param mappingHash keccak256 hash of the mapping name
/// @param key keccak256 hash of the mappings entry/property name
/// @return value for this mapping entry
function getMappingValue(bytes32 mappingHash, bytes32 key) public constant returns(bytes32) {
// return entry ('$KEY.$MAPPING.listentry')
Expand Down
24 changes: 12 additions & 12 deletions contracts/DataContractInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract DataContractInterface is BaseContractInterface {
/// @notice add entries to a list
/// @dev keep in mind that list do not provide a fixed order;
/// they can be iterated, but deleting entries repositions items
/// @param keys sha3 hash of the list name
/// @param keys keccak256 hash of the list name
/// @param values values to add to this list
function addListEntries(bytes32[] keys, bytes32[] values) public;

Expand All @@ -51,47 +51,47 @@ contract DataContractInterface is BaseContractInterface {
function init(bytes32 domain, bool allowConsumerInviteIn) public;

/// @notice move a list entry from a list into one or multiple lists
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @param index index of the element to delete
/// @param keys sha3 hashes of the list names
/// @param keys keccak256 hashes of the list names
function moveListEntry(bytes32 key, uint256 index, bytes32[] keys) public;

/// @notice remove a list entry from a list
/// @dev moves last element from list into the slot where the deleted entry was placed
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @param index index of the element to delete
function removeListEntry(bytes32 key, uint256 index) public;

/// @notice set a value of an entry in the contract
/// @param key sha3 hash of a key
/// @param key keccak256 hash of a key
/// @param value value to set for this key
function setEntry(bytes32 key, bytes32 value) public;

/// @notice set a value of a mapping property in the contract
/// @param mappingHash sha3 hash of the mapping name
/// @param key sha3 hash of the mappings entry/property name
/// @param mappingHash keccak256 hash of the mapping name
/// @param key keccak256 hash of the mappings entry/property name
/// @param value value to set for this key
function setMappingValue(bytes32 mappingHash, bytes32 key, bytes32 value) public;

/// @notice retrieve entry value for a key
/// @param key sha3 hash of a key
/// @param key keccak256 hash of a key
/// @return value for this key
function getEntry(bytes32 key) public constant returns(bytes32);

/// @notice get number of elements in a list
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @return number of elements
function getListEntryCount(bytes32 key) public constant returns(uint256);

/// @notice retrieve a single entry from a list
/// @param key sha3 hash of the list name
/// @param key keccak256 hash of the list name
/// @param index index of the element to retrieve
/// @return value for this list entry
function getListEntry(bytes32 key, uint256 index) public constant returns(bytes32);

/// @notice retrieve a single entry from a mapping
/// @param mappingHash sha3 hash of the mapping name
/// @param key sha3 hash of the mappings entry/property name
/// @param mappingHash keccak256 hash of the mapping name
/// @param key keccak256 hash of the mappings entry/property name
/// @return value for this mapping entry
function getMappingValue(bytes32 mappingHash, bytes32 key) public constant returns(bytes32);
}
2 changes: 1 addition & 1 deletion contracts/EnsReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract EnsReader {
bytes32 rootDomain = 0x01713a3bd6dccc828bbc37b3f42f3bc5555b16438783fabea9faf8c2243a0370;

function getAddr(bytes32 node) constant internal returns (address) {
return AbstractPublicResolver(ens.resolver(sha3(rootDomain, node))).addr(sha3(rootDomain, node));
return AbstractPublicResolver(ens.resolver(keccak256(rootDomain, node))).addr(keccak256(rootDomain, node));
}

function setEns(address ensAddress) internal {
Expand Down
2 changes: 1 addition & 1 deletion contracts/ServiceContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import "./ServiceContractInterface.sol";

contract ServiceContract is ServiceContractInterface, BaseContract {
bytes32 public constant EVENTHUB_LABEL =
0xea14ea6d138254c1a2931c6a19f6888c7b52f512d165cfa428183a53dd9dfb8c; //web3.sha3('events')
0xea14ea6d138254c1a2931c6a19f6888c7b52f512d165cfa428183a53dd9dfb8c; //web3.utils.soliditySha3('events')

function ServiceContract(address _provider, bytes32 _contractType, bytes32 _contractDescription, address ensAddress) public
BaseContract(_provider, _contractType, _contractDescription, ensAddress) {
Expand Down
2 changes: 1 addition & 1 deletion dbcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"contractus",
"library"
],
"version": "1.1.0",
"version": "1.1.1",
"versions": {
"0.1.0": "QmQ576qcoH4GXKRTYq3xqYJR62Lhf5665ySTj6YyENMZPJ",
"0.9.0": "QmNfBLnAM4DctyNxg7CbE4mtYdmQfTN9bVGx8x12nMvjUD",
Expand Down
Loading

0 comments on commit 55d9a77

Please sign in to comment.