diff --git a/VERSIONS.md b/VERSIONS.md index b4572fb..59e0c41 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -8,6 +8,11 @@ ### Deprecations +## Version 2.6.1 +### Fixes +- fix container factory permissions + + ## Version 2.6.0 ### Features - performance/cost optimizations for `ContainerDataContractFactory` diff --git a/contracts/ContainerDataContractFactory.sol b/contracts/ContainerDataContractFactory.sol index aa25726..20a87cd 100755 --- a/contracts/ContainerDataContractFactory.sol +++ b/contracts/ContainerDataContractFactory.sol @@ -70,42 +70,25 @@ contract ContainerDataContractFactory is BaseContractFactory, EnsReader { function createRoles(address owner, address newContract) public returns (DSRolesPerContract) { DSRolesPerContract roles = super.createRoles(owner); - + // roles + uint8 ownerRole = 0; + uint8 memberRole = 1; + // make contract root user of own roles config roles.setRootUser(newContract, true); - - uint8[] memory roles1; - assembly { - // Create an dynamic sized array manually. - // Don't need to define the data type here as the EVM will prefix it - roles1 := mload(0x40) // 0x40 is the address where next free memory slot is stored in Solidity. - mstore(add(roles1, 0x00), 9) // Set size to 14 - // omit owner roles, as initial value for field is 0 and owner role id is 0 - mstore(add(roles1, 0xc0), 1) - mstore(add(roles1, 0xe0), 1) - mstore(add(roles1, 0x0100), 1) - mstore(add(roles1, 0x0120), 1) - mstore(0x40, add(roles1, 0x0140)) // Update the msize offset to be our memory reference plus the amount of bytes we're using - } - bytes4[] memory sigs; - assembly { - // Create an dynamic sized array manually. - // Don't need to define the data type here as the EVM will prefix it - sigs := mload(0x40) // 0x40 is the address where next free memory slot is stored in Solidity. - mstore(add(sigs, 0x00), 9) // Set size to 14 - mstore(add(sigs, 0x20), 0x9f99b6e7) // init(bytes32,bool) - mstore(add(sigs, 0x40), 0x13af4035) // setOwner(address) - mstore(add(sigs, 0x60), 0xb14f5d7e) // inviteConsumer(address,address) - mstore(add(sigs, 0x80), 0xa7b93d61) // removeConsumer(address,address) - mstore(add(sigs, 0xa0), 0xcf82c070) // moveListEntry(bytes32,uint256,bytes32[]) - mstore(add(sigs, 0xc0), 0x6d948f50) // addListEntries(bytes32[],bytes32[]) - mstore(add(sigs, 0xe0), 0xc0ff8ed5) // removeListEntry(bytes32,uint256) - mstore(add(sigs, 0x0100), 0x44dd44d6) // setEntry(bytes32,bytes32) - mstore(add(sigs, 0x0120), 0xb4f64c05) // setMappingValue(bytes32,bytes32,bytes32) - mstore(0x40, add(sigs, 0x0140)) // Update the msize offset to be our memory reference plus the amount of bytes we're using - } - - roles.setRoleCapabilities(roles1, sigs, true); + + // role 2 permission (contract owner) + roles.setRoleCapability(ownerRole, 0, 0x9f99b6e7, true); // init(bytes32,bool) + roles.setRoleCapability(ownerRole, 0, 0x13af4035, true); // setOwner(address) + roles.setRoleCapability(ownerRole, 0, 0xb14f5d7e, true); // inviteConsumer(address,address) + roles.setRoleCapability(ownerRole, 0, 0xa7b93d61, true); // removeConsumer(address,address) + roles.setRoleCapability(ownerRole, 0, 0xcf82c070, true); // moveListEntry(bytes32,uint256,bytes32[]) + + // role 2 permission (members) + roles.setRoleCapability(memberRole, 0, 0x6d948f50, true); // addListEntries(bytes32[],bytes32[]) + roles.setRoleCapability(memberRole, 0, 0xc0ff8ed5, true); // removeListEntry(bytes32,uint256) + roles.setRoleCapability(memberRole, 0, 0x44dd44d6, true); // setEntry(bytes32,bytes32) + roles.setRoleCapability(memberRole, 0, 0xb4f64c05, true); // setMappingValue(bytes32,bytes32,bytes32) return roles; } diff --git a/package.json b/package.json index aab2ba2..087906d 100644 --- a/package.json +++ b/package.json @@ -32,5 +32,5 @@ "scripts": { "build-contracts": "node ./scripts/build-contracts.js" }, - "version": "2.6.0" + "version": "2.6.1" }