diff --git a/contracts/controller/Avatar.sol b/contracts/controller/Avatar.sol index 3c50ccae..587c3191 100644 --- a/contracts/controller/Avatar.sol +++ b/contracts/controller/Avatar.sol @@ -1,16 +1,16 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/Reputation.sol"; +import "@daostack/infra-experimental/contracts/Reputation.sol"; import "./DAOToken.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "../libs/SafeERC20.sol"; - +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title An Avatar holds tokens, reputation and ether for a controller */ -contract Avatar is Ownable { +contract Avatar is Initializable, Ownable { using SafeERC20 for address; string public orgName; @@ -26,20 +26,26 @@ contract Avatar is Ownable { event MetaData(string _metaData); /** - * @dev the constructor takes organization name, native token and reputation system - and creates an avatar for a controller + * @dev enables an avatar to receive ethers */ - constructor(string memory _orgName, DAOToken _nativeToken, Reputation _nativeReputation) public { - orgName = _orgName; - nativeToken = _nativeToken; - nativeReputation = _nativeReputation; + function() external payable { + emit ReceiveEther(msg.sender, msg.value); } /** - * @dev enables an avatar to receive ethers + * @dev initialize takes organization name, native token and reputation system + and creates an avatar for a controller */ - function() external payable { - emit ReceiveEther(msg.sender, msg.value); + function initialize(string calldata _orgName, + DAOToken _nativeToken, + Reputation _nativeReputation, + address _owner) + external + initializer { + orgName = _orgName; + nativeToken = _nativeToken; + nativeReputation = _nativeReputation; + Ownable.initialize(_owner); } /** @@ -50,8 +56,8 @@ contract Avatar is Ownable { * @return bool success or fail * bytes - the return bytes of the called contract's function. */ - function genericCall(address _contract, bytes memory _data, uint256 _value) - public + function genericCall(address _contract, bytes calldata _data, uint256 _value) + external onlyOwner returns(bool success, bytes memory returnValue) { // solhint-disable-next-line avoid-call-value @@ -65,7 +71,7 @@ contract Avatar is Ownable { * @param _to send the ethers to this address * @return bool which represents success */ - function sendEther(uint256 _amountInWei, address payable _to) public onlyOwner returns(bool) { + function sendEther(uint256 _amountInWei, address payable _to) external onlyOwner returns(bool) { _to.transfer(_amountInWei); emit SendEther(_amountInWei, _to); return true; @@ -79,7 +85,7 @@ contract Avatar is Ownable { * @return bool which represents success */ function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value) - public onlyOwner returns(bool) + external onlyOwner returns(bool) { address(_externalToken).safeTransfer(_to, _value); emit ExternalTokenTransfer(address(_externalToken), _to, _value); @@ -100,7 +106,7 @@ contract Avatar is Ownable { address _to, uint256 _value ) - public onlyOwner returns(bool) + external onlyOwner returns(bool) { address(_externalToken).safeTransferFrom(_from, _to, _value); emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value); @@ -116,7 +122,7 @@ contract Avatar is Ownable { * @return bool which represents a success */ function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value) - public onlyOwner returns(bool) + external onlyOwner returns(bool) { address(_externalToken).safeApprove(_spender, _value); emit ExternalTokenApproval(address(_externalToken), _spender, _value); @@ -128,7 +134,7 @@ contract Avatar is Ownable { * @param _metaData a string representing a hash of the meta data * @return bool which represents a success */ - function metaData(string memory _metaData) public onlyOwner returns(bool) { + function metaData(string calldata _metaData) external onlyOwner returns(bool) { emit MetaData(_metaData); return true; } diff --git a/contracts/controller/Controller.sol b/contracts/controller/Controller.sol index b63ed201..911b1a9a 100644 --- a/contracts/controller/Controller.sol +++ b/contracts/controller/Controller.sol @@ -2,40 +2,30 @@ pragma solidity ^0.5.11; import "./Avatar.sol"; import "../globalConstraints/GlobalConstraintInterface.sol"; -import "./ControllerInterface.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title Controller contract * @dev A controller controls the organizations tokens, reputation and avatar. * It is subject to a set of schemes and constraints that determine its behavior. - * Each scheme has it own parameters and operation permissions. */ -contract Controller is ControllerInterface { - - struct Scheme { - bytes32 paramsHash; // a hash "configuration" of the scheme - bytes4 permissions; // A bitwise flags of permissions, - // All 0: Not registered, - // 1st bit: Flag if the scheme is registered, - // 2nd bit: Scheme can register other schemes - // 3rd bit: Scheme can add/remove global constraints - // 4th bit: Scheme can upgrade the controller - // 5th bit: Scheme can call genericCall on behalf of - // the organization avatar - } - - struct GlobalConstraint { - address gcAddress; - bytes32 params; - } +contract Controller is Initializable { struct GlobalConstraintRegister { bool isRegistered; //is registered uint256 index; //index at globalConstraints } - mapping(address=>Scheme) public schemes; + // A bitwise flags of permissions, + // All 0: Not registered, + // 1st bit: Flag if the scheme is registered, + // 2nd bit: Scheme can register other schemes + // 3rd bit: Scheme can add/remove global constraints + // 4th bit: Scheme can upgrade the controller + // 5th bit: Scheme can call genericCall on behalf of + // the organization avatar + mapping(address=>bytes4) public schemesPermissions; Avatar public avatar; DAOToken public nativeToken; @@ -44,9 +34,9 @@ contract Controller is ControllerInterface { address public newController; // globalConstraintsPre that determine pre conditions for all actions on the controller - GlobalConstraint[] public globalConstraintsPre; + address[] public globalConstraintsPre; // globalConstraintsPost that determine post conditions for all actions on the controller - GlobalConstraint[] public globalConstraintsPost; + address[] public globalConstraintsPost; // globalConstraintsRegisterPre indicate if a globalConstraints is registered as a pre global constraint mapping(address=>GlobalConstraintRegister) public globalConstraintsRegisterPre; // globalConstraintsRegisterPost indicate if a globalConstraints is registered as a post global constraint @@ -61,52 +51,46 @@ contract Controller is ControllerInterface { event AddGlobalConstraint( address indexed _globalConstraint, - bytes32 _params, GlobalConstraintInterface.CallPhase _when); event RemoveGlobalConstraint(address indexed _globalConstraint, uint256 _index, bool _isPre); - constructor( Avatar _avatar) public { + function initialize( Avatar _avatar, address initialScheme ) external initializer { avatar = _avatar; nativeToken = avatar.nativeToken(); nativeReputation = avatar.nativeReputation(); - schemes[msg.sender] = Scheme({paramsHash: bytes32(0), permissions: bytes4(0x0000001F)}); - } - - // Do not allow mistaken calls: - // solhint-disable-next-line payable-fallback - function() external { - revert(); + schemesPermissions[initialScheme] = bytes4(0x0000001F); + emit RegisterScheme(msg.sender, initialScheme); } // Modifiers: modifier onlyRegisteredScheme() { - require(schemes[msg.sender].permissions&bytes4(0x00000001) == bytes4(0x00000001)); + require(schemesPermissions[msg.sender]&bytes4(0x00000001) == bytes4(0x00000001)); _; } modifier onlyRegisteringSchemes() { - require(schemes[msg.sender].permissions&bytes4(0x00000002) == bytes4(0x00000002)); + require(schemesPermissions[msg.sender]&bytes4(0x00000002) == bytes4(0x00000002)); _; } modifier onlyGlobalConstraintsScheme() { - require(schemes[msg.sender].permissions&bytes4(0x00000004) == bytes4(0x00000004)); + require(schemesPermissions[msg.sender]&bytes4(0x00000004) == bytes4(0x00000004)); _; } modifier onlyUpgradingScheme() { - require(schemes[msg.sender].permissions&bytes4(0x00000008) == bytes4(0x00000008)); + require(schemesPermissions[msg.sender]&bytes4(0x00000008) == bytes4(0x00000008)); _; } modifier onlyGenericCallScheme() { - require(schemes[msg.sender].permissions&bytes4(0x00000010) == bytes4(0x00000010)); + require(schemesPermissions[msg.sender]&bytes4(0x00000010) == bytes4(0x00000010)); _; } modifier onlyMetaDataScheme() { - require(schemes[msg.sender].permissions&bytes4(0x00000010) == bytes4(0x00000010)); + require(schemesPermissions[msg.sender]&bytes4(0x00000010) == bytes4(0x00000010)); _; } @@ -114,33 +98,27 @@ contract Controller is ControllerInterface { uint256 idx; for (idx = 0; idx < globalConstraintsPre.length; idx++) { require( - (GlobalConstraintInterface(globalConstraintsPre[idx].gcAddress)) - .pre(msg.sender, globalConstraintsPre[idx].params, func)); + (GlobalConstraintInterface(globalConstraintsPre[idx])) + .pre(msg.sender, func), "not allowed by globalConstraint"); } _; for (idx = 0; idx < globalConstraintsPost.length; idx++) { require( - (GlobalConstraintInterface(globalConstraintsPost[idx].gcAddress)) - .post(msg.sender, globalConstraintsPost[idx].params, func)); + (GlobalConstraintInterface(globalConstraintsPost[idx])) + .post(msg.sender, func), "not allowed by globalConstraint"); } } - modifier isAvatarValid(address _avatar) { - require(_avatar == address(avatar)); - _; - } - /** * @dev Mint `_amount` of reputation that are assigned to `_to` . * @param _amount amount of reputation to mint * @param _to beneficiary address * @return bool which represents a success */ - function mintReputation(uint256 _amount, address _to, address _avatar) + function mintReputation(uint256 _amount, address _to) external onlyRegisteredScheme onlySubjectToConstraint("mintReputation") - isAvatarValid(_avatar) returns(bool) { emit MintReputation(msg.sender, _to, _amount); @@ -153,11 +131,10 @@ contract Controller is ControllerInterface { * @param _from The address that will lose the reputation * @return bool which represents a success */ - function burnReputation(uint256 _amount, address _from, address _avatar) + function burnReputation(uint256 _amount, address _from) external onlyRegisteredScheme onlySubjectToConstraint("burnReputation") - isAvatarValid(_avatar) returns(bool) { emit BurnReputation(msg.sender, _from, _amount); @@ -170,11 +147,10 @@ contract Controller is ControllerInterface { * @param _beneficiary beneficiary address * @return bool which represents a success */ - function mintTokens(uint256 _amount, address _beneficiary, address _avatar) + function mintTokens(uint256 _amount, address _beneficiary) external onlyRegisteredScheme onlySubjectToConstraint("mintTokens") - isAvatarValid(_avatar) returns(bool) { emit MintTokens(msg.sender, _beneficiary, _amount); @@ -184,32 +160,29 @@ contract Controller is ControllerInterface { /** * @dev register a scheme * @param _scheme the address of the scheme - * @param _paramsHash a hashed configuration of the usage of the scheme * @param _permissions the permissions the new scheme will have * @return bool which represents a success */ - function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar) + function registerScheme(address _scheme, bytes4 _permissions) external onlyRegisteringSchemes onlySubjectToConstraint("registerScheme") - isAvatarValid(_avatar) returns(bool) { - Scheme memory scheme = schemes[_scheme]; + bytes4 permissions = schemesPermissions[_scheme]; // Check scheme has at least the permissions it is changing, and at least the current permissions: // Implementation is a bit messy. One must recall logic-circuits ^^ // produces non-zero if sender does not have all of the perms that are changing between old and new - require(bytes4(0x0000001f)&(_permissions^scheme.permissions)&(~schemes[msg.sender].permissions) == bytes4(0)); + require(bytes4(0x0000001f)&(_permissions^permissions)&(~schemesPermissions[msg.sender]) == bytes4(0)); // produces non-zero if sender does not have all of the perms in the old scheme - require(bytes4(0x0000001f)&(scheme.permissions&(~schemes[msg.sender].permissions)) == bytes4(0)); + require(bytes4(0x0000001f)&(permissions&(~schemesPermissions[msg.sender])) == bytes4(0)); // Add or change the scheme: - schemes[_scheme].paramsHash = _paramsHash; - schemes[_scheme].permissions = _permissions|bytes4(0x00000001); + schemesPermissions[_scheme] = _permissions|bytes4(0x00000001); emit RegisterScheme(msg.sender, _scheme); return true; } @@ -219,11 +192,10 @@ contract Controller is ControllerInterface { * @param _scheme the address of the scheme * @return bool which represents a success */ - function unregisterScheme( address _scheme, address _avatar) + function unregisterScheme(address _scheme) external onlyRegisteringSchemes onlySubjectToConstraint("unregisterScheme") - isAvatarValid(_avatar) returns(bool) { //check if the scheme is registered @@ -231,11 +203,11 @@ contract Controller is ControllerInterface { return false; } // Check the unregistering scheme has enough permissions: - require(bytes4(0x0000001f)&(schemes[_scheme].permissions&(~schemes[msg.sender].permissions)) == bytes4(0)); + require(bytes4(0x0000001f)&(schemesPermissions[_scheme]&(~schemesPermissions[msg.sender])) == bytes4(0)); // Unregister: emit UnregisterScheme(msg.sender, _scheme); - delete schemes[_scheme]; + delete schemesPermissions[_scheme]; return true; } @@ -243,11 +215,11 @@ contract Controller is ControllerInterface { * @dev unregister the caller's scheme * @return bool which represents a success */ - function unregisterSelf(address _avatar) external isAvatarValid(_avatar) returns(bool) { + function unregisterSelf() external returns(bool) { if (_isSchemeRegistered(msg.sender) == false) { return false; } - delete schemes[msg.sender]; + delete schemesPermissions[msg.sender]; emit UnregisterScheme(msg.sender, msg.sender); return true; } @@ -255,37 +227,31 @@ contract Controller is ControllerInterface { /** * @dev add or update Global Constraint * @param _globalConstraint the address of the global constraint to be added. - * @param _params the constraint parameters hash. * @return bool which represents a success */ - function addGlobalConstraint(address _globalConstraint, bytes32 _params, address _avatar) + function addGlobalConstraint(address _globalConstraint) external onlyGlobalConstraintsScheme - isAvatarValid(_avatar) returns(bool) { GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when(); if ((when == GlobalConstraintInterface.CallPhase.Pre)|| (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { if (!globalConstraintsRegisterPre[_globalConstraint].isRegistered) { - globalConstraintsPre.push(GlobalConstraint(_globalConstraint, _params)); + globalConstraintsPre.push(_globalConstraint); globalConstraintsRegisterPre[_globalConstraint] = GlobalConstraintRegister(true, globalConstraintsPre.length-1); - }else { - globalConstraintsPre[globalConstraintsRegisterPre[_globalConstraint].index].params = _params; } } if ((when == GlobalConstraintInterface.CallPhase.Post)|| (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { if (!globalConstraintsRegisterPost[_globalConstraint].isRegistered) { - globalConstraintsPost.push(GlobalConstraint(_globalConstraint, _params)); + globalConstraintsPost.push(_globalConstraint); globalConstraintsRegisterPost[_globalConstraint] = GlobalConstraintRegister(true, globalConstraintsPost.length-1); - }else { - globalConstraintsPost[globalConstraintsRegisterPost[_globalConstraint].index].params = _params; } } - emit AddGlobalConstraint(_globalConstraint, _params, when); + emit AddGlobalConstraint(_globalConstraint, when); return true; } @@ -295,14 +261,13 @@ contract Controller is ControllerInterface { * @return bool which represents a success */ // solhint-disable-next-line code-complexity - function removeGlobalConstraint (address _globalConstraint, address _avatar) + function removeGlobalConstraint (address _globalConstraint) external onlyGlobalConstraintsScheme - isAvatarValid(_avatar) returns(bool) { GlobalConstraintRegister memory globalConstraintRegister; - GlobalConstraint memory globalConstraint; + address globalConstraint; GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when(); bool retVal = false; @@ -313,7 +278,7 @@ contract Controller is ControllerInterface { if (globalConstraintRegister.index < globalConstraintsPre.length-1) { globalConstraint = globalConstraintsPre[globalConstraintsPre.length-1]; globalConstraintsPre[globalConstraintRegister.index] = globalConstraint; - globalConstraintsRegisterPre[globalConstraint.gcAddress].index = globalConstraintRegister.index; + globalConstraintsRegisterPre[globalConstraint].index = globalConstraintRegister.index; } globalConstraintsPre.length--; delete globalConstraintsRegisterPre[_globalConstraint]; @@ -327,7 +292,7 @@ contract Controller is ControllerInterface { if (globalConstraintRegister.index < globalConstraintsPost.length-1) { globalConstraint = globalConstraintsPost[globalConstraintsPost.length-1]; globalConstraintsPost[globalConstraintRegister.index] = globalConstraint; - globalConstraintsRegisterPost[globalConstraint.gcAddress].index = globalConstraintRegister.index; + globalConstraintsRegisterPost[globalConstraint].index = globalConstraintRegister.index; } globalConstraintsPost.length--; delete globalConstraintsRegisterPost[_globalConstraint]; @@ -350,10 +315,9 @@ contract Controller is ControllerInterface { * @param _newController the address of the new controller. * @return bool which represents a success */ - function upgradeController(address _newController, Avatar _avatar) + function upgradeController(address _newController) external onlyUpgradingScheme - isAvatarValid(address(_avatar)) returns(bool) { require(newController == address(0)); // so the upgrade could be done once for a contract. @@ -377,16 +341,14 @@ contract Controller is ControllerInterface { * @dev perform a generic call to an arbitrary contract * @param _contract the contract's address to call * @param _data ABI-encoded contract call to call `_contract` address. - * @param _avatar the controller's avatar address * @param _value value (ETH) to transfer with the transaction * @return bool -success * bytes - the return value of the called _contract's function. */ - function genericCall(address _contract, bytes calldata _data, Avatar _avatar, uint256 _value) + function genericCall(address _contract, bytes calldata _data, uint256 _value) external onlyGenericCallScheme onlySubjectToConstraint("genericCall") - isAvatarValid(address(_avatar)) returns (bool, bytes memory) { return avatar.genericCall(_contract, _data, _value); @@ -398,11 +360,10 @@ contract Controller is ControllerInterface { * @param _to address of the beneficiary * @return bool which represents a success */ - function sendEther(uint256 _amountInWei, address payable _to, Avatar _avatar) + function sendEther(uint256 _amountInWei, address payable _to) external onlyRegisteredScheme onlySubjectToConstraint("sendEther") - isAvatarValid(address(_avatar)) returns(bool) { return avatar.sendEther(_amountInWei, _to); @@ -415,11 +376,10 @@ contract Controller is ControllerInterface { * @param _value the amount of ether (in Wei) to send * @return bool which represents a success */ - function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) + function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenTransfer") - isAvatarValid(address(_avatar)) returns(bool) { return avatar.externalTokenTransfer(_externalToken, _to, _value); @@ -439,12 +399,10 @@ contract Controller is ControllerInterface { IERC20 _externalToken, address _from, address _to, - uint256 _value, - Avatar _avatar) + uint256 _value) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenTransferFrom") - isAvatarValid(address(_avatar)) returns(bool) { return avatar.externalTokenTransferFrom(_externalToken, _from, _to, _value); @@ -458,11 +416,10 @@ contract Controller is ControllerInterface { * @param _value the amount of ether (in Wei) which the approval is referring to. * @return bool which represents a success */ - function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar) + function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenIncreaseApproval") - isAvatarValid(address(_avatar)) returns(bool) { return avatar.externalTokenApproval(_externalToken, _spender, _value); @@ -471,81 +428,35 @@ contract Controller is ControllerInterface { /** * @dev metaData emits an event with a string, should contain the hash of some meta data. * @param _metaData a string representing a hash of the meta data - * @param _avatar Avatar * @return bool which represents a success */ - function metaData(string calldata _metaData, Avatar _avatar) + function metaData(string calldata _metaData) external onlyMetaDataScheme - isAvatarValid(address(_avatar)) returns(bool) { return avatar.metaData(_metaData); } - /** - * @dev getNativeReputation - * @param _avatar the organization avatar. - * @return organization native reputation - */ - function getNativeReputation(address _avatar) external isAvatarValid(_avatar) view returns(address) { - return address(nativeReputation); - } - - function isSchemeRegistered(address _scheme, address _avatar) external isAvatarValid(_avatar) view returns(bool) { + function isSchemeRegistered(address _scheme) external view returns(bool) { return _isSchemeRegistered(_scheme); } - function getSchemeParameters(address _scheme, address _avatar) - external - isAvatarValid(_avatar) - view - returns(bytes32) - { - return schemes[_scheme].paramsHash; - } - - function getSchemePermissions(address _scheme, address _avatar) - external - isAvatarValid(_avatar) - view - returns(bytes4) - { - return schemes[_scheme].permissions; - } - - function getGlobalConstraintParameters(address _globalConstraint, address) external view returns(bytes32) { - - GlobalConstraintRegister memory register = globalConstraintsRegisterPre[_globalConstraint]; - - if (register.isRegistered) { - return globalConstraintsPre[register.index].params; - } - - register = globalConstraintsRegisterPost[_globalConstraint]; - - if (register.isRegistered) { - return globalConstraintsPost[register.index].params; - } - } - /** * @dev globalConstraintsCount return the global constraint pre and post count * @return uint256 globalConstraintsPre count. * @return uint256 globalConstraintsPost count. */ - function globalConstraintsCount(address _avatar) + function globalConstraintsCount() external - isAvatarValid(_avatar) view returns(uint, uint) { return (globalConstraintsPre.length, globalConstraintsPost.length); } - function isGlobalConstraintRegistered(address _globalConstraint, address _avatar) + function isGlobalConstraintRegistered(address _globalConstraint) external - isAvatarValid(_avatar) view returns(bool) { @@ -554,6 +465,6 @@ contract Controller is ControllerInterface { } function _isSchemeRegistered(address _scheme) private view returns(bool) { - return (schemes[_scheme].permissions&bytes4(0x00000001) != bytes4(0)); + return (schemesPermissions[_scheme]&bytes4(0x00000001) != bytes4(0)); } } diff --git a/contracts/controller/ControllerInterface.sol b/contracts/controller/ControllerInterface.sol deleted file mode 100644 index 9790ec27..00000000 --- a/contracts/controller/ControllerInterface.sol +++ /dev/null @@ -1,204 +0,0 @@ -pragma solidity ^0.5.11; - -import "./Avatar.sol"; -import "../globalConstraints/GlobalConstraintInterface.sol"; - -/** - * @title Controller contract - * @dev A controller controls the organizations tokens ,reputation and avatar. - * It is subject to a set of schemes and constraints that determine its behavior. - * Each scheme has it own parameters and operation permissions. - */ -interface ControllerInterface { - - /** - * @dev Mint `_amount` of reputation that are assigned to `_to` . - * @param _amount amount of reputation to mint - * @param _to beneficiary address - * @return bool which represents a success - */ - function mintReputation(uint256 _amount, address _to, address _avatar) - external - returns(bool); - - /** - * @dev Burns `_amount` of reputation from `_from` - * @param _amount amount of reputation to burn - * @param _from The address that will lose the reputation - * @return bool which represents a success - */ - function burnReputation(uint256 _amount, address _from, address _avatar) - external - returns(bool); - - /** - * @dev mint tokens . - * @param _amount amount of token to mint - * @param _beneficiary beneficiary address - * @param _avatar address - * @return bool which represents a success - */ - function mintTokens(uint256 _amount, address _beneficiary, address _avatar) - external - returns(bool); - - /** - * @dev register or update a scheme - * @param _scheme the address of the scheme - * @param _paramsHash a hashed configuration of the usage of the scheme - * @param _permissions the permissions the new scheme will have - * @param _avatar address - * @return bool which represents a success - */ - function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar) - external - returns(bool); - - /** - * @dev unregister a scheme - * @param _avatar address - * @param _scheme the address of the scheme - * @return bool which represents a success - */ - function unregisterScheme(address _scheme, address _avatar) - external - returns(bool); - - /** - * @dev unregister the caller's scheme - * @param _avatar address - * @return bool which represents a success - */ - function unregisterSelf(address _avatar) external returns(bool); - - /** - * @dev add or update Global Constraint - * @param _globalConstraint the address of the global constraint to be added. - * @param _params the constraint parameters hash. - * @param _avatar the avatar of the organization - * @return bool which represents a success - */ - function addGlobalConstraint(address _globalConstraint, bytes32 _params, address _avatar) - external returns(bool); - - /** - * @dev remove Global Constraint - * @param _globalConstraint the address of the global constraint to be remove. - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function removeGlobalConstraint (address _globalConstraint, address _avatar) - external returns(bool); - - /** - * @dev upgrade the Controller - * The function will trigger an event 'UpgradeController'. - * @param _newController the address of the new controller. - * @param _avatar address - * @return bool which represents a success - */ - function upgradeController(address _newController, Avatar _avatar) - external returns(bool); - - /** - * @dev perform a generic call to an arbitrary contract - * @param _contract the contract's address to call - * @param _data ABI-encoded contract call to call `_contract` address. - * @param _avatar the controller's avatar address - * @param _value value (ETH) to transfer with the transaction - * @return bool -success - * bytes - the return value of the called _contract's function. - */ - function genericCall(address _contract, bytes calldata _data, Avatar _avatar, uint256 _value) - external - returns(bool, bytes memory); - - /** - * @dev send some ether - * @param _amountInWei the amount of ether (in Wei) to send - * @param _to address of the beneficiary - * @param _avatar address - * @return bool which represents a success - */ - function sendEther(uint256 _amountInWei, address payable _to, Avatar _avatar) - external returns(bool); - - /** - * @dev send some amount of arbitrary ERC20 Tokens - * @param _externalToken the address of the Token Contract - * @param _to address of the beneficiary - * @param _value the amount of ether (in Wei) to send - * @param _avatar address - * @return bool which represents a success - */ - function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) - external - returns(bool); - - /** - * @dev transfer token "from" address "to" address - * One must to approve the amount of tokens which can be spend from the - * "from" account.This can be done using externalTokenApprove. - * @param _externalToken the address of the Token Contract - * @param _from address of the account to send from - * @param _to address of the beneficiary - * @param _value the amount of ether (in Wei) to send - * @param _avatar address - * @return bool which represents a success - */ - function externalTokenTransferFrom( - IERC20 _externalToken, - address _from, - address _to, - uint256 _value, - Avatar _avatar) - external - returns(bool); - - /** - * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens - * on behalf of msg.sender. - * @param _externalToken the address of the Token Contract - * @param _spender address - * @param _value the amount of ether (in Wei) which the approval is referring to. - * @return bool which represents a success - */ - function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar) - external - returns(bool); - - /** - * @dev metaData emits an event with a string, should contain the hash of some meta data. - * @param _metaData a string representing a hash of the meta data - * @param _avatar Avatar - * @return bool which represents a success - */ - function metaData(string calldata _metaData, Avatar _avatar) external returns(bool); - - /** - * @dev getNativeReputation - * @param _avatar the organization avatar. - * @return organization native reputation - */ - function getNativeReputation(address _avatar) - external - view - returns(address); - - function isSchemeRegistered( address _scheme, address _avatar) external view returns(bool); - - function getSchemeParameters(address _scheme, address _avatar) external view returns(bytes32); - - function getGlobalConstraintParameters(address _globalConstraint, address _avatar) external view returns(bytes32); - - function getSchemePermissions(address _scheme, address _avatar) external view returns(bytes4); - - /** - * @dev globalConstraintsCount return the global constraint pre and post count - * @return uint256 globalConstraintsPre count. - * @return uint256 globalConstraintsPost count. - */ - function globalConstraintsCount(address _avatar) external view returns(uint, uint); - - function isGlobalConstraintRegistered(address _globalConstraint, address _avatar) external view returns(bool); -} diff --git a/contracts/controller/DAOToken.sol b/contracts/controller/DAOToken.sol index 0ef7f9ec..b1aeaaa4 100644 --- a/contracts/controller/DAOToken.sol +++ b/contracts/controller/DAOToken.sol @@ -1,16 +1,16 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Burnable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title DAOToken, base on zeppelin contract. * @dev ERC20 compatible token. It is a mintable, burnable token. */ - -contract DAOToken is ERC20, ERC20Burnable, Ownable { +contract DAOToken is Initializable, Ownable, ERC20, ERC20Burnable { string public name; string public symbol; @@ -19,16 +19,18 @@ contract DAOToken is ERC20, ERC20Burnable, Ownable { uint256 public cap; /** - * @dev Constructor + * @dev initialize * @param _name - token name * @param _symbol - token symbol * @param _cap - token cap - 0 value means no cap */ - constructor(string memory _name, string memory _symbol, uint256 _cap) - public { + function initialize(string calldata _name, string calldata _symbol, uint256 _cap, address _owner) + external + initializer { name = _name; symbol = _symbol; cap = _cap; + Ownable.initialize(_owner); } /** diff --git a/contracts/controller/UController.sol b/contracts/controller/UController.sol deleted file mode 100644 index 3f53ad05..00000000 --- a/contracts/controller/UController.sol +++ /dev/null @@ -1,590 +0,0 @@ -pragma solidity ^0.5.11; - -import "./Avatar.sol"; -import "../globalConstraints/GlobalConstraintInterface.sol"; -import "./ControllerInterface.sol"; - - -/** - * @title Universal Controller contract - * @dev A universal controller hold organizations and controls their tokens ,reputations - * and avatar. - * It is subject to a set of schemes and constraints that determine its behavior. - * Each scheme has it own parameters and operation permissions. - */ -contract UController is ControllerInterface { - - struct Scheme { - bytes32 paramsHash; // a hash "configuration" of the scheme - bytes4 permissions; // A bitwise flags of permissions, - // All 0: Not registered, - // 1st bit: Flag if the scheme is registered, - // 2nd bit: Scheme can register other schemes - // 3th bit: Scheme can add/remove global constraints - // 4rd bit: Scheme can upgrade the controller - // 5th bit: Scheme can call delegatecall - } - - struct GlobalConstraint { - address gcAddress; - bytes32 params; - } - - struct GlobalConstraintRegister { - bool isRegistered; //is registered - uint256 index; //index at globalConstraints - } - - struct Organization { - DAOToken nativeToken; - Reputation nativeReputation; - mapping(address=>Scheme) schemes; - // globalConstraintsPre that determine pre- conditions for all actions on the controller - GlobalConstraint[] globalConstraintsPre; - // globalConstraintsPost that determine post-conditions for all actions on the controller - GlobalConstraint[] globalConstraintsPost; - // globalConstraintsRegisterPre indicate if a globalConstraints is registered as a Pre global constraint. - mapping(address=>GlobalConstraintRegister) globalConstraintsRegisterPre; - // globalConstraintsRegisterPost indicate if a globalConstraints is registered as a Post global constraint. - mapping(address=>GlobalConstraintRegister) globalConstraintsRegisterPost; - } - - //mapping between organization's avatar address to Organization - mapping(address=>Organization) public organizations; - // newController will point to the new controller after the present controller is upgraded - // address external newController; - mapping(address=>address) public newControllers;//mapping between avatar address and newController address - //mapping for all reputation system and tokens addresses registered. - mapping(address=>bool) public actors; - - event MintReputation (address indexed _sender, address indexed _to, uint256 _amount, address indexed _avatar); - event BurnReputation (address indexed _sender, address indexed _from, uint256 _amount, address indexed _avatar); - event MintTokens (address indexed _sender, address indexed _beneficiary, uint256 _amount, address indexed _avatar); - event RegisterScheme (address indexed _sender, address indexed _scheme, address indexed _avatar); - event UnregisterScheme (address indexed _sender, address indexed _scheme, address indexed _avatar); - event UpgradeController(address indexed _oldController, address _newController, address _avatar); - - event AddGlobalConstraint( - address indexed _globalConstraint, - bytes32 _params, - GlobalConstraintInterface.CallPhase _when, - address indexed _avatar - ); - - event RemoveGlobalConstraint( - address indexed _globalConstraint, - uint256 _index, - bool _isPre, - address indexed _avatar - ); - - /** - * @dev newOrganization set up a new organization with default daoCreator. - * @param _avatar the organization avatar - */ - function newOrganization( - Avatar _avatar - ) external - { - require(!actors[address(_avatar)]); - actors[address(_avatar)] = true; - require(_avatar.owner() == address(this)); - DAOToken nativeToken = _avatar.nativeToken(); - Reputation nativeReputation = _avatar.nativeReputation(); - require(nativeToken.owner() == address(this)); - require(nativeReputation.owner() == address(this)); - //To guaranty uniqueness for the reputation systems. - require(!actors[address(nativeReputation)]); - actors[address(nativeReputation)] = true; - //To guaranty uniqueness for the nativeToken. - require(!actors[address(nativeToken)]); - actors[address(nativeToken)] = true; - organizations[address(_avatar)].nativeToken = nativeToken; - organizations[address(_avatar)].nativeReputation = nativeReputation; - organizations[address(_avatar)].schemes[msg.sender] = - Scheme({paramsHash: bytes32(0), permissions: bytes4(0x0000001f)}); - emit RegisterScheme(msg.sender, msg.sender, address(_avatar)); - } - - // Modifiers: - modifier onlyRegisteredScheme(address avatar) { - require(organizations[avatar].schemes[msg.sender].permissions&bytes4(0x00000001) == bytes4(0x00000001)); - _; - } - - modifier onlyRegisteringSchemes(address avatar) { - require(organizations[avatar].schemes[msg.sender].permissions&bytes4(0x00000002) == bytes4(0x00000002)); - _; - } - - modifier onlyGlobalConstraintsScheme(address avatar) { - require(organizations[avatar].schemes[msg.sender].permissions&bytes4(0x00000004) == bytes4(0x00000004)); - _; - } - - modifier onlyUpgradingScheme(address _avatar) { - require(organizations[_avatar].schemes[msg.sender].permissions&bytes4(0x00000008) == bytes4(0x00000008)); - _; - } - - modifier onlyGenericCallScheme(address _avatar) { - require(organizations[_avatar].schemes[msg.sender].permissions&bytes4(0x00000010) == bytes4(0x00000010)); - _; - } - - modifier onlyMetaDataScheme(address _avatar) { - require(organizations[_avatar].schemes[msg.sender].permissions&bytes4(0x00000010) == bytes4(0x00000010)); - _; - } - - modifier onlySubjectToConstraint(bytes32 func, address _avatar) { - uint256 idx; - GlobalConstraint[] memory globalConstraintsPre = organizations[_avatar].globalConstraintsPre; - GlobalConstraint[] memory globalConstraintsPost = organizations[_avatar].globalConstraintsPost; - for (idx = 0; idx < globalConstraintsPre.length; idx++) { - require( - (GlobalConstraintInterface(globalConstraintsPre[idx].gcAddress)) - .pre(msg.sender, globalConstraintsPre[idx].params, func)); - } - _; - for (idx = 0; idx < globalConstraintsPost.length; idx++) { - require( - (GlobalConstraintInterface(globalConstraintsPost[idx].gcAddress)) - .post(msg.sender, globalConstraintsPost[idx].params, func)); - } - } - - /** - * @dev Mint `_amount` of reputation that are assigned to `_to` . - * @param _amount amount of reputation to mint - * @param _to beneficiary address - * @param _avatar the address of the organization's avatar - * @return bool which represents a success - */ - function mintReputation(uint256 _amount, address _to, address _avatar) - external - onlyRegisteredScheme(_avatar) - onlySubjectToConstraint("mintReputation", _avatar) - returns(bool) - { - emit MintReputation(msg.sender, _to, _amount, _avatar); - return organizations[_avatar].nativeReputation.mint(_to, _amount); - } - - /** - * @dev Burns `_amount` of reputation from `_from` - * @param _amount amount of reputation to burn - * @param _from The address that will lose the reputation - * @return bool which represents a success - */ - function burnReputation(uint256 _amount, address _from, address _avatar) - external - onlyRegisteredScheme(_avatar) - onlySubjectToConstraint("burnReputation", _avatar) - returns(bool) - { - emit BurnReputation(msg.sender, _from, _amount, _avatar); - return organizations[_avatar].nativeReputation.burn(_from, _amount); - } - - /** - * @dev mint tokens . - * @param _amount amount of token to mint - * @param _beneficiary beneficiary address - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function mintTokens(uint256 _amount, address _beneficiary, address _avatar) - external - onlyRegisteredScheme(_avatar) - onlySubjectToConstraint("mintTokens", _avatar) - returns(bool) - { - emit MintTokens(msg.sender, _beneficiary, _amount, _avatar); - return organizations[_avatar].nativeToken.mint(_beneficiary, _amount); - } - - /** - * @dev register or update a scheme - * @param _scheme the address of the scheme - * @param _paramsHash a hashed configuration of the usage of the scheme - * @param _permissions the permissions the new scheme will have - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar) - external - onlyRegisteringSchemes(_avatar) - onlySubjectToConstraint("registerScheme", _avatar) - returns(bool) - { - bytes4 schemePermission = organizations[_avatar].schemes[_scheme].permissions; - bytes4 senderPermission = organizations[_avatar].schemes[msg.sender].permissions; - // Check scheme has at least the permissions it is changing, and at least the current permissions: - // Implementation is a bit messy. One must recall logic-circuits ^^ - - // produces non-zero if sender does not have all of the perms that are changing between old and new - require(bytes4(0x0000001f)&(_permissions^schemePermission)&(~senderPermission) == bytes4(0)); - - // produces non-zero if sender does not have all of the perms in the old scheme - require(bytes4(0x0000001f)&(schemePermission&(~senderPermission)) == bytes4(0)); - - // Add or change the scheme: - organizations[_avatar].schemes[_scheme] = - Scheme({paramsHash:_paramsHash, permissions:_permissions|bytes4(0x00000001)}); - emit RegisterScheme(msg.sender, _scheme, _avatar); - return true; - } - - /** - * @dev unregister a scheme - * @param _scheme the address of the scheme - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function unregisterScheme(address _scheme, address _avatar) - external - onlyRegisteringSchemes(_avatar) - onlySubjectToConstraint("unregisterScheme", _avatar) - returns(bool) - { - bytes4 schemePermission = organizations[_avatar].schemes[_scheme].permissions; - //check if the scheme is registered - if (schemePermission&bytes4(0x00000001) == bytes4(0)) { - return false; - } - // Check the unregistering scheme has enough permissions: - require( - bytes4(0x0000001f)&(schemePermission&(~organizations[_avatar].schemes[msg.sender].permissions)) == bytes4(0)); - - // Unregister: - emit UnregisterScheme(msg.sender, _scheme, _avatar); - delete organizations[_avatar].schemes[_scheme]; - return true; - } - - /** - * @dev unregister the caller's scheme - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function unregisterSelf(address _avatar) external returns(bool) { - if (_isSchemeRegistered(msg.sender, _avatar) == false) { - return false; - } - delete organizations[_avatar].schemes[msg.sender]; - emit UnregisterScheme(msg.sender, msg.sender, _avatar); - return true; - } - - /** - * @dev add or update Global Constraint - * @param _globalConstraint the address of the global constraint to be added. - * @param _params the constraint parameters hash. - * @param _avatar the avatar of the organization - * @return bool which represents a success - */ - function addGlobalConstraint(address _globalConstraint, bytes32 _params, address _avatar) - external onlyGlobalConstraintsScheme(_avatar) returns(bool) - { - Organization storage organization = organizations[_avatar]; - GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when(); - if ((when == GlobalConstraintInterface.CallPhase.Pre)|| - (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { - if (!organization.globalConstraintsRegisterPre[_globalConstraint].isRegistered) { - organization.globalConstraintsPre.push(GlobalConstraint(_globalConstraint, _params)); - organization.globalConstraintsRegisterPre[_globalConstraint] = - GlobalConstraintRegister(true, organization.globalConstraintsPre.length-1); - }else { - organization - .globalConstraintsPre[organization.globalConstraintsRegisterPre[_globalConstraint].index] - .params = _params; - } - } - - if ((when == GlobalConstraintInterface.CallPhase.Post)|| - (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { - if (!organization.globalConstraintsRegisterPost[_globalConstraint].isRegistered) { - organization.globalConstraintsPost.push(GlobalConstraint(_globalConstraint, _params)); - organization.globalConstraintsRegisterPost[_globalConstraint] = - GlobalConstraintRegister(true, organization.globalConstraintsPost.length-1); - } else { - organization - .globalConstraintsPost[organization.globalConstraintsRegisterPost[_globalConstraint].index] - .params = _params; - } - } - emit AddGlobalConstraint(_globalConstraint, _params, when, _avatar); - return true; - } - - /** - * @dev remove Global Constraint - * @param _globalConstraint the address of the global constraint to be remove. - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function removeGlobalConstraint (address _globalConstraint, address _avatar) - external onlyGlobalConstraintsScheme(_avatar) returns(bool) - { - GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when(); - if ((when == GlobalConstraintInterface.CallPhase.Pre)|| - (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { - removeGlobalConstraintPre(_globalConstraint, _avatar); - } - if ((when == GlobalConstraintInterface.CallPhase.Post)|| - (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { - removeGlobalConstraintPost(_globalConstraint, _avatar); - } - return true; - } - - /** - * @dev upgrade the Controller - * The function will trigger an event 'UpgradeController'. - * @param _newController the address of the new controller. - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function upgradeController(address _newController, Avatar _avatar) - external onlyUpgradingScheme(address(_avatar)) returns(bool) - { - require(newControllers[address(_avatar)] == address(0)); // so the upgrade could be done once for a contract. - require(_newController != address(0)); - newControllers[address(_avatar)] = _newController; - _avatar.transferOwnership(_newController); - require(_avatar.owner() == _newController); - if (organizations[address(_avatar)].nativeToken.owner() == address(this)) { - organizations[address(_avatar)].nativeToken.transferOwnership(_newController); - require(organizations[address(_avatar)].nativeToken.owner() == _newController); - } - if (organizations[address(_avatar)].nativeReputation.owner() == address(this)) { - organizations[address(_avatar)].nativeReputation.transferOwnership(_newController); - require(organizations[address(_avatar)].nativeReputation.owner() == _newController); - } - emit UpgradeController(address(this), _newController, address(_avatar)); - return true; - } - - /** - * @dev perform a generic call to an arbitrary contract - * @param _contract the contract's address to call - * @param _data ABI-encoded contract call to call `_contract` address. - * @param _avatar the controller's avatar address - * @param _value value (ETH) to transfer with the transaction - * @return bool -success - * bytes - the return value of the called _contract's function. - */ - function genericCall(address _contract, bytes calldata _data, Avatar _avatar, uint256 _value) - external - onlyGenericCallScheme(address(_avatar)) - onlySubjectToConstraint("genericCall", address(_avatar)) - returns (bool, bytes memory) - { - return _avatar.genericCall(_contract, _data, _value); - } - - /** - * @dev send some ether - * @param _amountInWei the amount of ether (in Wei) to send - * @param _to address of the beneficiary - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function sendEther(uint256 _amountInWei, address payable _to, Avatar _avatar) - external - onlyRegisteredScheme(address(_avatar)) - onlySubjectToConstraint("sendEther", address(_avatar)) - returns(bool) - { - return _avatar.sendEther(_amountInWei, _to); - } - - /** - * @dev send some amount of arbitrary ERC20 Tokens - * @param _externalToken the address of the Token Contract - * @param _to address of the beneficiary - * @param _value the amount of ether (in Wei) to send - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) - external - onlyRegisteredScheme(address(_avatar)) - onlySubjectToConstraint("externalTokenTransfer", address(_avatar)) - returns(bool) - { - return _avatar.externalTokenTransfer(_externalToken, _to, _value); - } - - /** - * @dev transfer token "from" address "to" address - * One must to approve the amount of tokens which can be spend from the - * "from" account.This can be done using externalTokenApprove. - * @param _externalToken the address of the Token Contract - * @param _from address of the account to send from - * @param _to address of the beneficiary - * @param _value the amount of ether (in Wei) to send - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function externalTokenTransferFrom( - IERC20 _externalToken, - address _from, - address _to, - uint256 _value, - Avatar _avatar) - external - onlyRegisteredScheme(address(_avatar)) - onlySubjectToConstraint("externalTokenTransferFrom", address(_avatar)) - returns(bool) - { - return _avatar.externalTokenTransferFrom(_externalToken, _from, _to, _value); - } - - /** - * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens - * on behalf of msg.sender. - * @param _externalToken the address of the Token Contract - * @param _spender address - * @param _value the amount of ether (in Wei) which the approval is referring to. - * @return bool which represents a success - */ - function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar) - external - onlyRegisteredScheme(address(_avatar)) - onlySubjectToConstraint("externalTokenApproval", address(_avatar)) - returns(bool) - { - return _avatar.externalTokenApproval(_externalToken, _spender, _value); - } - - /** - * @dev metaData emits an event with a string, should contain the hash of some meta data. - * @param _metaData a string representing a hash of the meta data - * @param _avatar Avatar - * @return bool which represents a success - */ - function metaData(string calldata _metaData, Avatar _avatar) - external - onlyMetaDataScheme(address(_avatar)) - returns(bool) - { - return _avatar.metaData(_metaData); - } - - function isSchemeRegistered( address _scheme, address _avatar) external view returns(bool) { - return _isSchemeRegistered(_scheme, _avatar); - } - - function getSchemeParameters(address _scheme, address _avatar) external view returns(bytes32) { - return organizations[_avatar].schemes[_scheme].paramsHash; - } - - function getSchemePermissions(address _scheme, address _avatar) external view returns(bytes4) { - return organizations[_avatar].schemes[_scheme].permissions; - } - - function getGlobalConstraintParameters(address _globalConstraint, address _avatar) external view returns(bytes32) { - - Organization storage organization = organizations[_avatar]; - - GlobalConstraintRegister memory register = organization.globalConstraintsRegisterPre[_globalConstraint]; - - if (register.isRegistered) { - return organization.globalConstraintsPre[register.index].params; - } - - register = organization.globalConstraintsRegisterPost[_globalConstraint]; - - if (register.isRegistered) { - return organization.globalConstraintsPost[register.index].params; - } - } - - /** - * @dev globalConstraintsCount return the global constraint pre and post count - * @return uint256 globalConstraintsPre count. - * @return uint256 globalConstraintsPost count. - */ - function globalConstraintsCount(address _avatar) external view returns(uint, uint) { - return ( - organizations[_avatar].globalConstraintsPre.length, - organizations[_avatar].globalConstraintsPost.length - ); - } - - function isGlobalConstraintRegistered(address _globalConstraint, address _avatar) external view returns(bool) { - return (organizations[_avatar].globalConstraintsRegisterPre[_globalConstraint].isRegistered || - organizations[_avatar].globalConstraintsRegisterPost[_globalConstraint].isRegistered); - } - - /** - * @dev getNativeReputation - * @param _avatar the organization avatar. - * @return organization native reputation - */ - function getNativeReputation(address _avatar) external view returns(address) { - return address(organizations[_avatar].nativeReputation); - } - - /** - * @dev removeGlobalConstraintPre - * @param _globalConstraint the address of the global constraint to be remove. - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function removeGlobalConstraintPre(address _globalConstraint, address _avatar) - private returns(bool) - { - GlobalConstraintRegister memory globalConstraintRegister = - organizations[_avatar].globalConstraintsRegisterPre[_globalConstraint]; - GlobalConstraint[] storage globalConstraints = organizations[_avatar].globalConstraintsPre; - - if (globalConstraintRegister.isRegistered) { - if (globalConstraintRegister.index < globalConstraints.length-1) { - GlobalConstraint memory globalConstraint = globalConstraints[globalConstraints.length-1]; - globalConstraints[globalConstraintRegister.index] = globalConstraint; - organizations[_avatar].globalConstraintsRegisterPre[globalConstraint.gcAddress].index = - globalConstraintRegister.index; - } - globalConstraints.length--; - delete organizations[_avatar].globalConstraintsRegisterPre[_globalConstraint]; - emit RemoveGlobalConstraint(_globalConstraint, globalConstraintRegister.index, true, _avatar); - return true; - } - return false; - } - - /** - * @dev removeGlobalConstraintPost - * @param _globalConstraint the address of the global constraint to be remove. - * @param _avatar the organization avatar. - * @return bool which represents a success - */ - function removeGlobalConstraintPost(address _globalConstraint, address _avatar) - private returns(bool) - { - GlobalConstraintRegister memory globalConstraintRegister = - organizations[_avatar].globalConstraintsRegisterPost[_globalConstraint]; - GlobalConstraint[] storage globalConstraints = organizations[_avatar].globalConstraintsPost; - - if (globalConstraintRegister.isRegistered) { - if (globalConstraintRegister.index < globalConstraints.length-1) { - GlobalConstraint memory globalConstraint = globalConstraints[globalConstraints.length-1]; - globalConstraints[globalConstraintRegister.index] = globalConstraint; - organizations[_avatar].globalConstraintsRegisterPost[globalConstraint.gcAddress].index = - globalConstraintRegister.index; - } - globalConstraints.length--; - delete organizations[_avatar].globalConstraintsRegisterPost[_globalConstraint]; - emit RemoveGlobalConstraint(_globalConstraint, globalConstraintRegister.index, false, _avatar); - return true; - } - return false; - } - - function _isSchemeRegistered( address _scheme, address _avatar) private view returns(bool) { - return (organizations[_avatar].schemes[_scheme].permissions&bytes4(0x00000001) != bytes4(0)); - } -} diff --git a/contracts/globalConstraints/GlobalConstraintInterface.sol b/contracts/globalConstraints/GlobalConstraintInterface.sol index d5d888ea..db496d6a 100644 --- a/contracts/globalConstraints/GlobalConstraintInterface.sol +++ b/contracts/globalConstraints/GlobalConstraintInterface.sol @@ -5,8 +5,8 @@ contract GlobalConstraintInterface { enum CallPhase { Pre, Post, PreAndPost } - function pre( address _scheme, bytes32 _params, bytes32 _method ) public returns(bool); - function post( address _scheme, bytes32 _params, bytes32 _method ) public returns(bool); + function pre( address _scheme, bytes32 _method ) public returns(bool); + function post( address _scheme, bytes32 _method ) public returns(bool); /** * @dev when return if this globalConstraints is pre, post or both. * @return CallPhase enum indication Pre, Post or PreAndPost. diff --git a/contracts/globalConstraints/TokenCapGC.sol b/contracts/globalConstraints/TokenCapGC.sol index 830ea825..d748fb44 100644 --- a/contracts/globalConstraints/TokenCapGC.sol +++ b/contracts/globalConstraints/TokenCapGC.sol @@ -1,64 +1,52 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "./GlobalConstraintInterface.sol"; - +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title Token Cap Global Constraint * @dev A simple global constraint to cap the number of tokens. */ - -contract TokenCapGC { +contract TokenCapGC is Initializable { // A set of parameters, on which the cap will be checked: struct Parameters { IERC20 token; uint256 cap; } - // Mapping from the hash of the parameters to the parameters themselves: - mapping (bytes32=>Parameters) public parameters; - - /** - * @dev adding a new set of parameters - * @param _token the token to add to the params. - * @param _cap the cap to check the total supply against. - * @return the calculated parameters hash - */ - function setParameters(IERC20 _token, uint256 _cap) public returns(bytes32) { - bytes32 paramsHash = getParametersHash(_token, _cap); - parameters[paramsHash].token = _token; - parameters[paramsHash].cap = _cap; - return paramsHash; - } + Parameters public parameters; /** - * @dev calculate and returns the hash of the given parameters - * @param _token the token to add to the params. + * @dev initialize + * @param _token the token this contract refer to. * @param _cap the cap to check the total supply against. - * @return the calculated parameters hash */ - function getParametersHash(IERC20 _token, uint256 _cap) public pure returns(bytes32) { - return (keccak256(abi.encodePacked(_token, _cap))); + function initialize(IERC20 _token, uint256 _cap) + external + initializer { + parameters = Parameters({ + token: _token, + cap: _cap + }); } /** - * @dev check the constraint after the action. + * @dev check the constraint before the action. * This global constraint only checks the state after the action, so here we just return true: * @return true */ - function pre(address, bytes32, bytes32) public pure returns(bool) { + function pre(address, bytes32) public pure returns(bool) { return true; } /** * @dev check the total supply cap. - * @param _paramsHash the parameters hash to check the total supply cap against. * @return bool which represents a success */ - function post(address, bytes32 _paramsHash, bytes32) public view returns(bool) { - if ((parameters[_paramsHash].token != IERC20(0)) && - (parameters[_paramsHash].token.totalSupply() > parameters[_paramsHash].cap)) { + function post(address, bytes32) public view returns(bool) { + if ((parameters.token != IERC20(0)) && + (parameters.token.totalSupply() > parameters.cap)) { return false; } return true; diff --git a/contracts/libs/SafeERC20.sol b/contracts/libs/SafeERC20.sol index b4cfba55..aa6317fe 100644 --- a/contracts/libs/SafeERC20.sol +++ b/contracts/libs/SafeERC20.sol @@ -14,8 +14,8 @@ REFERENCE & RELATED READING */ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/utils/Address.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; library SafeERC20 { using Address for address; diff --git a/contracts/schemes/Auction4Reputation.sol b/contracts/schemes/Auction4Reputation.sol index 71a3b835..93951014 100644 --- a/contracts/schemes/Auction4Reputation.sol +++ b/contracts/schemes/Auction4Reputation.sol @@ -1,16 +1,17 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -import "../controller/ControllerInterface.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; +import "../controller/Controller.sol"; import "../libs/SafeERC20.sol"; import "./Agreement.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A scheme for conduct ERC20 Tokens auction for reputation */ -contract Auction4Reputation is Agreement { +contract Auction4Reputation is Agreement, Initializable { using SafeMath for uint256; using SafeERC20 for address; @@ -66,8 +67,8 @@ contract Auction4Reputation is Agreement { address _wallet, bytes32 _agreementHash ) external + initializer { - require(avatar == Avatar(0), "can be called only one time"); require(_avatar != Avatar(0), "avatar cannot be zero"); require(_numberOfAuctions > 0, "number of auctions cannot be zero"); //_auctionPeriod should be greater than block interval @@ -104,8 +105,8 @@ contract Auction4Reputation is Agreement { // check that the reputation is sum zero reputationRewardLeft = reputationRewardLeft.sub(reputation); require( - ControllerInterface(avatar.owner()) - .mintReputation(reputation, _beneficiary, address(avatar)), "mint reputation should succeed"); + Controller(avatar.owner()) + .mintReputation(reputation, _beneficiary), "mint reputation should succeed"); emit Redeem(_auctionId, _beneficiary, reputation); } diff --git a/contracts/schemes/ContinuousLockingToken4Reputation.sol b/contracts/schemes/ContinuousLockingToken4Reputation.sol index 855aed4d..46aaa2fb 100644 --- a/contracts/schemes/ContinuousLockingToken4Reputation.sol +++ b/contracts/schemes/ContinuousLockingToken4Reputation.sol @@ -1,17 +1,17 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -import "openzeppelin-solidity/contracts/math/Math.sol"; -import "../controller/ControllerInterface.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/math/Math.sol"; +import "../controller/Controller.sol"; import "../libs/SafeERC20.sol"; import "./Agreement.sol"; -import { RealMath } from "@daostack/infra/contracts/libs/RealMath.sol"; +import { RealMath } from "@daostack/infra-experimental/contracts/libs/RealMath.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A scheme for continuous locking ERC20 Token for reputation */ - -contract ContinuousLocking4Reputation is Agreement { +contract ContinuousLocking4Reputation is Agreement, Initializable { using SafeMath for uint256; using SafeERC20 for address; using RealMath for uint216; @@ -94,8 +94,8 @@ contract ContinuousLocking4Reputation is Agreement { IERC20 _token, bytes32 _agreementHash ) external + initializer { - require(avatar == Avatar(0), "can be called only one time"); require(_avatar != Avatar(0), "avatar cannot be zero"); // _batchTime should be greater than block interval require(_batchTime > 15, "batchTime should be > 15"); @@ -151,8 +151,8 @@ contract ContinuousLocking4Reputation is Agreement { // check that the reputation is sum zero reputationRewardLeft = reputationRewardLeft.sub(reputation); require( - ControllerInterface(avatar.owner()) - .mintReputation(reputation, _beneficiary, address(avatar)), "mint reputation should succeed"); + Controller(avatar.owner()) + .mintReputation(reputation, _beneficiary), "mint reputation should succeed"); } /** diff --git a/contracts/universalSchemes/ContributionReward.sol b/contracts/schemes/ContributionReward.sol similarity index 61% rename from contracts/universalSchemes/ContributionReward.sol rename to contracts/schemes/ContributionReward.sol index a68fe62e..c755b9a3 100644 --- a/contracts/universalSchemes/ContributionReward.sol +++ b/contracts/schemes/ContributionReward.sol @@ -1,9 +1,7 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; -import "./UniversalScheme.sol"; import "../votingMachines/VotingMachineCallbacks.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** @@ -12,7 +10,10 @@ import "../votingMachines/VotingMachineCallbacks.sol"; * him with token, reputation, ether or any combination. */ -contract ContributionReward is UniversalScheme, VotingMachineCallbacks, ProposalExecuteInterface { +contract ContributionReward is + VotingMachineCallbacks, + ProposalExecuteInterface, + Initializable { using SafeMath for uint; event NewContributionProposal( @@ -63,56 +64,55 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal uint[4] redeemedPeriods; } - // A mapping from the organization (Avatar) address to the saved data of the organization: - mapping(address=>mapping(bytes32=>ContributionProposal)) public organizationsProposals; + mapping(bytes32=>ContributionProposal) public organizationProposals; - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - struct Parameters { - bytes32 voteApproveParams; - IntVoteInterface intVote; - } + IntVoteInterface public votingMachine; + bytes32 public voteParams; + Avatar public avatar; - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - mapping(bytes32=>Parameters) public parameters; + /** + * @dev initialize + * @param _avatar the avatar this scheme referring to. + * @param _votingMachine the voting machines address to + * @param _voteParams voting machine parameters. + */ + function initialize( + Avatar _avatar, + IntVoteInterface _votingMachine, + bytes32 _voteParams + ) + external + initializer + { + require(_avatar != Avatar(0), "avatar cannot be zero"); + avatar = _avatar; + votingMachine = _votingMachine; + voteParams = _voteParams; + } /** * @dev execution of proposals, can only be called by the voting machine in which the vote is held. * @param _proposalId the ID of the voting in the voting machine - * @param _param a parameter of the voting result, 1 yes and 2 is no. + * @param _decision a parameter of the voting result, 1 yes and 2 is no. */ - function executeProposal(bytes32 _proposalId, int256 _param) external onlyVotingMachine(_proposalId) returns(bool) { + function executeProposal(bytes32 _proposalId, int256 _decision) + external + onlyVotingMachine(_proposalId) + returns(bool) { ProposalInfo memory proposal = proposalsInfo[msg.sender][_proposalId]; - require(organizationsProposals[address(proposal.avatar)][_proposalId].executionTime == 0); - require(organizationsProposals[address(proposal.avatar)][_proposalId].beneficiary != address(0)); + require(organizationProposals[_proposalId].executionTime == 0); + require(organizationProposals[_proposalId].beneficiary != address(0)); // Check if vote was successful: - if (_param == 1) { + if (_decision == 1) { // solhint-disable-next-line not-rely-on-time - organizationsProposals[address(proposal.avatar)][_proposalId].executionTime = now; + organizationProposals[_proposalId].executionTime = now; } - emit ProposalExecuted(address(proposal.avatar), _proposalId, _param); + emit ProposalExecuted(address(proposal.avatar), _proposalId, _decision); return true; } - /** - * @dev hash the parameters, save them if necessary, and return the hash value - */ - function setParameters( - bytes32 _voteApproveParams, - IntVoteInterface _intVote - ) public returns(bytes32) - { - bytes32 paramsHash = getParametersHash( - _voteApproveParams, - _intVote - ); - parameters[paramsHash].voteApproveParams = _voteApproveParams; - parameters[paramsHash].intVote = _intVote; - return paramsHash; - } - /** * @dev Submit a proposal for a reward for a contribution: - * @param _avatar Avatar of the organization that the contribution was made for * @param _descriptionHash A hash of the proposal's description * @param _reputationChange - Amount of reputation change requested .Can be negative. * @param _rewards rewards array: @@ -125,7 +125,6 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal * @param _beneficiary Who gets the rewards */ function proposeContributionReward( - Avatar _avatar, string memory _descriptionHash, int256 _reputationChange, uint[5] memory _rewards, @@ -136,15 +135,7 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal returns(bytes32) { validateProposalParams(_reputationChange, _rewards); - Parameters memory controllerParams = parameters[getParametersFromController(_avatar)]; - - bytes32 contributionId = controllerParams.intVote.propose( - 2, - controllerParams.voteApproveParams, - msg.sender, - address(_avatar) - ); - + bytes32 proposalId = votingMachine.propose(2, voteParams, msg.sender, address(avatar)); address payable beneficiary = _beneficiary; if (beneficiary == address(0)) { beneficiary = msg.sender; @@ -162,12 +153,12 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal executionTime: 0, redeemedPeriods:[uint(0), uint(0), uint(0), uint(0)] }); - organizationsProposals[address(_avatar)][contributionId] = proposal; + organizationProposals[proposalId] = proposal; emit NewContributionProposal( - address(_avatar), - contributionId, - address(controllerParams.intVote), + address(avatar), + proposalId, + address(votingMachine), _descriptionHash, _reputationChange, _rewards, @@ -175,41 +166,40 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal beneficiary ); - proposalsInfo[address(controllerParams.intVote)][contributionId] = ProposalInfo({ + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ blockNumber:block.number, - avatar:_avatar + avatar:avatar }); - return contributionId; + return proposalId; } /** * @dev RedeemReputation reward for proposal * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @return reputation the redeemed reputation. */ - function redeemReputation(bytes32 _proposalId, Avatar _avatar) public returns(int256 reputation) { + function redeemReputation(bytes32 _proposalId) public returns(int256 reputation) { - ContributionProposal memory _proposal = organizationsProposals[address(_avatar)][_proposalId]; - ContributionProposal storage proposal = organizationsProposals[address(_avatar)][_proposalId]; + ContributionProposal memory _proposal = organizationProposals[_proposalId]; + ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.executionTime != 0); - uint256 periodsToPay = getPeriodsToPay(_proposalId, address(_avatar), 0); + uint256 periodsToPay = getPeriodsToPay(_proposalId, 0); //set proposal reward to zero to prevent reentrancy attack. proposal.reputationChange = 0; reputation = int(periodsToPay) * _proposal.reputationChange; if (reputation > 0) { require( - ControllerInterface( - _avatar.owner()).mintReputation(uint(reputation), _proposal.beneficiary, address(_avatar))); + Controller( + avatar.owner()).mintReputation(uint(reputation), _proposal.beneficiary)); } else if (reputation < 0) { require( - ControllerInterface( - _avatar.owner()).burnReputation(uint(reputation*(-1)), _proposal.beneficiary, address(_avatar))); + Controller( + avatar.owner()).burnReputation(uint(reputation*(-1)), _proposal.beneficiary)); } if (reputation != 0) { proposal.redeemedPeriods[0] = proposal.redeemedPeriods[0].add(periodsToPay); - emit RedeemReputation(address(_avatar), _proposalId, _proposal.beneficiary, reputation); + emit RedeemReputation(address(avatar), _proposalId, _proposal.beneficiary, reputation); } //restore proposal reward. proposal.reputationChange = _proposal.reputationChange; @@ -218,23 +208,22 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal /** * @dev RedeemNativeToken reward for proposal * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @return amount the redeemed nativeToken. */ - function redeemNativeToken(bytes32 _proposalId, Avatar _avatar) public returns(uint256 amount) { + function redeemNativeToken(bytes32 _proposalId) public returns(uint256 amount) { - ContributionProposal memory _proposal = organizationsProposals[address(_avatar)][_proposalId]; - ContributionProposal storage proposal = organizationsProposals[address(_avatar)][_proposalId]; + ContributionProposal memory _proposal = organizationProposals[_proposalId]; + ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.executionTime != 0); - uint256 periodsToPay = getPeriodsToPay(_proposalId, address(_avatar), 1); + uint256 periodsToPay = getPeriodsToPay(_proposalId, 1); //set proposal rewards to zero to prevent reentrancy attack. proposal.nativeTokenReward = 0; amount = periodsToPay.mul(_proposal.nativeTokenReward); if (amount > 0) { - require(ControllerInterface(_avatar.owner()).mintTokens(amount, _proposal.beneficiary, address(_avatar))); + require(Controller(avatar.owner()).mintTokens(amount, _proposal.beneficiary)); proposal.redeemedPeriods[1] = proposal.redeemedPeriods[1].add(periodsToPay); - emit RedeemNativeToken(address(_avatar), _proposalId, _proposal.beneficiary, amount); + emit RedeemNativeToken(address(avatar), _proposalId, _proposal.beneficiary, amount); } //restore proposal reward. @@ -244,23 +233,22 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal /** * @dev RedeemEther reward for proposal * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @return amount ether redeemed amount */ - function redeemEther(bytes32 _proposalId, Avatar _avatar) public returns(uint256 amount) { + function redeemEther(bytes32 _proposalId) public returns(uint256 amount) { - ContributionProposal memory _proposal = organizationsProposals[address(_avatar)][_proposalId]; - ContributionProposal storage proposal = organizationsProposals[address(_avatar)][_proposalId]; + ContributionProposal memory _proposal = organizationProposals[_proposalId]; + ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.executionTime != 0); - uint256 periodsToPay = getPeriodsToPay(_proposalId, address(_avatar), 2); + uint256 periodsToPay = getPeriodsToPay(_proposalId, 2); //set proposal rewards to zero to prevent reentrancy attack. proposal.ethReward = 0; amount = periodsToPay.mul(_proposal.ethReward); if (amount > 0) { - require(ControllerInterface(_avatar.owner()).sendEther(amount, _proposal.beneficiary, _avatar)); + require(Controller(avatar.owner()).sendEther(amount, _proposal.beneficiary)); proposal.redeemedPeriods[2] = proposal.redeemedPeriods[2].add(periodsToPay); - emit RedeemEther(address(_avatar), _proposalId, _proposal.beneficiary, amount); + emit RedeemEther(address(avatar), _proposalId, _proposal.beneficiary, amount); } //restore proposal reward. @@ -270,15 +258,14 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal /** * @dev RedeemNativeToken reward for proposal * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @return amount the external token redeemed amount */ - function redeemExternalToken(bytes32 _proposalId, Avatar _avatar) public returns(uint256 amount) { + function redeemExternalToken(bytes32 _proposalId) public returns(uint256 amount) { - ContributionProposal memory _proposal = organizationsProposals[address(_avatar)][_proposalId]; - ContributionProposal storage proposal = organizationsProposals[address(_avatar)][_proposalId]; + ContributionProposal memory _proposal = organizationProposals[_proposalId]; + ContributionProposal storage proposal = organizationProposals[_proposalId]; require(proposal.executionTime != 0); - uint256 periodsToPay = getPeriodsToPay(_proposalId, address(_avatar), 3); + uint256 periodsToPay = getPeriodsToPay(_proposalId, 3); //set proposal rewards to zero to prevent reentrancy attack. proposal.externalTokenReward = 0; @@ -286,11 +273,11 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal amount = periodsToPay.mul(_proposal.externalTokenReward); if (amount > 0) { require( - ControllerInterface( - _avatar.owner()) - .externalTokenTransfer(_proposal.externalToken, _proposal.beneficiary, amount, _avatar)); + Controller( + avatar.owner()) + .externalTokenTransfer(_proposal.externalToken, _proposal.beneficiary, amount)); proposal.redeemedPeriods[3] = proposal.redeemedPeriods[3].add(periodsToPay); - emit RedeemExternalToken(address(_avatar), _proposalId, _proposal.beneficiary, amount); + emit RedeemExternalToken(address(avatar), _proposalId, _proposal.beneficiary, amount); } } //restore proposal reward. @@ -300,7 +287,6 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal /** * @dev redeem rewards for proposal * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @param _whatToRedeem whatToRedeem array: * whatToRedeem[0] - reputation * whatToRedeem[1] - nativeTokenReward @@ -308,25 +294,25 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal * whatToRedeem[3] - ExternalToken * @return result boolean array for each redeem type. */ - function redeem(bytes32 _proposalId, Avatar _avatar, bool[4] memory _whatToRedeem) + function redeem(bytes32 _proposalId, bool[4] memory _whatToRedeem) public returns(int256 reputationReward, uint256 nativeTokenReward, uint256 etherReward, uint256 externalTokenReward) { if (_whatToRedeem[0]) { - reputationReward = redeemReputation(_proposalId, _avatar); + reputationReward = redeemReputation(_proposalId); } if (_whatToRedeem[1]) { - nativeTokenReward = redeemNativeToken(_proposalId, _avatar); + nativeTokenReward = redeemNativeToken(_proposalId); } if (_whatToRedeem[2]) { - etherReward = redeemEther(_proposalId, _avatar); + etherReward = redeemEther(_proposalId); } if (_whatToRedeem[3]) { - externalTokenReward = redeemExternalToken(_proposalId, _avatar); + externalTokenReward = redeemExternalToken(_proposalId); } } @@ -334,7 +320,6 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal * @dev getPeriodsToPay return the periods left to be paid for reputation,nativeToken,ether or externalToken. * The function ignore the reward amount to be paid (which can be zero). * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @param _redeemType - the type of the reward : * 0 - reputation * 1 - nativeTokenReward @@ -342,9 +327,9 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal * 3 - ExternalToken * @return periods left to be paid. */ - function getPeriodsToPay(bytes32 _proposalId, address _avatar, uint256 _redeemType) public view returns (uint256) { + function getPeriodsToPay(bytes32 _proposalId, uint256 _redeemType) public view returns (uint256) { require(_redeemType <= 3, "should be in the redeemedPeriods range"); - ContributionProposal memory _proposal = organizationsProposals[_avatar][_proposalId]; + ContributionProposal memory _proposal = organizationProposals[_proposalId]; if (_proposal.executionTime == 0) return 0; uint256 periodsFromExecution; @@ -364,7 +349,6 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal /** * @dev getRedeemedPeriods return the already redeemed periods for reputation, nativeToken, ether or externalToken. * @param _proposalId the ID of the voting in the voting machine - * @param _avatar address of the controller * @param _redeemType - the type of the reward : * 0 - reputation * 1 - nativeTokenReward @@ -372,41 +356,27 @@ contract ContributionReward is UniversalScheme, VotingMachineCallbacks, Proposal * 3 - ExternalToken * @return redeemed period. */ - function getRedeemedPeriods(bytes32 _proposalId, address _avatar, uint256 _redeemType) + function getRedeemedPeriods(bytes32 _proposalId, uint256 _redeemType) public view returns (uint256) { - return organizationsProposals[_avatar][_proposalId].redeemedPeriods[_redeemType]; + return organizationProposals[_proposalId].redeemedPeriods[_redeemType]; } - function getProposalEthReward(bytes32 _proposalId, address _avatar) public view returns (uint256) { - return organizationsProposals[_avatar][_proposalId].ethReward; + function getProposalEthReward(bytes32 _proposalId) public view returns (uint256) { + return organizationProposals[_proposalId].ethReward; } - function getProposalExternalTokenReward(bytes32 _proposalId, address _avatar) public view returns (uint256) { - return organizationsProposals[_avatar][_proposalId].externalTokenReward; + function getProposalExternalTokenReward(bytes32 _proposalId) public view returns (uint256) { + return organizationProposals[_proposalId].externalTokenReward; } - function getProposalExternalToken(bytes32 _proposalId, address _avatar) public view returns (address) { - return address(organizationsProposals[_avatar][_proposalId].externalToken); + function getProposalExternalToken(bytes32 _proposalId) public view returns (address) { + return address(organizationProposals[_proposalId].externalToken); } - function getProposalExecutionTime(bytes32 _proposalId, address _avatar) public view returns (uint256) { - return organizationsProposals[_avatar][_proposalId].executionTime; - } - - /** - * @dev return a hash of the given parameters - * @param _voteApproveParams parameters for the voting machine used to approve a contribution - * @param _intVote the voting machine used to approve a contribution - * @return a hash of the parameters - */ - function getParametersHash( - bytes32 _voteApproveParams, - IntVoteInterface _intVote - ) public pure returns(bytes32) - { - return (keccak256(abi.encodePacked(_voteApproveParams, _intVote))); + function getProposalExecutionTime(bytes32 _proposalId) public view returns (uint256) { + return organizationProposals[_proposalId].executionTime; } /** diff --git a/contracts/schemes/FixedReputationAllocation.sol b/contracts/schemes/FixedReputationAllocation.sol index 252572c2..7ea998a7 100644 --- a/contracts/schemes/FixedReputationAllocation.sol +++ b/contracts/schemes/FixedReputationAllocation.sol @@ -1,15 +1,15 @@ pragma solidity ^0.5.11; -import "../controller/ControllerInterface.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; - +import "../controller/Controller.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A fixed reputation allocation contract * This scheme can be used to allocate a pre define amount of reputation to whitelisted * beneficiaries. */ -contract FixedReputationAllocation is Ownable { +contract FixedReputationAllocation is Initializable, Ownable { using SafeMath for uint256; event Redeem(address indexed _beneficiary, uint256 _amount); @@ -31,12 +31,14 @@ contract FixedReputationAllocation is Ownable { * @param _reputationReward the total reputation this contract will reward * @param _redeemEnableTime time to enable redeem */ - function initialize(Avatar _avatar, uint256 _reputationReward, uint256 _redeemEnableTime) external onlyOwner { - require(avatar == Avatar(0), "can be called only one time"); + function initialize(Avatar _avatar, uint256 _reputationReward, uint256 _redeemEnableTime, address _owner) + external initializer + { require(_avatar != Avatar(0), "avatar cannot be zero"); reputationReward = _reputationReward; redeemEnableTime = _redeemEnableTime; avatar = _avatar; + Ownable.initialize(_owner); } /** @@ -51,9 +53,9 @@ contract FixedReputationAllocation is Ownable { // solhint-disable-next-line not-rely-on-time require(now > redeemEnableTime, "require now > redeemEnableTime"); require( - ControllerInterface( + Controller( avatar.owner()) - .mintReputation(beneficiaryReward, _beneficiary, address(avatar)), "mint reputation failed"); + .mintReputation(beneficiaryReward, _beneficiary), "mint reputation failed"); emit Redeem(_beneficiary, beneficiaryReward); diff --git a/contracts/schemes/Forwarder.sol b/contracts/schemes/Forwarder.sol index 4dacc59a..6bced80f 100644 --- a/contracts/schemes/Forwarder.sol +++ b/contracts/schemes/Forwarder.sol @@ -1,15 +1,15 @@ pragma solidity ^0.5.11; -import "../controller/ControllerInterface.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "../controller/Controller.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; + /** * @title A scheme to forward a call to a dao. * The scheme can unregister itself when its expirationTime reached. */ - - -contract Forwarder is Ownable { +contract Forwarder is Initializable, Ownable { Avatar public avatar; uint256 public expirationTime; @@ -31,11 +31,11 @@ contract Forwarder is Ownable { * @param _avatar the avatar of the dao to forward the call to * @param _expirationTime the expirationTime to forwardCall */ - function initialize(Avatar _avatar, uint256 _expirationTime) external onlyOwner { - require(avatar == Avatar(0), "can be called only one time"); + function initialize(Avatar _avatar, uint256 _expirationTime, address _owner) external initializer { require(_avatar != Avatar(0), "avatar cannot be zero"); avatar = _avatar; expirationTime = _expirationTime; + Ownable.initialize(_owner); } /** @@ -45,6 +45,6 @@ contract Forwarder is Ownable { function unregisterSelf() public returns(bool) { // solhint-disable-next-line not-rely-on-time require(expirationTime <= now, "expirationTime <= now"); - return ControllerInterface(avatar.owner()).unregisterSelf(address(avatar)); + return Controller(avatar.owner()).unregisterSelf(); } } diff --git a/contracts/schemes/GenericScheme.sol b/contracts/schemes/GenericScheme.sol index 625bea7a..35143d05 100644 --- a/contracts/schemes/GenericScheme.sol +++ b/contracts/schemes/GenericScheme.sol @@ -1,8 +1,9 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/IntVoteInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; import "../votingMachines/VotingMachineCallbacks.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** @@ -10,7 +11,7 @@ import "../votingMachines/VotingMachineCallbacks.sol"; * @dev A scheme for proposing and executing calls to an arbitrary function * on a specific contract on behalf of the organization avatar. */ -contract GenericScheme is VotingMachineCallbacks, ProposalExecuteInterface { +contract GenericScheme is VotingMachineCallbacks, ProposalExecuteInterface, Initializable { event NewCallProposal( address indexed _avatar, bytes32 indexed _proposalId, @@ -62,8 +63,8 @@ contract GenericScheme is VotingMachineCallbacks, ProposalExecuteInterface { address _contractToCall ) external + initializer { - require(avatar == Avatar(0), "can be called only one time"); require(_avatar != Avatar(0), "avatar cannot be zero"); avatar = _avatar; votingMachine = _votingMachine; @@ -108,9 +109,9 @@ contract GenericScheme is VotingMachineCallbacks, ProposalExecuteInterface { proposal.exist = false; bytes memory genericCallReturnValue; bool success; - ControllerInterface controller = ControllerInterface(avatar.owner()); + Controller controller = Controller(avatar.owner()); (success, genericCallReturnValue) = - controller.genericCall(contractToCall, proposal.callData, avatar, proposal.value); + controller.genericCall(contractToCall, proposal.callData, proposal.value); if (success) { delete organizationProposals[_proposalId]; emit ProposalDeleted(address(avatar), _proposalId); diff --git a/contracts/schemes/GlobalConstraintRegistrar.sol b/contracts/schemes/GlobalConstraintRegistrar.sol new file mode 100644 index 00000000..53864020 --- /dev/null +++ b/contracts/schemes/GlobalConstraintRegistrar.sol @@ -0,0 +1,184 @@ +pragma solidity ^0.5.11; + +import "@daostack/infra-experimental/contracts/votingMachines/IntVoteInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; +import "../votingMachines/VotingMachineCallbacks.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; + + +/** + * @title A scheme to manage global constraint for organizations + * @dev The scheme is used to register or remove new global constraints + */ +contract GlobalConstraintRegistrar is Initializable, VotingMachineCallbacks, ProposalExecuteInterface { + event NewGlobalConstraintsProposal( + address indexed _avatar, + bytes32 indexed _proposalId, + address indexed _intVoteInterface, + address _gc, + bytes32 _voteToRemoveParams, + string _descriptionHash + ); + + event RemoveGlobalConstraintsProposal( + address indexed _avatar, + bytes32 indexed _proposalId, + address indexed _intVoteInterface, + address _gc, + string _descriptionHash + ); + + event ProposalExecuted(address indexed _avatar, bytes32 indexed _proposalId, int256 _param); + event ProposalDeleted(address indexed _avatar, bytes32 indexed _proposalId); + event D(bool x); + + // The struct that holds the information of a global constraint proposed to be added or removed. + struct GCProposal { + address gc; // The address of the global constraint contract. + bool addGC; // true: add a GC, false: remove a GC. + bytes32 voteToRemoveParams; // Voting parameters for removing this GC. + } + + // GCProposal by avatar and proposalId + mapping(bytes32=>GCProposal) public organizationProposals; + + // voteToRemoveParams hash by avatar and proposal.gc + mapping(address=>bytes32) public voteToRemoveParams; + + IntVoteInterface public votingMachine; + bytes32 public voteParams; + Avatar public avatar; + + /** + * @dev initialize + * @param _avatar the avatar this scheme referring to. + * @param _votingMachine the voting machines address to + * @param _voteParams voting machine parameters. + */ + function initialize( + Avatar _avatar, + IntVoteInterface _votingMachine, + bytes32 _voteParams + ) + external + initializer + { + require(_avatar != Avatar(0), "avatar cannot be zero"); + avatar = _avatar; + votingMachine = _votingMachine; + voteParams = _voteParams; + } + + /** + * @dev execution of proposals, can only be called by the voting machine in which the vote is held. + * @param _proposalId the ID of the voting in the voting machine + * @param _decision the voting result, 1 yes and 2 is no. + * @return bool which represents a successful of the function. + */ + function executeProposal(bytes32 _proposalId, int256 _decision) + external + onlyVotingMachine(_proposalId) + returns(bool) { + bool retVal = true; + + // Check if vote was successful: + GCProposal memory proposal = organizationProposals[_proposalId]; + + require(proposal.gc != address(0)); + delete organizationProposals[_proposalId]; + emit ProposalDeleted(address(avatar), _proposalId); + + if (_decision == 1) { + + // Define controller and get the params: + Controller controller = Controller(avatar.owner()); + + // Adding a GC + if (proposal.addGC) { + retVal = controller.addGlobalConstraint(proposal.gc); + voteToRemoveParams[proposal.gc] = proposal.voteToRemoveParams; + } + // Removing a GC + if (!proposal.addGC) { + retVal = controller.removeGlobalConstraint(proposal.gc); + } + } + emit ProposalExecuted(address(avatar), _proposalId, _decision); + return retVal; + } + + /** + * @dev propose to add a new global constraint: + * @param _gc the address of the global constraint that is being proposed + * @param _voteToRemoveParams the conditions (on the voting machine) for removing this global constraint + * @param _descriptionHash proposal's description hash + * @return bytes32 -the proposal id + */ + function proposeGlobalConstraint( + address _gc, + bytes32 _voteToRemoveParams, + string memory _descriptionHash) + public + returns(bytes32) + { + bytes32 proposalId = votingMachine.propose(2, voteParams, msg.sender, address(avatar)); + + GCProposal memory proposal = GCProposal({ + gc: _gc, + addGC: true, + voteToRemoveParams: _voteToRemoveParams + }); + + organizationProposals[proposalId] = proposal; + emit NewGlobalConstraintsProposal( + address(avatar), + proposalId, + address(votingMachine), + _gc, + _voteToRemoveParams, + _descriptionHash + ); + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ + blockNumber:block.number, + avatar:avatar + }); + return proposalId; + } + + /** + * @dev propose to remove a global constraint: + * @param _gc the address of the global constraint that is being proposed + * @param _descriptionHash proposal's description hash + * @return bytes32 -the proposal id + */ + function proposeToRemoveGC(address _gc, string memory _descriptionHash) public returns(bytes32) { + Controller controller = Controller(avatar.owner()); + require(controller.isGlobalConstraintRegistered(_gc)); + bytes32 proposalId = votingMachine.propose( + 2, + voteToRemoveParams[_gc], + msg.sender, + address(avatar) + ); + + GCProposal memory proposal = GCProposal({ + gc: _gc, + addGC: false, + voteToRemoveParams: 0 + }); + + organizationProposals[proposalId] = proposal; + emit RemoveGlobalConstraintsProposal( + address(avatar), + proposalId, + address(votingMachine), + _gc, + _descriptionHash); + + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ + blockNumber: block.number, + avatar: avatar + }); + return proposalId; + } +} diff --git a/contracts/schemes/Locking4Reputation.sol b/contracts/schemes/Locking4Reputation.sol index 10153f9c..13f45f41 100644 --- a/contracts/schemes/Locking4Reputation.sol +++ b/contracts/schemes/Locking4Reputation.sol @@ -1,13 +1,14 @@ pragma solidity ^0.5.11; -import "../controller/ControllerInterface.sol"; +import "../controller/Controller.sol"; import "./Agreement.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A locker contract */ -contract Locking4Reputation is Agreement { +contract Locking4Reputation is Agreement, Initializable { using SafeMath for uint256; event Redeem(address indexed _beneficiary, uint256 _amount); @@ -54,9 +55,9 @@ contract Locking4Reputation is Agreement { //check that the reputation is sum zero reputationRewardLeft = reputationRewardLeft.sub(reputation); require( - ControllerInterface( + Controller( avatar.owner()) - .mintReputation(reputation, _beneficiary, address(avatar)), "mint reputation should succeed"); + .mintReputation(reputation, _beneficiary), "mint reputation should succeed"); emit Redeem(_beneficiary, reputation); } @@ -148,8 +149,8 @@ contract Locking4Reputation is Agreement { uint256 _maxLockingPeriod, bytes32 _agreementHash ) internal + initializer { - require(avatar == Avatar(0), "can be called only one time"); require(_avatar != Avatar(0), "avatar cannot be zero"); require(_lockingEndTime > _lockingStartTime, "locking end time should be greater than locking start time"); require(_redeemEnableTime >= _lockingEndTime, "redeemEnableTime >= lockingEndTime"); diff --git a/contracts/schemes/ReputationFromToken.sol b/contracts/schemes/ReputationFromToken.sol index 27639564..b981fa99 100644 --- a/contracts/schemes/ReputationFromToken.sol +++ b/contracts/schemes/ReputationFromToken.sol @@ -1,17 +1,18 @@ pragma solidity ^0.5.11; -import "../controller/ControllerInterface.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "../controller/Controller.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "./CurveInterface.sol"; -import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/cryptography/ECDSA.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A scheme for reputation allocation according to token balances * This contract is assuming that the token contract is paused, and one cannot transfer its tokens. */ -contract ReputationFromToken { +contract ReputationFromToken is Initializable { using ECDSA for bytes32; using SafeMath for uint256; @@ -30,15 +31,14 @@ contract ReputationFromToken { )); event Redeem(address indexed _beneficiary, address indexed _sender, uint256 _amount); - + /** * @dev initialize * @param _avatar the avatar to mint reputation from * @param _tokenContract the token contract */ - function initialize(Avatar _avatar, IERC20 _tokenContract, CurveInterface _curve) external + function initialize(Avatar _avatar, IERC20 _tokenContract, CurveInterface _curve) external initializer { - require(avatar == Avatar(0), "can be called only one time"); require(_avatar != Avatar(0), "avatar cannot be zero"); tokenContract = _tokenContract; avatar = _avatar; @@ -113,9 +113,9 @@ contract ReputationFromToken { _beneficiary = _redeemer; } require( - ControllerInterface( + Controller( avatar.owner()) - .mintReputation(tokenAmount, _beneficiary, address(avatar)), "mint reputation should succeed"); + .mintReputation(tokenAmount, _beneficiary), "mint reputation should succeed"); emit Redeem(_beneficiary, _redeemer, tokenAmount); return tokenAmount; } diff --git a/contracts/schemes/SchemeRegistrar.sol b/contracts/schemes/SchemeRegistrar.sol new file mode 100644 index 00000000..3695d6b0 --- /dev/null +++ b/contracts/schemes/SchemeRegistrar.sol @@ -0,0 +1,173 @@ +pragma solidity ^0.5.11; + +import "@daostack/infra-experimental/contracts/votingMachines/IntVoteInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; +import "../votingMachines/VotingMachineCallbacks.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; + + +/** + * @title A registrar for Schemes for organizations + * @dev The SchemeRegistrar is used for registering and unregistering schemes at organizations + */ + +contract SchemeRegistrar is Initializable, VotingMachineCallbacks, ProposalExecuteInterface { + event NewSchemeProposal( + address indexed _avatar, + bytes32 indexed _proposalId, + address indexed _intVoteInterface, + address _scheme, + bytes4 _permissions, + string _descriptionHash + ); + + event RemoveSchemeProposal(address indexed _avatar, + bytes32 indexed _proposalId, + address indexed _intVoteInterface, + address _scheme, + string _descriptionHash + ); + + event ProposalExecuted(address indexed _avatar, bytes32 indexed _proposalId, int256 _param); + event ProposalDeleted(address indexed _avatar, bytes32 indexed _proposalId); + + // a SchemeProposal is a proposal to add or remove a scheme to/from the an organization + struct SchemeProposal { + address scheme; // + bool addScheme; // true: add a scheme, false: remove a scheme. + bytes4 permissions; + } + + mapping(bytes32=>SchemeProposal) public organizationProposals; + + IntVoteInterface public votingMachine; + bytes32 public voteRegisterParams; + bytes32 public voteRemoveParams; + Avatar public avatar; + + /** + * @dev initialize + * @param _avatar the avatar this scheme referring to. + * @param _votingMachine the voting machines address to + * @param _voteRegisterParams voting machine parameters to register scheme. + * @param _voteRemoveParams voting machine parameters to remove scheme. + */ + function initialize( + Avatar _avatar, + IntVoteInterface _votingMachine, + bytes32 _voteRegisterParams, + bytes32 _voteRemoveParams + ) + external + initializer + { + require(_avatar != Avatar(0), "avatar cannot be zero"); + avatar = _avatar; + votingMachine = _votingMachine; + voteRegisterParams = _voteRegisterParams; + voteRemoveParams = _voteRemoveParams; + } + + /** + * @dev execution of proposals, can only be called by the voting machine in which the vote is held. + * @param _proposalId the ID of the voting in the voting machine + * @param _decision the voting result, 1 yes and 2 is no. + */ + function executeProposal(bytes32 _proposalId, int256 _decision) + external + onlyVotingMachine(_proposalId) + returns(bool) { + SchemeProposal memory proposal = organizationProposals[_proposalId]; + require(proposal.scheme != address(0)); + delete organizationProposals[_proposalId]; + emit ProposalDeleted(address(avatar), _proposalId); + if (_decision == 1) { + + // Define controller and get the params: + Controller controller = Controller(avatar.owner()); + + // Add a scheme: + if (proposal.addScheme) { + require(controller.registerScheme( + proposal.scheme, + proposal.permissions) + ); + } + // Remove a scheme: + if (!proposal.addScheme) { + require(controller.unregisterScheme(proposal.scheme)); + } + } + emit ProposalExecuted(address(avatar), _proposalId, _decision); + return true; + } + + /** + * @dev create a proposal to register a scheme + * @param _scheme the address of the scheme to be registered + * @param _permissions the permission of the scheme to be registered + * @param _descriptionHash proposal's description hash + * @return a proposal Id + * @dev NB: not only proposes the vote, but also votes for it + */ + function proposeScheme( + address _scheme, + bytes4 _permissions, + string memory _descriptionHash + ) + public + returns(bytes32) + { + // propose + require(_scheme != address(0), "scheme cannot be zero"); + + bytes32 proposalId = votingMachine.propose( + 2, + voteRegisterParams, + msg.sender, + address(avatar) + ); + + SchemeProposal memory proposal = SchemeProposal({ + scheme: _scheme, + addScheme: true, + permissions: _permissions + }); + emit NewSchemeProposal( + address(avatar), + proposalId, + address(votingMachine), + _scheme, + _permissions, + _descriptionHash + ); + organizationProposals[proposalId] = proposal; + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ + blockNumber:block.number, + avatar:avatar + }); + return proposalId; + } + + /** + * @dev propose to remove a scheme for a controller + * @param _scheme the address of the scheme we want to remove + * @param _descriptionHash proposal description hash + * NB: not only registers the proposal, but also votes for it + */ + function proposeToRemoveScheme(address _scheme, string memory _descriptionHash) + public + returns(bytes32) + { + require(_scheme != address(0), "scheme cannot be zero"); + + bytes32 proposalId = votingMachine.propose(2, voteRemoveParams, msg.sender, address(avatar)); + organizationProposals[proposalId].scheme = _scheme; + emit RemoveSchemeProposal(address(avatar), proposalId, address(votingMachine), _scheme, _descriptionHash); + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ + blockNumber:block.number, + avatar:avatar + }); + return proposalId; + } +} diff --git a/contracts/schemes/SignalScheme.sol b/contracts/schemes/SignalScheme.sol index 62121b7e..8fdd1b82 100644 --- a/contracts/schemes/SignalScheme.sol +++ b/contracts/schemes/SignalScheme.sol @@ -1,16 +1,17 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/IntVoteInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; import "../votingMachines/VotingMachineCallbacks.sol"; import "../controller/Avatar.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A scheme for proposing a signal on behalkf of the daoCreator */ -contract SignalScheme is VotingMachineCallbacks, ProposalExecuteInterface { +contract SignalScheme is VotingMachineCallbacks, ProposalExecuteInterface, Initializable { event NewSignalProposal( address indexed _avatar, @@ -53,8 +54,8 @@ contract SignalScheme is VotingMachineCallbacks, ProposalExecuteInterface { uint256 _signalType, bytes32 _voteApproveParams, IntVoteInterface _intVote) - external { - require(params.avatar == Avatar(0), "can be called only one time"); + external + initializer { require(_avatar != Avatar(0), "avatar cannot be zero"); params = Parameters({ voteApproveParams: _voteApproveParams, @@ -74,7 +75,7 @@ contract SignalScheme is VotingMachineCallbacks, ProposalExecuteInterface { external returns(bytes32) { - require(ControllerInterface(params.avatar.owner()).isSchemeRegistered(address(this), address(params.avatar)), + require(Controller(params.avatar.owner()).isSchemeRegistered(address(this)), "scheme is not registered"); bytes32 proposalId = params.intVote.propose( diff --git a/contracts/universalSchemes/UpgradeScheme.sol b/contracts/schemes/UpgradeScheme.sol similarity index 51% rename from contracts/universalSchemes/UpgradeScheme.sol rename to contracts/schemes/UpgradeScheme.sol index 1a269d0c..b7944edc 100644 --- a/contracts/universalSchemes/UpgradeScheme.sol +++ b/contracts/schemes/UpgradeScheme.sol @@ -1,17 +1,16 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/ProposalExecuteInterface.sol"; -import "./UniversalScheme.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/IntVoteInterface.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/ProposalExecuteInterface.sol"; import "../votingMachines/VotingMachineCallbacks.sol"; - +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title A scheme to manage the upgrade of an organization. * @dev The scheme is used to upgrade the controller of an organization to a new controller. */ -contract UpgradeScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecuteInterface { +contract UpgradeScheme is Initializable, VotingMachineCallbacks, ProposalExecuteInterface { event NewUpgradeProposal( address indexed _avatar, @@ -26,7 +25,6 @@ contract UpgradeScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecu bytes32 indexed _proposalId, address indexed _intVoteInterface, address _newUpgradeScheme, - bytes32 _params, string _descriptionHash ); @@ -36,20 +34,34 @@ contract UpgradeScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecu // Details of an upgrade proposal: struct UpgradeProposal { address upgradeContract; // Either the new controller we upgrade to, or the new upgrading scheme. - bytes32 params; // Params for the new upgrading scheme. uint256 proposalType; // 1: Upgrade controller, 2: change upgrade scheme. } - // A mapping from the organization's (Avatar) address to the saved data of the organization: - mapping(address=>mapping(bytes32=>UpgradeProposal)) public organizationsProposals; + mapping(bytes32=>UpgradeProposal) public organizationProposals; - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - struct Parameters { - bytes32 voteParams; - IntVoteInterface intVote; - } + IntVoteInterface public votingMachine; + bytes32 public voteParams; + Avatar public avatar; - mapping(bytes32=>Parameters) public parameters; + /** + * @dev initialize + * @param _avatar the avatar this scheme referring to. + * @param _votingMachine the voting machines address to + * @param _voteParams voting machine parameters. + */ + function initialize( + Avatar _avatar, + IntVoteInterface _votingMachine, + bytes32 _voteParams + ) + external + initializer + { + require(_avatar != Avatar(0), "avatar cannot be zero"); + avatar = _avatar; + votingMachine = _votingMachine; + voteParams = _voteParams; + } /** * @dev execution of proposals, can only be called by the voting machine in which the vote is held. @@ -57,29 +69,28 @@ contract UpgradeScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecu * @param _param a parameter of the voting result, 1 yes and 2 is no. */ function executeProposal(bytes32 _proposalId, int256 _param) external onlyVotingMachine(_proposalId) returns(bool) { - Avatar avatar = proposalsInfo[msg.sender][_proposalId].avatar; - UpgradeProposal memory proposal = organizationsProposals[address(avatar)][_proposalId]; + UpgradeProposal memory proposal = organizationProposals[_proposalId]; require(proposal.proposalType != 0); - delete organizationsProposals[address(avatar)][_proposalId]; + delete organizationProposals[_proposalId]; emit ProposalDeleted(address(avatar), _proposalId); // Check if vote was successful: if (_param == 1) { // Define controller and get the params: - ControllerInterface controller = ControllerInterface(avatar.owner()); + Controller controller = Controller(avatar.owner()); // Upgrading controller: if (proposal.proposalType == 1) { - require(controller.upgradeController(proposal.upgradeContract, avatar)); + require(controller.upgradeController(proposal.upgradeContract)); } // Changing upgrade scheme: if (proposal.proposalType == 2) { - bytes4 permissions = controller.getSchemePermissions(address(this), address(avatar)); + bytes4 permissions = controller.schemesPermissions(address(this)); require( - controller.registerScheme(proposal.upgradeContract, proposal.params, permissions, address(avatar)) + controller.registerScheme(proposal.upgradeContract, permissions) ); if (proposal.upgradeContract != address(this)) { - require(controller.unregisterSelf(address(avatar))); + require(controller.unregisterSelf()); } } } @@ -87,105 +98,69 @@ contract UpgradeScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecu return true; } - /** - * @dev hash the parameters, save them if necessary, and return the hash value - */ - function setParameters( - bytes32 _voteParams, - IntVoteInterface _intVote - ) public returns(bytes32) - { - bytes32 paramsHash = getParametersHash(_voteParams, _intVote); - parameters[paramsHash].voteParams = _voteParams; - parameters[paramsHash].intVote = _intVote; - return paramsHash; - } - /** * @dev propose an upgrade of the organization's controller - * @param _avatar avatar of the organization * @param _newController address of the new controller that is being proposed * @param _descriptionHash proposal description hash * @return an id which represents the proposal */ - function proposeUpgrade(Avatar _avatar, address _newController, string memory _descriptionHash) + function proposeUpgrade(address _newController, string memory _descriptionHash) public returns(bytes32) { - Parameters memory params = parameters[getParametersFromController(_avatar)]; - bytes32 proposalId = params.intVote.propose(2, params.voteParams, msg.sender, address(_avatar)); + bytes32 proposalId = votingMachine.propose(2, voteParams, msg.sender, address(avatar)); UpgradeProposal memory proposal = UpgradeProposal({ proposalType: 1, - upgradeContract: _newController, - params: bytes32(0) + upgradeContract: _newController }); - organizationsProposals[address(_avatar)][proposalId] = proposal; + organizationProposals[proposalId] = proposal; emit NewUpgradeProposal( - address(_avatar), + address(avatar), proposalId, - address(params.intVote), + address(votingMachine), _newController, _descriptionHash ); - proposalsInfo[address(params.intVote)][proposalId] = ProposalInfo({ + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ blockNumber:block.number, - avatar:_avatar + avatar:avatar }); return proposalId; } /** * @dev propose to replace this scheme by another upgrading scheme - * @param _avatar avatar of the organization * @param _scheme address of the new upgrading scheme - * @param _params the parameters of the new upgrading scheme * @param _descriptionHash proposal description hash * @return an id which represents the proposal */ function proposeChangeUpgradingScheme( - Avatar _avatar, address _scheme, - bytes32 _params, string memory _descriptionHash ) public returns(bytes32) { - Parameters memory params = parameters[getParametersFromController(_avatar)]; - IntVoteInterface intVote = params.intVote; - bytes32 proposalId = intVote.propose(2, params.voteParams, msg.sender, address(_avatar)); - require(organizationsProposals[address(_avatar)][proposalId].proposalType == 0); + bytes32 proposalId = votingMachine.propose(2, voteParams, msg.sender, address(avatar)); + require(organizationProposals[proposalId].proposalType == 0); UpgradeProposal memory proposal = UpgradeProposal({ proposalType: 2, - upgradeContract: _scheme, - params: _params + upgradeContract: _scheme }); - organizationsProposals[address(_avatar)][proposalId] = proposal; + organizationProposals[proposalId] = proposal; emit ChangeUpgradeSchemeProposal( - address(_avatar), + address(avatar), proposalId, - address(params.intVote), + address(votingMachine), _scheme, - _params, _descriptionHash ); - proposalsInfo[address(intVote)][proposalId] = ProposalInfo({ + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ blockNumber:block.number, - avatar:_avatar + avatar:avatar }); return proposalId; } - - /** - * @dev return a hash of the given parameters - */ - function getParametersHash( - bytes32 _voteParams, - IntVoteInterface _intVote - ) public pure returns(bytes32) - { - return (keccak256(abi.encodePacked(_voteParams, _intVote))); - } } diff --git a/contracts/universalSchemes/VoteInOrganizationScheme.sol b/contracts/schemes/VoteInOrganizationScheme.sol similarity index 52% rename from contracts/universalSchemes/VoteInOrganizationScheme.sol rename to contracts/schemes/VoteInOrganizationScheme.sol index 039a9279..373ef281 100644 --- a/contracts/universalSchemes/VoteInOrganizationScheme.sol +++ b/contracts/schemes/VoteInOrganizationScheme.sol @@ -1,16 +1,14 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; -import "./UniversalScheme.sol"; import "../votingMachines/VotingMachineCallbacks.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title VoteInOrganizationScheme. * @dev A scheme to allow an organization to vote in a proposal. */ -contract VoteInOrganizationScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecuteInterface { +contract VoteInOrganizationScheme is Initializable, VotingMachineCallbacks, ProposalExecuteInterface { event NewVoteProposal( address indexed _avatar, bytes32 indexed _proposalId, @@ -32,36 +30,53 @@ contract VoteInOrganizationScheme is UniversalScheme, VotingMachineCallbacks, Pr bool exist; } - // A mapping from the organization (Avatar) address to the saved data of the organization: - mapping(address=>mapping(bytes32=>VoteProposal)) public organizationsProposals; + mapping(bytes32=>VoteProposal) public organizationProposals; - struct Parameters { - IntVoteInterface intVote; - bytes32 voteParams; - } + IntVoteInterface public votingMachine; + bytes32 public voteParams; + Avatar public avatar; - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - mapping(bytes32=>Parameters) public parameters; + /** + * @dev initialize + * @param _avatar the avatar this scheme referring to. + * @param _votingMachine the voting machines address to + * @param _voteParams voting machine parameters. + */ + function initialize( + Avatar _avatar, + IntVoteInterface _votingMachine, + bytes32 _voteParams + ) + external + initializer + { + require(_avatar != Avatar(0), "avatar cannot be zero"); + avatar = _avatar; + votingMachine = _votingMachine; + voteParams = _voteParams; + } /** * @dev execution of proposals, can only be called by the voting machine in which the vote is held. * @param _proposalId the ID of the voting in the voting machine - * @param _param a parameter of the voting result, 1 yes and 2 is no. + * @param _decision the voting result, 1 yes and 2 is no. * @return bool which represents a successful of the function */ - function executeProposal(bytes32 _proposalId, int256 _param) external onlyVotingMachine(_proposalId) returns(bool) { - Avatar avatar = proposalsInfo[msg.sender][_proposalId].avatar; + function executeProposal(bytes32 _proposalId, int256 _decision) + external + onlyVotingMachine(_proposalId) + returns(bool) { // Save proposal to memory and delete from storage: - VoteProposal memory proposal = organizationsProposals[address(avatar)][_proposalId]; + VoteProposal memory proposal = organizationProposals[_proposalId]; require(proposal.exist); - delete organizationsProposals[address(avatar)][_proposalId]; + delete organizationProposals[_proposalId]; emit ProposalDeleted(address(avatar), _proposalId); bytes memory callReturnValue; bool success; // If no decision do nothing: - if (_param == 1) { + if (_decision == 1) { - ControllerInterface controller = ControllerInterface(avatar.owner()); + Controller controller = Controller(avatar.owner()); (success, callReturnValue) = controller.genericCall( address(proposal.originalIntVote), abi.encodeWithSignature("vote(bytes32,uint256,uint256,address)", @@ -69,36 +84,17 @@ contract VoteInOrganizationScheme is UniversalScheme, VotingMachineCallbacks, Pr proposal.vote, 0, address(this)), - avatar, 0 ); require(success); } - emit ProposalExecuted(address(avatar), _proposalId, _param, callReturnValue); + emit ProposalExecuted(address(avatar), _proposalId, _decision, callReturnValue); return true; } - /** - * @dev Hash the parameters, save them if necessary, and return the hash value - * @param _voteParams - voting parameters - * @param _intVote - voting machine contract. - * @return bytes32 -the parameters hash - */ - function setParameters( - bytes32 _voteParams, - IntVoteInterface _intVote - ) public returns(bytes32) - { - bytes32 paramsHash = getParametersHash(_voteParams, _intVote); - parameters[paramsHash].voteParams = _voteParams; - parameters[paramsHash].intVote = _intVote; - return paramsHash; - } - /** * @dev propose to vote in other organization * The function trigger NewVoteProposal event - * @param _avatar avatar of the organization * @param _originalIntVote the other organization voting machine * @param _originalProposalId the other organization proposal id * @param _vote - which value to vote in the destination organization @@ -106,7 +102,6 @@ contract VoteInOrganizationScheme is UniversalScheme, VotingMachineCallbacks, Pr * @return an id which represents the proposal */ function proposeVote( - Avatar _avatar, IntVoteInterface _originalIntVote, bytes32 _originalProposalId, uint256 _vote, @@ -114,48 +109,32 @@ contract VoteInOrganizationScheme is UniversalScheme, VotingMachineCallbacks, Pr public returns(bytes32) { - Parameters memory params = parameters[getParametersFromController(_avatar)]; - IntVoteInterface intVote = params.intVote; (uint256 minVote, uint256 maxVote) = _originalIntVote.getAllowedRangeOfChoices(); require(_vote <= maxVote && _vote >= minVote, "vote should be in the allowed range"); require(_vote <= _originalIntVote.getNumberOfChoices(_originalProposalId), "vote should be <= original proposal number of choices"); - bytes32 proposalId = intVote.propose(2, params.voteParams, msg.sender, address(_avatar)); + bytes32 proposalId = votingMachine.propose(2, voteParams, msg.sender, address(avatar)); - organizationsProposals[address(_avatar)][proposalId] = VoteProposal({ + organizationProposals[proposalId] = VoteProposal({ originalIntVote: _originalIntVote, originalProposalId: _originalProposalId, vote:_vote, exist: true }); emit NewVoteProposal( - address(_avatar), + address(avatar), proposalId, - address(params.intVote), + address(votingMachine), _originalIntVote, _originalProposalId, _vote, _descriptionHash ); - proposalsInfo[address(intVote)][proposalId] = ProposalInfo({ + proposalsInfo[address(votingMachine)][proposalId] = ProposalInfo({ blockNumber:block.number, - avatar:_avatar + avatar:avatar }); return proposalId; } - - /** - * @dev Hash the parameters, and return the hash value - * @param _voteParams - voting parameters - * @param _intVote - voting machine contract. - * @return bytes32 -the parameters hash - */ - function getParametersHash( - bytes32 _voteParams, - IntVoteInterface _intVote - ) public pure returns(bytes32) - { - return keccak256(abi.encodePacked(_voteParams, _intVote)); - } } diff --git a/contracts/test/ARCDebug.sol b/contracts/test/ARCDebug.sol index 63c688b4..cbd2ba7d 100644 --- a/contracts/test/ARCDebug.sol +++ b/contracts/test/ARCDebug.sol @@ -1,10 +1,10 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/votingMachines/GenesisProtocol.sol"; -import "@daostack/infra/contracts/votingMachines/AbsoluteVote.sol"; -import "@daostack/infra/contracts/votingMachines/QuorumVote.sol"; -import "@daostack/infra/contracts/test/AbsoluteVoteExecuteMock.sol"; -import "@daostack/infra/contracts/test/GenesisProtocolCallbacksMock.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/GenesisProtocol.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/AbsoluteVote.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/QuorumVote.sol"; +import "@daostack/infra-experimental/contracts/test/AbsoluteVoteExecuteMock.sol"; +import "@daostack/infra-experimental/contracts/test/GenesisProtocolCallbacksMock.sol"; /* A contract you can inherit from that has some useful Events to print statements. diff --git a/contracts/test/ERC20Mock.sol b/contracts/test/ERC20Mock.sol index ba6b25fd..2ae73cf2 100644 --- a/contracts/test/ERC20Mock.sol +++ b/contracts/test/ERC20Mock.sol @@ -1,6 +1,6 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol"; // mock class using ERC20 diff --git a/contracts/test/ExternalTokenLockerMock.sol b/contracts/test/ExternalTokenLockerMock.sol index e3cce5cb..da787e36 100644 --- a/contracts/test/ExternalTokenLockerMock.sol +++ b/contracts/test/ExternalTokenLockerMock.sol @@ -1,12 +1,23 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; + contract ExternalTokenLockerMock is Ownable { // user => amount mapping (address => uint256) public lockedTokenBalances; + /** + * @dev initialize + * @param _owner contract owner + */ + function initialize(address _owner) + public + initializer { + Ownable.initialize(_owner); + } + function lock(uint256 _amount, address _beneficiary) public onlyOwner { lockedTokenBalances[_beneficiary] = _amount; } diff --git a/contracts/test/GlobalConstraintMock.sol b/contracts/test/GlobalConstraintMock.sol index b827868d..54be5e6f 100644 --- a/contracts/test/GlobalConstraintMock.sol +++ b/contracts/test/GlobalConstraintMock.sol @@ -30,11 +30,11 @@ contract GlobalConstraintMock { return true; } - function pre(address, bytes32, bytes32 method) public view returns(bool) { + function pre(address, bytes32 method) public view returns(bool) { return testParams[method].pre; } - function post(address, bytes32, bytes32 method) public view returns(bool) { + function post(address, bytes32 method) public view returns(bool) { return testParams[method].post; } diff --git a/contracts/test/NectarRepAllocation.sol b/contracts/test/NectarRepAllocation.sol index 651cccc7..6b5229f2 100644 --- a/contracts/test/NectarRepAllocation.sol +++ b/contracts/test/NectarRepAllocation.sol @@ -1,6 +1,6 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; contract MiniMeToken { diff --git a/contracts/test/PriceOracleMock.sol b/contracts/test/PriceOracleMock.sol index a69909ec..ef6475e5 100644 --- a/contracts/test/PriceOracleMock.sol +++ b/contracts/test/PriceOracleMock.sol @@ -1,10 +1,11 @@ pragma solidity ^0.5.11; import "../schemes/PriceOracleInterface.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; -contract PriceOracleMock is PriceOracleInterface, Ownable { +contract PriceOracleMock is Initializable, PriceOracleInterface, Ownable { struct Price { uint256 numerator; @@ -14,10 +15,20 @@ contract PriceOracleMock is PriceOracleInterface, Ownable { // user => amount mapping (address => Price) public tokenPrices; + /** + * @dev initialize + * @param _owner contract owner + */ + function initialize(address _owner) + public + initializer { + Ownable.initialize(_owner); + } + function setTokenPrice(address token, uint256 numerator, uint256 denominator) public onlyOwner { tokenPrices[token] = Price(numerator, denominator); } - + function getPrice(address token) public view returns (uint, uint) { Price memory price = tokenPrices[token]; return (price.numerator, price.denominator); diff --git a/contracts/test/SafeERC20Mock.sol b/contracts/test/SafeERC20Mock.sol index 3ddff4bc..3be0a20e 100644 --- a/contracts/test/SafeERC20Mock.sol +++ b/contracts/test/SafeERC20Mock.sol @@ -1,7 +1,7 @@ pragma solidity ^0.5.11; import "./BadERC20.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "../libs/SafeERC20.sol"; diff --git a/contracts/test/UniversalSchemeMock.sol b/contracts/test/SchemeMock.sol similarity index 58% rename from contracts/test/UniversalSchemeMock.sol rename to contracts/test/SchemeMock.sol index a057a45f..714e7010 100644 --- a/contracts/test/UniversalSchemeMock.sol +++ b/contracts/test/SchemeMock.sol @@ -1,18 +1,28 @@ pragma solidity ^0.5.11; -import "../universalSchemes/UniversalScheme.sol"; -import "../controller/ControllerInterface.sol"; +import "../controller/Controller.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; -contract UniversalSchemeMock is UniversalScheme { +contract SchemeMock is Initializable { + Avatar public avatar; + uint256 public testData; + + function initialize(Avatar _avatar, uint256 _testData) + external + initializer { + avatar = _avatar; + testData = _testData; + } + function genericCall(Avatar _avatar, address _contract, uint256 _a, address _b, bytes32 _c, uint256 _value) public returns(bool, bytes memory) { address controller = _avatar.owner(); - return ControllerInterface(controller).genericCall( - _contract, abi.encodeWithSignature("test(uint256,address,bytes32)", _a, _b, _c), _avatar, _value); + return Controller(controller).genericCall( + _contract, abi.encodeWithSignature("test(uint256,address,bytes32)", _a, _b, _c), _value); } function genericCallDirect(Avatar _avatar, address _contract, uint256 _a, address _b, bytes32 _c, uint256 _value) diff --git a/contracts/test/Wallet.sol b/contracts/test/Wallet.sol index 28093eec..a63a8998 100644 --- a/contracts/test/Wallet.sol +++ b/contracts/test/Wallet.sol @@ -1,5 +1,5 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; contract Wallet is Ownable { @@ -11,6 +11,16 @@ contract Wallet is Ownable { emit ReceiveEther(msg.sender, msg.value); } + /** + * @dev initialize + * @param _owner contract owner + */ + function initialize(address _owner) + public + initializer { + Ownable.initialize(_owner); + } + function pay(address payable _beneficiary) public onlyOwner { uint256 amount = address(this).balance; _beneficiary.transfer(amount); diff --git a/contracts/universalSchemes/GlobalConstraintRegistrar.sol b/contracts/universalSchemes/GlobalConstraintRegistrar.sol deleted file mode 100644 index b3ca63f8..00000000 --- a/contracts/universalSchemes/GlobalConstraintRegistrar.sol +++ /dev/null @@ -1,205 +0,0 @@ -pragma solidity ^0.5.11; - -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; -import "./UniversalScheme.sol"; -import "../votingMachines/VotingMachineCallbacks.sol"; - - - -/** - * @title A scheme to manage global constraint for organizations - * @dev The scheme is used to register or remove new global constraints - */ -contract GlobalConstraintRegistrar is UniversalScheme, VotingMachineCallbacks, ProposalExecuteInterface { - event NewGlobalConstraintsProposal( - address indexed _avatar, - bytes32 indexed _proposalId, - address indexed _intVoteInterface, - address _gc, - bytes32 _params, - bytes32 _voteToRemoveParams, - string _descriptionHash - ); - - event RemoveGlobalConstraintsProposal( - address indexed _avatar, - bytes32 indexed _proposalId, - address indexed _intVoteInterface, - address _gc, - string _descriptionHash - ); - - event ProposalExecuted(address indexed _avatar, bytes32 indexed _proposalId, int256 _param); - event ProposalDeleted(address indexed _avatar, bytes32 indexed _proposalId); - - // The struct that holds the information of a global constraint proposed to be added or removed. - struct GCProposal { - address gc; // The address of the global constraint contract. - bool addGC; // true: add a GC, false: remove a GC. - bytes32 params; // Parameters for global constraint. - bytes32 voteToRemoveParams; // Voting parameters for removing this GC. - } - - // GCProposal by avatar and proposalId - mapping(address=>mapping(bytes32=>GCProposal)) public organizationsProposals; - - // voteToRemoveParams hash by avatar and proposal.gc - mapping(address=>mapping(address=>bytes32)) public voteToRemoveParams; - - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - struct Parameters { - bytes32 voteRegisterParams; - IntVoteInterface intVote; - } - - mapping(bytes32=>Parameters) public parameters; - - /** - * @dev execution of proposals, can only be called by the voting machine in which the vote is held. - * @param _proposalId the ID of the voting in the voting machine - * @param _param a parameter of the voting result, 1 yes and 2 is no. - * @return bool which represents a successful of the function. - */ - function executeProposal(bytes32 _proposalId, int256 _param) external onlyVotingMachine(_proposalId) returns(bool) { - Avatar avatar = proposalsInfo[msg.sender][_proposalId].avatar; - bool retVal = true; - // Check if vote was successful: - GCProposal memory proposal = organizationsProposals[address(avatar)][_proposalId]; - require(proposal.gc != address(0)); - delete organizationsProposals[address(avatar)][_proposalId]; - emit ProposalDeleted(address(avatar), _proposalId); - - if (_param == 1) { - - // Define controller and get the params: - ControllerInterface controller = ControllerInterface(avatar.owner()); - - // Adding a GC - if (proposal.addGC) { - retVal = controller.addGlobalConstraint(proposal.gc, proposal.params, address(avatar)); - voteToRemoveParams[address(avatar)][proposal.gc] = proposal.voteToRemoveParams; - } - // Removing a GC - if (!proposal.addGC) { - retVal = controller.removeGlobalConstraint(proposal.gc, address(avatar)); - } - } - emit ProposalExecuted(address(avatar), _proposalId, _param); - return retVal; - } - - /** - * @dev Hash the parameters, save them if necessary, and return the hash value - * @param _voteRegisterParams - voting parameters for register global constraint - * @param _intVote - voting machine contract. - * @return bytes32 -the parameters hash - */ - function setParameters( - bytes32 _voteRegisterParams, - IntVoteInterface _intVote - ) public returns(bytes32) - { - bytes32 paramsHash = getParametersHash(_voteRegisterParams, _intVote); - parameters[paramsHash].voteRegisterParams = _voteRegisterParams; - parameters[paramsHash].intVote = _intVote; - return paramsHash; - } - - /** - * @dev propose to add a new global constraint: - * @param _avatar the avatar of the organization that the constraint is proposed for - * @param _gc the address of the global constraint that is being proposed - * @param _params the parameters for the global constraint - * @param _voteToRemoveParams the conditions (on the voting machine) for removing this global constraint - * @param _descriptionHash proposal's description hash - * @return bytes32 -the proposal id - */ - // TODO: do some checks on _voteToRemoveParams - it is very easy to make a mistake and not be able to remove the GC - function proposeGlobalConstraint( - Avatar _avatar, - address _gc, - bytes32 _params, - bytes32 _voteToRemoveParams, - string memory _descriptionHash) - public - returns(bytes32) - { - Parameters memory votingParams = parameters[getParametersFromController(_avatar)]; - - IntVoteInterface intVote = votingParams.intVote; - bytes32 proposalId = intVote.propose(2, votingParams.voteRegisterParams, msg.sender, address(_avatar)); - - GCProposal memory proposal = GCProposal({ - gc: _gc, - params: _params, - addGC: true, - voteToRemoveParams: _voteToRemoveParams - }); - - organizationsProposals[address(_avatar)][proposalId] = proposal; - emit NewGlobalConstraintsProposal( - address(_avatar), - proposalId, - address(intVote), - _gc, - _params, - _voteToRemoveParams, - _descriptionHash - ); - proposalsInfo[address(intVote)][proposalId] = ProposalInfo({ - blockNumber:block.number, - avatar:_avatar - }); - return proposalId; - } - - /** - * @dev propose to remove a global constraint: - * @param _avatar the avatar of the organization that the constraint is proposed for - * @param _gc the address of the global constraint that is being proposed - * @param _descriptionHash proposal's description hash - * @return bytes32 -the proposal id - */ - function proposeToRemoveGC(Avatar _avatar, address _gc, string memory _descriptionHash) public returns(bytes32) { - ControllerInterface controller = ControllerInterface(_avatar.owner()); - require(controller.isGlobalConstraintRegistered(_gc, address(_avatar))); - Parameters memory params = parameters[getParametersFromController(_avatar)]; - IntVoteInterface intVote = params.intVote; - bytes32 proposalId = intVote.propose( - 2, - voteToRemoveParams[address(_avatar)][_gc], - msg.sender, - address(_avatar) - ); - - GCProposal memory proposal = GCProposal({ - gc: _gc, - params: 0, - addGC: false, - voteToRemoveParams: 0 - }); - - organizationsProposals[address(_avatar)][proposalId] = proposal; - emit RemoveGlobalConstraintsProposal(address(_avatar), proposalId, address(intVote), _gc, _descriptionHash); - proposalsInfo[address(intVote)][proposalId] = ProposalInfo({ - blockNumber: block.number, - avatar: _avatar - }); - return proposalId; - } - - /** - * @dev Hash the parameters and return the hash value - * @param _voteRegisterParams - voting parameters - * @param _intVote - voting machine contract. - * @return bytes32 -the parameters hash - */ - function getParametersHash( - bytes32 _voteRegisterParams, - IntVoteInterface _intVote - ) public pure returns(bytes32) - { - return (keccak256(abi.encodePacked(_voteRegisterParams, _intVote))); - } -} diff --git a/contracts/universalSchemes/OrganizationRegister.sol b/contracts/universalSchemes/OrganizationRegister.sol deleted file mode 100644 index d80f5468..00000000 --- a/contracts/universalSchemes/OrganizationRegister.sol +++ /dev/null @@ -1,84 +0,0 @@ -pragma solidity ^0.5.11; - -import "./UniversalScheme.sol"; -import "../libs/SafeERC20.sol"; - -/** - * @title A universal organization registry. - * @dev Organizations can use this scheme to open a registry. - * Other organizations can then add and promote themselves on this registry. - */ - -contract OrganizationRegister is UniversalScheme { - using SafeMath for uint; - using SafeERC20 for address; - - struct Parameters { - uint256 fee; - IERC20 token; - address beneficiary; - } - - // A mapping from the organization (Avatar) address to the saved data of the organization: - mapping(address=>mapping(address=>uint)) public organizationsRegistry; - - mapping(bytes32=>Parameters) public parameters; - - event OrgAdded( address indexed _registry, address indexed _org); - event Promotion( address indexed _registry, address indexed _org, uint256 _amount); - - /** - * @dev Hash the parameters, save if needed and return the hash value - * @param _token - the token to pay for register or promotion an address. - * @param _fee - fee needed for register an address. - * @param _beneficiary - the beneficiary payment address - * @return bytes32 -the parameters hash - */ - function setParameters(IERC20 _token, uint256 _fee, address _beneficiary) public returns(bytes32) { - bytes32 paramsHash = getParametersHash(_token, _fee, _beneficiary); - if (parameters[paramsHash].token == ERC20(0)) { - parameters[paramsHash].token = _token; - parameters[paramsHash].fee = _fee; - parameters[paramsHash].beneficiary = _beneficiary; - } - return paramsHash; - } - - /** - * @dev Adding or promoting an address on the registry. - * An address(record) to add or promote can be organization address or any contract address. - * Adding a record is done by paying at least the minimum required by the registry params. - * Promoting a record is done by paying(adding)amount of token to the registry beneficiary. - * @param _avatar The _avatar of the organization which own the registry. - * @param _record The address to add or promote. - * @param _amount amount to pay for adding or promoting - */ - function addOrPromoteAddress(Avatar _avatar, address _record, uint256 _amount) - public - { - Parameters memory params = parameters[getParametersFromController(_avatar)]; - // Pay promotion, if the org was not listed the minimum is the fee: - require((organizationsRegistry[address(_avatar)][_record] > 0) || (_amount >= params.fee)); - - address(params.token).safeTransferFrom(msg.sender, params.beneficiary, _amount); - if (organizationsRegistry[address(_avatar)][_record] == 0) { - emit OrgAdded(address(_avatar), _record); - } - organizationsRegistry[address(_avatar)][_record] = - organizationsRegistry[address(_avatar)][_record].add(_amount); - emit Promotion(address(_avatar), _record, _amount); - } - - /** - * @dev Hash the parameters ,and return the hash value - * @param _token - the token to pay for register or promotion an address. - * @param _fee - fee needed for register an address. - * @param _beneficiary - the beneficiary payment address - * @return bytes32 -the parameters hash - */ - function getParametersHash(IERC20 _token, uint256 _fee, address _beneficiary) - public pure returns(bytes32) - { - return (keccak256(abi.encodePacked(_token, _fee, _beneficiary))); - } -} diff --git a/contracts/universalSchemes/SchemeRegistrar.sol b/contracts/universalSchemes/SchemeRegistrar.sol deleted file mode 100644 index dc5afac9..00000000 --- a/contracts/universalSchemes/SchemeRegistrar.sol +++ /dev/null @@ -1,192 +0,0 @@ -pragma solidity ^0.5.11; - -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; -import "./UniversalScheme.sol"; -import "../votingMachines/VotingMachineCallbacks.sol"; - - -/** - * @title A registrar for Schemes for organizations - * @dev The SchemeRegistrar is used for registering and unregistering schemes at organizations - */ - -contract SchemeRegistrar is UniversalScheme, VotingMachineCallbacks, ProposalExecuteInterface { - event NewSchemeProposal( - address indexed _avatar, - bytes32 indexed _proposalId, - address indexed _intVoteInterface, - address _scheme, - bytes32 _parametersHash, - bytes4 _permissions, - string _descriptionHash - ); - - event RemoveSchemeProposal(address indexed _avatar, - bytes32 indexed _proposalId, - address indexed _intVoteInterface, - address _scheme, - string _descriptionHash - ); - - event ProposalExecuted(address indexed _avatar, bytes32 indexed _proposalId, int256 _param); - event ProposalDeleted(address indexed _avatar, bytes32 indexed _proposalId); - - // a SchemeProposal is a proposal to add or remove a scheme to/from the an organization - struct SchemeProposal { - address scheme; // - bool addScheme; // true: add a scheme, false: remove a scheme. - bytes32 parametersHash; - bytes4 permissions; - } - - // A mapping from the organization (Avatar) address to the saved data of the organization: - mapping(address=>mapping(bytes32=>SchemeProposal)) public organizationsProposals; - - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - struct Parameters { - bytes32 voteRegisterParams; - bytes32 voteRemoveParams; - IntVoteInterface intVote; - } - - mapping(bytes32=>Parameters) public parameters; - - /** - * @dev execution of proposals, can only be called by the voting machine in which the vote is held. - * @param _proposalId the ID of the voting in the voting machine - * @param _param a parameter of the voting result, 1 yes and 2 is no. - */ - function executeProposal(bytes32 _proposalId, int256 _param) external onlyVotingMachine(_proposalId) returns(bool) { - Avatar avatar = proposalsInfo[msg.sender][_proposalId].avatar; - SchemeProposal memory proposal = organizationsProposals[address(avatar)][_proposalId]; - require(proposal.scheme != address(0)); - delete organizationsProposals[address(avatar)][_proposalId]; - emit ProposalDeleted(address(avatar), _proposalId); - if (_param == 1) { - - // Define controller and get the params: - ControllerInterface controller = ControllerInterface(avatar.owner()); - - // Add a scheme: - if (proposal.addScheme) { - require(controller.registerScheme( - proposal.scheme, - proposal.parametersHash, - proposal.permissions, - address(avatar)) - ); - } - // Remove a scheme: - if (!proposal.addScheme) { - require(controller.unregisterScheme(proposal.scheme, address(avatar))); - } - } - emit ProposalExecuted(address(avatar), _proposalId, _param); - return true; - } - - /** - * @dev hash the parameters, save them if necessary, and return the hash value - */ - function setParameters( - bytes32 _voteRegisterParams, - bytes32 _voteRemoveParams, - IntVoteInterface _intVote - ) public returns(bytes32) - { - bytes32 paramsHash = getParametersHash(_voteRegisterParams, _voteRemoveParams, _intVote); - parameters[paramsHash].voteRegisterParams = _voteRegisterParams; - parameters[paramsHash].voteRemoveParams = _voteRemoveParams; - parameters[paramsHash].intVote = _intVote; - return paramsHash; - } - - /** - * @dev create a proposal to register a scheme - * @param _avatar the address of the organization the scheme will be registered for - * @param _scheme the address of the scheme to be registered - * @param _parametersHash a hash of the configuration of the _scheme - * @param _permissions the permission of the scheme to be registered - * @param _descriptionHash proposal's description hash - * @return a proposal Id - * @dev NB: not only proposes the vote, but also votes for it - */ - function proposeScheme( - Avatar _avatar, - address _scheme, - bytes32 _parametersHash, - bytes4 _permissions, - string memory _descriptionHash - ) - public - returns(bytes32) - { - // propose - require(_scheme != address(0), "scheme cannot be zero"); - Parameters memory controllerParams = parameters[getParametersFromController(_avatar)]; - - bytes32 proposalId = controllerParams.intVote.propose( - 2, - controllerParams.voteRegisterParams, - msg.sender, - address(_avatar) - ); - - SchemeProposal memory proposal = SchemeProposal({ - scheme: _scheme, - parametersHash: _parametersHash, - addScheme: true, - permissions: _permissions - }); - emit NewSchemeProposal( - address(_avatar), - proposalId, - address(controllerParams.intVote), - _scheme, _parametersHash, - _permissions, - _descriptionHash - ); - organizationsProposals[address(_avatar)][proposalId] = proposal; - proposalsInfo[address(controllerParams.intVote)][proposalId] = ProposalInfo({ - blockNumber:block.number, - avatar:_avatar - }); - return proposalId; - } - - /** - * @dev propose to remove a scheme for a controller - * @param _avatar the address of the controller from which we want to remove a scheme - * @param _scheme the address of the scheme we want to remove - * @param _descriptionHash proposal description hash - * NB: not only registers the proposal, but also votes for it - */ - function proposeToRemoveScheme(Avatar _avatar, address _scheme, string memory _descriptionHash) - public - returns(bytes32) - { - require(_scheme != address(0), "scheme cannot be zero"); - bytes32 paramsHash = getParametersFromController(_avatar); - Parameters memory params = parameters[paramsHash]; - - IntVoteInterface intVote = params.intVote; - bytes32 proposalId = intVote.propose(2, params.voteRemoveParams, msg.sender, address(_avatar)); - organizationsProposals[address(_avatar)][proposalId].scheme = _scheme; - emit RemoveSchemeProposal(address(_avatar), proposalId, address(intVote), _scheme, _descriptionHash); - proposalsInfo[address(params.intVote)][proposalId] = ProposalInfo({ - blockNumber:block.number, - avatar:_avatar - }); - return proposalId; - } - - function getParametersHash( - bytes32 _voteRegisterParams, - bytes32 _voteRemoveParams, - IntVoteInterface _intVote - ) public pure returns(bytes32) - { - return keccak256(abi.encodePacked(_voteRegisterParams, _voteRemoveParams, _intVote)); - } -} diff --git a/contracts/universalSchemes/UGenericScheme.sol b/contracts/universalSchemes/UGenericScheme.sol deleted file mode 100644 index 637f4f40..00000000 --- a/contracts/universalSchemes/UGenericScheme.sol +++ /dev/null @@ -1,184 +0,0 @@ -pragma solidity ^0.5.11; - -import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol"; -import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol"; -import "./UniversalScheme.sol"; -import "../votingMachines/VotingMachineCallbacks.sol"; - - -/** - * @title UGenericScheme. - * @dev A scheme for proposing and executing calls to an arbitrary function - * on a specific contract on behalf of the organization avatar. - */ -contract UGenericScheme is UniversalScheme, VotingMachineCallbacks, ProposalExecuteInterface { - event NewCallProposal( - address indexed _avatar, - bytes32 indexed _proposalId, - bytes _callData, - uint256 _value, - string _descriptionHash - ); - - event ProposalExecuted( - address indexed _avatar, - bytes32 indexed _proposalId, - bytes _genericCallReturnValue - ); - - event ProposalExecutedByVotingMachine( - address indexed _avatar, - bytes32 indexed _proposalId, - int256 _param - ); - - event ProposalDeleted(address indexed _avatar, bytes32 indexed _proposalId); - - // Details of a voting proposal: - struct CallProposal { - bytes callData; - uint256 value; - bool exist; - bool passed; - } - - // A mapping from the organization (Avatar) address to the saved data of the organization: - mapping(address=>mapping(bytes32=>CallProposal)) public organizationsProposals; - - struct Parameters { - IntVoteInterface intVote; - bytes32 voteParams; - address contractToCall; - } - - // A mapping from hashes to parameters (use to store a particular configuration on the controller) - mapping(bytes32=>Parameters) public parameters; - - /** - * @dev execution of proposals, can only be called by the voting machine in which the vote is held. - * @param _proposalId the ID of the voting in the voting machine - * @param _decision a parameter of the voting result, 1 yes and 2 is no. - * @return bool success - */ - function executeProposal(bytes32 _proposalId, int256 _decision) - external - onlyVotingMachine(_proposalId) - returns(bool) { - Avatar avatar = proposalsInfo[msg.sender][_proposalId].avatar; - CallProposal storage proposal = organizationsProposals[address(avatar)][_proposalId]; - require(proposal.exist, "must be a live proposal"); - require(proposal.passed == false, "cannot execute twice"); - - if (_decision == 1) { - proposal.passed = true; - execute(avatar, _proposalId); - } else { - delete organizationsProposals[address(avatar)][_proposalId]; - emit ProposalDeleted(address(avatar), _proposalId); - } - - emit ProposalExecutedByVotingMachine(address(avatar), _proposalId, _decision); - return true; - } - - /** - * @dev execution of proposals after it has been decided by the voting machine - * @param _proposalId the ID of the voting in the voting machine - */ - function execute(Avatar _avatar, bytes32 _proposalId) public { - Parameters memory params = parameters[getParametersFromController(_avatar)]; - CallProposal storage proposal = organizationsProposals[address(_avatar)][_proposalId]; - require(proposal.exist, "must be a live proposal"); - require(proposal.passed, "proposal must passed by voting machine"); - proposal.exist = false; - bytes memory genericCallReturnValue; - bool success; - ControllerInterface controller = ControllerInterface(_avatar.owner()); - (success, genericCallReturnValue) = - controller.genericCall(params.contractToCall, proposal.callData, _avatar, proposal.value); - if (success) { - delete organizationsProposals[address(_avatar)][_proposalId]; - emit ProposalDeleted(address(_avatar), _proposalId); - emit ProposalExecuted(address(_avatar), _proposalId, genericCallReturnValue); - } else { - proposal.exist = true; - } - } - - /** - * @dev Hash the parameters, save them if necessary, and return the hash value - * @param _voteParams - voting parameters - * @param _intVote - voting machine contract. - * @return bytes32 -the parameters hash - */ - function setParameters( - bytes32 _voteParams, - IntVoteInterface _intVote, - address _contractToCall - ) public returns(bytes32) - { - bytes32 paramsHash = getParametersHash(_voteParams, _intVote, _contractToCall); - parameters[paramsHash].voteParams = _voteParams; - parameters[paramsHash].intVote = _intVote; - parameters[paramsHash].contractToCall = _contractToCall; - return paramsHash; - } - - /** - * @dev propose to call on behalf of the _avatar - * The function trigger NewCallProposal event - * @param _avatar avatar of the organization - * @param _callData - The abi encode data for the call - * @param _value value(ETH) to transfer with the call - * @param _descriptionHash proposal description hash - * @return an id which represents the proposal - */ - function proposeCall(Avatar _avatar, bytes memory _callData, uint256 _value, string memory _descriptionHash) - public - returns(bytes32) - { - Parameters memory params = parameters[getParametersFromController(_avatar)]; - IntVoteInterface intVote = params.intVote; - - bytes32 proposalId = intVote.propose(2, params.voteParams, msg.sender, address(_avatar)); - - organizationsProposals[address(_avatar)][proposalId] = CallProposal({ - callData: _callData, - value: _value, - exist: true, - passed: false - }); - proposalsInfo[address(params.intVote)][proposalId] = ProposalInfo({ - blockNumber:block.number, - avatar:_avatar - }); - emit NewCallProposal(address(_avatar), proposalId, _callData, _value, _descriptionHash); - return proposalId; - } - - /** - * @dev getContractToCall return the contract this scheme is calling - * @param _avatar address of the organization's avatar - * @return address the address of the contract this scheme is calling to - * on behalf of the avatar - */ - function getContractToCall(Avatar _avatar) public view returns(address) { - return parameters[getParametersFromController(_avatar)].contractToCall; - } - - /** - * @dev Hash the parameters, and return the hash value - * @param _voteParams - voting parameters - * @param _intVote - voting machine contract. - * @return bytes32 -the parameters hash - */ - function getParametersHash( - bytes32 _voteParams, - IntVoteInterface _intVote, - address _contractToCall - ) public pure returns(bytes32) - { - return keccak256(abi.encodePacked(_voteParams, _intVote, _contractToCall)); - } - -} diff --git a/contracts/universalSchemes/UniversalScheme.sol b/contracts/universalSchemes/UniversalScheme.sol deleted file mode 100644 index f8cf69ee..00000000 --- a/contracts/universalSchemes/UniversalScheme.sol +++ /dev/null @@ -1,17 +0,0 @@ -pragma solidity ^0.5.11; - -import "./UniversalSchemeInterface.sol"; -import "../controller/ControllerInterface.sol"; -import "../controller/Avatar.sol"; - - -contract UniversalScheme is UniversalSchemeInterface { - /** - * @dev get the parameters for the current scheme from the controller - */ - function getParametersFromController(Avatar _avatar) internal view returns(bytes32) { - require(ControllerInterface(_avatar.owner()).isSchemeRegistered(address(this), address(_avatar)), - "scheme is not registered"); - return ControllerInterface(_avatar.owner()).getSchemeParameters(address(this), address(_avatar)); - } -} diff --git a/contracts/universalSchemes/UniversalSchemeInterface.sol b/contracts/universalSchemes/UniversalSchemeInterface.sol deleted file mode 100644 index a03d7dc2..00000000 --- a/contracts/universalSchemes/UniversalSchemeInterface.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma solidity ^0.5.11; - -import "../controller/Avatar.sol"; - -contract UniversalSchemeInterface { - - function getParametersFromController(Avatar _avatar) internal view returns(bytes32); - -} diff --git a/contracts/utils/DAOFactory.sol b/contracts/utils/DAOFactory.sol new file mode 100644 index 00000000..b90a63da --- /dev/null +++ b/contracts/utils/DAOFactory.sol @@ -0,0 +1,274 @@ +pragma solidity ^0.5.11; + +import "@openzeppelin/upgrades/contracts/Initializable.sol"; +import "@openzeppelin/upgrades/contracts/application/App.sol"; +import "@openzeppelin/upgrades/contracts/application/ImplementationDirectory.sol"; +import "@openzeppelin/upgrades/contracts/upgradeability/ProxyAdmin.sol"; +import "@openzeppelin/upgrades/contracts/upgradeability/AdminUpgradeabilityProxy.sol"; +import "solidity-bytes-utils/contracts/BytesLib.sol"; +import "../controller/Controller.sol"; +import "../utils/DAOTracker.sol"; + + +contract DAOFactory is Initializable { + using BytesLib for bytes; + + event NewOrg (address indexed _avatar); + event InitialSchemesSet (address indexed _avatar); + event SchemeInstance(address indexed _scheme, string indexed _name); + + mapping(address=>address) public locks; + App public app; + string public constant PACKAGE_NAME = "DAOstack"; + DAOTracker private daoTracker; + + function initialize(address _appContractAddress, DAOTracker _daoTracker) external initializer { + require(_daoTracker != DAOTracker(0)); + app = App(_appContractAddress); + daoTracker = _daoTracker; + } + + /** + * @dev Create a new organization + * @param _orgName The name of the new organization + * @param _tokenInitData the DAOToken init data (tokenName,tokenSymbol,cap) + * @param _founders An array with the addresses of the founders of the organization + * @param _foundersTokenAmount An array of amount of tokens that the founders + * receive in the new organization + * @param _foundersReputationAmount An array of amount of reputation that the + * founders receive in the new organization + * @return The address of the avatar of the controller + */ + function forgeOrg ( + string calldata _orgName, + bytes calldata _tokenInitData, + address[] calldata _founders, + uint[] calldata _foundersTokenAmount, + uint[] calldata _foundersReputationAmount) + external + returns(address) { + return _forgeOrg(_orgName, _tokenInitData, _founders, _foundersTokenAmount, _foundersReputationAmount); + } + + /** + * @dev addFounders add founders to the organization. + * this function can be called only after forgeOrg and before setSchemes + * @param _avatar the organization avatar + * @param _founders An array with the addresses of the founders of the organization + * @param _foundersTokenAmount An array of amount of tokens that the founders + * receive in the new organization + * @param _foundersReputationAmount An array of amount of reputation that the + * founders receive in the new organization + * @return bool true or false + */ + function addFounders ( + Avatar _avatar, + address[] calldata _founders, + uint[] calldata _foundersTokenAmount, + uint[] calldata _foundersReputationAmount + ) + external + returns(bool) + { + require(_founders.length == _foundersTokenAmount.length); + require(_founders.length == _foundersReputationAmount.length); + require(_founders.length > 0); + require(locks[address(_avatar)] == msg.sender); + // Mint token and reputation for founders: + for (uint256 i = 0; i < _founders.length; i++) { + require(_founders[i] != address(0)); + if (_foundersTokenAmount[i] > 0) { + Controller( + _avatar.owner()).mintTokens(_foundersTokenAmount[i], _founders[i]); + } + if (_foundersReputationAmount[i] > 0) { + Controller( + _avatar.owner()).mintReputation(_foundersReputationAmount[i], _founders[i]); + } + } + return true; + } + + /** + * @dev Set initial schemes for the organization. + * @param _avatar organization avatar (returns from forgeOrg) + * @param _schemesNames the schemes name to register for the organization + * @param _schemesData the schemes initilization data + * @param _schemesInitilizeDataLens the schemes initilization data lens (at _schemesData) + * @param _permissions the schemes permissions. + * @param _metaData dao meta data hash + */ + function setSchemes ( + Avatar _avatar, + bytes32[] calldata _schemesNames, + bytes calldata _schemesData, + uint256[] calldata _schemesInitilizeDataLens, + bytes4[] calldata _permissions, + string calldata _metaData + ) + external { + _setSchemes( + address(_avatar), + _schemesNames, + _schemesData, + _schemesInitilizeDataLens, + _permissions, + _metaData); + } + + //this function is an helper function to concate 2 bytes vars and return its length. + //todo: implement that offlince and remove it from the contract + function bytesConcat(bytes calldata _preBytes, bytes calldata _postBytes) + external + pure + returns (bytes memory, uint256, uint256) { + if (_postBytes.length == 0) { + return (_preBytes, _preBytes.length, 0); + } + return (_preBytes.concat(_postBytes), _preBytes.length, _postBytes.length); + } + + /** + * @dev createSchemeInstance . + * @param _schemeName scheme name to create instance of + * @param _admin the scheme proxy administrator + * @param _data scheme data to be initialize with + * @param schemeInstance the proxied scheme insrtance + */ + function createSchemeInstance(string memory _schemeName, address _admin, bytes memory _data) + public + returns (address schemeInstance) + { + schemeInstance = address(app.create(PACKAGE_NAME, _schemeName, _admin, _data)); + emit SchemeInstance(schemeInstance, _schemeName); + } + + /** + * @dev Set initial schemes for the organization. + * @param _avatar organization avatar (returns from forgeOrg) + * @param _schemesNames the schemes name to register for the organization + * @param _schemesData the schemes initilization data + * @param _schemesInitilizeDataLens the schemes initilization data lens (at _schemesData) + * @param _permissions the schemes permissions. + * @param _metaData dao meta data hash + */ + function _setSchemes ( + address payable _avatar, + bytes32[] memory _schemesNames, + bytes memory _schemesData, + uint256[] memory _schemesInitilizeDataLens, + bytes4[] memory _permissions, + string memory _metaData + ) + private + { + // this action can only be executed by the account that holds the lock + // for this controller + require(locks[_avatar] == msg.sender); + // register initial schemes: + Controller controller = Controller(Avatar(_avatar).owner()); + uint256 startIndex = 0; + for (uint256 i = 0; i < _schemesNames.length; i++) { + address scheme = createSchemeInstance(bytes32ToStr(_schemesNames[i]), + _avatar, + _schemesData.slice(startIndex, _schemesInitilizeDataLens[i])); + controller.registerScheme(scheme, _permissions[i]); + startIndex = _schemesInitilizeDataLens[i]; + } + controller.metaData(_metaData); + // Unregister self: + controller.unregisterSelf(); + // Remove lock: + delete locks[_avatar]; + emit InitialSchemesSet(_avatar); + } + + function bytes32ToStr(bytes32 x) private pure returns (string memory) { + bytes memory bytesString = new bytes(32); + uint charCount = 0; + uint j; + for (j = 0; j < 32; j++) { + byte char = byte(bytes32(uint(x) * 2 ** (8 * j))); + if (char != 0) { + bytesString[charCount] = char; + charCount++; + } + } + bytes memory bytesStringTrimmed = new bytes(charCount); + for (j = 0; j < charCount; j++) { + bytesStringTrimmed[j] = bytesString[j]; + } + return string(bytesStringTrimmed); + } + + /** + * @dev Create a new organization + * @param _orgName The name of the new organization + * @param _tokenInitData the DAOToken init data (tokenName,tokenSymbol,cap) + * @param _founders An array with the addresses of the founders of the organization + * @param _foundersTokenAmount An array of amount of tokens that the founders + * receive in the new organization + * @param _foundersReputationAmount An array of amount of reputation that the + * founders receive in the new organization + * @return The address of the avatar of the controller + */ + function _forgeOrg ( + string memory _orgName, + bytes memory _tokenInitData, + address[] memory _founders, + uint256[] memory _foundersTokenAmount, + uint256[] memory _foundersReputationAmount + ) + private + returns(address) { + // Create Token, Reputation and Avatar: + require(_founders.length == _foundersTokenAmount.length); + require(_founders.length == _foundersReputationAmount.length); + require(_founders.length > 0); + AdminUpgradeabilityProxy nativeToken = app.create(PACKAGE_NAME, "DAOToken", address(this), _tokenInitData); + AdminUpgradeabilityProxy nativeReputation = + app.create(PACKAGE_NAME, "Reputation", address(this), + abi.encodeWithSignature("initialize(address)", address(this))); + + AdminUpgradeabilityProxy avatar = app.create(PACKAGE_NAME, "Avatar", address(this), + abi.encodeWithSignature( + "initialize(string,address,address,address)", + _orgName, + address(nativeToken), + address(nativeReputation), + address(this))); + nativeToken.changeAdmin(address(avatar)); + nativeReputation.changeAdmin(address(avatar)); + avatar.changeAdmin(address(avatar)); + // Mint token and reputation for founders: + for (uint256 i = 0; i < _founders.length; i++) { + require(_founders[i] != address(0)); + if (_foundersTokenAmount[i] > 0) { + DAOToken(address(nativeToken)).mint(_founders[i], _foundersTokenAmount[i]); + } + if (_foundersReputationAmount[i] > 0) { + Reputation(address(nativeReputation)).mint(_founders[i], _foundersReputationAmount[i]); + } + } + // Create Controller: + Controller controller = + Controller(address(app.create( + PACKAGE_NAME, + "Controller", + address(avatar), + abi.encodeWithSignature("initialize(address,address)", address(avatar), address(this))))); + + // Add the DAO to the tracking registry + daoTracker.track(Avatar(address(avatar)), controller); + + // Transfer ownership: + Avatar(address(avatar)).transferOwnership(address(controller)); + DAOToken(address(nativeToken)).transferOwnership(address(controller)); + Reputation(address(nativeReputation)).transferOwnership(address(controller)); + + locks[address(avatar)] = msg.sender; + + emit NewOrg (address(avatar)); + return (address(avatar)); + } +} diff --git a/contracts/utils/DAOTracker.sol b/contracts/utils/DAOTracker.sol index 6ae6c3d8..e00bfe86 100644 --- a/contracts/utils/DAOTracker.sol +++ b/contracts/utils/DAOTracker.sol @@ -1,16 +1,16 @@ pragma solidity ^0.5.11; -import "@daostack/infra/contracts/Reputation.sol"; import "../controller/DAOToken.sol"; import "../controller/Avatar.sol"; -import "../controller/ControllerInterface.sol"; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "../controller/Controller.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title An on-chain "source of truth" for what DAOs * should be index into DAOstack's subgraph. */ -contract DAOTracker is Ownable { +contract DAOTracker is Initializable, Ownable { // `blacklist` the DAO from the subgraph's cache. // Only able to be set by the owner of the DAOTracker. @@ -32,6 +32,10 @@ contract DAOTracker is Ownable { _; } + function initialize(address _owner) public initializer { + Ownable.initialize(_owner); + } + /** * @dev track a new organization. This function will tell the subgraph * to start ingesting events from the DAO's contracts. @@ -43,14 +47,14 @@ contract DAOTracker is Ownable { * @param _avatar the organization avatar * @param _controller the organization controller */ - function track(Avatar _avatar, ControllerInterface _controller) + function track(Avatar _avatar, Controller _controller) public onlyAvatarOwner(_avatar) notBlacklisted(_avatar) { // Only allow the information to be set once. In the case of a controller upgrades, // the subgraph will be updated via the UpgradeController event. require(_avatar != Avatar(0)); - require(_controller != ControllerInterface(0)); + require(_controller != Controller(0)); emit TrackDAO( address(_avatar), diff --git a/contracts/universalSchemes/DaoCreator.sol b/contracts/utils/DaoCreator.sol similarity index 79% rename from contracts/universalSchemes/DaoCreator.sol rename to contracts/utils/DaoCreator.sol index 59f23887..b0fa2ddd 100644 --- a/contracts/universalSchemes/DaoCreator.sol +++ b/contracts/utils/DaoCreator.sol @@ -1,7 +1,5 @@ pragma solidity ^0.5.11; -import "./UniversalScheme.sol"; -import "../controller/UController.sol"; import "../controller/Controller.sol"; import "../utils/DAOTracker.sol"; @@ -12,9 +10,10 @@ import "../utils/DAOTracker.sol"; contract ControllerCreator { function create(Avatar _avatar) public returns(address) { - Controller controller = new Controller(_avatar); - controller.registerScheme(msg.sender, bytes32(0), bytes4(0x0000001f), address(_avatar)); - controller.unregisterScheme(address(this), address(_avatar)); + Controller controller = new Controller(); + controller.initialize(_avatar, address(this)); + controller.registerScheme(msg.sender, bytes4(0x0000001f)); + controller.unregisterScheme(address(this)); return address(controller); } } @@ -67,12 +66,12 @@ contract DaoCreator { for (uint256 i = 0; i < _founders.length; i++) { require(_founders[i] != address(0)); if (_foundersTokenAmount[i] > 0) { - ControllerInterface( - _avatar.owner()).mintTokens(_foundersTokenAmount[i], _founders[i], address(_avatar)); + Controller( + _avatar.owner()).mintTokens(_foundersTokenAmount[i], _founders[i]); } if (_foundersReputationAmount[i] > 0) { - ControllerInterface( - _avatar.owner()).mintReputation(_foundersReputationAmount[i], _founders[i], address(_avatar)); + Controller( + _avatar.owner()).mintReputation(_foundersReputationAmount[i], _founders[i]); } } return true; @@ -88,8 +87,6 @@ contract DaoCreator { * receive in the new organization * @param _foundersReputationAmount An array of amount of reputation that the * founders receive in the new organization - * @param _uController universal controller instance - * if _uController address equal to zero the organization will use none universal controller. * @param _cap token cap - 0 for no cap. * @return The address of the avatar of the controller */ @@ -100,7 +97,6 @@ contract DaoCreator { address[] calldata _founders, uint[] calldata _foundersTokenAmount, uint[] calldata _foundersReputationAmount, - UController _uController, uint256 _cap ) external @@ -114,7 +110,6 @@ contract DaoCreator { _founders, _foundersTokenAmount, _foundersReputationAmount, - _uController, _cap); } @@ -122,14 +117,12 @@ contract DaoCreator { * @dev Set initial schemes for the organization. * @param _avatar organization avatar (returns from forgeOrg) * @param _schemes the schemes to register for the organization - * @param _params the schemes's params * @param _permissions the schemes permissions. * @param _metaData dao meta data hash */ function setSchemes ( Avatar _avatar, address[] calldata _schemes, - bytes32[] calldata _params, bytes4[] calldata _permissions, string calldata _metaData ) @@ -139,13 +132,13 @@ contract DaoCreator { // for this controller require(locks[address(_avatar)] == msg.sender); // register initial schemes: - ControllerInterface controller = ControllerInterface(_avatar.owner()); + Controller controller = Controller(_avatar.owner()); for (uint256 i = 0; i < _schemes.length; i++) { - controller.registerScheme(_schemes[i], _params[i], _permissions[i], address(_avatar)); + controller.registerScheme(_schemes[i], _permissions[i]); } - controller.metaData(_metaData, _avatar); + controller.metaData(_metaData); // Unregister self: - controller.unregisterScheme(address(this), address(_avatar)); + controller.unregisterScheme(address(this)); // Remove lock: delete locks[address(_avatar)]; emit InitialSchemesSet(address(_avatar)); @@ -161,8 +154,6 @@ contract DaoCreator { * receive in the new organization * @param _foundersReputationAmount An array of amount of reputation that the * founders receive in the new organization - * @param _uController universal controller instance - * if _uController address equal to zero the organization will use none universal controller. * @param _cap token cap - 0 for no cap. * @return The address of the avatar of the controller */ @@ -173,7 +164,6 @@ contract DaoCreator { address[] memory _founders, uint[] memory _foundersTokenAmount, uint[] memory _foundersReputationAmount, - UController _uController, uint256 _cap ) private returns(address) { @@ -181,10 +171,12 @@ contract DaoCreator { require(_founders.length == _foundersTokenAmount.length); require(_founders.length == _foundersReputationAmount.length); require(_founders.length > 0); - DAOToken nativeToken = new DAOToken(_tokenName, _tokenSymbol, _cap); + DAOToken nativeToken = new DAOToken(); + nativeToken.initialize(_tokenName, _tokenSymbol, _cap, address(this)); Reputation nativeReputation = new Reputation(); - Avatar avatar = new Avatar(_orgName, nativeToken, nativeReputation); - ControllerInterface controller; + nativeReputation.initialize(address(this)); + Avatar avatar = new Avatar(); + avatar.initialize(_orgName, nativeToken, nativeReputation, address(this)); // Mint token and reputation for founders: for (uint256 i = 0; i < _founders.length; i++) { @@ -198,11 +190,7 @@ contract DaoCreator { } // Create Controller: - if (UController(0) == _uController) { - controller = ControllerInterface(controllerCreator.create(avatar)); - } else { - controller = _uController; - } + Controller controller = Controller(controllerCreator.create(avatar)); // Add the DAO to the tracking registry daoTracker.track(avatar, controller); @@ -212,10 +200,6 @@ contract DaoCreator { nativeToken.transferOwnership(address(controller)); nativeReputation.transferOwnership(address(controller)); - if (controller == _uController) { - _uController.newOrganization(avatar); - } - locks[address(avatar)] = msg.sender; emit NewOrg (address(avatar)); diff --git a/contracts/utils/Redeemer.sol b/contracts/utils/Redeemer.sol index d31b4952..634c985f 100644 --- a/contracts/utils/Redeemer.sol +++ b/contracts/utils/Redeemer.sol @@ -1,8 +1,8 @@ pragma solidity ^0.5.11; -import "../universalSchemes/ContributionReward.sol"; -import "@daostack/infra/contracts/votingMachines/GenesisProtocol.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "../schemes/ContributionReward.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/GenesisProtocol.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; contract Redeemer { @@ -71,7 +71,7 @@ contract Redeemer { } winningVote = _genesisProtocol.winningVote(_proposalId); //redeem from contributionReward only if it executed - if (_contributionReward.getProposalExecutionTime(_proposalId, address(_avatar)) > 0) { + if (_contributionReward.getProposalExecutionTime(_proposalId) > 0) { (crReputationReward, crNativeTokenReward, crEthReward, crExternalTokenReward) = contributionRewardRedeem(_contributionReward, _proposalId, _avatar); } @@ -85,17 +85,17 @@ contract Redeemer { bool[4] memory whatToRedeem; whatToRedeem[0] = true; //reputation whatToRedeem[1] = true; //nativeToken - uint256 periodsToPay = _contributionReward.getPeriodsToPay(_proposalId, address(_avatar), 2); - uint256 ethReward = _contributionReward.getProposalEthReward(_proposalId, address(_avatar)); - uint256 externalTokenReward = _contributionReward.getProposalExternalTokenReward(_proposalId, address(_avatar)); - address externalTokenAddress = _contributionReward.getProposalExternalToken(_proposalId, address(_avatar)); + uint256 periodsToPay = _contributionReward.getPeriodsToPay(_proposalId, 2); + uint256 ethReward = _contributionReward.getProposalEthReward(_proposalId); + uint256 externalTokenReward = _contributionReward.getProposalExternalTokenReward(_proposalId); + address externalTokenAddress = _contributionReward.getProposalExternalToken(_proposalId); ethReward = periodsToPay.mul(ethReward); if ((ethReward == 0) || (address(_avatar).balance < ethReward)) { whatToRedeem[2] = false; } else { whatToRedeem[2] = true; } - periodsToPay = _contributionReward.getPeriodsToPay(_proposalId, address(_avatar), 3); + periodsToPay = _contributionReward.getPeriodsToPay(_proposalId, 3); externalTokenReward = periodsToPay.mul(externalTokenReward); if ((externalTokenReward == 0) || (IERC20(externalTokenAddress).balanceOf(address(_avatar)) < externalTokenReward)) { @@ -103,6 +103,6 @@ contract Redeemer { } else { whatToRedeem[3] = true; } - (reputation, nativeToken, eth, externalToken) = _contributionReward.redeem(_proposalId, _avatar, whatToRedeem); + (reputation, nativeToken, eth, externalToken) = _contributionReward.redeem(_proposalId, whatToRedeem); } } diff --git a/contracts/utils/RepAllocation.sol b/contracts/utils/RepAllocation.sol index f9df6ca7..57f7d07f 100644 --- a/contracts/utils/RepAllocation.sol +++ b/contracts/utils/RepAllocation.sol @@ -1,6 +1,7 @@ pragma solidity ^0.5.11; -import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; +import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** @@ -9,7 +10,7 @@ import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; * beneficiaries. * this contract can be used as the rep mapping contract for RepitationFromToken contract. */ -contract RepAllocation is Ownable { +contract RepAllocation is Initializable, Ownable { // beneficiary -> amount @@ -18,6 +19,14 @@ contract RepAllocation is Ownable { event BeneficiaryAddressAdded(address indexed _beneficiary, uint256 indexed _amount); + /** + * @dev initialize function + * @param _owner contract's owner to be set + */ + function initialize(address _owner) public initializer { + Ownable.initialize(_owner); + } + /** * @dev addBeneficiary function * @param _beneficiary to be whitelisted diff --git a/contracts/votingMachines/VotingMachineCallbacks.sol b/contracts/votingMachines/VotingMachineCallbacks.sol index 8eb104c0..f0564302 100644 --- a/contracts/votingMachines/VotingMachineCallbacks.sol +++ b/contracts/votingMachines/VotingMachineCallbacks.sol @@ -1,7 +1,8 @@ pragma solidity ^0.5.11; -import "../universalSchemes/UniversalScheme.sol"; -import "@daostack/infra/contracts/votingMachines/GenesisProtocol.sol"; +import "@daostack/infra-experimental/contracts/votingMachines/GenesisProtocol.sol"; +import "../controller/Avatar.sol"; +import "../controller/Controller.sol"; contract VotingMachineCallbacks is VotingMachineCallbacksInterface { @@ -28,7 +29,7 @@ contract VotingMachineCallbacks is VotingMachineCallbacksInterface { if (avatar == Avatar(0)) { return false; } - return ControllerInterface(avatar.owner()).mintReputation(_amount, _beneficiary, address(avatar)); + return Controller(avatar.owner()).mintReputation(_amount, _beneficiary); } function burnReputation(uint256 _amount, address _beneficiary, bytes32 _proposalId) @@ -40,7 +41,7 @@ contract VotingMachineCallbacks is VotingMachineCallbacksInterface { if (avatar == Avatar(0)) { return false; } - return ControllerInterface(avatar.owner()).burnReputation(_amount, _beneficiary, address(avatar)); + return Controller(avatar.owner()).burnReputation(_amount, _beneficiary); } function stakingTokenTransfer( @@ -56,7 +57,7 @@ contract VotingMachineCallbacks is VotingMachineCallbacksInterface { if (avatar == Avatar(0)) { return false; } - return ControllerInterface(avatar.owner()).externalTokenTransfer(_stakingToken, _beneficiary, _amount, avatar); + return Controller(avatar.owner()).externalTokenTransfer(_stakingToken, _beneficiary, _amount); } function balanceOfStakingToken(IERC20 _stakingToken, bytes32 _proposalId) external view returns(uint256) { diff --git a/migrations/2_deploy_organization.js b/migrations/2_deploy_organization.js index fb6353b3..a21c36fb 100644 --- a/migrations/2_deploy_organization.js +++ b/migrations/2_deploy_organization.js @@ -1,7 +1,6 @@ //this migration file is used only for testing purpose var constants = require('../test/constants'); var Avatar = artifacts.require('./Avatar.sol'); -var UController = artifacts.require('./UController.sol'); var DaoCreator = artifacts.require('./DaoCreator.sol'); var GlobalConstraintRegistrar = artifacts.require('./GlobalConstraintRegistrar.sol'); var SchemeRegistrar = artifacts.require('./SchemeRegistrar.sol'); @@ -40,13 +39,13 @@ module.exports = async function(deployer) { var daoTracker = await DAOTracker.deployed(); var controllerCreator = await ControllerCreator.deployed(); await deployer.deploy(DaoCreator,controllerCreator.address,daoTracker.address, {gas: constants.ARC_GAS_LIMIT}); - var daoCreatorInst = await DaoCreator.deployed(controllerCreator.address,{gas: constants.ARC_GAS_LIMIT}); + var daoCreatorInst = await DaoCreator.deployed(controllerCreator.address,daoTracker.address,{gas: constants.ARC_GAS_LIMIT}); // Create DAOstack: await web3.eth.getAccounts(function(err,res) { accounts = res; }); founders[0] = accounts[0]; var returnedParams = await daoCreatorInst.forgeOrg(orgName, tokenName, tokenSymbol, founders, - initTokenInWei, initRepInWei,NULL_ADDRESS,cap,{gas: constants.ARC_GAS_LIMIT}); + initTokenInWei, initRepInWei,cap,{gas: constants.ARC_GAS_LIMIT}); var AvatarInst = await Avatar.at(returnedParams.logs[0].args._avatar); await deployer.deploy(AbsoluteVote,{gas: constants.ARC_GAS_LIMIT}); // Deploy AbsoluteVote: @@ -67,41 +66,23 @@ module.exports = async function(deployer) { // Voting parameters and schemes params: var voteParametersHash = await AbsoluteVoteInst.getParametersHash(votePrec, NULL_ADDRESS); - await schemeRegistrarInst.setParameters(voteParametersHash, voteParametersHash, AbsoluteVoteInst.address); - var schemeRegisterParams = await schemeRegistrarInst.getParametersHash(voteParametersHash, voteParametersHash, AbsoluteVoteInst.address); - await globalConstraintRegistrarInst.setParameters(voteParametersHash, AbsoluteVoteInst.address); - var schemeGCRegisterParams = await globalConstraintRegistrarInst.getParametersHash(voteParametersHash, AbsoluteVoteInst.address); - await upgradeSchemeInst.setParameters(voteParametersHash, AbsoluteVoteInst.address); - var schemeUpgradeParams = await upgradeSchemeInst.getParametersHash(voteParametersHash, AbsoluteVoteInst.address); + await schemeRegistrarInst.initialize(AvatarInst.address,AbsoluteVoteInst.address,voteParametersHash, voteParametersHash, ); + await globalConstraintRegistrarInst.initialize(AvatarInst.address, AbsoluteVoteInst.address, voteParametersHash); + await upgradeSchemeInst.initialize(AvatarInst.address, AbsoluteVoteInst.address, voteParametersHash); - await contributionRewardInst.setParameters(voteParametersHash, AbsoluteVoteInst.address); - var contributionRewardParams = await contributionRewardInst.getParametersHash(voteParametersHash, AbsoluteVoteInst.address); + await contributionRewardInst.initialize(AvatarInst.address, AbsoluteVoteInst.address, voteParametersHash); var schemesArray = [schemeRegistrarInst.address, globalConstraintRegistrarInst.address, upgradeSchemeInst.address, contributionRewardInst.address]; - const paramsArray = [schemeRegisterParams, schemeGCRegisterParams, schemeUpgradeParams,contributionRewardParams]; const permissionArray = ['0x0000001F', '0x00000005', '0x0000000a','0x00000001']; // set DAOstack initial schmes: await daoCreatorInst.setSchemes( AvatarInst.address, schemesArray, - paramsArray, permissionArray, "metaData"); - //now deploy with universal controller - await deployer.deploy(UController, {gas: constants.ARC_GAS_LIMIT}); - var uController = await UController.deployed(); - returnedParams = await daoCreatorInst.forgeOrg(orgName, tokenName, tokenSymbol, founders, - initTokenInWei, initRepInWei,uController.address,cap,{gas: constants.ARC_GAS_LIMIT}); - AvatarInst = await Avatar.at(returnedParams.logs[0].args._avatar); - await daoCreatorInst.setSchemes( - AvatarInst.address, - schemesArray, - paramsArray, - permissionArray, - "metaData"); }); }; diff --git a/package-lock.json b/package-lock.json index 96b8ca99..2dd880a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "@daostack/arc", + "name": "@daostack/arc-experimental", "version": "0.0.1-rc.31", "lockfileVersion": 1, "requires": true, @@ -125,6 +125,12 @@ "requires": { "ms": "^2.1.1" } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true } } }, @@ -139,13 +145,67 @@ "to-fast-properties": "^2.0.0" } }, - "@daostack/infra": { - "version": "0.0.1-rc.15", - "resolved": "https://registry.npmjs.org/@daostack/infra/-/infra-0.0.1-rc.15.tgz", - "integrity": "sha512-th/nb1okI7qDNxMCILDdX8I+31zIDvgfDJlPhe/dTPUAC3Zr55WCcrUa8oS7cOb6G1ki7OdGycDCbfnu2ndWgg==", + "@daostack/infra-experimental": { + "version": "0.0.1-rc.16", + "resolved": "https://registry.npmjs.org/@daostack/infra-experimental/-/infra-experimental-0.0.1-rc.16.tgz", + "integrity": "sha512-8toFOgE8pN7yN/y+eqZS6y0b5HWJa492GecoqmU6mFIOjL3JiM1M47mhQ6BlOZQAznLZ5UAz0SVZriM2RxU9Fw==", "requires": { - "ethereumjs-abi": "^0.6.5", - "openzeppelin-solidity": "2.3.0" + "@openzeppelin/contracts-ethereum-package": "2.3.0", + "@openzeppelin/upgrades": "2.5.3", + "ethereumjs-abi": "^0.6.5" + } + }, + "@openzeppelin/contracts-ethereum-package": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-ethereum-package/-/contracts-ethereum-package-2.3.0.tgz", + "integrity": "sha512-voAH5uPmfZ0bpMHV6JgXoaWqkp0YIMmAino04nvJWso4S9di/rrWr8nnJB+b5bwQEz06u1rN9O3nXM9vIiHBlw==" + }, + "@openzeppelin/upgrades": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/@openzeppelin/upgrades/-/upgrades-2.5.3.tgz", + "integrity": "sha512-3tF3CCcfXb1OsCVjlv7v694pGdO+ssJddgDYI+K6AwUdAmxafaHSaftCFQ5BRmdpHKCxzAYrc2SSLHZpLpXl2g==", + "requires": { + "@types/cbor": "^2.0.0", + "@types/web3": "^1.0.14", + "axios": "^0.18.0", + "bignumber.js": "^7.2.0", + "cbor": "^4.1.5", + "chalk": "^2.4.1", + "ethers": "^4.0.20", + "glob": "^7.1.3", + "lodash.concat": "^4.5.0", + "lodash.difference": "^4.5.0", + "lodash.every": "^4.6.0", + "lodash.findlast": "^4.6.0", + "lodash.flatten": "^4.4.0", + "lodash.includes": "^4.3.0", + "lodash.invertby": "^4.7.0", + "lodash.isempty": "^4.4.0", + "lodash.isequal": "^4.5.0", + "lodash.isstring": "^4.0.1", + "lodash.keys": "^4.2.0", + "lodash.map": "^4.6.0", + "lodash.omit": "^4.5.0", + "lodash.pick": "^4.4.0", + "lodash.pickby": "^4.6.0", + "lodash.random": "^3.2.0", + "lodash.reverse": "^4.0.1", + "lodash.some": "^4.6.0", + "lodash.uniq": "^4.5.0", + "lodash.values": "^4.3.0", + "lodash.without": "^4.4.0", + "semver": "^5.5.1", + "spinnies": "^0.4.2", + "truffle-flattener": "^1.4.0", + "web3": "1.2.1", + "web3-utils": "1.2.0" + }, + "dependencies": { + "bignumber.js": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", + "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==" + } } }, "@resolver-engine/core": { @@ -155,6 +215,21 @@ "requires": { "debug": "^3.1.0", "request": "^2.85.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } } }, "@resolver-engine/fs": { @@ -164,6 +239,21 @@ "requires": { "@resolver-engine/core": "^0.2.1", "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } } }, "@resolver-engine/imports": { @@ -174,6 +264,21 @@ "@resolver-engine/core": "^0.2.1", "debug": "^3.1.0", "hosted-git-info": "^2.6.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } } }, "@resolver-engine/imports-fs": { @@ -184,6 +289,34 @@ "@resolver-engine/fs": "^0.2.1", "@resolver-engine/imports": "^0.2.2", "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "requires": { + "defer-to-connect": "^1.0.1" } }, "@types/babel-types": { @@ -201,6 +334,44 @@ "@types/babel-types": "*" } }, + "@types/cbor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/cbor/-/cbor-2.0.0.tgz", + "integrity": "sha1-xievwu4i8j8jN/7LNGKKT5fGr7s=", + "requires": { + "@types/node": "*" + } + }, + "@types/node": { + "version": "12.12.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.3.tgz", + "integrity": "sha512-opgSsy+cEF9N8MgaVPnWVtdJ3o4mV2aMHvDq7thkQUFt0EuOHJon4rQpJfhjmNHB+ikl0Cd6WhWIErOyQ+f7tw==" + }, + "@types/web3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/web3/-/web3-1.2.2.tgz", + "integrity": "sha512-eFiYJKggNrOl0nsD+9cMh2MLk4zVBfXfGnVeRFbpiZzBE20eet4KLA3fXcjSuHaBn0RnQzwLAGdgzgzdet4C0A==", + "requires": { + "web3": "*" + } + }, + "abstract-leveldown": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", + "integrity": "sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA==", + "requires": { + "xtend": "~4.0.0" + } + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, "acorn": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", @@ -230,6 +401,11 @@ "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", "dev": true }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" + }, "ajv": { "version": "6.10.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", @@ -252,6 +428,12 @@ "repeat-string": "^1.5.2" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -285,16 +467,14 @@ "dev": true }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -305,6 +485,11 @@ "integrity": "sha512-haHyTW7Y9joE5MVs37P2lNYfU2RWBLfcRDD8OWldcdZm5TiCE91B5Xl1oWSwiDUSd4rlExpt2pu1fksYQjRBYQ==", "dev": true }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -359,6 +544,11 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, "array-includes": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", @@ -389,6 +579,16 @@ "safer-buffer": "~2.1.0" } }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", @@ -410,7 +610,6 @@ "version": "2.6.3", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dev": true, "requires": { "lodash": "^4.17.14" } @@ -421,6 +620,19 @@ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, + "async-eventemitter": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/async-eventemitter/-/async-eventemitter-0.2.4.tgz", + "integrity": "sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw==", + "requires": { + "async": "^2.4.0" + } + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, "async-listener": { "version": "0.6.10", "resolved": "https://registry.npmjs.org/async-listener/-/async-listener-0.6.10.tgz", @@ -452,6 +664,15 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, + "axios": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz", + "integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==", + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -463,6 +684,12 @@ "js-tokens": "^3.0.2" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -488,6 +715,15 @@ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -523,21 +759,6 @@ "source-map": "^0.5.7" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", @@ -1069,26 +1290,11 @@ "lodash": "^4.17.4" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, @@ -1121,8 +1327,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -1179,6 +1384,19 @@ } } }, + "base-x": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.7.tgz", + "integrity": "sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -1207,6 +1425,18 @@ "file-uri-to-path": "1.0.0" } }, + "bip39": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-2.6.0.tgz", + "integrity": "sha512-RrnQRG2EgEoqO24ea+Q/fftuPUZLmrEM3qNhhGsA3PbaXaCW791LTzPuVyx/VprXQcTbPJ3K3UeTna8ZnVl2sg==", + "requires": { + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1", + "safe-buffer": "^5.0.1", + "unorm": "^1.3.3" + } + }, "bip66": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", @@ -1215,22 +1445,52 @@ "safe-buffer": "^5.0.1" } }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, "blessed": { "version": "0.1.81", "resolved": "https://registry.npmjs.org/blessed/-/blessed-0.1.81.tgz", "integrity": "sha1-+WLWh+wsNpVwrnGvhDJW5tDKESk=", "dev": true }, + "bluebird": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz", + "integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==" + }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, + "body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "requires": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1289,17 +1549,131 @@ "safe-buffer": "^5.0.1" } }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sha3": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz", + "integrity": "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=", + "requires": { + "js-sha3": "^0.6.1", + "safe-buffer": "^5.1.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "buffer": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", + "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -1317,6 +1691,35 @@ "unset-value": "^1.0.0" } }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, "caller-callsite": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", @@ -1350,16 +1753,38 @@ "dev": true }, "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "cbor": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/cbor/-/cbor-4.3.0.tgz", + "integrity": "sha512-CvzaxQlaJVa88sdtTWvLJ++MbdtPHtZOBBNjm7h3YKUHILMs9nQyD4AC6hvFZy7GBVB3I6bRibJcxeHydyT2IQ==", + "requires": { + "bignumber.js": "^9.0.0", + "commander": "^3.0.0", + "json-text-sequence": "^0.1", + "nofilter": "^1.0.3" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + }, + "commander": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" + } + } + }, "center-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", @@ -1374,7 +1799,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -1402,6 +1826,14 @@ "integrity": "sha1-BsIe7RobBq62dVPNxT4jJ0usIpY=", "dev": true }, + "checkpoint-store": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/checkpoint-store/-/checkpoint-store-1.1.0.tgz", + "integrity": "sha1-BOTLUWuRQziTWB5tRgGnjpVS6gY=", + "requires": { + "functional-red-black-tree": "^1.0.1" + } + }, "chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -1422,6 +1854,11 @@ "upath": "^1.1.1" } }, + "chownr": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==" + }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -1472,12 +1909,11 @@ } }, "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "requires": { - "restore-cursor": "^2.0.0" + "restore-cursor": "^3.1.0" } }, "cli-table-redemption": { @@ -1489,6 +1925,12 @@ "chalk": "^1.1.3" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -1508,6 +1950,15 @@ "supports-color": "^2.0.0" } }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -1523,21 +1974,61 @@ "dev": true }, "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" }, "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "coinstring": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/coinstring/-/coinstring-2.3.0.tgz", + "integrity": "sha1-zbYzY6lhUCQEolr7gsLibV/2J6Q=", + "requires": { + "bs58": "^2.0.1", + "create-hash": "^1.1.1" + }, + "dependencies": { + "bs58": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-2.0.1.tgz", + "integrity": "sha1-VZCNWPGYKrogCPob7Y+RmYopv40=" } } }, @@ -1555,7 +2046,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "requires": { "color-name": "1.1.3" } @@ -1563,8 +2053,7 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "colors": { "version": "1.4.0", @@ -1581,10 +2070,12 @@ } }, "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "requires": { + "graceful-readlink": ">= 1.0.0" + } }, "component-emitter": { "version": "1.3.0", @@ -1595,8 +2086,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "constantinople": { "version": "3.1.2", @@ -1616,6 +2106,26 @@ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", "dev": true }, + "content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "requires": { + "safe-buffer": "5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, "continuation-local-storage": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz", @@ -1643,6 +2153,21 @@ } } }, + "cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -1660,6 +2185,15 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "cosmiconfig": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", @@ -1700,6 +2234,15 @@ } } }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, "create-hash": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", @@ -1754,6 +2297,29 @@ "which": "^1.2.9" } }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "crypto-js": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.8.tgz", + "integrity": "sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU=" + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1763,24 +2329,116 @@ } }, "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { - "ms": "^2.1.1" + "ms": "2.0.0" } }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz", + "integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", + "requires": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "requires": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + } + }, + "decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "requires": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "dependencies": { + "file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==" + } + } + }, + "decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "requires": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + } + }, + "decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "requires": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "dependencies": { + "file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" + }, + "get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", + "requires": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + } + } + } + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" }, "deep-is": { "version": "0.1.3", @@ -1806,11 +2464,23 @@ "lodash": "^4.0.0" } }, + "defer-to-connect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.0.2.tgz", + "integrity": "sha512-k09hcQcTDY+cwgiwa6PYKLm3jlagNzQ+RSvhjzESOGOx+MNOuXkxTfEvPrO1IOQ81tArCFYQgi631clB70RpQw==" + }, + "deferred-leveldown": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz", + "integrity": "sha512-uukrWD2bguRtXilKt6cAWKyoXrTSMo5m7crUdLfWQmu8kIm88w3QZoUL+6nhpfKVmhHANER6Re3sKoNoZ3IKMA==", + "requires": { + "abstract-leveldown": "~2.6.0" + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -1856,11 +2526,40 @@ } } }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, + "delimit-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/delimit-stream/-/delimit-stream-0.1.0.tgz", + "integrity": "sha1-m4MZR3wOX4rrPONXrjBfwl6hzSs=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, "detect-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", @@ -1876,6 +2575,16 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -1891,6 +2600,11 @@ "integrity": "sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk=", "dev": true }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, "drbg.js": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", @@ -1901,6 +2615,11 @@ "create-hmac": "^1.1.4" } }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -1910,6 +2629,11 @@ "safer-buffer": "^2.1.0" } }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, "elliptic": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz", @@ -1939,11 +2663,39 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "requires": { + "iconv-lite": "~0.4.13" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "requires": { + "prr": "~1.0.1" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "requires": { "is-arrayish": "^0.2.1" } @@ -1952,7 +2704,6 @@ "version": "1.16.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.0.tgz", "integrity": "sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg==", - "dev": true, "requires": { "es-to-primitive": "^1.2.0", "function-bind": "^1.1.1", @@ -1970,13 +2721,17 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", "is-symbol": "^1.0.2" } }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, "escape-regexp": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/escape-regexp/-/escape-regexp-0.0.1.tgz", @@ -1986,8 +2741,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { "version": "5.16.0", @@ -2061,6 +2815,12 @@ "ms": "^2.1.1" } }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -2092,23 +2852,6 @@ "requires": { "debug": "^2.6.9", "resolve": "^1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "eslint-module-utils": { @@ -2119,23 +2862,6 @@ "requires": { "debug": "^2.6.8", "pkg-dir": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "eslint-plugin-import": { @@ -2157,15 +2883,6 @@ "resolve": "^1.11.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "doctrine": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", @@ -2176,10 +2893,52 @@ "isarray": "^1.0.0" } }, - "ms": { + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true } } @@ -2322,6 +3081,46 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-ens-namehash": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", + "integrity": "sha1-IprEbsqG1S4MmR58sq74P/D2i88=", + "requires": { + "idna-uts46-hx": "^2.3.1", + "js-sha3": "^0.5.7" + }, + "dependencies": { + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" + } + } + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethereum-common": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.2.0.tgz", + "integrity": "sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA==" + }, "ethereumjs-abi": { "version": "0.6.8", "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", @@ -2331,39 +3130,284 @@ "ethereumjs-util": "^6.0.0" } }, - "ethereumjs-util": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", - "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", + "ethereumjs-account": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/ethereumjs-account/-/ethereumjs-account-2.0.5.tgz", + "integrity": "sha512-bgDojnXGjhMwo6eXQC0bY6UK2liSFUSMwwylOmQvZbSl/D7NXQ3+vrGO46ZeOgjGfxXmgIeVNDIiHw7fNZM4VA==", "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "ethjs-util": "0.1.6", - "keccak": "^1.0.2", + "ethereumjs-util": "^5.0.0", "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + } } }, - "ethjs-util": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", - "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "ethereumjs-block": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz", + "integrity": "sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg==", "requires": { - "is-hex-prefixed": "1.0.0", - "strip-hex-prefix": "1.0.0" - } - }, - "eventemitter2": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-1.0.5.tgz", - "integrity": "sha1-+YNhBRexc3wLncZDvsqTiTwE3xg=", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "async": "^2.0.1", + "ethereum-common": "0.2.0", + "ethereumjs-tx": "^1.2.2", + "ethereumjs-util": "^5.0.0", + "merkle-patricia-tree": "^2.1.2" + }, + "dependencies": { + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + } + } + }, + "ethereumjs-common": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.3.2.tgz", + "integrity": "sha512-GkltYRIqBLzaZLmF/K3E+g9lZ4O4FL+TtpisAlD3N+UVlR+mrtoG+TvxavqVa6PwOY4nKIEMe5pl6MrTio3Lww==" + }, + "ethereumjs-tx": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz", + "integrity": "sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA==", + "requires": { + "ethereum-common": "^0.0.18", + "ethereumjs-util": "^5.0.0" + }, + "dependencies": { + "ethereum-common": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.0.18.tgz", + "integrity": "sha1-L9w1dvIykDNYl26znaeDIT/5Uj8=" + }, + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + } + } + }, + "ethereumjs-util": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", + "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "0.1.6", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + }, + "ethereumjs-vm": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.6.0.tgz", + "integrity": "sha512-r/XIUik/ynGbxS3y+mvGnbOKnuLo40V5Mj1J25+HEO63aWYREIqvWeRO/hnROlMBE5WoniQmPmhiaN0ctiHaXw==", + "requires": { + "async": "^2.1.2", + "async-eventemitter": "^0.2.2", + "ethereumjs-account": "^2.0.3", + "ethereumjs-block": "~2.2.0", + "ethereumjs-common": "^1.1.0", + "ethereumjs-util": "^6.0.0", + "fake-merkle-patricia-tree": "^1.0.1", + "functional-red-black-tree": "^1.0.1", + "merkle-patricia-tree": "^2.3.2", + "rustbn.js": "~0.2.0", + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "ethereumjs-block": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-2.2.0.tgz", + "integrity": "sha512-Ye+uG/L2wrp364Zihdlr/GfC3ft+zG8PdHcRtsBFNNH1CkOhxOwdB8friBU85n89uRZ9eIMAywCq0F4CwT1wAw==", + "requires": { + "async": "^2.0.1", + "ethereumjs-common": "^1.1.0", + "ethereumjs-tx": "^1.2.2", + "ethereumjs-util": "^5.0.0", + "merkle-patricia-tree": "^2.1.2" + }, + "dependencies": { + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + } + } + } + } + }, + "ethereumjs-wallet": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.3.tgz", + "integrity": "sha512-qiXPiZOsStem+Dj/CQHbn5qex+FVkuPmGH7SvSnA9F3tdRDt8dLMyvIj3+U05QzVZNPYh4HXEdnzoYI4dZkr9w==", + "requires": { + "aes-js": "^3.1.1", + "bs58check": "^2.1.2", + "ethereumjs-util": "^6.0.0", + "hdkey": "^1.1.0", + "randombytes": "^2.0.6", + "safe-buffer": "^5.1.2", + "scrypt.js": "^0.3.0", + "utf8": "^3.0.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "aes-js": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", + "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" + } + } + }, + "ethers": { + "version": "4.0.39", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.39.tgz", + "integrity": "sha512-QVtC8TTUgTrnlQjQvdFJ7fkSWKwp8HVTbKRmrdbVryrPzJHMTf3WSeRNvLF2enGyAFtyHJyFNnjN0fSshcEr9w==", + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.4", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + }, + "dependencies": { + "@types/node": { + "version": "10.17.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.2.tgz", + "integrity": "sha512-sAh60KDol+MpwOr1RTK0+HgBEYejKsxdpmrOS1Wts5bI03dLzq8F7T0sRXDKeaEK8iWDlGfdzxrzg6vx/c5pNA==" + }, + "elliptic": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", + "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" + }, + "scrypt-js": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz", + "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==" + }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + }, + "uuid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + } + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "requires": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + } + }, + "eventemitter2": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-1.0.5.tgz", + "integrity": "sha1-+YNhBRexc3wLncZDvsqTiTwE3xg=", + "dev": true + }, + "eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "requires": { "md5.js": "^1.3.4", "safe-buffer": "^5.1.1" @@ -2384,15 +3428,6 @@ "to-regex": "^3.0.1" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -2410,12 +3445,50 @@ "requires": { "is-extendable": "^0.1.0" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + } + } + }, + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "requires": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" } } }, @@ -2526,6 +3599,14 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, + "fake-merkle-patricia-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz", + "integrity": "sha1-S4w6z7Ugr635hgsfFM2M40As3dM=", + "requires": { + "checkpoint-store": "^1.1.0" + } + }, "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", @@ -2554,6 +3635,14 @@ "integrity": "sha1-EOhdo4v+p/xZk0HClu4ddyZu5kA=", "dev": true }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "requires": { + "pend": "~1.2.0" + } + }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -2572,6 +3661,11 @@ "flat-cache": "^2.0.1" } }, + "file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=" + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -2600,6 +3694,20 @@ } } }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + } + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -2636,6 +3744,32 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -2657,6 +3791,11 @@ "mime-types": "^2.1.12" } }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -2666,6 +3805,34 @@ "map-cache": "^0.2.2" } }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "requires": { + "minipass": "^2.6.0" + } + }, "fs-readdir-recursive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", @@ -2675,8 +3842,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "1.2.9", @@ -3210,14 +4376,12 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, "ganache-cli": { "version": "6.7.0", @@ -3892,6 +5056,19 @@ } } }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -3916,7 +5093,6 @@ "version": "7.1.5", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3947,17 +5123,48 @@ } } }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, "graceful-fs": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", - "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==", - "dev": true + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" }, "growl": { "version": "1.10.5", @@ -3983,7 +5190,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -3995,19 +5201,38 @@ "dev": true, "requires": { "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } } }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==" }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "requires": { + "has-symbol-support-x": "^1.4.1" + } }, "has-value": { "version": "1.0.0", @@ -4030,6 +5255,12 @@ "kind-of": "^4.0.0" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", @@ -4059,6 +5290,16 @@ "minimalistic-assert": "^1.0.1" } }, + "hdkey": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/hdkey/-/hdkey-1.1.1.tgz", + "integrity": "sha512-DvHZ5OuavsfWs5yfVJZestsnc3wzPvLWNk6c2nRUfo6X+OtxypGt20vDDf7Ba+MJzjL3KS1og2nw2eBbLCOUTA==", + "requires": { + "coinstring": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -4090,6 +5331,35 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==" }, + "http-cache-semantics": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" + }, + "http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -4104,17 +5374,41 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } }, + "idna-uts46-hx": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", + "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" + } + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, + "immediate": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", + "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" + }, "import-fresh": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", @@ -4135,7 +5429,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -4168,18 +5461,70 @@ }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "restore-cursor": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } } } } @@ -4199,6 +5544,16 @@ "loose-envify": "^1.0.0" } }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" + }, + "ipaddr.js": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", + "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" + }, "is": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz", @@ -4214,6 +5569,12 @@ "kind-of": "^3.0.2" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -4228,8 +5589,7 @@ "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" }, "is-binary-path": { "version": "1.0.1", @@ -4241,16 +5601,14 @@ } }, "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" }, "is-data-descriptor": { "version": "0.1.4", @@ -4261,6 +5619,12 @@ "kind-of": "^3.0.2" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -4275,8 +5639,7 @@ "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-descriptor": { "version": "0.1.6", @@ -4343,10 +5706,17 @@ } }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" }, "is-glob": { "version": "4.0.1", @@ -4362,6 +5732,11 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, + "is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -4371,6 +5746,12 @@ "kind-of": "^3.0.2" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -4382,11 +5763,15 @@ } } }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" + }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" }, "is-plain-object": { "version": "2.0.4", @@ -4407,16 +5792,24 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, "requires": { "has": "^1.0.1" } }, + "is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, "is-symbol": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, "requires": { "has-symbols": "^1.0.0" } @@ -4426,6 +5819,11 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -4435,8 +5833,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -4450,11 +5847,34 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, + "isomorphic-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "requires": { + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" + } + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "isurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "requires": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + } + }, + "js-sha3": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz", + "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=" + }, "js-stringify": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", @@ -4488,6 +5908,11 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -4515,12 +5940,28 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json-text-sequence": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/json-text-sequence/-/json-text-sequence-0.1.1.tgz", + "integrity": "sha1-py8hfcSvxGKf/1/rME3BvVGi89I=", + "requires": { + "delimit-stream": "0.1.0" + } + }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -4543,9 +5984,9 @@ } }, "jsx-ast-utils": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz", - "integrity": "sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.3.tgz", + "integrity": "sha512-EdIHFMm+1BPynpKOpdPqiOsvnIrInRGJD7bzPZdPkjitQEqpdpUuFpq4T0npZFKTiB3RhWFdGN+oqOJIdhDhQA==", "dev": true, "requires": { "array-includes": "^3.0.3", @@ -4563,12 +6004,37 @@ "safe-buffer": "^5.1.0" } }, + "keccakjs": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", + "integrity": "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==", + "requires": { + "browserify-sha3": "^0.0.4", + "sha3": "^1.2.2" + } + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "requires": { + "json-buffer": "3.0.0" + } + }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "requires": { + "graceful-fs": "^4.1.9" + } + }, "lazy": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/lazy/-/lazy-1.0.11.tgz", @@ -4581,6 +6047,127 @@ "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", "dev": true }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "requires": { + "invert-kv": "^1.0.0" + } + }, + "level-codec": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-7.0.1.tgz", + "integrity": "sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ==" + }, + "level-errors": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-1.0.5.tgz", + "integrity": "sha512-/cLUpQduF6bNrWuAC4pwtUKA5t669pCsCi2XbmojG2tFeOr9j6ShtdDCtFFQO1DRt+EVZhx9gPzP9G2bUaG4ig==", + "requires": { + "errno": "~0.1.1" + } + }, + "level-iterator-stream": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz", + "integrity": "sha1-5Dt4sagUPm+pek9IXrjqUwNS8u0=", + "requires": { + "inherits": "^2.0.1", + "level-errors": "^1.0.3", + "readable-stream": "^1.0.33", + "xtend": "^4.0.0" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, + "level-ws": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/level-ws/-/level-ws-0.0.0.tgz", + "integrity": "sha1-Ny5RIXeSSgBCSwtDrvK7QkltIos=", + "requires": { + "readable-stream": "~1.0.15", + "xtend": "~2.1.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "object-keys": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", + "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "xtend": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", + "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", + "requires": { + "object-keys": "~0.4.0" + } + } + } + }, + "levelup": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.9.tgz", + "integrity": "sha512-VVGHfKIlmw8w1XqpGOAGwq6sZm2WwWLmlDcULkKWQXEA5EopA8OBNJ2Ck2v6bdk8HeEZSbCSEgzXadyQFm76sQ==", + "requires": { + "deferred-leveldown": "~1.2.1", + "level-codec": "~7.0.0", + "level-errors": "~1.0.3", + "level-iterator-stream": "~1.3.0", + "prr": "~1.0.1", + "semver": "~5.4.1", + "xtend": "~4.0.0" + }, + "dependencies": { + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" + } + } + }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -4592,15 +6179,15 @@ } }, "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", "pify": "^2.0.0", - "strip-bom": "^3.0.0" + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, "locate-path": { @@ -4615,8 +6202,27 @@ "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=" + }, + "lodash.concat": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.concat/-/lodash.concat-4.5.0.tgz", + "integrity": "sha1-sFOuAuSoAIWC5yVrnQK9ptA4A5U=" + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=" + }, + "lodash.every": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.every/-/lodash.every-4.6.0.tgz", + "integrity": "sha1-64mYS+vENkJ5uzrvu9HKGb+mxqc=" }, "lodash.findindex": { "version": "4.6.0", @@ -4624,11 +6230,50 @@ "integrity": "sha1-oyRd7mH7m24GJLU1ElYku2nBEQY=", "dev": true }, + "lodash.findlast": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.findlast/-/lodash.findlast-4.6.0.tgz", + "integrity": "sha1-6ou3jPLn54BPyK630ZU+B/4x+8g=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" + }, + "lodash.invertby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.invertby/-/lodash.invertby-4.7.0.tgz", + "integrity": "sha1-zeu2zUlCqmuN8sdL4cXZSGgnGLA=" + }, + "lodash.isempty": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz", + "integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4=" + }, "lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", - "dev": true + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.2.0.tgz", + "integrity": "sha1-oIYCrBLk+4P5H8H7ejYKTZujUgU=" + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" }, "lodash.merge": { "version": "4.6.2", @@ -4636,6 +6281,51 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "lodash.omit": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz", + "integrity": "sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA=" + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.pickby": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz", + "integrity": "sha1-feoh2MGNdwOifHBMFdO4SmfjOv8=" + }, + "lodash.random": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.random/-/lodash.random-3.2.0.tgz", + "integrity": "sha1-luJOdjMzGZEw0sni/Vf5FwPMJi0=" + }, + "lodash.reverse": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.reverse/-/lodash.reverse-4.0.1.tgz", + "integrity": "sha1-Hyr+2s4uFuZg86p8WdMwCm8l0Tw=" + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "lodash.values": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.values/-/lodash.values-4.3.0.tgz", + "integrity": "sha1-o6bCsOvsxcLLocF+bmIP6BtT00c=" + }, + "lodash.without": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.4.0.tgz", + "integrity": "sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=" + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -4651,6 +6341,11 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + }, "lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", @@ -4659,6 +6354,34 @@ "requires": { "pseudomap": "^1.0.2", "yallist": "^2.1.2" + }, + "dependencies": { + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "ltgt": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", + "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=" + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "map-cache": { @@ -4691,33 +6414,125 @@ "safe-buffer": "^5.1.2" } }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "dev": true + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, + "memdown": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/memdown/-/memdown-1.4.1.tgz", + "integrity": "sha1-tOThkhdGZP+65BNhqlAPMRnv4hU=", "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" + "abstract-leveldown": "~2.7.1", + "functional-red-black-tree": "^1.0.1", + "immediate": "^3.2.3", + "inherits": "~2.0.1", + "ltgt": "~2.2.0", + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "abstract-leveldown": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz", + "integrity": "sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w==", + "requires": { + "xtend": "~4.0.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } } }, + "memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "merkle-patricia-tree": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz", + "integrity": "sha512-81PW5m8oz/pz3GvsAwbauj7Y00rqm81Tzad77tHBwU7pIAtN+TJnMSOJhxBKflSVYhptMMb9RskhqHqrSm1V+g==", + "requires": { + "async": "^1.4.2", + "ethereumjs-util": "^5.0.0", + "level-ws": "0.0.0", + "levelup": "^1.2.1", + "memdown": "^1.0.0", + "readable-stream": "^2.0.0", + "rlp": "^2.0.0", + "semaphore": ">=1.0.1" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + } + } + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, "mime-db": { "version": "1.40.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", @@ -4732,10 +6547,22 @@ } }, "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } }, "minimalistic-assert": { "version": "1.0.1", @@ -4751,7 +6578,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4761,6 +6587,23 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "requires": { + "minipass": "^2.9.0" + } + }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -4790,6 +6633,14 @@ "minimist": "0.0.8" } }, + "mkdirp-promise": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", + "integrity": "sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE=", + "requires": { + "mkdirp": "*" + } + }, "mocha": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", @@ -4838,12 +6689,6 @@ "path-is-absolute": "^1.0.0" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -4855,6 +6700,11 @@ } } }, + "mock-fs": { + "version": "4.10.2", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.10.2.tgz", + "integrity": "sha512-ewPQ83O4U8/Gd8I15WoB6vgTTmq5khxBskUWCRvswUqjCfOOTREmxllztQOm+PXMWUxATry+VBWXQJloAyxtbQ==" + }, "moment": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", @@ -4871,9 +6721,9 @@ } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mute-stream": { "version": "0.0.7", @@ -4882,9 +6732,14 @@ "dev": true }, "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", + "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" }, "nanomatch": { "version": "1.2.13", @@ -4920,19 +6775,54 @@ "debug": "^3.2.6", "iconv-lite": "^0.4.4", "sax": "^1.2.4" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "requires": { + "encoding": "^0.1.11", + "is-stream": "^1.0.1" + } + }, + "nofilter": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.3.tgz", + "integrity": "sha512-FlUlqwRK6reQCaFLAhMcF+6VkVG2caYjKQY3YsRDTl4/SEch595Qb3oLjJRDr8dkHAAOVj2pOx3VknfnSgkE5g==" + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, "requires": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -4946,6 +6836,11 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + }, "nssocket": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/nssocket/-/nssocket-0.6.0.tgz", @@ -4967,8 +6862,23 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } }, "oauth-sign": { "version": "0.9.0", @@ -4978,8 +6888,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "object-copy": { "version": "0.1.0", @@ -5001,6 +6910,12 @@ "is-descriptor": "^0.1.0" } }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -5015,14 +6930,12 @@ "object-inspect": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", - "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", - "dev": true + "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, "object-visit": { "version": "1.0.1", @@ -5090,29 +7003,38 @@ "has": "^1.0.3" } }, + "oboe": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", + "integrity": "sha1-IMiM2wwVNxuwQRklfU/dNLCqSfY=", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } }, "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", "requires": { - "mimic-fn": "^1.0.0" + "mimic-fn": "^2.1.0" } }, - "openzeppelin-solidity": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-2.3.0.tgz", - "integrity": "sha512-QYeiPLvB1oSbDt6lDQvvpx7k8ODczvE474hb2kLXZBPKMsxKT1WxTCHBYrCU7kS7hfAku4DcJ0jqOyL+jvjwQw==" - }, "optionator": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", @@ -5139,6 +7061,14 @@ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "requires": { + "lcid": "^1.0.0" + } + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -5156,6 +7086,16 @@ "mkdirp": "^0.5.1" } }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -5172,6 +7112,14 @@ "p-limit": "^1.1.0" } }, + "p-timeout": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "requires": { + "p-finally": "^1.0.0" + } + }, "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", @@ -5186,15 +7134,41 @@ "callsites": "^3.0.0" } }, + "parse-asn1": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-headers": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz", + "integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==", + "requires": { + "for-each": "^0.3.3", + "string.prototype.trim": "^1.1.2" + } + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, "requires": { "error-ex": "^1.2.0" } }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -5215,8 +7189,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-is-inside": { "version": "1.0.2", @@ -5233,18 +7206,40 @@ "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", "requires": { - "pify": "^2.0.0" + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -5259,8 +7254,20 @@ "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } }, "pkg-dir": { "version": "2.0.0", @@ -5308,6 +7315,12 @@ "yamljs": "^0.3.0" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -5333,6 +7346,21 @@ "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", "dev": true }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5340,9 +7368,9 @@ "dev": true }, "source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -5355,6 +7383,15 @@ "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=", "dev": true }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -5373,6 +7410,23 @@ "amp-message": "~0.1.1", "debug": "^3.0", "escape-regexp": "0.0.1" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "pm2-axon-rpc": { @@ -5382,6 +7436,23 @@ "dev": true, "requires": { "debug": "^3.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "pm2-deploy": { @@ -5414,6 +7485,23 @@ "json-stringify-safe": "^5.0", "semver": "5.*", "vxx": "^1.2.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "posix-character-classes": { @@ -5428,6 +7516,11 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" + }, "prettier": { "version": "1.18.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", @@ -5441,11 +7534,15 @@ "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", "dev": true }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "2.0.3", @@ -5491,6 +7588,20 @@ "react-is": "^16.8.1" } }, + "proxy-addr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", + "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.0" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -5502,9 +7613,22 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" }, - "pug": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pug/-/pug-2.0.4.tgz", + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "pug": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pug/-/pug-2.0.4.tgz", "integrity": "sha512-XhoaDlvi6NIzL49nu094R2NA6P37ijtgMDuWE+ofekDChvfKnzFal60bhSdiy8y2PBO6fmz3oMEIcfpBVRUdvw==", "dev": true, "requires": { @@ -5628,20 +7752,77 @@ "integrity": "sha512-GMu3M5nUL3fju4/egXwZO0XLi6fW/K3T3VTgFQ14GxNi8btlxgT5qZL//JwZFm/2Fa64J/PNS8AZeys3wiMkVA==", "dev": true }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } }, "react-is": { - "version": "16.10.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.10.2.tgz", - "integrity": "sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA==", + "version": "16.11.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz", + "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==", "dev": true }, "read": { @@ -5654,31 +7835,47 @@ } }, "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "requires": { - "load-json-file": "^2.0.0", + "load-json-file": "^1.0.0", "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "path-type": "^1.0.0" } }, "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + } } }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -5692,8 +7889,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" } } }, @@ -5842,13 +8038,34 @@ "tough-cookie": "~2.4.3", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + } } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-from-string": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", + "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=" + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" + }, "resolve": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", - "dev": true, "requires": { "path-parse": "^1.0.6" } @@ -5865,16 +8082,31 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "requires": { - "onetime": "^2.0.0", + "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, + "resumer": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=", + "requires": { + "through": "~2.3.4" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -5894,7 +8126,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -5936,6 +8167,11 @@ "ganache-cli": "^6.0.3" } }, + "rustbn.js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/rustbn.js/-/rustbn.js-0.2.0.tgz", + "integrity": "sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA==" + }, "rxjs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", @@ -5970,6 +8206,44 @@ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true }, + "scrypt": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", + "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", + "optional": true, + "requires": { + "nan": "^2.0.8" + } + }, + "scrypt-js": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", + "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" + }, + "scrypt.js": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/scrypt.js/-/scrypt.js-0.3.0.tgz", + "integrity": "sha512-42LTc1nyFsyv/o0gcHtDztrn+aqpkaCNt5Qh7ATBZfhEZU7IC/0oT/qbBH+uRNoAPvs2fwiOId68FDEoSRA8/A==", + "requires": { + "scrypt": "^6.0.2", + "scryptsy": "^1.2.1" + }, + "dependencies": { + "scryptsy": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-1.2.1.tgz", + "integrity": "sha1-oyJfpLJST4AnAHYeKFW987LZIWM=", + "requires": { + "pbkdf2": "^3.0.3" + } + } + } + }, + "scryptsy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.1.0.tgz", + "integrity": "sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w==" + }, "secp256k1": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.1.tgz", @@ -5983,13 +8257,87 @@ "elliptic": "^6.4.1", "nan": "^2.14.0", "safe-buffer": "^5.1.2" + }, + "dependencies": { + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + } + } + }, + "seek-bzip": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", + "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", + "requires": { + "commander": "~2.8.1" } }, + "semaphore": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.1.0.tgz", + "integrity": "sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA==" + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, + "serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { "version": "2.0.1", @@ -6014,6 +8362,16 @@ } } }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -6023,6 +8381,14 @@ "safe-buffer": "^5.0.1" } }, + "sha3": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.3.tgz", + "integrity": "sha512-sOWDZi8cDBRkLfWOw18wvJyNblXDHzwMGnRWut8zNNeIeLnmMRO17bjpLc7OzMuj1ASUgx2IyohzUCAl+Kx5vA==", + "requires": { + "nan": "2.13.2" + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -6058,8 +8424,22 @@ "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } }, "slash": { "version": "2.0.0", @@ -6076,6 +8456,14 @@ "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } } }, "snapdragon": { @@ -6094,15 +8482,6 @@ "use": "^3.1.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -6120,12 +8499,6 @@ "requires": { "is-extendable": "^0.1.0" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, @@ -6189,6 +8562,12 @@ "kind-of": "^3.2.0" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -6200,6 +8579,40 @@ } } }, + "solc": { + "version": "0.4.26", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.26.tgz", + "integrity": "sha512-o+c6FpkiHd+HPjmjEVpQgH7fqZ14tJpXhho+/bQXlXbliLIS/xjXb42Vxh+qQY1WCSTMQ0+a5vR9vi0MfhU6mA==", + "requires": { + "fs-extra": "^0.30.0", + "memorystream": "^0.3.1", + "require-from-string": "^1.1.0", + "semver": "^5.3.0", + "yargs": "^4.7.1" + }, + "dependencies": { + "fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + } + } + }, "solhint": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/solhint/-/solhint-2.3.0.tgz", @@ -6235,6 +8648,14 @@ } } }, + "solidity-bytes-utils": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/solidity-bytes-utils/-/solidity-bytes-utils-0.0.8.tgz", + "integrity": "sha512-TQi6HFM2PDLLckVXQCzcQGZN8VrQsLA2aRIHNqZkbN/K7pmOSgit/7CnuatiLpM7i8Yy7Vibt5oFBA+sMWEZBA==", + "requires": { + "truffle-hdwallet-provider": "0.0.3" + } + }, "solidity-parser-antlr": { "version": "0.4.11", "resolved": "https://registry.npmjs.org/solidity-parser-antlr/-/solidity-parser-antlr-0.4.11.tgz", @@ -6278,7 +8699,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", - "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -6287,14 +8707,12 @@ "spdx-exceptions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", - "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", - "dev": true + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==" }, "spdx-expression-parse": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -6303,8 +8721,17 @@ "spdx-license-ids": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", - "dev": true + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" + }, + "spinnies": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/spinnies/-/spinnies-0.4.3.tgz", + "integrity": "sha512-TTA2vWXrXJpfThWAl2t2hchBnCMI1JM5Wmb2uyI7Zkefdw/xO98LDy6/SBYwQPiYXL3swx3Eb44ZxgoS8X5wpA==", + "requires": { + "chalk": "^2.4.2", + "cli-cursor": "^3.0.0", + "strip-ansi": "^5.2.0" + } }, "split-string": { "version": "3.1.0", @@ -6358,38 +8785,55 @@ } } }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" }, "dependencies": { "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^2.0.0" } } } }, + "string.prototype.trim": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.0.tgz", + "integrity": "sha512-9EIjYD/WdlvLpn987+ctkLf0FfvBefOCuiEr2henD8X+7jfwPnyvTdmW8OJhj5p+M0/96mBdynLWkxUr+rHlpg==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.13.0", + "function-bind": "^1.1.1" + } + }, "string.prototype.trimleft": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", - "dev": true, "requires": { "define-properties": "^1.1.3", "function-bind": "^1.1.1" @@ -6399,7 +8843,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", - "dev": true, "requires": { "define-properties": "^1.1.3", "function-bind": "^1.1.1" @@ -6409,7 +8852,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" }, @@ -6417,25 +8859,33 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" } } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^4.1.0" } }, "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "requires": { + "is-natural-number": "^4.0.1" + } }, "strip-hex-prefix": { "version": "1.0.0", @@ -6455,11 +8905,75 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } }, + "swarm-js": { + "version": "0.1.39", + "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.39.tgz", + "integrity": "sha512-QLMqL2rzF6n5s50BptyD6Oi0R1aWlJC5Y17SRIVXRj6OR1DRIPM7nepvrxxkjA1zNzFz6mUOMjfeqeDaWB7OOg==", + "requires": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "decompress": "^4.0.0", + "eth-lib": "^0.1.26", + "fs-extra": "^4.0.2", + "got": "^7.1.0", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar": "^4.0.2", + "xhr-request-promise": "^0.1.2" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + }, + "got": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "requires": { + "prepend-http": "^1.0.1" + } + } + } + }, "table": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", @@ -6472,10 +8986,10 @@ "string-width": "^3.0.0" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "string-width": { @@ -6488,29 +9002,97 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } } } }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "tape": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/tape/-/tape-4.11.0.tgz", + "integrity": "sha512-yixvDMX7q7JIs/omJSzSZrqulOV51EC9dK8dM0TzImTIkHWfe2/kFyL5v+d9C+SrCMaICk59ujsqFAVidDqDaA==", + "requires": { + "deep-equal": "~1.0.1", + "defined": "~1.0.0", + "for-each": "~0.3.3", + "function-bind": "~1.1.1", + "glob": "~7.1.4", + "has": "~1.0.3", + "inherits": "~2.0.4", + "minimist": "~1.2.0", + "object-inspect": "~1.6.0", + "resolve": "~1.11.1", + "resumer": "~0.0.0", + "string.prototype.trim": "~1.1.2", + "through": "~2.3.8" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "resolve": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", + "integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", + "requires": { + "path-parse": "^1.0.6" + } + }, + "string.prototype.trim": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", + "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.0", + "function-bind": "^1.0.2" + } + } + } + }, + "tar": { + "version": "4.4.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, "tmp": { "version": "0.0.33", @@ -6521,6 +9103,11 @@ "os-tmpdir": "~1.0.2" } }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -6536,6 +9123,12 @@ "kind-of": "^3.0.2" }, "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -6547,6 +9140,11 @@ } } }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" + }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -6569,6 +9167,11 @@ "repeat-string": "^1.6.1" } }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + }, "token-stream": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz", @@ -6620,6 +9223,40 @@ "tsort": "0.0.1" } }, + "truffle-hdwallet-provider": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/truffle-hdwallet-provider/-/truffle-hdwallet-provider-0.0.3.tgz", + "integrity": "sha1-Dh3gIQS3PTh14c9wkzBbTqii2EM=", + "requires": { + "bip39": "^2.2.0", + "ethereumjs-wallet": "^0.6.0", + "web3": "^0.18.2", + "web3-provider-engine": "^8.4.0" + }, + "dependencies": { + "bignumber.js": { + "version": "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2", + "from": "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2" + }, + "utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" + }, + "web3": { + "version": "0.18.4", + "resolved": "https://registry.npmjs.org/web3/-/web3-0.18.4.tgz", + "integrity": "sha1-gewXhBRUkfLqqJVbMcBgSeB8Xn0=", + "requires": { + "bignumber.js": "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2", + "crypto-js": "^3.1.4", + "utf8": "^2.1.1", + "xhr2": "*", + "xmlhttprequest": "*" + } + } + } + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", @@ -6659,6 +9296,15 @@ "prelude-ls": "~1.1.2" } }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -6668,6 +9314,49 @@ "source-map": "~0.5.1", "uglify-to-browserify": "~1.0.0", "yargs": "~3.10.0" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + } } }, "uglify-to-browserify": { @@ -6683,6 +9372,25 @@ "integrity": "sha1-5hjYAtf//Si3CPzOzHMVYIusR/I=", "dev": true }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "unbzip2-stream": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz", + "integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==", + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -6695,6 +9403,21 @@ "set-value": "^2.0.1" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "unorm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", + "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -6755,17 +9478,44 @@ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "requires": { + "prepend-http": "^2.0.0" + } + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=" + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { "version": "3.3.3", @@ -6782,12 +9532,16 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, "requires": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -6838,25 +9592,750 @@ "semver": "^5.0.1", "shimmer": "^1.0.0", "uuid": "^3.0.1" + } + }, + "web3": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.2.1.tgz", + "integrity": "sha512-nNMzeCK0agb5i/oTWNdQ1aGtwYfXzHottFP2Dz0oGIzavPMGSKyVlr8ibVb1yK5sJBjrWVnTdGaOC2zKDFuFRw==", + "requires": { + "web3-bzz": "1.2.1", + "web3-core": "1.2.1", + "web3-eth": "1.2.1", + "web3-eth-personal": "1.2.1", + "web3-net": "1.2.1", + "web3-shh": "1.2.1", + "web3-utils": "1.2.1" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", "requires": { - "ms": "2.0.0" + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-bzz": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.1.tgz", + "integrity": "sha512-LdOO44TuYbGIPfL4ilkuS89GQovxUpmLz6C1UC7VYVVRILeZS740FVB3j9V4P4FHUk1RenaDfKhcntqgVCHtjw==", + "requires": { + "got": "9.6.0", + "swarm-js": "0.1.39", + "underscore": "1.9.1" + } + }, + "web3-core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.1.tgz", + "integrity": "sha512-5ODwIqgl8oIg/0+Ai4jsLxkKFWJYE0uLuE1yUKHNVCL4zL6n3rFjRMpKPokd6id6nJCNgeA64KdWQ4XfpnjdMg==", + "requires": { + "web3-core-helpers": "1.2.1", + "web3-core-method": "1.2.1", + "web3-core-requestmanager": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-core-helpers": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.1.tgz", + "integrity": "sha512-Gx3sTEajD5r96bJgfuW377PZVFmXIH4TdqDhgGwd2lZQCcMi+DA4TgxJNJGxn0R3aUVzyyE76j4LBrh412mXrw==", + "requires": { + "underscore": "1.9.1", + "web3-eth-iban": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-core-method": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.1.tgz", + "integrity": "sha512-Ghg2WS23qi6Xj8Od3VCzaImLHseEA7/usvnOItluiIc5cKs00WYWsNy2YRStzU9a2+z8lwQywPYp0nTzR/QXdQ==", + "requires": { + "underscore": "1.9.1", + "web3-core-helpers": "1.2.1", + "web3-core-promievent": "1.2.1", + "web3-core-subscriptions": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-core-promievent": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.1.tgz", + "integrity": "sha512-IVUqgpIKoeOYblwpex4Hye6npM0aMR+kU49VP06secPeN0rHMyhGF0ZGveWBrGvf8WDPI7jhqPBFIC6Jf3Q3zw==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "3.1.2" + } + }, + "web3-core-requestmanager": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.1.tgz", + "integrity": "sha512-xfknTC69RfYmLKC+83Jz73IC3/sS2ZLhGtX33D4Q5nQ8yc39ElyAolxr9sJQS8kihOcM6u4J+8gyGMqsLcpIBg==", + "requires": { + "underscore": "1.9.1", + "web3-core-helpers": "1.2.1", + "web3-providers-http": "1.2.1", + "web3-providers-ipc": "1.2.1", + "web3-providers-ws": "1.2.1" + } + }, + "web3-core-subscriptions": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.1.tgz", + "integrity": "sha512-nmOwe3NsB8V8UFsY1r+sW6KjdOS68h8nuh7NzlWxBQT/19QSUGiERRTaZXWu5BYvo1EoZRMxCKyCQpSSXLc08g==", + "requires": { + "eventemitter3": "3.1.2", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.1" + } + }, + "web3-eth": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.1.tgz", + "integrity": "sha512-/2xly4Yry5FW1i+uygPjhfvgUP/MS/Dk+PDqmzp5M88tS86A+j8BzKc23GrlA8sgGs0645cpZK/999LpEF5UdA==", + "requires": { + "underscore": "1.9.1", + "web3-core": "1.2.1", + "web3-core-helpers": "1.2.1", + "web3-core-method": "1.2.1", + "web3-core-subscriptions": "1.2.1", + "web3-eth-abi": "1.2.1", + "web3-eth-accounts": "1.2.1", + "web3-eth-contract": "1.2.1", + "web3-eth-ens": "1.2.1", + "web3-eth-iban": "1.2.1", + "web3-eth-personal": "1.2.1", + "web3-net": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-eth-abi": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.1.tgz", + "integrity": "sha512-jI/KhU2a/DQPZXHjo2GW0myEljzfiKOn+h1qxK1+Y9OQfTcBMxrQJyH5AP89O6l6NZ1QvNdq99ThAxBFoy5L+g==", + "requires": { + "ethers": "4.0.0-beta.3", + "underscore": "1.9.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "@types/node": { + "version": "10.17.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.2.tgz", + "integrity": "sha512-sAh60KDol+MpwOr1RTK0+HgBEYejKsxdpmrOS1Wts5bI03dLzq8F7T0sRXDKeaEK8iWDlGfdzxrzg6vx/c5pNA==" + }, + "elliptic": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", + "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + }, + "dependencies": { + "elliptic": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz", + "integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + } + } + }, + "ethers": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.3.tgz", + "integrity": "sha512-YYPogooSknTwvHg3+Mv71gM/3Wcrx+ZpCzarBj3mqs9njjRkrOo2/eufzhHloOCo3JSoNI4TQJJ6yU5ABm3Uog==", + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.3", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" + }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + }, + "uuid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-eth-accounts": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.1.tgz", + "integrity": "sha512-26I4qq42STQ8IeKUyur3MdQ1NzrzCqPsmzqpux0j6X/XBD7EjZ+Cs0lhGNkSKH5dI3V8CJasnQ5T1mNKeWB7nQ==", + "requires": { + "any-promise": "1.3.0", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.7", + "scryptsy": "2.1.0", + "semver": "6.2.0", + "underscore": "1.9.1", + "uuid": "3.3.2", + "web3-core": "1.2.1", + "web3-core-helpers": "1.2.1", + "web3-core-method": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "semver": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz", + "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-eth-contract": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.1.tgz", + "integrity": "sha512-kYFESbQ3boC9bl2rYVghj7O8UKMiuKaiMkxvRH5cEDHil8V7MGEGZNH0slSdoyeftZVlaWSMqkRP/chfnKND0g==", + "requires": { + "underscore": "1.9.1", + "web3-core": "1.2.1", + "web3-core-helpers": "1.2.1", + "web3-core-method": "1.2.1", + "web3-core-promievent": "1.2.1", + "web3-core-subscriptions": "1.2.1", + "web3-eth-abi": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-eth-ens": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.1.tgz", + "integrity": "sha512-lhP1kFhqZr2nnbu3CGIFFrAnNxk2veXpOXBY48Tub37RtobDyHijHgrj+xTh+mFiPokyrapVjpFsbGa+Xzye4Q==", + "requires": { + "eth-ens-namehash": "2.0.8", + "underscore": "1.9.1", + "web3-core": "1.2.1", + "web3-core-helpers": "1.2.1", + "web3-core-promievent": "1.2.1", + "web3-eth-abi": "1.2.1", + "web3-eth-contract": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-eth-iban": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.1.tgz", + "integrity": "sha512-9gkr4QPl1jCU+wkgmZ8EwODVO3ovVj6d6JKMos52ggdT2YCmlfvFVF6wlGLwi0VvNa/p+0BjJzaqxnnG/JewjQ==", + "requires": { + "bn.js": "4.11.8", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } } } }, + "web3-eth-personal": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.1.tgz", + "integrity": "sha512-RNDVSiaSoY4aIp8+Hc7z+X72H7lMb3fmAChuSBADoEc7DsJrY/d0R5qQDK9g9t2BO8oxgLrLNyBP/9ub2Hc6Bg==", + "requires": { + "web3-core": "1.2.1", + "web3-core-helpers": "1.2.1", + "web3-core-method": "1.2.1", + "web3-net": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-net": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.1.tgz", + "integrity": "sha512-Yt1Bs7WgnLESPe0rri/ZoPWzSy55ovioaP35w1KZydrNtQ5Yq4WcrAdhBzcOW7vAkIwrsLQsvA+hrOCy7mNauw==", + "requires": { + "web3-core": "1.2.1", + "web3-core-method": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "web3-utils": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", + "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + } + } + } + }, + "web3-provider-engine": { + "version": "8.6.1", + "resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-8.6.1.tgz", + "integrity": "sha1-TYbhnjDKr5ffNRUR7A9gE25bMOs=", + "requires": { + "async": "^2.1.2", + "clone": "^2.0.0", + "ethereumjs-block": "^1.2.2", + "ethereumjs-tx": "^1.2.0", + "ethereumjs-util": "^5.0.1", + "ethereumjs-vm": "^2.0.2", + "isomorphic-fetch": "^2.2.0", + "request": "^2.67.0", + "semaphore": "^1.0.3", + "solc": "^0.4.2", + "tape": "^4.4.0", + "web3": "^0.16.0", + "xhr": "^2.2.0", + "xtend": "^4.0.1" + }, + "dependencies": { + "bignumber.js": { + "version": "git+https://github.com/debris/bignumber.js.git#c7a38de919ed75e6fb6ba38051986e294b328df9", + "from": "git+https://github.com/debris/bignumber.js.git#master" + }, + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + }, + "utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" + }, + "web3": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/web3/-/web3-0.16.0.tgz", + "integrity": "sha1-pFVBdc1GKUMDWx8dOUMvdBxrYBk=", + "requires": { + "crypto-js": "^3.1.4", + "utf8": "^2.1.1", + "xmlhttprequest": "*" + }, + "dependencies": { + "bignumber.js": { + "version": "git+https://github.com/debris/bignumber.js.git#c7a38de919ed75e6fb6ba38051986e294b328df9", + "from": "git+https://github.com/debris/bignumber.js.git#c7a38de919ed75e6fb6ba38051986e294b328df9" + } + } + } + } + }, + "web3-providers-http": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.1.tgz", + "integrity": "sha512-BDtVUVolT9b3CAzeGVA/np1hhn7RPUZ6YYGB/sYky+GjeO311Yoq8SRDUSezU92x8yImSC2B+SMReGhd1zL+bQ==", + "requires": { + "web3-core-helpers": "1.2.1", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.1.tgz", + "integrity": "sha512-oPEuOCwxVx8L4CPD0TUdnlOUZwGBSRKScCz/Ws2YHdr9Ium+whm+0NLmOZjkjQp5wovQbyBzNa6zJz1noFRvFA==", + "requires": { + "oboe": "2.1.4", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.1" + } + }, + "web3-providers-ws": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.1.tgz", + "integrity": "sha512-oqsQXzu+ejJACVHy864WwIyw+oB21nw/pI65/sD95Zi98+/HQzFfNcIFneF1NC4bVF3VNX4YHTNq2I2o97LAiA==", + "requires": { + "underscore": "1.9.1", + "web3-core-helpers": "1.2.1" + }, + "dependencies": { + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "websocket": { + "version": "github:web3-js/WebSocket-Node#905deb4812572b344f5801f8c9ce8bb02799d82e", + "from": "github:web3-js/WebSocket-Node#905deb4812572b344f5801f8c9ce8bb02799d82e", + "requires": { + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "nan": "^2.14.0", + "typedarray-to-buffer": "^3.1.5", + "yaeti": "^0.0.6" + } + } + } + }, + "web3-shh": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.1.tgz", + "integrity": "sha512-/3Cl04nza5kuFn25bV3FJWa0s3Vafr5BlT933h26xovQ6HIIz61LmvNQlvX1AhFL+SNJOTcQmK1SM59vcyC8bA==", + "requires": { + "web3-core": "1.2.1", + "web3-core-method": "1.2.1", + "web3-core-subscriptions": "1.2.1", + "web3-net": "1.2.1" + } + }, + "web3-utils": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.0.tgz", + "integrity": "sha512-tI1low8ICoaWU2c53cikH0rsksKuIskI2nycH5E5sEXxxl9/BOD3CeDDBFbxgNPQ+bpDevbR7gXNEDB7Ud4G9g==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + } + } + }, + "whatwg-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + }, "when": { "version": "3.7.8", "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", @@ -6872,11 +10351,15 @@ "isexe": "^2.0.0" } }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=" + }, "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", + "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=" }, "with": { "version": "5.1.1", @@ -6902,11 +10385,34 @@ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { "version": "1.0.3", @@ -6917,11 +10423,88 @@ "mkdirp": "^0.5.1" } }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.2.0.tgz", + "integrity": "sha512-BDtiD0i2iKPK/S8OAZfpk6tyzEDnKKSjxWHcMBVmh+LuqJ8A32qXTyOx+TVOg2dKvq6zGBq2sgKPkEeRs1qTRA==" + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" + }, "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "yamljs": { "version": "0.3.0", @@ -6934,15 +10517,42 @@ } }, "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", + "requires": { + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "lodash.assign": "^4.0.3", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.1", + "which-module": "^1.0.0", + "window-size": "^0.2.0", + "y18n": "^3.2.1", + "yargs-parser": "^2.4.1" + } + }, + "yargs-parser": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", + "requires": { + "camelcase": "^3.0.0", + "lodash.assign": "^4.0.6" + } + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" } } } diff --git a/package.json b/package.json index 43404205..693c7407 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@daostack/arc", + "name": "@daostack/arc-experimental", "version": "0.0.1-rc.31", "description": "A platform for building DAOs", "files": [ @@ -12,7 +12,7 @@ "tsconfig.json" ], "config": { - "gasLimit": "6100000" + "gasLimit": "6500000" }, "scripts": { "test": "cross-conf-env run-with-ganache --ganache-cmd 'npm run ganache' 'npm run truffle compile && npm run truffle migrate && npm run truffle test'", @@ -75,9 +75,11 @@ }, "homepage": "https://daostack.io", "dependencies": { - "@daostack/infra": "0.0.1-rc.15", + "@daostack/infra-experimental": "0.0.1-rc.16", + "@openzeppelin/contracts-ethereum-package": "2.3.0", + "@openzeppelin/upgrades": "2.5.3", "math": "0.0.3", - "openzeppelin-solidity": "2.3.0", + "solidity-bytes-utils": "0.0.8", "truffle-flattener": "^1.4.2" }, "peerDependencies": { diff --git a/test/auction4reputation.js b/test/auction4reputation.js index 1dfa6a51..20e3c185 100644 --- a/test/auction4reputation.js +++ b/test/auction4reputation.js @@ -42,7 +42,7 @@ const setup = async function (accounts, } var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.auction4Reputation.address],[web3.utils.asciiToHex("0")],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.auction4Reputation.address],[permissions],"metaData"); await testSetup.biddingToken.approve(testSetup.auction4Reputation.address,web3.utils.toWei('100', "ether")); return testSetup; }; diff --git a/test/avatar.js b/test/avatar.js index 063ca416..7b205d5b 100644 --- a/test/avatar.js +++ b/test/avatar.js @@ -2,12 +2,13 @@ const helpers = require('./helpers'); const Avatar = artifacts.require("./Avatar.sol"); const ERC20Mock = artifacts.require('./test/ERC20Mock.sol'); const ActionMock = artifacts.require('./test/ActionMock.sol'); -const UniversalSchemeMock = artifacts.require('./test/UniversalSchemeMock.sol'); +const SchemeMock = artifacts.require('./test/SchemeMock.sol'); let avatar; const setup = async function (accounts) { - avatar = await Avatar.new("0x1234", accounts[0], accounts[1]); + avatar = await Avatar.new(); + await avatar.initialize("0x1234", accounts[0], accounts[1],accounts[0]); return avatar; }; @@ -16,7 +17,7 @@ contract('Avatar', accounts => { it("genericCall no owner", async () => { avatar = await setup(accounts); let actionMock = await ActionMock.new(); - var scheme = await UniversalSchemeMock.new(); + var scheme = await SchemeMock.new(); let a = 7; let b = actionMock.address; let c = "0x1234"; @@ -31,7 +32,7 @@ contract('Avatar', accounts => { it("generic call", async () => { avatar = await setup(accounts); let actionMock = await ActionMock.new(); - var scheme = await UniversalSchemeMock.new(); + var scheme = await SchemeMock.new(); await avatar.transferOwnership(scheme.address); let a = 7; let b = actionMock.address; @@ -47,7 +48,7 @@ contract('Avatar', accounts => { it("generic call should not revert if action revert", async () => { avatar = await setup(accounts); let actionMock = await ActionMock.new(); - var scheme = await UniversalSchemeMock.new(); + var scheme = await SchemeMock.new(); await avatar.transferOwnership(scheme.address); let a = 7; let b = actionMock.address; diff --git a/test/constants.js b/test/constants.js index ab71e6ac..3f8b91cb 100644 --- a/test/constants.js +++ b/test/constants.js @@ -1,3 +1,3 @@ -const ARC_GAS_LIMIT = 6100000; +const ARC_GAS_LIMIT = 6500000; module.exports = { ARC_GAS_LIMIT }; diff --git a/test/continuouslockingtoken4reputation.js b/test/continuouslockingtoken4reputation.js index df961ecc..ff7d6e98 100644 --- a/test/continuouslockingtoken4reputation.js +++ b/test/continuouslockingtoken4reputation.js @@ -53,7 +53,7 @@ const setup = async function (accounts, } var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.continuousLocking4Reputation.address],[web3.utils.asciiToHex("0")],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.continuousLocking4Reputation.address],[permissions],"metaData"); await testSetup.lockingToken.approve(testSetup.continuousLocking4Reputation.address,web3.utils.toWei('100', "ether")); return testSetup; }; diff --git a/test/contributionreward.js b/test/contributionreward.js index 09ba8ffc..88c0323e 100644 --- a/test/contributionreward.js +++ b/test/contributionreward.js @@ -1,10 +1,6 @@ import * as helpers from './helpers'; -const constants = require('./constants'); const ContributionReward = artifacts.require("./ContributionReward.sol"); const ERC20Mock = artifacts.require('./test/ERC20Mock.sol'); -const DaoCreator = artifacts.require("./DaoCreator.sol"); -const ControllerCreator = artifacts.require("./ControllerCreator.sol"); -const DAOTracker = artifacts.require("./DAOTracker.sol"); const Avatar = artifacts.require("./Avatar.sol"); const Redeemer = artifacts.require("./Redeemer.sol"); @@ -23,10 +19,10 @@ const checkRedeemedPeriods = async function( EtherPeriod, ExternalTokenPeriod ) { - assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,testSetup.org.avatar.address,0),ReputationPeriod); - assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,testSetup.org.avatar.address,1),nativeTokenPeriod); - assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,testSetup.org.avatar.address,2),EtherPeriod); - assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId, testSetup.org.avatar.address,3),ExternalTokenPeriod); + assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,0),ReputationPeriod); + assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,1),nativeTokenPeriod); + assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,2),EtherPeriod); + assert.equal(await testSetup.contributionReward.getRedeemedPeriods(proposalId,3),ExternalTokenPeriod); }; const checkRedeemedPeriodsLeft = async function( @@ -37,77 +33,105 @@ const checkRedeemedPeriodsLeft = async function( EtherPeriod, ExternalTokenPeriod ) { - assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,testSetup.org.avatar.address,web3.utils.toBN(0)),ReputationPeriod); - assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,testSetup.org.avatar.address,web3.utils.toBN(1)),nativeTokenPeriod); - assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,testSetup.org.avatar.address,web3.utils.toBN(2)),EtherPeriod); - assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId, testSetup.org.avatar.address,web3.utils.toBN(3)),ExternalTokenPeriod); + assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,web3.utils.toBN(0)),ReputationPeriod); + assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,web3.utils.toBN(1)),nativeTokenPeriod); + assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,web3.utils.toBN(2)),EtherPeriod); + assert.equal(await testSetup.contributionReward.getPeriodsToPay(proposalId,web3.utils.toBN(3)),ExternalTokenPeriod); }; - -const setupContributionRewardParams = async function( - contributionReward, +var registration; +const setupContributionReward = async function( accounts, genesisProtocol, token, - avatar + avatarAddress ) { var contributionRewardParams = new ContributionRewardParams(); + if (genesisProtocol === true) { - contributionRewardParams.votingMachine = await helpers.setupGenesisProtocol(accounts,token,avatar,helpers.NULL_ADDRESS); - await contributionReward.setParameters( - contributionRewardParams.votingMachine.params, - contributionRewardParams.votingMachine.genesisProtocol.address); - contributionRewardParams.paramsHash = await contributionReward.getParametersHash( - contributionRewardParams.votingMachine.params, - contributionRewardParams.votingMachine.genesisProtocol.address); + contributionRewardParams.votingMachine = await helpers.setupGenesisProtocol(accounts,token,helpers.NULL_ADDRESS); + contributionRewardParams.initdata = await new web3.eth.Contract(registration.contributionReward.abi) + .methods + .initialize(avatarAddress, + contributionRewardParams.votingMachine.genesisProtocol.address, + contributionRewardParams.votingMachine.params) + .encodeABI(); } else { - contributionRewardParams.votingMachine = await helpers.setupAbsoluteVote(helpers.NULL_ADDRESS,50,contributionReward.address); - await contributionReward.setParameters( - contributionRewardParams.votingMachine.params, - contributionRewardParams.votingMachine.absoluteVote.address); - contributionRewardParams.paramsHash = await contributionReward.getParametersHash( - contributionRewardParams.votingMachine.params, - contributionRewardParams.votingMachine.absoluteVote.address); + contributionRewardParams.votingMachine = await helpers.setupAbsoluteVote(helpers.NULL_ADDRESS,50); + contributionRewardParams.initdata = await new web3.eth.Contract(registration.contributionReward.abi) + .methods + .initialize(avatarAddress, + contributionRewardParams.votingMachine.absoluteVote.address, + contributionRewardParams.votingMachine.params) + .encodeABI(); } return contributionRewardParams; }; const setup = async function (accounts,genesisProtocol = false,tokenAddress=0) { var testSetup = new helpers.TestSetup(); + registration = await helpers.registerImplementation(); testSetup.standardTokenMock = await ERC20Mock.new(accounts[1],100); - testSetup.contributionReward = await ContributionReward.new(); - var controllerCreator = await ControllerCreator.new({gas: constants.ARC_GAS_LIMIT}); - var daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); - testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); + if (genesisProtocol) { testSetup.reputationArray = [1000,100,0]; } else { testSetup.reputationArray = [2000,4000,7000]; } - testSetup.org = await helpers.setupOrganizationWithArrays(testSetup.daoCreator,[accounts[0],accounts[1],accounts[2]],[1000,0,0],testSetup.reputationArray); - testSetup.contributionRewardParams= await setupContributionRewardParams( - testSetup.contributionReward, + testSetup.proxyAdmin = accounts[5]; + testSetup.org = await helpers.setupOrganizationWithArraysDAOFactory(testSetup.proxyAdmin, + accounts, + registration, + [accounts[0], + accounts[1], + accounts[2]], + [1000,0,0], + testSetup.reputationArray); + testSetup.contributionRewardParams= await setupContributionReward( accounts,genesisProtocol, tokenAddress, - testSetup.org.avatar); + testSetup.org.avatar.address); var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, - [testSetup.contributionReward.address], - [testSetup.contributionRewardParams.paramsHash],[permissions],"metaData"); + + var bytesConcate = await registration.daoFactory.bytesConcat(testSetup.contributionRewardParams.initdata,"0x"); + + var tx = await registration.daoFactory.setSchemes( + testSetup.org.avatar.address, + [web3.utils.fromAscii("ContributionReward")], + bytesConcate[0], + [bytesConcate[1]], + [permissions], + "metaData",{from:testSetup.proxyAdmin}); + + testSetup.contributionReward = await ContributionReward.at(tx.logs[0].args._scheme); return testSetup; }; contract('ContributionReward', accounts => { - it("setParameters", async function() { - var contributionReward = await ContributionReward.new(); - var params = await setupContributionRewardParams(contributionReward); - var parameters = await contributionReward.parameters(params.paramsHash); - assert.equal(parameters[1],params.votingMachine.absoluteVote.address); + it("initialize", async function() { + var testSetup = await setup(accounts); + assert.equal(await testSetup.contributionReward.votingMachine(), + testSetup.contributionRewardParams.votingMachine.absoluteVote.address); + assert.equal(await testSetup.contributionReward.avatar(),testSetup.org.avatar.address); + }); + + it("cannot initialize twice", async function() { + var testSetup = await setup(accounts); + + try { + await testSetup.contributionReward.initialize(testSetup.org.avatar.address, + testSetup.contributionRewardParams.votingMachine.absoluteVote.address, + testSetup.contributionRewardParams.votingMachine.params); + assert(false, 'cannot initialize twice'); + } catch (ex) { + helpers.assertVMException(ex); + } + }); it("proposeContributionReward log", async function() { var testSetup = await setup(accounts); var periodLength = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( "description-hash", 10, [1,2,3,periodLength,5], @@ -133,7 +157,7 @@ contract('ContributionReward', accounts => { var testSetup = await setup(accounts); var beneficiary = helpers.NULL_ADDRESS; var periodLength = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), 0, [0,0,0,periodLength,0], @@ -146,7 +170,7 @@ contract('ContributionReward', accounts => { it("execute proposeContributionReward yes ", async function() { var testSetup = await setup(accounts); var periodLength = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), 0, [0,0,0,periodLength,0], @@ -156,7 +180,7 @@ contract('ContributionReward', accounts => { //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - var organizationProposal = await testSetup.contributionReward.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.contributionReward.organizationProposals(proposalId); assert.notEqual(organizationProposal[8],0);//executionTime }); @@ -165,7 +189,7 @@ contract('ContributionReward', accounts => { var reputationReward = 12; var periodLength = 50; var numberOfPeriods = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [0,0,0,periodLength,numberOfPeriods], @@ -176,7 +200,7 @@ contract('ContributionReward', accounts => { var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); await helpers.increaseTime(periodLength+1); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[true,false,false,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[true,false,false,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemReputation"); assert.equal(tx.logs[0].args._amount, reputationReward); @@ -190,7 +214,7 @@ contract('ContributionReward', accounts => { var nativeTokenReward = 12; var periodLength = 50; var numberOfPeriods = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,0,0,periodLength,numberOfPeriods], @@ -201,7 +225,7 @@ contract('ContributionReward', accounts => { var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); await helpers.increaseTime(periodLength+1); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,true,false,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,true,false,false]); var tokens = await testSetup.org.token.balanceOf(accounts[1]); assert.equal(tokens.toNumber(),nativeTokenReward); }); @@ -214,9 +238,11 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:20}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,0,periodLength,numberOfPeriods], @@ -227,7 +253,7 @@ contract('ContributionReward', accounts => { var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); await helpers.increaseTime(periodLength+1); - await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); var eth = await web3.eth.getBalance(otherAvatar.address); assert.equal(eth,ethReward); }); @@ -243,9 +269,11 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS , accounts[0]); + await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:20}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,externalTokenReward,periodLength,numberOfPeriods], @@ -256,7 +284,7 @@ contract('ContributionReward', accounts => { var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); await helpers.increaseTime(periodLength+1); - await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,false,true]); + await testSetup.contributionReward.redeem(proposalId,[false,false,false,true]); var tokens = await testSetup.standardTokenMock.balanceOf(otherAvatar.address); assert.equal(tokens.toNumber(),externalTokenReward); }); @@ -270,9 +298,10 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:20}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,externalTokenReward,periodLength,numberOfPeriods], @@ -281,12 +310,12 @@ contract('ContributionReward', accounts => { ); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); - var organizationProposal = await testSetup.contributionReward.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.contributionReward.organizationProposals(proposalId); assert.equal(organizationProposal[5],otherAvatar.address);//beneficiary await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,0,0,helpers.NULL_ADDRESS,{from:accounts[2]}); await helpers.increaseTime(periodLength+1); try { - await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[true,true,true,true]); + await testSetup.contributionReward.redeem(proposalId,[true,true,true,true]); assert(false, 'redeem should revert because there was no positive voting'); } catch (ex) { helpers.assertVMException(ex); @@ -302,9 +331,10 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 5; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:12}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,0,periodLength,numberOfPeriods], @@ -318,7 +348,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,proposalId,0,0,0,0); await checkRedeemedPeriodsLeft(testSetup,proposalId,1,1,1,1); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemEther"); @@ -329,7 +359,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,proposalId,0,0,1,0); await checkRedeemedPeriodsLeft(testSetup,proposalId,1,1,0,1); //now try again on the same period - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert.equal(tx.logs.length, 0); eth = await web3.eth.getBalance(otherAvatar.address); assert.equal(eth,ethReward); @@ -340,7 +370,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,proposalId,0,0,1,0); await checkRedeemedPeriodsLeft(testSetup,proposalId,2,2,1,2); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemEther"); assert.equal(tx.logs[0].args._amount, ethReward); @@ -353,7 +383,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,proposalId,0,0,2,0); await checkRedeemedPeriodsLeft(testSetup,proposalId,4,4,2,4); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemEther"); assert.equal(tx.logs[0].args._amount, ethReward*2); @@ -365,7 +395,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,proposalId,0,0,4,0); await checkRedeemedPeriodsLeft(testSetup,proposalId,5,5,1,5); try { - await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert(false, 'redeem should revert because no ether left on avatar'); } catch (ex) { helpers.assertVMException(ex); @@ -375,7 +405,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,proposalId,0,0,4,0); await checkRedeemedPeriodsLeft(testSetup,proposalId,5,5,1,5); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemEther"); assert.equal(tx.logs[0].args._amount, ethReward); @@ -388,7 +418,7 @@ contract('ContributionReward', accounts => { //cannot redeem any more.. await helpers.increaseTime(periodLength+1); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[false,false,true,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[false,false,true,false]); assert.equal(tx.logs.length, 0); eth = await web3.eth.getBalance(otherAvatar.address); assert.equal(eth,ethReward*5); @@ -402,7 +432,7 @@ contract('ContributionReward', accounts => { var reputationReward = -12; var periodLength = 50; var numberOfPeriods = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [0,0,0,periodLength,numberOfPeriods], @@ -413,7 +443,7 @@ contract('ContributionReward', accounts => { var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); await helpers.increaseTime(periodLength+1); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[true,false,false,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[true,false,false,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemReputation"); assert.equal(tx.logs[0].args._amount, reputationReward); @@ -427,7 +457,7 @@ contract('ContributionReward', accounts => { var reputationReward = -12; var periodLength = 50; var numberOfPeriods = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [0,0,0,periodLength,numberOfPeriods], @@ -454,7 +484,7 @@ contract('ContributionReward', accounts => { await checkRedeemedPeriods(testSetup,fakePId,0,0,0,0); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), 0, [0,0,0,periodLength,0], @@ -479,9 +509,10 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:20}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,0,periodLength,numberOfPeriods], @@ -533,9 +564,10 @@ contract('ContributionReward', accounts => { var periodLength = 0; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:20}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,0,periodLength,numberOfPeriods], @@ -590,9 +622,10 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value:20}); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,0,periodLength,numberOfPeriods], @@ -628,8 +661,9 @@ contract('ContributionReward', accounts => { var periodLength = 50; var numberOfPeriods = 1; //send some ether to the org avatar - var otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var otherAvatar = await Avatar.new(); + await otherAvatar.initialize('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS,accounts[0]); + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [nativeTokenReward,ethReward,0,periodLength,numberOfPeriods], @@ -657,7 +691,7 @@ contract('ContributionReward', accounts => { var reputationReward = 12; var periodLength = 0; var numberOfPeriods = 1; - var tx = await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + var tx = await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [0,0,0,periodLength,numberOfPeriods], @@ -666,7 +700,7 @@ contract('ContributionReward', accounts => { {from:accounts[2]} ); try { - await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [0,0,0,periodLength,2], @@ -682,14 +716,14 @@ contract('ContributionReward', accounts => { //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.contributionRewardParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[true,false,false,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[true,false,false,false]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RedeemReputation"); assert.equal(tx.logs[0].args._amount, reputationReward); var rep = await testSetup.org.reputation.balanceOf(accounts[1]); assert.equal(rep.toNumber(),testSetup.reputationArray[1]+reputationReward); //try to redeem again. - tx = await testSetup.contributionReward.redeem(proposalId,testSetup.org.avatar.address,[true,false,false,false]); + tx = await testSetup.contributionReward.redeem(proposalId,[true,false,false,false]); assert.equal(tx.logs.length, 0); rep = await testSetup.org.reputation.balanceOf(accounts[1]); assert.equal(rep.toNumber(),testSetup.reputationArray[1]+reputationReward); @@ -704,7 +738,7 @@ contract('ContributionReward', accounts => { var numberOfPeriods = 2; try { - await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [0,0,0,periodLength,numberOfPeriods], @@ -723,7 +757,7 @@ contract('ContributionReward', accounts => { var externalTokenReward = 0; try { - await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [tokenReward,ethReward,externalTokenReward,periodLength,numberOfPeriods], @@ -741,7 +775,7 @@ contract('ContributionReward', accounts => { externalTokenReward = 0; try { - await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [tokenReward,ethReward,externalTokenReward,periodLength,numberOfPeriods], @@ -759,7 +793,7 @@ contract('ContributionReward', accounts => { externalTokenReward = ((new BigNumber(2)).toPower(256).sub(1)).toString(10); try { - await testSetup.contributionReward.proposeContributionReward(testSetup.org.avatar.address, + await testSetup.contributionReward.proposeContributionReward( web3.utils.asciiToHex("description"), reputationReward, [tokenReward,ethReward,externalTokenReward,periodLength,numberOfPeriods], diff --git a/test/controller.js b/test/controller.js index ed7f663d..9c765b50 100644 --- a/test/controller.js +++ b/test/controller.js @@ -15,20 +15,26 @@ var amountToMint = 10; const setup = async function (accounts,permission='0',registerScheme = accounts[0]) { var _controller; - token = await DAOToken.new("TEST","TST",0); + token = await DAOToken.new(); + await token.initialize("TEST","TST",0,accounts[0]); // set up a reputation system reputation = await Reputation.new(); + await reputation.initialize(accounts[0]); - avatar = await Avatar.new('name', token.address, reputation.address); + avatar = await Avatar.new(); + await avatar.initialize('name', token.address, reputation.address,accounts[0]); if (permission !== '0') { - _controller = await Controller.new(avatar.address,{from:accounts[1],gas: constants.ARC_GAS_LIMIT}); - await _controller.registerScheme(registerScheme,"0x0000000000000000000000000000000000000000",permission,avatar.address,{from:accounts[1]}); - await _controller.unregisterSelf(avatar.address,{from:accounts[1]}); + _controller = await Controller.new({from:accounts[1],gas: constants.ARC_GAS_LIMIT}); + await _controller.initialize(avatar.address, accounts[1]); + await _controller.registerScheme(registerScheme,permission,{from:accounts[1]}); + await _controller.unregisterSelf({from:accounts[1]}); } else { - - _controller = await Controller.new(avatar.address,{gas: constants.ARC_GAS_LIMIT}); - + _controller = await Controller.new({gas: constants.ARC_GAS_LIMIT}); + var tx = await _controller.initialize(avatar.address ,accounts[0]); + assert.equal(tx.logs.length, 1); + assert.equal(tx.logs[0].event, "RegisterScheme"); + assert.equal(tx.logs[0].args._scheme, accounts[0]); } controller = _controller; return _controller; @@ -36,38 +42,20 @@ const setup = async function (accounts,permission='0',registerScheme = accounts[ const constraint = async function (method, pre=false, post=false) { var globalConstraints = await GlobalConstraintMock.new(); - let globalConstraintsCountOrig = await controller.globalConstraintsCount(avatar.address); + let globalConstraintsCountOrig = await controller.globalConstraintsCount(); await globalConstraints.setConstraint(web3.utils.asciiToHex(method),pre,post); - await controller.addGlobalConstraint(globalConstraints.address,web3.utils.asciiToHex("0"),avatar.address); - let globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.addGlobalConstraint(globalConstraints.address); + let globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0].toNumber(),globalConstraintsCountOrig[0].toNumber() + (pre ? 0 : 1)); assert.equal(globalConstraintsCount[1].toNumber(),globalConstraintsCountOrig[1].toNumber() + (post ? 0 : 1)); return globalConstraints; }; contract('Controller', accounts => { - - it("getGlobalConstraintParameters", async() => { - controller = await setup(accounts); - // separate cases for pre and post - var globalConstraints = await constraint("gcParams1", true); - await controller.addGlobalConstraint(globalConstraints.address,"0x1235",avatar.address); - var paramsHash = await controller.getGlobalConstraintParameters(globalConstraints.address, avatar.address); - - assert.equal(paramsHash,"0x1235000000000000000000000000000000000000000000000000000000000000"); - globalConstraints = await constraint("gcParams2", false, true); - - await controller.addGlobalConstraint(globalConstraints.address,"0x1236",avatar.address); - - paramsHash = await controller.getGlobalConstraintParameters(globalConstraints.address, avatar.address); - - assert.equal(paramsHash,"0x1236000000000000000000000000000000000000000000000000000000000000"); - }); - it("mint reputation via controller", async () => { controller = await setup(accounts); await reputation.transferOwnership(controller.address); - let tx = await controller.mintReputation(amountToMint,accounts[0],avatar.address); + let tx = await controller.mintReputation(amountToMint,accounts[0]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "MintReputation"); assert.equal(tx.logs[0].args._amount, amountToMint); @@ -79,8 +67,8 @@ contract('Controller', accounts => { it("burn reputation via controller", async () => { controller = await setup(accounts); await reputation.transferOwnership(controller.address); - await controller.mintReputation(amountToMint,accounts[0],avatar.address); - let tx = await controller.burnReputation(amountToMint-1,accounts[0],avatar.address); + await controller.mintReputation(amountToMint,accounts[0]); + let tx = await controller.burnReputation(amountToMint-1,accounts[0]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "BurnReputation"); assert.equal(tx.logs[0].args._amount, amountToMint-1); @@ -92,7 +80,7 @@ contract('Controller', accounts => { it("mint tokens via controller", async () => { controller = await setup(accounts); await token.transferOwnership(controller.address); - let tx = await controller.mintTokens(amountToMint,accounts[0],avatar.address); + let tx = await controller.mintTokens(amountToMint,accounts[0]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "MintTokens"); assert.equal(tx.logs[0].args._amount, amountToMint); @@ -102,7 +90,7 @@ contract('Controller', accounts => { it("register schemes", async () => { controller = await setup(accounts); - let tx = await controller.registerScheme(accounts[1], web3.utils.asciiToHex("0"),"0x00000000",avatar.address); + let tx = await controller.registerScheme(accounts[1], "0x00000000"); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RegisterScheme"); }); @@ -113,51 +101,50 @@ contract('Controller', accounts => { // controller; for(j = 0; j <= 15; j++ ){ //registered scheme has already permission to register(2) - controller = await setup('0x'+uint32.toHex(j|2)); + controller = await setup(accounts,'0x'+uint32.toHex(j|2)); var register; for(i = 0; i <= 15; i++ ){ register = true; try { - await controller.registerScheme(accounts[1],0,'0x'+uint32.toHex(i),avatar.address); + await controller.registerScheme(accounts[1],'0x'+uint32.toHex(i)); } catch (ex) { //registered scheme has already permission to register(2) and is register(1). assert.notEqual(i&(~(j|3),0)); register = false; } if (register){ - await controller.unregisterScheme(accounts[1],avatar.address); + await controller.unregisterScheme(accounts[1]); register= false; } } } }); - it("register schemes - check permissions for updating existing scheme", async () => { - // Check scheme has at least the permissions it is changing, and at least the current permissions. - controller = await setup(accounts,'0x0000000F'); - // scheme with permission 0x0000000F should be able to register scheme with permission 0x00000001 - let tx = await controller.registerScheme(accounts[0],"0x0000000000000000000000000000000000000000","0x00000001",avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "RegisterScheme"); - - controller = await setup(accounts,'0x00000001'); - try { - await controller.registerScheme(accounts[0],"0x0000000000000000000000000000000000000000","0x00000002",avatar.address); - assert(false, 'scheme with permission 0x00000001 should not be able to register scheme with permission 0x00000002'); - } catch (ex) { - helpers.assertVMException(ex); - } - }); + it("register schemes - check permissions for updating existing scheme", async () => { + // Check scheme has at least the permissions it is changing, and at least the current permissions. + controller = await setup(accounts,'0x0000000F'); + // scheme with permission 0x0000000F should be able to register scheme with permission 0x00000001 + let tx = await controller.registerScheme(accounts[0],"0x00000001"); + assert.equal(tx.logs.length, 1); + assert.equal(tx.logs[0].event, "RegisterScheme"); + controller = await setup(accounts,'0x00000001'); + try { + await controller.registerScheme(accounts[0],"0x00000002"); + assert(false, 'scheme with permission 0x00000001 should not be able to register scheme with permission 0x00000002'); + } catch (ex) { + helpers.assertVMException(ex); + } + }); it("unregister schemes", async () => { controller = await setup(accounts); - let tx = await controller.unregisterScheme(accounts[0],avatar.address); + let tx = await controller.unregisterScheme(accounts[0]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "UnregisterScheme"); }); it("unregister none registered scheme", async () => { controller = await setup(accounts); - let tx = await controller.unregisterScheme(accounts[1],avatar.address); + let tx = await controller.unregisterScheme(accounts[1]); assert.equal(tx.logs.length, 0); }); @@ -172,25 +159,25 @@ contract('Controller', accounts => { var unregisteredScheme = accounts[2]; for(i = 0; i <= 15; i++ ){ //registered scheme has already permission to register(2) - tx = await controller.registerScheme(registeredScheme,"0x0000000000000000000000000000000000000000",'0x'+uint32.toHex(i|3),avatar.address); + tx = await controller.registerScheme(registeredScheme,'0x'+uint32.toHex(i|3)); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RegisterScheme"); for(j = 0; j <= 15; j++ ){ - tx = await controller.registerScheme(unregisteredScheme,"0x0000000000000000000000000000000000000000",'0x'+uint32.toHex(j),avatar.address); + tx = await controller.registerScheme(unregisteredScheme,'0x'+uint32.toHex(j)); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RegisterScheme"); //try to unregisterScheme if (j&(~(i|3))) { //unregister should fail try { - await controller.unregisterScheme(unregisteredScheme,avatar.address,{ from: registeredScheme }); + await controller.unregisterScheme(unregisteredScheme,{ from: registeredScheme }); assert(false, "scheme with permission " +uint32.toHex(i|3)+ " should not be able to unregister scheme with permission"+uint32.toHex(j)); } catch (ex) { helpers.assertVMException(ex); } }else{ //unregister should succeed - tx = await controller.unregisterScheme(unregisteredScheme,avatar.address,{ from: registeredScheme }); + tx = await controller.unregisterScheme(unregisteredScheme,{ from: registeredScheme }); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "UnregisterScheme"); } @@ -198,24 +185,13 @@ contract('Controller', accounts => { } }); - it("call with none valid avatar should revert", async () => { - controller = await setup(accounts); - var registeredScheme = accounts[1]; - try { - await controller.registerScheme(registeredScheme,"0x0000000000000000000000000000000000000000",'0x'+uint32.toHex(1|3),"0x0000000000000000000000000000000000000000"); - assert(false, "call with none valid avatar should revert"); - } catch (ex) { - helpers.assertVMException(ex); - } - }); - it("unregister self", async () => { var tx; controller = await setup(accounts,"0x00000000"); - tx = await controller.unregisterSelf(avatar.address,{ from: accounts[1]}); + tx = await controller.unregisterSelf({ from: accounts[1]}); assert.equal(tx.logs.length, 0); // scheme was not registered - tx = await controller.unregisterSelf(avatar.address); + tx = await controller.unregisterSelf(); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "UnregisterScheme"); }); @@ -223,20 +199,20 @@ contract('Controller', accounts => { it("isSchemeRegistered ", async () => { var isSchemeRegistered; controller = await setup(accounts,"0x00000000"); - isSchemeRegistered = await controller.isSchemeRegistered(accounts[1],avatar.address); + isSchemeRegistered = await controller.isSchemeRegistered(accounts[1]); assert.equal(isSchemeRegistered, false); - isSchemeRegistered = await controller.isSchemeRegistered(accounts[0],avatar.address); + isSchemeRegistered = await controller.isSchemeRegistered(accounts[0]); assert.equal(isSchemeRegistered, true); }); it("addGlobalConstraint ", async () => { controller = await setup(accounts); var globalConstraints = await constraint(0); - var tx = await controller.addGlobalConstraint(globalConstraints.address,"0x0000000000000000000000000000000000000000",avatar.address); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address,avatar.address),true); + var tx = await controller.addGlobalConstraint(globalConstraints.address); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address),true); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "AddGlobalConstraint"); - var count = await controller.globalConstraintsCount(avatar.address); + var count = await controller.globalConstraintsCount(); assert.equal(count[0], 1); //pre assert.equal(count[1], 1); //post }); @@ -254,29 +230,29 @@ contract('Controller', accounts => { var globalConstraints4 = await GlobalConstraintMock.new(); await globalConstraints4.setConstraint(web3.utils.asciiToHex("method"),false,false); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address,avatar.address),false); - await controller.addGlobalConstraint(globalConstraints.address,zeroBytes32,avatar.address); - await controller.addGlobalConstraint(globalConstraints1.address,zeroBytes32,avatar.address); - await controller.addGlobalConstraint(globalConstraints2.address,zeroBytes32,avatar.address); - await controller.addGlobalConstraint(globalConstraints3.address,zeroBytes32,avatar.address); - await controller.addGlobalConstraint(globalConstraints4.address,zeroBytes32,avatar.address); - var tx = await controller.removeGlobalConstraint(globalConstraints2.address,avatar.address); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address),false); + await controller.addGlobalConstraint(globalConstraints.address); + await controller.addGlobalConstraint(globalConstraints1.address); + await controller.addGlobalConstraint(globalConstraints2.address); + await controller.addGlobalConstraint(globalConstraints3.address); + await controller.addGlobalConstraint(globalConstraints4.address); + var tx = await controller.removeGlobalConstraint(globalConstraints2.address); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RemoveGlobalConstraint"); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address,avatar.address),true); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints1.address,avatar.address),true); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints2.address,avatar.address),false); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints3.address,avatar.address),true); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints4.address,avatar.address),true); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address),true); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints1.address),true); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints2.address),false); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints3.address),true); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints4.address),true); - let gcCount = await controller.globalConstraintsCount(avatar.address); + let gcCount = await controller.globalConstraintsCount(); assert.equal(gcCount[0],4); assert.equal(gcCount[1],4); - await controller.removeGlobalConstraint(globalConstraints4.address,avatar.address); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints4.address,avatar.address),false); - gcCount = await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints4.address); + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints4.address),false); + gcCount = await controller.globalConstraintsCount(); assert.equal(gcCount[0],3); assert.equal(gcCount[1],3); }); @@ -286,7 +262,7 @@ contract('Controller', accounts => { await reputation.transferOwnership(controller.address); await token.transferOwnership(controller.address); await avatar.transferOwnership(controller.address); - var tx = await controller.upgradeController(accounts[1],avatar.address); + var tx = await controller.upgradeController(accounts[1]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "UpgradeController"); }); @@ -297,7 +273,7 @@ contract('Controller', accounts => { await token.transferOwnership(controller.address); await avatar.transferOwnership(controller.address); try{ - await controller.upgradeController(accounts[1],avatar.address); + await controller.upgradeController(accounts[1]); assert(false,"scheme with permission 0x00000007 is not allowed to upgrade "); } catch (ex) { helpers.assertVMException(ex); @@ -312,7 +288,7 @@ contract('Controller', accounts => { let b = actionMock.address; let c = "0x1234"; const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.test(a,b,c).encodeABI(); - var tx = await controller.genericCall(actionMock.address,encodeABI,avatar.address,0); + var tx = await controller.genericCall(actionMock.address,encodeABI,0); await avatar.getPastEvents('GenericCall', { fromBlock: tx.blockNumber, toBlock: 'latest' @@ -332,7 +308,7 @@ contract('Controller', accounts => { let b = actionMock.address; let c = "0x1234"; const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.test(a,b,c).encodeABI(); - var result = await controller.genericCall.call(actionMock.address,encodeABI,avatar.address,0); + var result = await controller.genericCall.call(actionMock.address,encodeABI,0); assert.equal(result[1], 14); }); @@ -343,7 +319,7 @@ contract('Controller', accounts => { const actionMockContract = await new web3.eth.Contract(actionMock.abi); const encodeABI = actionMockContract.methods.withoutReturnValue(avatar.address).encodeABI(); - var tx = await controller.genericCall(actionMock.address,encodeABI,avatar.address,0); + var tx = await controller.genericCall(actionMock.address,encodeABI,0); await actionMock.getPastEvents('WithoutReturnValue', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -360,7 +336,7 @@ contract('Controller', accounts => { //send some ether to the avatar await web3.eth.sendTransaction({from:accounts[0],to:avatar.address, value: web3.utils.toWei('1', "ether")}); //send some ether from an organization's avatar to the otherAvatar - var tx = await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address,avatar.address); + var tx = await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address); await avatar.getPastEvents('SendEther', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -382,7 +358,7 @@ contract('Controller', accounts => { let balanceAvatar = await standardToken.balanceOf(avatar.address); assert.equal(balanceAvatar, 100); await avatar.transferOwnership(controller.address); - var tx = await controller.externalTokenTransfer(standardToken.address,accounts[1],50,avatar.address); + var tx = await controller.externalTokenTransfer(standardToken.address,accounts[1],50); await avatar.getPastEvents('ExternalTokenTransfer', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -403,7 +379,7 @@ contract('Controller', accounts => { controller = await setup(accounts); var standardToken = await ERC20Mock.new(avatar.address, 100); await avatar.transferOwnership(controller.address); - tx = await controller.externalTokenApproval(standardToken.address,avatar.address,50,avatar.address); + tx = await controller.externalTokenApproval(standardToken.address,avatar.address,50); await avatar.getPastEvents('ExternalTokenApproval', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -412,7 +388,7 @@ contract('Controller', accounts => { .then(function(events){ assert.equal(events[0].event,"ExternalTokenApproval"); }); - tx = await controller.externalTokenTransferFrom(standardToken.address,avatar.address,to,50,avatar.address); + tx = await controller.externalTokenTransferFrom(standardToken.address,avatar.address,to,50); await avatar.getPastEvents('ExternalTokenTransferFrom', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -432,17 +408,17 @@ contract('Controller', accounts => { var globalConstraints = await constraint("mintReputation"); await reputation.transferOwnership(controller.address); try { - await controller.mintReputation(amountToMint,accounts[0],avatar.address); + await controller.mintReputation(amountToMint,accounts[0]); assert(false,"mint reputation should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); assert.equal(globalConstraintsCount[1],0); - let tx = await controller.mintReputation(amountToMint,accounts[0],avatar.address); + let tx = await controller.mintReputation(amountToMint,accounts[0]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "MintReputation"); assert.equal(tx.logs[0].args._amount, amountToMint); @@ -454,17 +430,17 @@ contract('Controller', accounts => { controller = await setup(accounts); var globalConstraints = await constraint("registerScheme"); try { - await controller.registerScheme(accounts[1], helpers.NULL_HASH,"0x00000000",avatar.address); + await controller.registerScheme(accounts[1],"0x00000000"); assert(false,"registerScheme should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); assert.equal(globalConstraintsCount[1],0); - let tx = await controller.registerScheme(accounts[1], helpers.NULL_HASH,"0x00000000",avatar.address); + let tx = await controller.registerScheme(accounts[1],"0x00000000"); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RegisterScheme"); }); @@ -473,17 +449,17 @@ contract('Controller', accounts => { controller = await setup(accounts); var globalConstraints = await constraint("registerScheme"); try { - await controller.unregisterScheme(accounts[0],avatar.address); + await controller.unregisterScheme(accounts[0]); assert(false,"unregisterScheme should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); assert.equal(globalConstraintsCount[1],0); - let tx = await controller.unregisterScheme(accounts[0],avatar.address); + let tx = await controller.unregisterScheme(accounts[0]); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "UnregisterScheme"); }); @@ -497,17 +473,17 @@ contract('Controller', accounts => { let c = "0x1234"; const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.test(a,b,c).encodeABI(); try { - await controller.genericCall.call(actionMock.address,encodeABI,avatar.address,0); + await controller.genericCall.call(actionMock.address,encodeABI,0); assert(false,"genericCall should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); assert.equal(globalConstraintsCount[1],0); - var tx = await controller.genericCall(actionMock.address,encodeABI,avatar.address,0); + var tx = await controller.genericCall(actionMock.address,encodeABI,0); await avatar.getPastEvents('GenericCall', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -526,16 +502,16 @@ contract('Controller', accounts => { web3.eth.sendTransaction({from:accounts[0],to:avatar.address, value: web3.utils.toWei('1', "ether")}); try { - await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address,avatar.address); + await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address); assert(false,"sendEther should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); - var tx = await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address,avatar.address); + var tx = await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address); await avatar.getPastEvents('SendEther', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -559,16 +535,16 @@ contract('Controller', accounts => { await avatar.transferOwnership(controller.address); try { - await controller.externalTokenTransfer(standardToken.address,accounts[1],50,avatar.address); + await controller.externalTokenTransfer(standardToken.address,accounts[1],50); assert(false,"externalTokenTransfer should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); - var tx = await controller.externalTokenTransfer(standardToken.address,accounts[1],50,avatar.address); + var tx = await controller.externalTokenTransfer(standardToken.address,accounts[1],50); await avatar.getPastEvents('ExternalTokenTransfer', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -587,7 +563,7 @@ contract('Controller', accounts => { it("getNativeReputation", async () => { controller = await setup(accounts); - var nativeReputation = await controller.getNativeReputation(avatar.address); + var nativeReputation = await controller.nativeReputation(); assert.equal(nativeReputation,reputation.address); }); @@ -601,17 +577,17 @@ contract('Controller', accounts => { await avatar.transferOwnership(controller.address); try { - await controller.externalTokenApproval(standardToken.address,avatar.address,50,avatar.address); + await controller.externalTokenApproval(standardToken.address,avatar.address,50); assert(false,"externalTokenApproval should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + var globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); - tx = await controller.externalTokenApproval(standardToken.address,avatar.address,50,avatar.address); + tx = await controller.externalTokenApproval(standardToken.address,avatar.address,50); await avatar.getPastEvents('ExternalTokenApproval', { filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 fromBlock: tx.blockNumber, @@ -622,14 +598,14 @@ contract('Controller', accounts => { }); globalConstraints = await constraint("externalTokenTransferFrom"); try { - await controller.externalTokenTransferFrom(standardToken.address,avatar.address,to,50,avatar.address); + await controller.externalTokenTransferFrom(standardToken.address,avatar.address,to,50); assert(false,"externalTokenTransferFrom should fail due to the global constraint "); } catch(ex){ helpers.assertVMException(ex); } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); + await controller.removeGlobalConstraint(globalConstraints.address); + globalConstraintsCount =await controller.globalConstraintsCount(); assert.equal(globalConstraintsCount[0],0); }); diff --git a/test/daocreator.js b/test/daocreator.js index f7defbe3..3bce5fdd 100644 --- a/test/daocreator.js +++ b/test/daocreator.js @@ -5,24 +5,17 @@ const Reputation = artifacts.require("./Reputation.sol"); const DaoCreator = artifacts.require("./DaoCreator.sol"); const Avatar = artifacts.require("./Avatar.sol"); const Controller = artifacts.require("./Controller.sol"); -const UController = artifacts.require("./UController.sol"); const ERC20Mock = artifacts.require('./test/ERC20Mock.sol'); -const UniversalSchemeMock = artifacts.require('./test/UniversalSchemeMock.sol'); +const SchemeMock = artifacts.require('./test/SchemeMock.sol'); const ControllerCreator = artifacts.require("./ControllerCreator.sol"); const DAOTracker = artifacts.require("./DAOTracker.sol"); -const zeroBytes32 = helpers.NULL_HASH; -var avatar,token,reputation,daoCreator,uController,controllerCreator; -const setup = async function (accounts,founderToken,founderReputation,useUController=false,cap=0) { +var avatar,token,reputation,daoCreator,controllerCreator; +const setup = async function (accounts,founderToken,founderReputation,cap=0) { controllerCreator = await ControllerCreator.new({gas: constants.ARC_GAS_LIMIT}); var daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); - var uControllerAddress = helpers.NULL_ADDRESS; - if (useUController){ - uController = await UController.new({gas:constants.ARC_GAS_LIMIT}); - uControllerAddress = uController.address; - } - var tx = await daoCreator.forgeOrg("testOrg","TEST","TST",[accounts[0]],[founderToken],[founderReputation],uControllerAddress,cap,{gas:constants.ARC_GAS_LIMIT}); + var tx = await daoCreator.forgeOrg("testOrg","TEST","TST",[accounts[0]],[founderToken],[founderReputation],cap,{gas:constants.ARC_GAS_LIMIT}); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewOrg"); var avatarAddress = tx.logs[0].args._avatar; @@ -75,20 +68,20 @@ contract('DaoCreator', function(accounts) { assert.equal(controllerReputationAddress,reputationAddress); }); - it("setSchemes to none UniversalScheme", async function() { + it("setSchemes to none SchemeMock", async function() { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); - var tx = await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); + var tx = await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData"); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "InitialSchemesSet"); assert.equal(tx.logs[0].args._avatar, avatar.address); }); - it("setSchemes to UniversalScheme", async function() { + it("setSchemes to SchemeMock", async function() { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); - var universalSchemeMock = await UniversalSchemeMock.new(); - var tx = await daoCreator.setSchemes(avatar.address,[universalSchemeMock.address],[zeroBytes32],["0x8000000F"],"metaData"); + var universalSchemeMock = await SchemeMock.new(); + var tx = await daoCreator.setSchemes(avatar.address,[universalSchemeMock.address],["0x8000000F"],"metaData"); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "InitialSchemesSet"); assert.equal(tx.logs[0].args._avatar, avatar.address); @@ -98,7 +91,7 @@ contract('DaoCreator', function(accounts) { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); try { - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData",{ from: accounts[1]}); + await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData",{ from: accounts[1]}); assert(false,"should fail because accounts[1] does not hold the lock"); } catch(ex){ @@ -110,10 +103,10 @@ contract('DaoCreator', function(accounts) { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); var standardTokenMock = await ERC20Mock.new(avatar.address, 100); - var universalSchemeMock = await UniversalSchemeMock.new(); + var universalSchemeMock = await SchemeMock.new(); var allowance = await standardTokenMock.allowance(avatar.address,universalSchemeMock.address); assert.equal(allowance,0); - await daoCreator.setSchemes(avatar.address,[universalSchemeMock.address],[zeroBytes32],["0x8000000F"],"metaData"); + await daoCreator.setSchemes(avatar.address,[universalSchemeMock.address],["0x8000000F"],"metaData"); allowance = await standardTokenMock.allowance(avatar.address,universalSchemeMock.address); assert.equal(allowance,0); }); @@ -125,7 +118,7 @@ contract('DaoCreator', function(accounts) { var allowance = await standardTokenMock.allowance(avatar.address,accounts[1]); assert.equal(allowance,0); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); + await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData"); allowance = await standardTokenMock.allowance(avatar.address,accounts[1]); assert.equal(allowance,0); }); @@ -134,10 +127,10 @@ contract('DaoCreator', function(accounts) { var amountToMint = 10; var controllerAddress,controller; await setup(accounts,amountToMint,amountToMint); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); + await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData"); controllerAddress = await avatar.owner(); controller = await Controller.at(controllerAddress); - var isSchemeRegistered = await controller.isSchemeRegistered(accounts[1],avatar.address); + var isSchemeRegistered = await controller.isSchemeRegistered(accounts[1]); assert.equal(isSchemeRegistered,true); }); @@ -147,140 +140,21 @@ contract('DaoCreator', function(accounts) { await setup(accounts,amountToMint,amountToMint); controllerAddress = await avatar.owner(); controller = await Controller.at(controllerAddress); - var isSchemeRegistered = await controller.isSchemeRegistered(daoCreator.address,avatar.address); + var isSchemeRegistered = await controller.isSchemeRegistered(daoCreator.address); assert.equal(isSchemeRegistered,true); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); + await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData"); controllerAddress = await avatar.owner(); controller = await Controller.at(controllerAddress); - isSchemeRegistered = await controller.isSchemeRegistered(daoCreator.address,avatar.address); + isSchemeRegistered = await controller.isSchemeRegistered(daoCreator.address); assert.equal(isSchemeRegistered,false); }); it("setSchemes delete lock", async function() { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); + await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData"); try { - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData",{ from: accounts[1]}); - assert(false,"should fail because lock for account[0] suppose to be deleted by the first call"); - } - catch(ex){ - helpers.assertVMException(ex); - } - }); - // test with universal controller - it("forgeOrg with universal controller check avatar", async function() { - await setup(accounts,10,10,true); - assert.equal(await avatar.orgName(),"testOrg"); - }); - - it("forgeOrg with universal controller check reputations and tokens to founders", async function() { - await setup(accounts,10,10,true); - var founderBalance = await token.balanceOf(accounts[0]); - assert.equal(founderBalance,10); - var founderReputation = await reputation.balanceOf(accounts[0]); - assert.equal(founderReputation,10); - }); - - - it("forgeOrg with universal controller check transfer ownership", async function() { - //check the forgeOrg transfer ownership to avatar ,reputation and token - //to the controller contract - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - assert.equal(await avatar.owner(),uController.address); - assert.equal(await token.owner(),uController.address); - assert.equal(await reputation.owner(),uController.address); - }); - - it("setSchemes with universal controller to none UniversalScheme", async function() { - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - var tx = await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "InitialSchemesSet"); - assert.equal(tx.logs[0].args._avatar, avatar.address); - }); - - it("setSchemes with universal controller to UniversalScheme", async function() { - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - var universalSchemeMock = await UniversalSchemeMock.new(); - var tx = await daoCreator.setSchemes(avatar.address,[universalSchemeMock.address],[zeroBytes32],["0x8000000F"],"metaData"); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "InitialSchemesSet"); - assert.equal(tx.logs[0].args._avatar, avatar.address); - }); - - it("setSchemes with universal controller from account that does not hold the lock", async function() { - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - try { - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData",{ from: accounts[1]}); - assert(false,"should fail because accounts[1] does not hold the lock"); - } - catch(ex){ - helpers.assertVMException(ex); - } - }); - - it("setSchemes with universal controller increase approval for scheme and register org in scheme", async function() { - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - var standardTokenMock = await ERC20Mock.new(avatar.address, 100); - var universalSchemeMock = await UniversalSchemeMock.new(); - var allowance = await standardTokenMock.allowance(avatar.address,universalSchemeMock.address); - assert.equal(allowance,0); - await daoCreator.setSchemes(avatar.address,[universalSchemeMock.address],[zeroBytes32],["0x8000000F"],"metaData"); - allowance = await standardTokenMock.allowance(avatar.address,universalSchemeMock.address); - assert.equal(allowance,0); - //check org registered in scheme - }); - - it("setSchemes with universal controller increase approval for scheme without fee", async function() { - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - var standardTokenMock = await ERC20Mock.new(accounts[0], 100); - var allowance = await standardTokenMock.allowance(avatar.address,accounts[1]); - assert.equal(allowance,0); - - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); - allowance = await standardTokenMock.allowance(avatar.address,accounts[1]); - assert.equal(allowance,0); - }); - - it("setSchemes with universal controller check register", async function() { - var amountToMint = 10; - var controllerAddress,controller; - await setup(accounts,amountToMint,amountToMint,true); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); - controllerAddress = await avatar.owner(); - controller = await Controller.at(controllerAddress); - var isSchemeRegistered = await controller.isSchemeRegistered(accounts[1],avatar.address); - assert.equal(isSchemeRegistered,true); - }); - - it("setSchemes with universal controller check unregisterSelf", async function() { - var amountToMint = 10; - var controllerAddress,controller; - await setup(accounts,amountToMint,amountToMint,true); - controllerAddress = await avatar.owner(); - controller = await Controller.at(controllerAddress); - var isSchemeRegistered = await controller.isSchemeRegistered(daoCreator.address,avatar.address); - assert.equal(isSchemeRegistered,true); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); - controllerAddress = await avatar.owner(); - controller = await Controller.at(controllerAddress); - isSchemeRegistered = await controller.isSchemeRegistered(daoCreator.address,avatar.address); - assert.equal(isSchemeRegistered,false); - }); - - it("setSchemes with universal controller delete lock", async function() { - var amountToMint = 10; - await setup(accounts,amountToMint,amountToMint,true); - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); - try { - await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData",{ from: accounts[1]}); + await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData",{ from: accounts[1]}); assert(false,"should fail because lock for account[0] suppose to be deleted by the first call"); } catch(ex){ @@ -293,9 +167,8 @@ contract('DaoCreator', function(accounts) { var controllerCreator = await ControllerCreator.new({gas: constants.ARC_GAS_LIMIT}); var daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); - var uControllerAddress = helpers.NULL_ADDRESS; try { - await daoCreator.forgeOrg("testOrg","TEST","TST",[accounts[0]],[amountToMint],[],uControllerAddress,helpers.NULL_ADDRESS,{gas:constants.ARC_GAS_LIMIT}); + await daoCreator.forgeOrg("testOrg","TEST","TST",[accounts[0]],[amountToMint],[],helpers.NULL_ADDRESS,{gas:constants.ARC_GAS_LIMIT}); assert(false,"should revert because reputation array size is 0"); } catch(ex){ @@ -303,14 +176,14 @@ contract('DaoCreator', function(accounts) { } try { - await daoCreator.forgeOrg("testOrg","TEST","TST",[accounts[0],helpers.NULL_ADDRESS],[amountToMint,amountToMint],[amountToMint,amountToMint],uControllerAddress,0,{gas:constants.ARC_GAS_LIMIT}); + await daoCreator.forgeOrg("testOrg","TEST","TST",[accounts[0],helpers.NULL_ADDRESS],[amountToMint,amountToMint],[amountToMint,amountToMint],0,{gas:constants.ARC_GAS_LIMIT}); assert(false,"should revert because account is 0"); } catch(ex){ helpers.assertVMException(ex); } }); - it("setSchemes to none UniversalScheme and addFounders", async function() { + it("setSchemes to none SchemeMock and addFounders", async function() { var amountToMint = 10; await setup(accounts,amountToMint,amountToMint); var foundersArray = []; @@ -337,7 +210,7 @@ contract('DaoCreator', function(accounts) { assert.equal(rep.toNumber(),numberOfFounders); var founderBalance = await token.balanceOf(accounts[1]); assert.equal(founderBalance.toNumber(),numberOfFounders); - var tx = await daoCreator.setSchemes(avatar.address,[accounts[1]],[zeroBytes32],["0x0000000F"],"metaData"); + var tx = await daoCreator.setSchemes(avatar.address,[accounts[1]],["0x0000000F"],"metaData"); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "InitialSchemesSet"); assert.equal(tx.logs[0].args._avatar, avatar.address); diff --git a/test/daofactory.js b/test/daofactory.js new file mode 100644 index 00000000..5f3aa8bc --- /dev/null +++ b/test/daofactory.js @@ -0,0 +1,282 @@ +const helpers = require('./helpers'); +const constants = require('./constants'); +const DAOToken = artifacts.require("./DAOToken.sol"); +const Reputation = artifacts.require("./Reputation.sol"); +const Avatar = artifacts.require("./Avatar.sol"); +const Controller = artifacts.require("./Controller.sol"); +const SchemeMock = artifacts.require('./test/SchemeMock.sol'); + + +var avatar; +var daoToken; +var reputation; +var nativeTokenData; +var registration; + +const setup = async function (accounts,founderToken,founderReputation,cap=0) { + registration = await helpers.registerImplementation(); + nativeTokenData = await new web3.eth.Contract(registration.daoToken.abi) + .methods + .initialize("TEST","TST",cap,registration.daoFactory.address) + .encodeABI(); + + var tx = await registration.daoFactory.forgeOrg("testOrg",nativeTokenData,[accounts[0]],[founderToken],[founderReputation],{gas:constants.ARC_GAS_LIMIT}); + assert.equal(tx.logs.length, 1); + assert.equal(tx.logs[0].event, "NewOrg"); + var avatarAddress = tx.logs[0].args._avatar; + avatar = await Avatar.at(avatarAddress); + var tokenAddress = await avatar.nativeToken({from:accounts[1]}); + daoToken = await DAOToken.at(tokenAddress); + var reputationAddress = await avatar.nativeReputation({from:accounts[1]}); + reputation = await Reputation.at(reputationAddress); +}; + +contract('DaoFactory', function(accounts) { + + it("forgeOrg check avatar", async function() { + await setup(accounts,10,10); + assert.equal(await avatar.orgName({from:accounts[1]}),"testOrg"); + }); + + it("forgeOrg check reputations and tokens to founders", async function() { + await setup(accounts,10,10); + var founderBalance = await daoToken.balanceOf(accounts[0],{from:accounts[1]}); + assert.equal(founderBalance,10); + var founderReputation = await reputation.balanceOf(accounts[0],{from:accounts[1]}); + assert.equal(founderReputation,10); + }); + + + it("forgeOrg check transfer ownership", async function() { + //check the forgeOrg transfer ownership to avatar ,reputation and token + //to the controller contract + var amountToMint = 10; + await setup(accounts,amountToMint,amountToMint); + var controllerAddress,controller; + controllerAddress = await avatar.owner({from:accounts[1]}); + controller = await Controller.at(controllerAddress); + + var controllerAvatarAddress = await controller.avatar({from:accounts[1]}); + assert.equal(controllerAvatarAddress,avatar.address); + var tokenAddress = await avatar.nativeToken({from:accounts[1]}); + var token = await DAOToken.at(tokenAddress); + controllerAddress = await token.owner({from:accounts[1]}); + controller = await Controller.at(controllerAddress); + var controllerTokenAddress = await controller.nativeToken({from:accounts[1]}); + assert.equal(controllerTokenAddress,tokenAddress); + + var reputationAddress = await avatar.nativeReputation({from:accounts[1]}); + var reputation = await Reputation.at(reputationAddress); + controllerAddress = await reputation.owner({from:accounts[1]}); + controller = await Controller.at(controllerAddress); + var controllerReputationAddress = await controller.nativeReputation({from:accounts[1]}); + assert.equal(controllerReputationAddress,reputationAddress); + }); + + it("setSchemes", async function() { + var amountToMint = 10; + await setup(accounts,amountToMint,amountToMint); + var schemeMockData1 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,1) + .encodeABI(); + var schemeMockData2 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,2) + .encodeABI(); + var bytesConcate = await registration.daoFactory.bytesConcat(schemeMockData1,schemeMockData2); + + var tx = await registration.daoFactory.setSchemes( + avatar.address, + [web3.utils.fromAscii("SchemeMock"),web3.utils.fromAscii("SchemeMock")], + bytesConcate[0], + [bytesConcate[1],bytesConcate[2]], + ["0x0000000F","0x0000000F"], + "metaData"); + assert.equal(tx.logs.length, 3); + assert.equal(tx.logs[2].event, "InitialSchemesSet"); + assert.equal(tx.logs[2].args._avatar, avatar.address); + + assert.equal(tx.logs[0].event, "SchemeInstance"); + var scheme1Instance = new SchemeMock(tx.logs[0].args._scheme); + var scheme2Instance = new SchemeMock(tx.logs[1].args._scheme); + assert.equal(await scheme1Instance.testData({from:accounts[1]}), 1); + assert.equal(await scheme2Instance.testData({from:accounts[1]}), 2); + + }); + + it("setSchemes from account that does not hold the lock", async function() { + var amountToMint = 10; + await setup(accounts,amountToMint,amountToMint); + var schemeMockData1 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,1) + .encodeABI(); + var schemeMockData2 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,2) + .encodeABI(); + var bytesConcate = await registration.daoFactory.bytesConcat(schemeMockData1,schemeMockData2); + + try { + await registration.daoFactory.setSchemes( + avatar.address, + [web3.utils.fromAscii("SchemeMock"),web3.utils.fromAscii("SchemeMock")], + bytesConcate[0], + [bytesConcate[1],bytesConcate[2]], + ["0x0000000F","0x0000000F"], + "metaData",{from:accounts[1]}); + assert(false,"should fail because accounts[1] does not hold the lock"); + } + catch(ex){ + helpers.assertVMException(ex); + } + }); + + it("setSchemes check register", async function() { + var amountToMint = 10; + var controllerAddress,controller; + await setup(accounts,amountToMint,amountToMint); + var schemeMockData1 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,1) + .encodeABI(); + var bytesConcate = await registration.daoFactory.bytesConcat(schemeMockData1,"0x"); + + var tx = await registration.daoFactory.setSchemes( + avatar.address, + [web3.utils.fromAscii("SchemeMock")], + bytesConcate[0], + [bytesConcate[1]], + ["0x0000000F"], + "metaData"); + controllerAddress = await avatar.owner({from:accounts[1]}); + controller = await Controller.at(controllerAddress); + var isSchemeRegistered = await controller.isSchemeRegistered(tx.logs[0].args._scheme,{from:accounts[1]}); + assert.equal(isSchemeRegistered,true); + }); + + it("setSchemes check unregisterSelf", async function() { + var amountToMint = 10; + var controllerAddress,controller; + await setup(accounts,amountToMint,amountToMint); + controllerAddress = await avatar.owner({from:accounts[1]}); + controller = await Controller.at(controllerAddress); + var isSchemeRegistered = await controller.isSchemeRegistered(registration.daoFactory.address,{from:accounts[1]}); + assert.equal(isSchemeRegistered,true); + + var schemeMockData1 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,1) + .encodeABI(); + var bytesConcate = await registration.daoFactory.bytesConcat(schemeMockData1,"0x"); + + await registration.daoFactory.setSchemes( + avatar.address, + [web3.utils.fromAscii("SchemeMock")], + bytesConcate[0], + [bytesConcate[1]], + ["0x0000000F"], + "metaData"); + isSchemeRegistered = await controller.isSchemeRegistered(registration.daoFactory.address,{from:accounts[1]}); + assert.equal(isSchemeRegistered,false); + }); + + it("setSchemes delete lock", async function() { + var amountToMint = 10; + await setup(accounts,amountToMint,amountToMint); + var schemeMockData1 = await new web3.eth.Contract(registration.schemeMock.abi) + .methods + .initialize(avatar.address,1) + .encodeABI(); + var bytesConcate = await registration.daoFactory.bytesConcat(schemeMockData1,"0x"); + + await registration.daoFactory.setSchemes( + avatar.address, + [web3.utils.fromAscii("SchemeMock")], + bytesConcate[0], + [bytesConcate[1]], + ["0x0000000F"], + "metaData"); + try { + await registration.daoFactory.setSchemes( + avatar.address, + [web3.utils.fromAscii("SchemeMock")], + bytesConcate[0], + [bytesConcate[1]], + ["0x0000000F"], + "metaData"); + assert(false,"should fail because lock for account[0] suppose to be deleted by the first call"); + } + catch(ex){ + helpers.assertVMException(ex); + } + }); + + it("forgeOrg with different params length should revert", async function() { + var amountToMint = 10; + await setup(accounts,amountToMint,amountToMint); + + try { + await registration.daoFactory.forgeOrg("testOrg",nativeTokenData,[accounts[0]],[11],[],{gas:constants.ARC_GAS_LIMIT}); + assert(false,"should revert because reputation array size is 0"); + } + catch(ex){ + helpers.assertVMException(ex); + } + + try { + await registration.daoFactory.forgeOrg("testOrg",nativeTokenData,[accounts[0],helpers.NULL_ADDRESS],[amountToMint,amountToMint],[amountToMint,amountToMint],{gas:constants.ARC_GAS_LIMIT}); + assert(false,"should revert because account is 0"); + } + catch(ex){ + helpers.assertVMException(ex); + } + }); + it("setSchemes to SchemeMock and addFounders", async function() { + var amountToMint = 10; + await setup(accounts,amountToMint,amountToMint); + var foundersArray = []; + var founderReputation = []; + var founderToken = []; + var i; + var numberOfFounders = 60; + for (i=0;i { const testTokenName = "DAOstack"; const testTokenSymbol = "STACK"; + beforeEach( async function() { + token = await DAOToken.new(); + await token.initialize(testTokenName,testTokenSymbol,0,accounts[0]); + }); it("should put 0 Coins in the first account", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + let balance = await token.balanceOf.call(accounts[0]); assert.equal(balance.valueOf(), 0); }); it("should be owned by its creator", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + let owner = await token.owner(); assert.equal(owner, accounts[0]); }); @@ -21,7 +25,7 @@ contract('DAOToken', accounts => { await helpers.etherForEveryone(accounts); let owner, totalSupply, userSupply; - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + totalSupply = await token.totalSupply(); owner = await token.owner(); userSupply = await token.balanceOf(owner); @@ -44,7 +48,7 @@ contract('DAOToken', accounts => { it("should allow minting tokens only by owner", async () => { await helpers.etherForEveryone(accounts); - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + let owner = await token.owner(); let totalSupply = await token.totalSupply(); @@ -62,7 +66,7 @@ contract('DAOToken', accounts => { }); it("log the Transfer event on mint", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + const tx = await token.mint(accounts[1], 1000, { from: accounts[0] }); @@ -73,7 +77,7 @@ contract('DAOToken', accounts => { }); it("mint should be reflected in totalSupply", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + await token.mint(accounts[1], 1000, { from: accounts[0] }); let amount = await token.totalSupply(); @@ -87,7 +91,7 @@ contract('DAOToken', accounts => { }); it("mint should be reflected in balances", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + await token.mint(accounts[1], 1000, { from: accounts[0] }); @@ -97,7 +101,7 @@ contract('DAOToken', accounts => { }); it("totalSupply is 0 on init", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + const totalSupply = await token.totalSupply(); @@ -105,7 +109,7 @@ contract('DAOToken', accounts => { }); it("burn", async () => { - const token = await DAOToken.new(testTokenName,testTokenSymbol,0); + await token.mint(accounts[1], 1000, { from: accounts[0] }); @@ -126,8 +130,8 @@ contract('DAOToken', accounts => { it("CappedToken ", async () => { let cap = 100000000; - const token = await DAOToken.new(testTokenName,testTokenSymbol,cap); - + const token = await DAOToken.new(); + await token.initialize(testTokenName,testTokenSymbol,cap,accounts[0]); await token.mint(accounts[1], cap); var amount = await token.balanceOf(accounts[1]); @@ -152,7 +156,6 @@ contract('DAOToken', accounts => { describe('onlyOwner', () => { it('mint by owner', async () => { - const token = await DAOToken.new(testTokenName, testTokenSymbol,0); try { await token.mint(accounts[1], 10, { from: accounts[0] }); } catch (ex) { @@ -161,7 +164,6 @@ contract('DAOToken', accounts => { }); it('mint by not owner', async () => { - const token = await DAOToken.new(testTokenName, testTokenSymbol,0); try { await token.mint(accounts[1], 10, { from: accounts[1] }); diff --git a/test/daotracker.js b/test/daotracker.js index f0490538..56a7a7c9 100644 --- a/test/daotracker.js +++ b/test/daotracker.js @@ -4,26 +4,30 @@ const DAOTracker = artifacts.require("./DAOTracker.sol"); const Reputation = artifacts.require("./Reputation.sol"); const DAOToken = artifacts.require("./DAOToken.sol"); const Avatar = artifacts.require("./Avatar.sol"); -const UController = artifacts.require("./UController.sol"); +const Controller = artifacts.require("./Controller.sol"); const opts = {gas: constants.ARC_GAS_LIMIT}; -const setup = async function () { +const setup = async function (accounts) { var testSetup = new helpers.TestSetup(); testSetup.daoTracker = await DAOTracker.new(opts); - testSetup.daoToken = await DAOToken.new("test", "test", 0, opts); + await testSetup.daoTracker.initialize(accounts[0]); + testSetup.daoToken = await DAOToken.new(opts); + await testSetup.daoToken.initialize("test", "test", 0, accounts[0],opts); testSetup.reputation = await Reputation.new(opts); - testSetup.avatar = await Avatar.new( - "test", testSetup.daoToken.address, testSetup.reputation.address, opts, + await testSetup.reputation.initialize(accounts[0]); + testSetup.avatar = await Avatar.new(opts); + await testSetup.avatar.initialize( + "test", testSetup.daoToken.address, testSetup.reputation.address, accounts[0] ); - testSetup.controller = await UController.new(opts); + testSetup.controller = await Controller.new(opts); return testSetup; }; contract("DAOTracker", accounts => { it("track", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; const daoToken = testSetup.daoToken.address; const reputation = testSetup.reputation.address; @@ -47,7 +51,7 @@ contract("DAOTracker", accounts => { }); it("track onlyAvatarOwner", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; const controller = testSetup.controller.address; @@ -62,7 +66,7 @@ contract("DAOTracker", accounts => { }); it("track null Avatar", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const controller = testSetup.controller.address; try { @@ -76,7 +80,7 @@ contract("DAOTracker", accounts => { }); it("track null Controller", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; try { @@ -90,14 +94,12 @@ contract("DAOTracker", accounts => { }); it("blacklist", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; let blacklisted = await testSetup.daoTracker.blacklisted(avatar); assert.equal(blacklisted, false); - const tx = await testSetup.daoTracker.blacklist(avatar, "TEST", opts); - // Verify Event assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "BlacklistDAO"); @@ -110,7 +112,7 @@ contract("DAOTracker", accounts => { }); it("blacklist onlyOwner", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; try { @@ -122,7 +124,7 @@ contract("DAOTracker", accounts => { }); it("blacklist null Avatar", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); try { await testSetup.daoTracker.blacklist("0x0000000000000000000000000000000000000000", "TEST", opts); @@ -132,8 +134,8 @@ contract("DAOTracker", accounts => { } }); - it("reset", async () => { - const testSetup = await setup(); + it("reset", async () => { + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; const controller = testSetup.controller.address; @@ -163,7 +165,7 @@ contract("DAOTracker", accounts => { }); it("reset onlyOwner", async () => { - const testSetup = await setup(); + const testSetup = await setup(accounts); const avatar = testSetup.avatar.address; try { diff --git a/test/externallocking4reputation.js b/test/externallocking4reputation.js index 4d23382c..a9f76c92 100644 --- a/test/externallocking4reputation.js +++ b/test/externallocking4reputation.js @@ -17,6 +17,7 @@ const setup = async function (accounts,_repAllocation = 100,_claimingStartTime = testSetup.lockingStartTime = block.timestamp + _claimingStartTime; testSetup.redeemEnableTime = block.timestamp + _redeemEnableTime; testSetup.extetnalTokenLockerMock = await ExternalTokenLockerMock.new(); + await testSetup.extetnalTokenLockerMock.initialize(accounts[0]); await testSetup.extetnalTokenLockerMock.lock(100,accounts[0]); await testSetup.extetnalTokenLockerMock.lock(200,accounts[1]); await testSetup.extetnalTokenLockerMock.lock(300,accounts[2]); @@ -35,7 +36,7 @@ const setup = async function (accounts,_repAllocation = 100,_claimingStartTime = } var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.externalLocking4Reputation.address],[helpers.NULL_HASH],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.externalLocking4Reputation.address],[permissions],"metaData"); return testSetup; }; diff --git a/test/fixreputationallocation.js b/test/fixreputationallocation.js index cbf2c8e1..f9fa2431 100644 --- a/test/fixreputationallocation.js +++ b/test/fixreputationallocation.js @@ -18,11 +18,12 @@ const setup = async function (accounts,_repAllocation = 300,_initialize = true,_ testSetup.redeemEnableTime = block.timestamp + _redeemEnableTime; await testSetup.fixedReputationAllocation.initialize(testSetup.org.avatar.address, _repAllocation, - testSetup.redeemEnableTime); + testSetup.redeemEnableTime, + accounts[0]); } var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.fixedReputationAllocation.address],[helpers.NULL_HASH],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.fixedReputationAllocation.address],[permissions],"metaData"); return testSetup; }; @@ -108,15 +109,11 @@ contract('FixedReputationAllocation', accounts => { } }); - it("cannot redeem if not initialize", async () => { + it("cannot addBeneficiaries if not initialize", async () => { let testSetup = await setup(accounts,300,false); - await testSetup.fixedReputationAllocation.addBeneficiaries(accounts); - assert.equal(await testSetup.fixedReputationAllocation.numberOfBeneficiaries(),accounts.length); - assert.equal(await testSetup.fixedReputationAllocation.beneficiaryReward(),0); - await testSetup.fixedReputationAllocation.enable(); try { - await testSetup.fixedReputationAllocation.redeem(accounts[0]); - assert(false, "cannot redeem if not initialize"); + await testSetup.fixedReputationAllocation.addBeneficiaries(accounts); + assert(false, "cannot addBeneficiaries if not initialize"); } catch(error) { helpers.assertVMException(error); } @@ -179,27 +176,11 @@ contract('FixedReputationAllocation', accounts => { try { await testSetup.fixedReputationAllocation.initialize(testSetup.org.avatar.address, 100, - 100); + 100, + accounts[0]); assert(false, "cannot initialize twice"); } catch(error) { helpers.assertVMException(error); } }); - - it("initialize is onlyOwner", async () => { - var fixedReputationAllocation = await FixedReputationAllocation.new(); - try { - await fixedReputationAllocation.initialize(accounts[0], - 100, - 100, - {from:accounts[1]}); - assert(false, "initialize is onlyOwner"); - } catch(error) { - helpers.assertVMException(error); - } - await fixedReputationAllocation.initialize(accounts[0], - 100, - 100, - {from:accounts[0]}); - }); }); diff --git a/test/forwarder.js b/test/forwarder.js index 8ae36e4f..17a1b708 100644 --- a/test/forwarder.js +++ b/test/forwarder.js @@ -5,7 +5,7 @@ const DAOTracker = artifacts.require("./DAOTracker.sol"); const constants = require("./constants"); const ERC20Mock = artifacts.require("./test/ERC20Mock.sol"); var Forwarder = artifacts.require("./Forwarder.sol"); -var ControllerInterface = artifacts.require("./ControllerInterface.sol"); +var Controller = artifacts.require("./Controller.sol"); const setup = async function (accounts, _expirationTime = 300) @@ -17,16 +17,15 @@ const setup = async function (accounts, testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); testSetup.org = await helpers.setupOrganization(testSetup.daoCreator,accounts[0],1000,1000); testSetup.forwarder = await Forwarder.new(); - testSetup.expirationTime = (await web3.eth.getBlock("latest")).timestamp + _expirationTime; await testSetup.forwarder.initialize(testSetup.org.avatar.address, - testSetup.expirationTime); + testSetup.expirationTime, + accounts[0]); var permissions = "0x0000001f"; await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, [accounts[0],testSetup.forwarder.address], - [web3.utils.asciiToHex("0"),web3.utils.asciiToHex("0")], [permissions,permissions],"metaData"); return testSetup; }; @@ -43,7 +42,8 @@ contract('Forwarder', accounts => { let testSetup = await setup(accounts); try { await testSetup.forwarder.initialize(testSetup.org.avatar.address, - testSetup.expirationTime); + testSetup.expirationTime, + accounts[0]); assert(false, "cannot initialize twice"); } catch(error) { helpers.assertVMException(error); @@ -56,16 +56,16 @@ contract('Forwarder', accounts => { // transferOwnership of testSetupA.forwarder to testSetupB avatar await testSetupA.forwarder.transferOwnership(testSetupB.org.avatar.address); //do generic call from testSetupB controller to testSetupA controller to "registerScheme" - let controllerB = await ControllerInterface.at(await testSetupB.org.avatar.owner()); - let controllerA = await ControllerInterface.at(await testSetupA.org.avatar.owner()); + let controllerB = await Controller.at(await testSetupB.org.avatar.owner()); + let controllerA = await Controller.at(await testSetupA.org.avatar.owner()); const encodeABI = await new web3.eth.Contract(controllerA.abi). methods. - registerScheme(accounts[1],helpers.NULL_HASH,"0x0000001f",testSetupA.org.avatar.address). + registerScheme(accounts[1],"0x0000001f"). encodeABI(); - assert.equal(await controllerA.isSchemeRegistered(accounts[1],testSetupA.org.avatar.address),false); - await controllerB.genericCall(testSetupA.forwarder.address,encodeABI,testSetupB.org.avatar.address,0); + assert.equal(await controllerA.isSchemeRegistered(accounts[1]),false); + await controllerB.genericCall(testSetupA.forwarder.address,encodeABI,0); //check that accounts[1] register as scheme at controllerA. - assert.equal(await controllerA.isSchemeRegistered(accounts[1],testSetupA.org.avatar.address),true); + assert.equal(await controllerA.isSchemeRegistered(accounts[1]),true); }); @@ -75,16 +75,16 @@ contract('Forwarder', accounts => { // transferOwnership of testSetupA.forwarder to testSetupB avatar await testSetupA.forwarder.transferOwnership(testSetupB.org.avatar.address); //do generic call from testSetupB controller to testSetupA controller to "registerScheme" - let controllerB = await ControllerInterface.at(await testSetupB.org.avatar.owner()); - let controllerA = await ControllerInterface.at(await testSetupA.org.avatar.owner()); + let controllerB = await Controller.at(await testSetupB.org.avatar.owner()); + let controllerA = await Controller.at(await testSetupA.org.avatar.owner()); const encodeABI = await new web3.eth.Contract(controllerA.abi). methods. - registerScheme(accounts[1],helpers.NULL_HASH,"0x0000001f",testSetupA.org.avatar.address). + registerScheme(accounts[1],"0x0000001f"). encodeABI(); //expiered await helpers.increaseTime(301); - let tx = await controllerB.genericCall(testSetupA.forwarder.address,encodeABI,testSetupB.org.avatar.address,0); + let tx = await controllerB.genericCall(testSetupA.forwarder.address,encodeABI,0); await testSetupB.org.avatar.getPastEvents('GenericCall', { fromBlock: tx.blockNumber, toBlock: 'latest' @@ -101,13 +101,13 @@ contract('Forwarder', accounts => { let testSetupA = await setup(accounts); let testSetupB = await setup(accounts); //do generic call from testSetupB controller to testSetupA controller to "registerScheme" - let controllerB = await ControllerInterface.at(await testSetupB.org.avatar.owner()); - let controllerA = await ControllerInterface.at(await testSetupA.org.avatar.owner()); + let controllerB = await Controller.at(await testSetupB.org.avatar.owner()); + let controllerA = await Controller.at(await testSetupA.org.avatar.owner()); const encodeABI = await new web3.eth.Contract(controllerA.abi). methods. - registerScheme(accounts[1],helpers.NULL_HASH,"0x0000001f",testSetupA.org.avatar.address). + registerScheme(accounts[1],"0x0000001f"). encodeABI(); - let tx = await controllerB.genericCall(testSetupA.forwarder.address,encodeABI,testSetupB.org.avatar.address,0); + let tx = await controllerB.genericCall(testSetupA.forwarder.address,encodeABI,0); await testSetupB.org.avatar.getPastEvents('GenericCall', { fromBlock: tx.blockNumber, toBlock: 'latest' @@ -122,20 +122,20 @@ contract('Forwarder', accounts => { it("unregisterSelf", async () => { let testSetupA = await setup(accounts); let testSetupB = await setup(accounts); - let controllerA = await ControllerInterface.at(await testSetupA.org.avatar.owner()); + let controllerA = await Controller.at(await testSetupA.org.avatar.owner()); // transferOwnership of testSetupA.forwarder to testSetupB avatar await testSetupA.forwarder.transferOwnership(testSetupB.org.avatar.address); - assert.equal(await controllerA.isSchemeRegistered(testSetupA.forwarder.address,testSetupA.org.avatar.address),true); + assert.equal(await controllerA.isSchemeRegistered(testSetupA.forwarder.address),true); try { await testSetupA.forwarder.unregisterSelf(); assert(false, "expirationTime did not passed"); } catch(error) { helpers.assertVMException(error); } - assert.equal(await controllerA.isSchemeRegistered(testSetupA.forwarder.address,testSetupA.org.avatar.address),true); + assert.equal(await controllerA.isSchemeRegistered(testSetupA.forwarder.address),true); await helpers.increaseTime(301); await testSetupA.forwarder.unregisterSelf(); - assert.equal(await controllerA.isSchemeRegistered(testSetupA.forwarder.address,testSetupA.org.avatar.address),false); + assert.equal(await controllerA.isSchemeRegistered(testSetupA.forwarder.address),false); }); }); diff --git a/test/genericscheme.js b/test/genericscheme.js index 28576408..8eb73105 100644 --- a/test/genericscheme.js +++ b/test/genericscheme.js @@ -23,7 +23,7 @@ const setupGenericSchemeParams = async function( ) { var genericSchemeParams = new GenericSchemeParams(); if (genesisProtocol === true){ - genericSchemeParams.votingMachine = await helpers.setupGenesisProtocol(accounts,tokenAddress,0,helpers.NULL_ADDRESS); + genericSchemeParams.votingMachine = await helpers.setupGenesisProtocol(accounts,tokenAddress,helpers.NULL_ADDRESS); await genericScheme.initialize( avatar.address, genericSchemeParams.votingMachine.genesisProtocol.address, @@ -49,7 +49,6 @@ const setup = async function (accounts,contractToCall = 0,reputationAccount=0,ge var daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); testSetup.reputationArray = [20,10,70]; - if (reputationAccount === 0) { testSetup.org = await helpers.setupOrganizationWithArrays(testSetup.daoCreator,[accounts[0],accounts[1],accounts[2]],[1000,1000,1000],testSetup.reputationArray); } else { @@ -61,7 +60,7 @@ const setup = async function (accounts,contractToCall = 0,reputationAccount=0,ge await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, [testSetup.genericScheme.address], - [helpers.NULL_HASH],[permissions],"metaData"); + [permissions],"metaData"); return testSetup; }; @@ -76,9 +75,10 @@ contract('GenericScheme', function(accounts) { }); it("proposeCall log", async function() { - var actionMock =await ActionMock.new(); + var testSetup = await setup(accounts,actionMock.address); + var callData = await createCallToActionMock(testSetup.org.avatar.address,actionMock); var tx = await testSetup.genericScheme.proposeCall( @@ -234,6 +234,7 @@ contract('GenericScheme', function(accounts) { it("Wallet - execute proposeVote -positive decision - check action - with GenesisProtocol", async function() { var wallet =await Wallet.new(); + await wallet.initialize(accounts[0]); await web3.eth.sendTransaction({from:accounts[0],to:wallet.address, value: web3.utils.toWei('1', "ether")}); var standardTokenMock = await ERC20Mock.new(accounts[0],1000); var testSetup = await setup(accounts,wallet.address,0,true,standardTokenMock.address); diff --git a/test/globalconstraintregistrar.js b/test/globalconstraintregistrar.js index 523eddce..59ab1fe9 100644 --- a/test/globalconstraintregistrar.js +++ b/test/globalconstraintregistrar.js @@ -20,21 +20,22 @@ const setupGlobalConstraintRegistrarParams = async function( globalConstraintRegistrar, accounts, genesisProtocol, - token + token, + avatarAddress ) { var globalConstraintRegistrarParams = new GlobalConstraintRegistrarParams(); if (genesisProtocol === true) { - globalConstraintRegistrarParams.votingMachine = await helpers.setupGenesisProtocol(accounts,token,0,helpers.NULL_ADDRESS); - await globalConstraintRegistrar.setParameters(globalConstraintRegistrarParams.votingMachine.params, - globalConstraintRegistrarParams.votingMachine.genesisProtocol.address); - globalConstraintRegistrarParams.paramsHash = await globalConstraintRegistrar.getParametersHash(globalConstraintRegistrarParams.votingMachine.params, - globalConstraintRegistrarParams.votingMachine.genesisProtocol.address); + globalConstraintRegistrarParams.votingMachine = await helpers.setupGenesisProtocol(accounts,token,helpers.NULL_ADDRESS); + await globalConstraintRegistrar.initialize(avatarAddress, + globalConstraintRegistrarParams.votingMachine.genesisProtocol.address, + globalConstraintRegistrarParams.votingMachine.params + ); } else { globalConstraintRegistrarParams.votingMachine = await helpers.setupAbsoluteVote(helpers.NULL_ADDRESS,50,globalConstraintRegistrar.address); - await globalConstraintRegistrar.setParameters(globalConstraintRegistrarParams.votingMachine.params, - globalConstraintRegistrarParams.votingMachine.absoluteVote.address); - globalConstraintRegistrarParams.paramsHash = await globalConstraintRegistrar.getParametersHash(globalConstraintRegistrarParams.votingMachine.params, - globalConstraintRegistrarParams.votingMachine.absoluteVote.address); + await globalConstraintRegistrar.initialize( avatarAddress, + globalConstraintRegistrarParams.votingMachine.absoluteVote.address, + globalConstraintRegistrarParams.votingMachine.params, + ); } return globalConstraintRegistrarParams; }; @@ -48,35 +49,41 @@ const setup = async function (accounts,genesisProtocol = false,tokenAddress=0) { testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); testSetup.reputationArray = [20,10,70]; testSetup.org = await helpers.setupOrganizationWithArrays(testSetup.daoCreator,[accounts[0],accounts[1],accounts[2]],[1000,1000,1000],testSetup.reputationArray); - testSetup.globalConstraintRegistrarParams= await setupGlobalConstraintRegistrarParams(testSetup.globalConstraintRegistrar,accounts,genesisProtocol,tokenAddress); + testSetup.globalConstraintRegistrarParams= await setupGlobalConstraintRegistrarParams(testSetup.globalConstraintRegistrar, + accounts, + genesisProtocol, + tokenAddress, + testSetup.org.avatar.address); var permissions = "0x00000004"; await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, [testSetup.globalConstraintRegistrar.address], - [testSetup.globalConstraintRegistrarParams.paramsHash], [permissions],"metaData"); return testSetup; }; contract('GlobalConstraintRegistrar', accounts => { - it("setParameters", async ()=> { + it("initialize", async ()=> { var globalConstraintRegistrar = await GlobalConstraintRegistrar.new(); - var params = await setupGlobalConstraintRegistrarParams(globalConstraintRegistrar); - var parameters = await globalConstraintRegistrar.parameters(params.paramsHash); - assert.equal(parameters[1],params.votingMachine.absoluteVote.address); + var params = await setupGlobalConstraintRegistrarParams(globalConstraintRegistrar, + accounts, + false, + helpers.SOME_ADDRESS, + helpers.SOME_ADDRESS); + + assert.equal(await globalConstraintRegistrar.votingMachine(),params.votingMachine.absoluteVote.address); }); it("proposeGlobalConstraint voteToRemoveParams", async function() { var testSetup = await setup(accounts); var globalConstraintMock = await GlobalConstraintMock.new(); - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", "0x1235",helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.globalConstraintRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - var voteToRemoveParams = await testSetup.globalConstraintRegistrar.voteToRemoveParams(testSetup.org.avatar.address, globalConstraintMock.address); + var voteToRemoveParams = await testSetup.globalConstraintRegistrar.voteToRemoveParams(globalConstraintMock.address); assert.equal(voteToRemoveParams, "0x1235000000000000000000000000000000000000000000000000000000000000"); }); @@ -84,12 +91,11 @@ contract('GlobalConstraintRegistrar', accounts => { var testSetup = await setup(accounts); var globalConstraintMock = await GlobalConstraintMock.new(); - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", "0x1234",helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); - var organizationProposal = await testSetup.globalConstraintRegistrar.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.globalConstraintRegistrar.organizationProposals(proposalId); assert.equal(organizationProposal[0],globalConstraintMock.address); }); @@ -97,9 +103,8 @@ contract('GlobalConstraintRegistrar', accounts => { var testSetup = await setup(accounts); var globalConstraintMock = await GlobalConstraintMock.new(); - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", "0x1234",helpers.NULL_HASH); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewGlobalConstraintsProposal"); @@ -113,18 +118,17 @@ contract('GlobalConstraintRegistrar', accounts => { - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", testSetup.globalConstraintRegistrarParams.votingMachine.params,helpers.NULL_HASH); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewGlobalConstraintsProposal"); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); - let gcCount = await controller.globalConstraintsCount(testSetup.org.avatar.address); + let gcCount = await controller.globalConstraintsCount(); assert.equal(gcCount[0],0); assert.equal(gcCount[1],0); tx = await testSetup.globalConstraintRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - gcCount = await controller.globalConstraintsCount(testSetup.org.avatar.address); + gcCount = await controller.globalConstraintsCount(); assert.equal(gcCount[0],1); }); @@ -133,13 +137,12 @@ contract('GlobalConstraintRegistrar', accounts => { var globalConstraintMock =await GlobalConstraintMock.new(); await globalConstraintMock.setConstraint(web3.utils.asciiToHex("method"),false,false); - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", testSetup.globalConstraintRegistrarParams.votingMachine.params,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.globalConstraintRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - tx = await testSetup.globalConstraintRegistrar.proposeToRemoveGC(testSetup.org.avatar.address, + tx = await testSetup.globalConstraintRegistrar.proposeToRemoveGC( globalConstraintMock.address,helpers.NULL_HASH); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RemoveGlobalConstraintsProposal"); @@ -150,7 +153,7 @@ contract('GlobalConstraintRegistrar', accounts => { var testSetup = await setup(accounts,false); var globalConstraintMock =await GlobalConstraintMock.new(); try{ - await testSetup.globalConstraintRegistrar.proposeToRemoveGC(testSetup.org.avatar.address, + await testSetup.globalConstraintRegistrar.proposeToRemoveGC( globalConstraintMock.address, helpers.NULL_HASH); assert(false,"proposeGlobalConstraint should fail - due to no registration !"); @@ -165,23 +168,22 @@ contract('GlobalConstraintRegistrar', accounts => { var globalConstraintMock =await GlobalConstraintMock.new(); await globalConstraintMock.setConstraint(web3.utils.asciiToHex("method"),false,false); - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", testSetup.globalConstraintRegistrarParams.votingMachine.params,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.globalConstraintRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraintMock.address,testSetup.org.avatar.address),true); - tx = await testSetup.globalConstraintRegistrar.proposeToRemoveGC(testSetup.org.avatar.address, + assert.equal(await controller.isGlobalConstraintRegistered(globalConstraintMock.address),true); + tx = await testSetup.globalConstraintRegistrar.proposeToRemoveGC( globalConstraintMock.address, helpers.NULL_HASH); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "RemoveGlobalConstraintsProposal"); proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); - let count = await controller.globalConstraintsCount(testSetup.org.avatar.address); + let count = await controller.globalConstraintsCount(); assert.equal(count[0],1); await testSetup.globalConstraintRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - count = await controller.globalConstraintsCount(testSetup.org.avatar.address); + count = await controller.globalConstraintsCount(); assert.equal(count[0],0); }); @@ -191,44 +193,34 @@ contract('GlobalConstraintRegistrar', accounts => { var globalConstraintMock =await GlobalConstraintMock.new(); await globalConstraintMock.setConstraint(web3.utils.asciiToHex("method"),false,false); - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", testSetup.globalConstraintRegistrarParams.votingMachine.params,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.globalConstraintRegistrarParams.votingMachine.absoluteVote.vote(proposalId,0,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - let count = await controller.globalConstraintsCount(testSetup.org.avatar.address); + let count = await controller.globalConstraintsCount(); assert.equal(count[0],0); }); - - - it("proposeToRemoveGC with genesis protocol", async function() { var standardTokenMock = await ERC20Mock.new(accounts[0],1000); var testSetup = await setup(accounts,true,standardTokenMock.address); var globalConstraintMock =await GlobalConstraintMock.new(); //genesisProtocol use burn reputation. await globalConstraintMock.setConstraint(web3.utils.asciiToHex("burnReputation"),true,true); - - var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint(testSetup.org.avatar.address, + var tx = await testSetup.globalConstraintRegistrar.proposeGlobalConstraint( globalConstraintMock.address, - "0x1234", testSetup.globalConstraintRegistrarParams.votingMachine.params, helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.globalConstraintRegistrarParams.votingMachine.genesisProtocol.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - - tx = await testSetup.globalConstraintRegistrar.proposeToRemoveGC(testSetup.org.avatar.address, + tx = await testSetup.globalConstraintRegistrar.proposeToRemoveGC( globalConstraintMock.address, helpers.NULL_HASH); - proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); var rep = await testSetup.org.reputation.balanceOf(accounts[2]); - - await testSetup.globalConstraintRegistrarParams.votingMachine.genesisProtocol.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); + await testSetup.globalConstraintRegistrarParams.votingMachine.genesisProtocol.vote(proposalId,1,0,helpers.NULL_ADDRESS,{gas: constants.ARC_GAS_LIMIT, from:accounts[2]}); await helpers.checkVoteInfo(testSetup.globalConstraintRegistrarParams.votingMachine.genesisProtocol,proposalId,accounts[2],[1,rep.toNumber()]); }); diff --git a/test/helpers.js b/test/helpers.js index 2b968ca1..72cc70a6 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -8,6 +8,14 @@ const Reputation = artifacts.require("./Reputation.sol"); const AbsoluteVote = artifacts.require("./AbsoluteVote.sol"); const constants = require('./constants'); const GenesisProtocol = artifacts.require("./GenesisProtocol.sol"); +const DAOFactory = artifacts.require("./DAOFactory.sol"); +const SchemeMock = artifacts.require('./test/SchemeMock.sol'); +const DAOTracker = artifacts.require("./DAOTracker.sol"); +const App = artifacts.require("./App.sol"); +const Package = artifacts.require("./Package.sol"); +var ImplementationDirectory = artifacts.require("./ImplementationDirectory.sol"); +var Controller = artifacts.require("./Controller.sol"); +const ContributionReward = artifacts.require("./ContributionReward.sol"); export const MAX_UINT_256 = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; export const NULL_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000'; @@ -30,6 +38,11 @@ export class Organization { } } +export class Registration { + constructor() { + } +} + export function getProposalAddress(tx) { // helper function that returns a proposal object from the ProposalCreated event // in the logs of tx @@ -120,6 +133,33 @@ export function assertJump(error) { assert.isAbove(error.message.search('invalid JUMP'), -1, 'Invalid JUMP error must be returned' + error.message); } +export const registerImplementation = async function () { + var registration = new Registration(); + var packageName = "DAOstack"; + var packageInstance = await Package.new(); + var implementationDirectory = await ImplementationDirectory.new(); + await packageInstance.addVersion([0,1,0],implementationDirectory.address,NULL_HASH); + registration.app = await App.new(); + await registration.app.setPackage(packageName,packageInstance.address,[0,1,0]); + registration.daoToken = await DAOToken.new(); + registration.reputation = await Reputation.new(); + registration.avatar = await Avatar.new(); + registration.controller = await Controller.new(); + registration.schemeMock = await SchemeMock.new(); + registration.contributionReward = await ContributionReward.new(); + await implementationDirectory.setImplementation("DAOToken",registration.daoToken.address); + await implementationDirectory.setImplementation("Reputation",registration.reputation.address); + await implementationDirectory.setImplementation("Avatar",registration.avatar.address); + await implementationDirectory.setImplementation("Controller",registration.controller.address); + await implementationDirectory.setImplementation("SchemeMock",registration.schemeMock.address); + await implementationDirectory.setImplementation("ContributionReward",registration.contributionReward.address); + + registration.daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); + registration.daoFactory = await DAOFactory.new({gas:constants.ARC_GAS_LIMIT}); + registration.daoFactory.initialize(registration.app.address,registration.daoTracker.address); + return registration; +}; + export const setupAbsoluteVote = async function (voteOnBehalf=NULL_ADDRESS, precReq=50 ) { var votingMachine = new VotingMachine(); votingMachine.absoluteVote = await AbsoluteVote.new(); @@ -132,7 +172,6 @@ export const setupAbsoluteVote = async function (voteOnBehalf=NULL_ADDRESS, prec export const setupGenesisProtocol = async function ( accounts, token, - avatar, voteOnBehalf = NULL_ADDRESS, _queuedVoteRequiredPercentage=50, _queuedVotePeriodLimit=60, @@ -179,9 +218,33 @@ export const setupGenesisProtocol = async function ( return votingMachine; }; -export const setupOrganizationWithArrays = async function (daoCreator,daoCreatorOwner,founderToken,founderReputation,controller=NULL_ADDRESS,cap=0) { +export const setupOrganizationWithArrays = async function (daoCreator,daoCreatorOwner,founderToken,founderReputation,cap=0) { + var org = new Organization(); + var tx = await daoCreator.forgeOrg("testOrg","TEST","TST",daoCreatorOwner,founderToken,founderReputation,cap,{gas: constants.ARC_GAS_LIMIT}); + assert.equal(tx.logs.length, 1); + assert.equal(tx.logs[0].event, "NewOrg"); + var avatarAddress = tx.logs[0].args._avatar; + org.avatar = await Avatar.at(avatarAddress); + var tokenAddress = await org.avatar.nativeToken(); + org.token = await DAOToken.at(tokenAddress); + var reputationAddress = await org.avatar.nativeReputation(); + org.reputation = await Reputation.at(reputationAddress); + return org; +}; + +export const setupOrganizationWithArraysDAOFactory = async function (proxyAdmin, + accounts, + registration, + daoCreatorOwner, + founderToken, + founderReputation, + cap=0) { var org = new Organization(); - var tx = await daoCreator.forgeOrg("testOrg","TEST","TST",daoCreatorOwner,founderToken,founderReputation,controller,cap,{gas: constants.ARC_GAS_LIMIT}); + var nativeTokenData = await new web3.eth.Contract(registration.daoToken.abi) + .methods + .initialize("TEST","TST",cap,registration.daoFactory.address) + .encodeABI(); + var tx = await registration.daoFactory.forgeOrg("testOrg",nativeTokenData,daoCreatorOwner,founderToken,founderReputation,{from:proxyAdmin,gas:constants.ARC_GAS_LIMIT}); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewOrg"); var avatarAddress = tx.logs[0].args._avatar; @@ -193,9 +256,9 @@ export const setupOrganizationWithArrays = async function (daoCreator,daoCreator return org; }; -export const setupOrganization = async function (daoCreator,daoCreatorOwner,founderToken,founderReputation,controller=NULL_ADDRESS,cap=0) { +export const setupOrganization = async function (daoCreator,daoCreatorOwner,founderToken,founderReputation,cap=0) { var org = new Organization(); - var tx = await daoCreator.forgeOrg("testOrg","TEST","TST",[daoCreatorOwner],[founderToken],[founderReputation],controller,cap,{gas: constants.ARC_GAS_LIMIT}); + var tx = await daoCreator.forgeOrg("testOrg","TEST","TST",[daoCreatorOwner],[founderToken],[founderReputation],cap,{gas: constants.ARC_GAS_LIMIT}); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewOrg"); var avatarAddress = tx.logs[0].args._avatar; diff --git a/test/lockingeth4reputation.js b/test/lockingeth4reputation.js index e6ee930d..486ddef3 100644 --- a/test/lockingeth4reputation.js +++ b/test/lockingeth4reputation.js @@ -36,7 +36,7 @@ const setup = async function (accounts, var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.lockingEth4Reputation.address],[helpers.NULL_HASH],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.lockingEth4Reputation.address],[permissions],"metaData"); return testSetup; }; diff --git a/test/lockingtoken4reputation.js b/test/lockingtoken4reputation.js index 545e457f..d2151429 100644 --- a/test/lockingtoken4reputation.js +++ b/test/lockingtoken4reputation.js @@ -29,6 +29,7 @@ const setup = async function (accounts, testSetup.lockingToken4Reputation = await LockingToken4Reputation.new(); testSetup.priceOracleMock = await PriceOracleMock.new(); + await testSetup.priceOracleMock.initialize(accounts[0]); await testSetup.priceOracleMock.setTokenPrice(testSetup.lockingToken.address,100,4); await testSetup.priceOracleMock.setTokenPrice(testSetup.lockingToken2.address,200,4); @@ -44,7 +45,7 @@ const setup = async function (accounts, } var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.lockingToken4Reputation.address],[helpers.NULL_HASH],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.lockingToken4Reputation.address],[permissions],"metaData"); await testSetup.lockingToken.approve(testSetup.lockingToken4Reputation.address,web3.utils.toWei('100', "ether")); return testSetup; }; diff --git a/test/nectarrepallocation.js b/test/nectarrepallocation.js index 35622cad..ad5cb732 100644 --- a/test/nectarrepallocation.js +++ b/test/nectarrepallocation.js @@ -11,6 +11,7 @@ const setup = async function (accounts, ) { var testSetup = new helpers.TestSetup(); testSetup.nectarToken = await NectarToken.new(); + await testSetup.nectarToken.initialize(accounts[0]); await testSetup.nectarToken.mint(accounts[0],100); await testSetup.nectarToken.mint(accounts[1],200); testSetup.blockReference = await web3.eth.getBlockNumber(); diff --git a/test/organizationregister.js b/test/organizationregister.js deleted file mode 100644 index 2a1a980b..00000000 --- a/test/organizationregister.js +++ /dev/null @@ -1,106 +0,0 @@ -import * as helpers from './helpers'; -const constants = require('./constants'); -const OrganizationRegister = artifacts.require('./OrganizationRegister.sol'); -const ERC20Mock = artifacts.require('./test/ERC20Mock.sol'); -const DaoCreator = artifacts.require("./DaoCreator.sol"); -const ControllerCreator = artifacts.require("./ControllerCreator.sol"); -const DAOTracker = artifacts.require("./DAOTracker.sol"); - -export class OrganizationRegisterParams { - constructor() { - } -} - -const setupOrganizationRegisterParams = async function( - organizationRegister, - tokenAddress, - beneficiary, - - ) { - var organizationRegisterParams = new OrganizationRegisterParams(); - organizationRegisterParams.votingMachine = await helpers.setupAbsoluteVote(); - await organizationRegister.setParameters(tokenAddress,13,beneficiary); - organizationRegisterParams.paramsHash = await organizationRegister.getParametersHash(tokenAddress,13,beneficiary); - return organizationRegisterParams; -}; - -const setup = async function (accounts) { - var testSetup = new helpers.TestSetup(); - testSetup.fee = 10; - testSetup.standardTokenMock = await ERC20Mock.new(accounts[1],100); - testSetup.organizationRegister = await OrganizationRegister.new(); - var controllerCreator = await ControllerCreator.new({gas: constants.ARC_GAS_LIMIT}); - var daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); - testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); - testSetup.org = await helpers.setupOrganization(testSetup.daoCreator,accounts[0],1000,1000); - testSetup.organizationRegisterParams= await setupOrganizationRegisterParams(testSetup.organizationRegister,testSetup.standardTokenMock.address,accounts[2]); - var permissions = "0x00000000"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.organizationRegister.address],[testSetup.organizationRegisterParams.paramsHash],[permissions],"metaData"); - - return testSetup; -}; - -contract('OrganizationRegister',accounts => { - before(function() { - helpers.etherForEveryone(accounts); - }); - - it("setParameters", async() => { - var organizationRegister = await OrganizationRegister.new(); - await organizationRegister.setParameters(accounts[3],13,accounts[2]); - var paramHash = await organizationRegister.getParametersHash(accounts[3],13,accounts[2]); - var parameters = await organizationRegister.parameters(paramHash); - assert.equal(parameters[1],accounts[3]); - assert.equal(parameters[0],13); - assert.equal(parameters[2],accounts[2]); - }); - - - it("addOrPromoteAddress add and promote ", async function() { - var testSetup = await setup(accounts); - var record = accounts[4]; - var amount = 13; - - - await testSetup.standardTokenMock.approve(testSetup.organizationRegister.address,100,{from:accounts[1]}); - - var tx = await testSetup.organizationRegister.addOrPromoteAddress(testSetup.org.avatar.address, - record, - amount,{from:accounts[1]}); - assert.equal(tx.logs.length, 2); - assert.equal(tx.logs[0].event, "OrgAdded"); - assert.equal(tx.logs[1].event, "Promotion"); - var registery = await helpers.getValueFromLogs(tx, '_registry'); - var org = await helpers.getValueFromLogs(tx, '_org'); - var registeryAmount = await testSetup.organizationRegister.organizationsRegistry(registery,org); - assert.equal(amount,registeryAmount); - //now try to promote. - tx = await testSetup.organizationRegister.addOrPromoteAddress(testSetup.org.avatar.address, - record, - 1,{from:accounts[1]}); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "Promotion"); - registery = await helpers.getValueFromLogs(tx, '_registry'); - org = await helpers.getValueFromLogs(tx, '_org'); - registeryAmount = await testSetup.organizationRegister.organizationsRegistry(registery,org); - assert.equal(amount+1,registeryAmount); - }); - - it("addOrPromoteAddress add without enough fee should fail ", async function() { - var testSetup = await setup(accounts); - var record = accounts[4]; - var amount = 12; - - - await testSetup.standardTokenMock.approve(testSetup.organizationRegister.address,100,{from:accounts[1]}); - - try{ - await testSetup.organizationRegister.addOrPromoteAddress(testSetup.org.avatar.address, - record, - amount,{from:accounts[1]}); - assert(false,"addOrPromoteAddress should fail - due to amount { - it("setParameters", async() => { + it("initialize", async() => { var schemeRegistrar = await SchemeRegistrar.new(); - var params = await setupSchemeRegistrarParams(schemeRegistrar); - var parameters = await schemeRegistrar.parameters(params.paramsHash); - assert.equal(parameters[2],params.votingMachine.absoluteVote.address); + var params = await setupSchemeRegistrarParams(schemeRegistrar,helpers.SOME_ADDRESS); + assert.equal(await schemeRegistrar.votingMachine(),params.votingMachine.absoluteVote.address); }); it("proposeScheme log", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address, + var tx = await testSetup.schemeRegistrar.proposeScheme( testSetup.schemeRegistrar.address, - helpers.NULL_HASH, "0x00000000", helpers.NULL_HASH); assert.equal(tx.logs.length, 1); @@ -64,7 +62,7 @@ contract('SchemeRegistrar', accounts => { it("proposeToRemoveScheme log", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.schemeRegistrar.proposeToRemoveScheme(testSetup.org.avatar.address, + var tx = await testSetup.schemeRegistrar.proposeToRemoveScheme( testSetup.schemeRegistrar.address, helpers.NULL_HASH); assert.equal(tx.logs.length, 1); @@ -74,90 +72,90 @@ contract('SchemeRegistrar', accounts => { it("execute proposeScheme and execute -yes - fee > 0 ", async function() { var testSetup = await setup(accounts); - var universalScheme = await UniversalScheme.new(); - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,universalScheme.address,helpers.NULL_HASH,"0x00000000",helpers.NULL_HASH); + var universalScheme = await SchemeMock.new(); + var tx = await testSetup.schemeRegistrar.proposeScheme(universalScheme.address,"0x00000000",helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(universalScheme.address,testSetup.org.avatar.address),true); + assert.equal(await controller.isSchemeRegistered(universalScheme.address),true); }); it("execute proposeScheme and execute -yes - permissions== 0x00000001", async function() { var testSetup = await setup(accounts); var permissions = "0x00000001"; - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,permissions,helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],permissions,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.getSchemePermissions(accounts[0],testSetup.org.avatar.address),"0x00000001"); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.schemesPermissions(accounts[0]),"0x00000001"); }); it("execute proposeScheme and execute -yes - permissions== 0x00000002", async function() { var testSetup = await setup(accounts); var permissions = "0x00000002"; - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,permissions,helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],permissions,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.getSchemePermissions(accounts[0],testSetup.org.avatar.address),"0x00000003"); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.schemesPermissions(accounts[0]),"0x00000003"); }); it("execute proposeScheme and execute -yes - permissions== 0x00000003", async function() { var testSetup = await setup(accounts); var permissions = "0x00000003"; - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,permissions,helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],permissions,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.getSchemePermissions(accounts[0],testSetup.org.avatar.address),"0x00000003"); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.schemesPermissions(accounts[0]),"0x00000003"); }); it("execute proposeScheme and execute -yes - permissions== 0x00000008", async function() { var testSetup = await setup(accounts); var permissions = "0x00000008"; - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,permissions,helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],permissions,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.getSchemePermissions(accounts[0],testSetup.org.avatar.address),"0x00000009"); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.schemesPermissions(accounts[0]),"0x00000009"); }); it("execute proposeScheme and execute -yes - permissions== 0x00000010", async function() { var testSetup = await setup(accounts); var permissions = "0x00000010"; - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,permissions,helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],permissions,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.getSchemePermissions(accounts[0],testSetup.org.avatar.address),"0x00000011"); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.schemesPermissions(accounts[0]),"0x00000011"); }); it("execute proposeScheme and execute -yes - isRegistering==FALSE ", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,"0x00000000",helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],"0x00000000",helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.getSchemePermissions(accounts[0],testSetup.org.avatar.address),"0x00000001"); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.schemesPermissions(accounts[0]),"0x00000001"); }); @@ -165,41 +163,41 @@ contract('SchemeRegistrar', accounts => { it("execute proposeScheme - no decision (same for remove scheme) - proposal data delete", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,accounts[0],helpers.NULL_HASH,"0x00000000",helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeScheme(accounts[0],"0x00000000",helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); //check organizationsProposals before execution - var organizationProposal = await testSetup.schemeRegistrar.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.schemeRegistrar.organizationProposals(proposalId); assert.equal(organizationProposal[1],true);//proposalType //Vote with reputation to trigger execution await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,2,0,helpers.NULL_ADDRESS,{from:accounts[2]}); var controller = await Controller.at(await testSetup.org.avatar.owner()); //should not register because the decision is "no" - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),false); + assert.equal(await controller.isSchemeRegistered(accounts[0]),false); //check organizationsProposals after execution - organizationProposal = await testSetup.schemeRegistrar.organizationsProposals(testSetup.org.avatar.address,proposalId); + organizationProposal = await testSetup.schemeRegistrar.organizationProposals(proposalId); assert.equal(organizationProposal[2],0);//proposalType }); it("execute proposeToRemoveScheme ", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.schemeRegistrar.proposeToRemoveScheme(testSetup.org.avatar.address,testSetup.schemeRegistrar.address,helpers.NULL_HASH); + var tx = await testSetup.schemeRegistrar.proposeToRemoveScheme(testSetup.schemeRegistrar.address,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(testSetup.schemeRegistrar.address,testSetup.org.avatar.address),true); + assert.equal(await controller.isSchemeRegistered(testSetup.schemeRegistrar.address),true); //Vote with reputation to trigger execution await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - assert.equal(await controller.isSchemeRegistered(testSetup.schemeRegistrar.address,testSetup.org.avatar.address),false); + assert.equal(await controller.isSchemeRegistered(testSetup.schemeRegistrar.address),false); //check organizationsProposals after execution - var organizationProposal = await testSetup.schemeRegistrar.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.schemeRegistrar.organizationProposals(proposalId); assert.equal(organizationProposal[2],0);//proposalType }); it("execute proposeScheme and execute -yes - autoRegisterOrganization==TRUE arc scheme", async function() { var testSetup = await setup(accounts); - var universalScheme = await UniversalScheme.new(); - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,universalScheme.address,helpers.NULL_HASH,"0x00000000",helpers.NULL_HASH); + var universalScheme = await SchemeMock.new(); + var tx = await testSetup.schemeRegistrar.proposeScheme(universalScheme.address,"0x00000000",helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); @@ -208,8 +206,8 @@ contract('SchemeRegistrar', accounts => { it("execute proposeScheme and execute -yes - autoRegisterOrganization==FALSE arc scheme", async function() { var testSetup = await setup(accounts); - var universalScheme = await UniversalScheme.new(); - var tx = await testSetup.schemeRegistrar.proposeScheme(testSetup.org.avatar.address,universalScheme.address,helpers.NULL_HASH,"0x00000000",helpers.NULL_HASH); + var universalScheme = await SchemeMock.new(); + var tx = await testSetup.schemeRegistrar.proposeScheme(universalScheme.address,"0x00000000",helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); await testSetup.schemeRegistrarParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); diff --git a/test/signalscheme.js b/test/signalscheme.js index 237e6405..f0e572a5 100644 --- a/test/signalscheme.js +++ b/test/signalscheme.js @@ -54,7 +54,7 @@ const setup = async function (accounts,genesisProtocol = false) { var permissions = "0x00000000"; await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, [testSetup.signalScheme.address], - [helpers.NULL_HASH],[permissions],"metaData"); + [permissions],"metaData"); return testSetup; }; contract('SignalScheme', accounts => { diff --git a/test/tokencapgc.js b/test/tokencapgc.js index db248bd7..544354a2 100644 --- a/test/tokencapgc.js +++ b/test/tokencapgc.js @@ -7,82 +7,65 @@ const Avatar = artifacts.require("./Avatar.sol"); var constants = require('../test/constants'); -let reputation, avatar,token,controller; -const setup = async function (permission='0') { +let reputation, avatar,token,controller,tokenCapGC; + +const setup = async function (accounts,permission='0') { var _controller; - token = await DAOToken.new("TEST","TST",0); + tokenCapGC = await TokenCapGC.new(); + token = await DAOToken.new(); + await token.initialize("TEST","TST",0,accounts[0]); + await tokenCapGC.initialize(token.address,100); // set up a reputation system reputation = await Reputation.new(); - avatar = await Avatar.new('name', token.address, reputation.address); + await reputation.initialize(accounts[0]); + avatar = await Avatar.new(); + await avatar.initialize('name', token.address, reputation.address, accounts[0]); if (permission !== '0'){ - _controller = await Controller.new(avatar.address,{from:accounts[1],gas: constants.ARC_GAS_LIMIT}); - await _controller.registerScheme(accounts[0],0,permission,0,{from:accounts[1]}); - await _controller.unregisterSelf(0,{from:accounts[1]}); + _controller = await Controller.new({from:accounts[1],gas: constants.ARC_GAS_LIMIT}); + await _controller.initialize(avatar.address,accounts[0],{from:accounts[1],gas: constants.ARC_GAS_LIMIT}); + await _controller.registerScheme(accounts[0],permission,{from:accounts[1]}); + await _controller.unregisterSelf({from:accounts[1]}); } else { - _controller = await Controller.new(avatar.address,{gas: constants.ARC_GAS_LIMIT}); + _controller = await Controller.new({gas: constants.ARC_GAS_LIMIT}); + await _controller.initialize(avatar.address,accounts[0],{gas: constants.ARC_GAS_LIMIT}); } controller = _controller; return _controller; }; contract('TokenCapGC', accounts => { - it("setParameters", async () => { - var paramsHash; - var tokenCapGC = await TokenCapGC.new(); - var token = await DAOToken.new("TEST","TST",0); - await tokenCapGC.setParameters(token.address,100); - paramsHash = await tokenCapGC.getParametersHash(token.address,100); - var param = await tokenCapGC.parameters(paramsHash); + + it("initialize", async () => { + await setup(accounts); + var param = await tokenCapGC.parameters(); assert.equal(param[1].toNumber(),100); }); it("pre and post", async () => { - var paramsHash,post,pre; - var tokenCapGC = await TokenCapGC.new(); - var token = await DAOToken.new("TEST","TST",0); - await tokenCapGC.setParameters(token.address,100); - paramsHash = await tokenCapGC.getParametersHash(token.address,100); - pre = await tokenCapGC.pre(token.address,paramsHash,helpers.NULL_HASH); + var post,pre; + await setup(accounts); + pre = await tokenCapGC.pre(token.address,helpers.NULL_HASH); assert.equal(pre,true); - post = await tokenCapGC.post(token.address,paramsHash,helpers.NULL_HASH); + post = await tokenCapGC.post(token.address,helpers.NULL_HASH); //token total supply is 0 assert.equal(post,true); //increase the total supply await token.mint(accounts[2], 101); - post = await tokenCapGC.post(token.address,paramsHash,helpers.NULL_HASH); + post = await tokenCapGC.post(token.address,helpers.NULL_HASH); //token total supply is 101 assert.equal(post,false); }); - it("post with wrong paramHash", async () => { - var post; - var tokenCapGC = await TokenCapGC.new(); - var token = await DAOToken.new("TEST","TST",0); - await tokenCapGC.setParameters(token.address,100); - await tokenCapGC.getParametersHash(token.address,100); - post = await tokenCapGC.post(token.address,"0x0001",helpers.NULL_HASH); - //token total supply is 0 - assert.equal(post,true); - //increase the total supply - await token.mint(accounts[2], 101); - post = await tokenCapGC.post(token.address,"0x0001",helpers.NULL_HASH); - //token total supply is 101 - assert.equal(post,true); - }); - it("mintTokens check", async () => { - controller = await setup(); - var tokenCapGC = await TokenCapGC.new(); - await tokenCapGC.setParameters(token.address,100); - var tokenCapGCParamsHash = await tokenCapGC.getParametersHash(token.address,100); - await controller.addGlobalConstraint(tokenCapGC.address,tokenCapGCParamsHash,avatar.address); - //var globalConstraints = await constraint("mintTokens"); + controller = await setup(accounts); + + await controller.addGlobalConstraint(tokenCapGC.address); await token.transferOwnership(controller.address); - await controller.mintTokens(50,accounts[0],avatar.address); + await controller.mintTokens(50,accounts[0]); try { - await controller.mintTokens(51,accounts[0],avatar.address); + await controller.mintTokens(51,accounts[0]); assert(false,"mint tokens should fail due to the tokenCapGC global constraint "); } catch(ex){ diff --git a/test/ucontroller.js b/test/ucontroller.js deleted file mode 100644 index 6acc33e6..00000000 --- a/test/ucontroller.js +++ /dev/null @@ -1,700 +0,0 @@ -const helpers = require('./helpers'); -const UController = artifacts.require("./UController.sol"); -const Reputation = artifacts.require("./Reputation.sol"); -const Avatar = artifacts.require("./Avatar.sol"); -const DAOToken = artifacts.require("./DAOToken.sol"); -const ERC20Mock = artifacts.require('./ERC20Mock.sol'); -const GlobalConstraintMock = artifacts.require('./test/GlobalConstraintMock.sol'); -const ActionMock = artifacts.require('./test/ActionMock.sol'); -const UniversalSchemeMock = artifacts.require('./test/UniversalSchemeMock.sol'); -var constants = require('./constants'); -var uint32 = require('uint32'); - - -let reputation, avatar,token,controller; -var amountToMint = 10; - -const setup = async function (accounts,permission='0x00000000',registerScheme = accounts[0]) { - var uController = await UController.new({gas: constants.ARC_GAS_LIMIT}); - token = await DAOToken.new("TEST","TST",0); - // set up a reputation system - reputation = await Reputation.new(); - await token.transferOwnership(uController.address); - await reputation.transferOwnership(uController.address); - avatar = await Avatar.new('name', token.address, reputation.address); - await avatar.transferOwnership(uController.address); - if (permission !== '0x00000000'){ - await uController.newOrganization(avatar.address,{from:accounts[1]}); - await uController.registerScheme(registerScheme,helpers.NULL_HASH,permission,avatar.address,{from:accounts[1]}); - await uController.unregisterSelf(avatar.address,{from:accounts[1]}); - } - else { - await uController.newOrganization(avatar.address); - } - return uController; -}; - -const constraint = async function (method, pre=false, post=false) { - var globalConstraints = await GlobalConstraintMock.new(); - let globalConstraintsCountOrig = await controller.globalConstraintsCount(avatar.address); - await globalConstraints.setConstraint(web3.utils.asciiToHex(method),pre,post); - await controller.addGlobalConstraint(globalConstraints.address,helpers.NULL_HASH,avatar.address); - let globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0].toNumber(),globalConstraintsCountOrig[0].toNumber() + (pre ? 0 : 1)); - assert.equal(globalConstraintsCount[1].toNumber(),globalConstraintsCountOrig[1].toNumber() + (post ? 0 : 1)); - return globalConstraints; -}; - -contract('UController',accounts => { - - it("getGlobalConstraintParameters", async() => { - controller = await setup(accounts); - // separate cases for pre and post - var globalConstraints = await constraint("gcParams1", true); - await controller.addGlobalConstraint(globalConstraints.address,"0x1235",avatar.address); - - var paramsHash = await controller.getGlobalConstraintParameters(globalConstraints.address, avatar.address); - - assert.equal(paramsHash,"0x1235000000000000000000000000000000000000000000000000000000000000"); - - globalConstraints = await constraint("gcParams2", false, true); - await controller.addGlobalConstraint(globalConstraints.address,"0x1236",avatar.address); - - paramsHash = await controller.getGlobalConstraintParameters(globalConstraints.address, avatar.address); - - assert.equal(paramsHash,"0x1236000000000000000000000000000000000000000000000000000000000000"); - }); - - it("newOrganization without controller owner of the avatar", async () => { - var uController = await UController.new({gas: constants.ARC_GAS_LIMIT}); - token = await DAOToken.new("TEST","TST",0); - // set up a reputation system - reputation = await Reputation.new(); - avatar = await Avatar.new('name', token.address, reputation.address); - try { - await uController.newOrganization(avatar.address); - assert(false, 'newOrganization should fail because controller is not the avatar owner'); - } catch (ex) { - helpers.assertVMException(ex); - } - }); - - it("newOrganization with same avatar", async () => { - controller = await setup(accounts); - try { - await controller.newOrganization(avatar.address); - assert(false, 'trying to call new organization with an avatar which already registered should fail.'); - } catch (ex) { - helpers.assertVMException(ex); - } - }); - - it("newOrganization with same reputation and token", async () => { - controller = await setup(accounts); - let fakeAvatar = await Avatar.new("0x1234", reputation.address, token.address); - await fakeAvatar.transferOwnership(controller.address); - try { - await controller.newOrganization(fakeAvatar.address); - assert(false, 'trying to call new organization with same reputation and token'); - } catch (ex) { - helpers.assertVMException(ex); - } - - fakeAvatar = await Avatar.new("0x1234", token.address, reputation.address); - await fakeAvatar.transferOwnership(controller.address); - - try { - await controller.newOrganization(fakeAvatar.address); - assert(false, 'trying to call new organization with same reputation and token'); - } catch (ex) { - helpers.assertVMException(ex); - } - - fakeAvatar = await Avatar.new("0x1234", token.address, token.address); - await fakeAvatar.transferOwnership(controller.address); - - try { - await controller.newOrganization(fakeAvatar.address); - assert(false, 'trying to call new organization with same reputation and token'); - } catch (ex) { - helpers.assertVMException(ex); - } - - fakeAvatar = await Avatar.new("0x1234", reputation.address, reputation.address); - await fakeAvatar.transferOwnership(controller.address); - - try { - await controller.newOrganization(fakeAvatar.address); - assert(false, 'trying to call new organization with same reputation and token'); - } catch (ex) { - helpers.assertVMException(ex); - } - }); - - it("mint reputation via controller", async () => { - controller = await setup(accounts); - let tx = await controller.mintReputation(amountToMint,accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "MintReputation"); - assert.equal(tx.logs[0].args._amount, amountToMint); - assert.equal(tx.logs[0].args._to, accounts[0]); - let rep = await reputation.balanceOf(accounts[0]); - assert.equal(rep,amountToMint); - }); - - it("burn reputation via controller", async () => { - controller = await setup(accounts); - await controller.mintReputation(amountToMint,accounts[0],avatar.address); - let tx = await controller.burnReputation(amountToMint-1,accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "BurnReputation"); - assert.equal(tx.logs[0].args._amount, amountToMint-1); - assert.equal(tx.logs[0].args._from, accounts[0]); - let rep = await reputation.balanceOf(accounts[0]); - assert.equal(rep,1); - }); - - it("mint tokens via controller", async () => { - controller = await setup(accounts); - let tx = await controller.mintTokens(amountToMint,accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "MintTokens"); - assert.equal(tx.logs[0].args._amount, amountToMint); - let balance = await token.balanceOf(accounts[0]); - assert.equal(balance,amountToMint); - }); - - it("register schemes", async () => { - controller = await setup(accounts); - let tx = await controller.registerScheme(accounts[1], helpers.NULL_HASH,"0x00000000",avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "RegisterScheme"); - }); - - it("register schemes - check permissions for register new scheme", async () => { - // Check scheme has at least the permissions it is changing, and at least the current permissions. - var i,j; - var controller; - for(j = 0; j <= 15; j++ ){ - //registered scheme has already permission to register(2) - controller = await setup(accounts,'0x'+uint32.toHex(j|2)); - var register; - for(i = 0; i <= 15; i++ ){ - register = true; - try { - await controller.registerScheme(accounts[1],helpers.NULL_HASH,'0x'+uint32.toHex(i),avatar.address); - } catch (ex) { - //registered scheme has already permission to register(2) and is register(1). - assert.notEqual(i&(~(j|3),0)); - register = false; - } - if (register){ - await controller.unregisterScheme(accounts[1],avatar.address); - register= false; - } - } - } - }); - - it("register schemes - check permissions for updating existing scheme", async () => { - // Check scheme has at least the permissions it is changing, and at least the current permissions. - controller = await setup(accounts,'0x0000000F'); - // scheme with permission 0x0000000F should be able to register scheme with permission 0x00000001 - let tx = await controller.registerScheme(accounts[0],helpers.NULL_HASH,"0x00000001",avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "RegisterScheme"); - - controller = await setup(accounts,'0x00000001'); - try { - await controller.registerScheme(accounts[0],helpers.NULL_HASH,"0x00000002",avatar.address); - assert(false, 'scheme with permission 0x00000001 should not be able to register scheme with permission 0x00000002'); - } catch (ex) { - helpers.assertVMException(ex); - } - }); - - it("unregister schemes", async () => { - controller = await setup(accounts); - let tx = await controller.unregisterScheme(accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "UnregisterScheme"); - }); - it("unregister none registered scheme", async () => { - controller = await setup(accounts); - let tx = await controller.unregisterScheme(accounts[1],avatar.address); - assert.equal(tx.logs.length, 0); - }); - - it("unregister schemes - check permissions unregister scheme", async () => { - // Check scheme has at least the permissions it is changing, and at least the current permissions. - //1. setup - controller = await setup(accounts); - //2. account[0] register schemes ,on account[1] with variables permissions which could unregister other schemes. - var i,j; - var tx; - var registeredScheme = accounts[1]; - var unregisteredScheme = accounts[2]; - for(i = 0; i <= 15; i++ ){ - //registered scheme has already permission to register(2) - tx = await controller.registerScheme(registeredScheme,helpers.NULL_HASH,'0x'+uint32.toHex(i|3),avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "RegisterScheme"); - for(j = 0; j <= 15; j++ ){ - tx = await controller.registerScheme(unregisteredScheme,helpers.NULL_HASH,'0x'+uint32.toHex(j),avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "RegisterScheme"); - //try to unregisterScheme - if (j&(~(i|3))) { - //unregister should fail - try { - await controller.unregisterScheme(unregisteredScheme,avatar.address,{ from: registeredScheme }); - assert(false, "scheme with permission " +uint32.toHex(i|3)+ " should not be able to unregister scheme with permission"+uint32.toHex(j)); - } catch (ex) { - helpers.assertVMException(ex); - } - }else{ - //unregister should succeed - tx = await controller.unregisterScheme(unregisteredScheme,avatar.address,{ from: registeredScheme }); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "UnregisterScheme"); - } - } - } - }); - - it("unregister self", async () => { - var tx; - controller = await setup(accounts,"0x00000000"); - tx = await controller.unregisterSelf(avatar.address,{ from: accounts[1]}); - assert.equal(tx.logs.length, 0); // scheme was not registered - - tx = await controller.unregisterSelf(avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "UnregisterScheme"); - }); - - it("isSchemeRegistered ", async () => { - var isSchemeRegistered; - controller = await setup(accounts,"0x00000000"); - isSchemeRegistered = await controller.isSchemeRegistered(accounts[1],avatar.address); - assert.equal(isSchemeRegistered, false); - isSchemeRegistered = await controller.isSchemeRegistered(accounts[0],avatar.address); - assert.equal(isSchemeRegistered, true); - }); - - it("addGlobalConstraint ", async () => { - controller = await setup(accounts); - var globalConstraints = await constraint("0"); - var tx = await controller.addGlobalConstraint(globalConstraints.address,helpers.NULL_HASH,avatar.address); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address,avatar.address),true); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "AddGlobalConstraint"); - var count = await controller.globalConstraintsCount(avatar.address); - assert.equal(count[0], 1); - }); - - it("removeGlobalConstraint ", async () => { - controller = await setup(accounts); - var globalConstraints = await GlobalConstraintMock.new(); - await globalConstraints.setConstraint(web3.utils.asciiToHex("0"),false,false); - var globalConstraints1 = await GlobalConstraintMock.new(); - await globalConstraints1.setConstraint(web3.utils.asciiToHex("method"),false,false); - var globalConstraints2 = await GlobalConstraintMock.new(); - await globalConstraints2.setConstraint(web3.utils.asciiToHex("method"),false,false); - var globalConstraints3 = await GlobalConstraintMock.new(); - await globalConstraints3.setConstraint(web3.utils.asciiToHex("method"),false,false); - var globalConstraints4 = await GlobalConstraintMock.new(); - await globalConstraints4.setConstraint(web3.utils.asciiToHex("method"),false,false); - - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address,avatar.address),false); - await controller.addGlobalConstraint(globalConstraints.address,helpers.NULL_HASH,avatar.address); - await controller.addGlobalConstraint(globalConstraints1.address,helpers.NULL_HASH,avatar.address); - await controller.addGlobalConstraint(globalConstraints2.address,helpers.NULL_HASH,avatar.address); - await controller.addGlobalConstraint(globalConstraints3.address,helpers.NULL_HASH,avatar.address); - await controller.addGlobalConstraint(globalConstraints4.address,helpers.NULL_HASH,avatar.address); - var tx = await controller.removeGlobalConstraint(globalConstraints2.address,avatar.address); - assert.equal(tx.logs.length, 2); - assert.equal(tx.logs[0].event, "RemoveGlobalConstraint"); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints.address,avatar.address),true); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints1.address,avatar.address),true); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints2.address,avatar.address),false); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints3.address,avatar.address),true); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints4.address,avatar.address),true); - - let gcCount = await controller.globalConstraintsCount(avatar.address); - - assert.equal(gcCount[0],4); - assert.equal(gcCount[1],4); - - await controller.removeGlobalConstraint(globalConstraints4.address,avatar.address); - assert.equal(await controller.isGlobalConstraintRegistered(globalConstraints4.address,avatar.address),false); - gcCount = await controller.globalConstraintsCount(avatar.address); - assert.equal(gcCount[0],3); - assert.equal(gcCount[1],3); - }); - - it("upgrade controller ", async () => { - controller = await setup(accounts); - var tx = await controller.upgradeController(accounts[1],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "UpgradeController"); - }); - - it("upgrade controller check permission", async () => { - controller = await setup(accounts,'0x00000007'); - try{ - await controller.upgradeController(accounts[1],avatar.address); - assert(false,"scheme with permission 0x00000007 is not allowed to upgrade "); - } catch (ex) { - helpers.assertVMException(ex); - } - }); - - it("generic call log", async () => { - controller = await setup(accounts,'0x00000010'); - let actionMock = await ActionMock.new(); - let a = 7; - let b = actionMock.address; - let c = "0x1234"; - const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.test(a,b,c).encodeABI(); - var tx = await controller.genericCall(actionMock.address,encodeABI,avatar.address,0); - await avatar.getPastEvents('GenericCall', { - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"GenericCall"); - assert.equal(events[0].args._contract,actionMock.address); - }); - - }); - - it("generic call", async () => { - controller = await setup(accounts,'0x00000010'); - let actionMock = await ActionMock.new(); - let a = 7; - let b = actionMock.address; - let c = "0x1234"; - const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.test(a,b,c).encodeABI(); - var result = await controller.genericCall.call(actionMock.address,encodeABI,avatar.address,0); - assert.equal(result[1], 14); - - }); - it("generic call withoutReturnValue", async () => { - controller = await setup(accounts,'0x00000010'); - let actionMock = await ActionMock.new(); - const actionMockContract = await new web3.eth.Contract(actionMock.abi); - const encodeABI = actionMockContract.methods.withoutReturnValue(avatar.address).encodeABI(); - var tx = await controller.genericCall(actionMock.address,encodeABI,avatar.address,0); - await actionMock.getPastEvents('WithoutReturnValue', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"WithoutReturnValue"); - }); - }); - - it("generic call via contract scheme", async () => { - var scheme = await UniversalSchemeMock.new(); - controller = await setup(accounts,'0x00000010',scheme.address); - let actionMock = await ActionMock.new(); - let a = 7; - let b = actionMock.address; - let c = "0x1234"; - let result = await scheme.genericCall.call(avatar.address,actionMock.address, a,b,c,0); - assert.equal(result[1], 14); - - }); - - it("sendEther", async () => { - controller = await setup(accounts); - let otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); - //send some ether to the avatar - await web3.eth.sendTransaction({from:accounts[0],to:avatar.address, value: web3.utils.toWei('1', "ether")}); - //send some ether from an organization's avatar to the otherAvatar - var tx = await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address,avatar.address); - await avatar.getPastEvents('SendEther', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"SendEther"); - }); - var avatarBalance = await web3.eth.getBalance(avatar.address)/web3.utils.toWei('1', "ether"); - assert.equal(avatarBalance, 0); - var otherAvatarBalance = await web3.eth.getBalance(otherAvatar.address)/web3.utils.toWei('1', "ether"); - assert.equal(otherAvatarBalance, 1); - }); - - it("externalTokenTransfer", async () => { - //External transfer token from avatar contract to other address - controller = await setup(accounts); - var standardToken = await ERC20Mock.new(avatar.address, 100); - let balanceAvatar = await standardToken.balanceOf(avatar.address); - assert.equal(balanceAvatar, 100); - var tx = await controller.externalTokenTransfer(standardToken.address,accounts[1],50,avatar.address); - await avatar.getPastEvents('ExternalTokenTransfer', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ExternalTokenTransfer"); - }); - balanceAvatar = await standardToken.balanceOf(avatar.address); - assert.equal(balanceAvatar, 50); - let balance1 = await standardToken.balanceOf(accounts[1]); - assert.equal(balance1, 50); - }); - - it("externalTokenTransferFrom & ExternalTokenApproval", async () => { - var tx; - var to = accounts[1]; - controller = await setup(accounts); - var standardToken = await ERC20Mock.new(avatar.address, 100); - tx = await controller.externalTokenApproval(standardToken.address,avatar.address,50,avatar.address); - await avatar.getPastEvents('ExternalTokenApproval', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ExternalTokenApproval"); - }); - tx = await controller.externalTokenTransferFrom(standardToken.address,avatar.address,to,50,avatar.address); - - await avatar.getPastEvents('ExternalTokenTransferFrom', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ExternalTokenTransferFrom"); - }); - let balanceAvatar = await standardToken.balanceOf(avatar.address); - assert.equal(balanceAvatar, 50); - let balanceTo = await standardToken.balanceOf(to); - assert.equal(balanceTo, 50); - }); - - it("globalConstraints mintReputation add & remove", async () => { - controller = await setup(accounts); - var globalConstraints = await constraint("mintReputation"); - try { - await controller.mintReputation(amountToMint,accounts[0],avatar.address); - assert(false,"mint reputation should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - let tx = await controller.mintReputation(amountToMint,accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "MintReputation"); - assert.equal(tx.logs[0].args._amount, amountToMint); - let rep = await reputation.balanceOf(accounts[0]); - assert.equal(rep,amountToMint); - }); - - it("globalConstraints mintTokens add & remove", async () => { - - controller = await setup(accounts); - var globalConstraints = await constraint("mintTokens"); - try { - await controller.mintTokens(amountToMint,accounts[0],avatar.address); - assert(false,"mint tokens should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - let tx = await controller.mintTokens(amountToMint,accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "MintTokens"); - assert.equal(tx.logs[0].args._amount, amountToMint); - let balance = await token.balanceOf(accounts[0]); - assert.equal(balance,amountToMint); - }); - - it("globalConstraints register schemes add & remove", async () => { - controller = await setup(accounts); - var globalConstraints = await constraint("registerScheme"); - try { - await controller.registerScheme(accounts[1], helpers.NULL_HASH,"0x00000000",avatar.address); - assert(false,"registerScheme should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - let tx = await controller.registerScheme(accounts[1], helpers.NULL_HASH,"0x00000000",avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "RegisterScheme"); - }); - - it("globalConstraints unregister schemes add & remove", async () => { - controller = await setup(accounts); - var globalConstraints = await constraint("registerScheme"); - try { - await controller.unregisterScheme(accounts[0],avatar.address); - assert(false,"unregisterScheme should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - let tx = await controller.unregisterScheme(accounts[0],avatar.address); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "UnregisterScheme"); - }); - - it("globalConstraints generic call add & remove", async () => { - controller = await setup(accounts,'0x00000014'); - var globalConstraints = await constraint("genericCall"); - let actionMock = await ActionMock.new(); - let a = 7; - let b = actionMock.address; - let c = "0x1234"; - const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.test(a,b,c).encodeABI(); - try { - await controller.genericCall.call(actionMock.address,encodeABI,avatar.address,0); - assert(false,"genericAction should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - var tx = await controller.genericCall(actionMock.address,encodeABI,avatar.address,0); - await avatar.getPastEvents('GenericCall', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"GenericCall"); - }); - }); - - it("globalConstraints sendEther add & remove", async () => { - controller = await setup(accounts); - var globalConstraints = await constraint("sendEther"); - let otherAvatar = await Avatar.new('otheravatar', helpers.NULL_ADDRESS, helpers.NULL_ADDRESS); - web3.eth.sendTransaction({from:accounts[0],to:avatar.address, value: web3.utils.toWei('1', "ether")}); - - try { - await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address,avatar.address); - assert(false,"sendEther should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - var tx = await controller.sendEther(web3.utils.toWei('1', "ether"),otherAvatar.address,avatar.address); - await avatar.getPastEvents('SendEther', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"SendEther"); - }); - var avatarBalance = await web3.eth.getBalance(avatar.address)/web3.utils.toWei('1', "ether"); - assert.equal(avatarBalance, 0); - var otherAvatarBalance = await web3.eth.getBalance(otherAvatar.address)/web3.utils.toWei('1', "ether"); - assert.equal(otherAvatarBalance, 1); - }); - - it("globalConstraints externalTokenTransfer add & remove", async () => { - controller = await setup(accounts); - var globalConstraints = await constraint("externalTokenTransfer"); - var standardToken = await ERC20Mock.new(avatar.address, 100); - let balanceAvatar = await standardToken.balanceOf(avatar.address); - assert.equal(balanceAvatar, 100); - - try { - await controller.externalTokenTransfer(standardToken.address,accounts[1],50,avatar.address); - assert(false,"externalTokenTransfer should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - var tx = await controller.externalTokenTransfer(standardToken.address,accounts[1],50,avatar.address); - await avatar.getPastEvents('ExternalTokenTransfer', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ExternalTokenTransfer"); - }); - balanceAvatar = await standardToken.balanceOf(avatar.address); - assert.equal(balanceAvatar, 50); - let balance1 = await standardToken.balanceOf(accounts[1]); - assert.equal(balance1, 50); - }); - - it("globalConstraints externalTokenTransferFrom , externalTokenApproval", async () => { - var tx; - var to = accounts[1]; - controller = await setup(accounts); - var globalConstraints = await constraint("externalTokenApproval"); - var standardToken = await ERC20Mock.new(avatar.address, 100); - try { - await controller.externalTokenApproval(standardToken.address,avatar.address,50,avatar.address); - assert(false,"externalTokenIncreaseApproval should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - var globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - assert.equal(globalConstraintsCount[1],0); - - tx = await controller.externalTokenApproval(standardToken.address,avatar.address,50,avatar.address); - await avatar.getPastEvents('ExternalTokenApproval', { - filter: {_addr: avatar.address}, // Using an array means OR: e.g. 20 or 23 - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ExternalTokenApproval"); - }); - globalConstraints = await constraint("externalTokenTransferFrom"); - try { - await controller.externalTokenTransferFrom(standardToken.address,avatar.address,to,50,avatar.address); - assert(false,"externalTokenTransferFrom should fail due to the global constraint "); - } - catch(ex){ - helpers.assertVMException(ex); - } - await controller.removeGlobalConstraint(globalConstraints.address,avatar.address); - globalConstraintsCount =await controller.globalConstraintsCount(avatar.address); - assert.equal(globalConstraintsCount[0],0); - }); -}); diff --git a/test/ugenericscheme.js b/test/ugenericscheme.js deleted file mode 100644 index e1509bb0..00000000 --- a/test/ugenericscheme.js +++ /dev/null @@ -1,257 +0,0 @@ -import * as helpers from './helpers'; -const constants = require('./constants'); -const AbsoluteVote = artifacts.require('./AbsoluteVote.sol'); -const GenericScheme = artifacts.require('./UGenericScheme.sol'); -const DaoCreator = artifacts.require("./DaoCreator.sol"); -const DAOTracker = artifacts.require("./DAOTracker.sol"); -const ControllerCreator = artifacts.require("./ControllerCreator.sol"); -const ERC20Mock = artifacts.require("./ERC20Mock.sol"); -const ActionMock = artifacts.require("./ActionMock.sol"); -const Wallet = artifacts.require("./Wallet.sol"); - -export class GenericSchemeParams { - constructor() { - } -} - -const setupGenericSchemeParams = async function( - genericScheme, - accounts, - contractToCall, - genesisProtocol = false, - tokenAddress = 0 - ) { - var genericSchemeParams = new GenericSchemeParams(); - if (genesisProtocol === true){ - genericSchemeParams.votingMachine = await helpers.setupGenesisProtocol(accounts,tokenAddress,0,helpers.NULL_ADDRESS); - await genericScheme.setParameters(genericSchemeParams.votingMachine.params,genericSchemeParams.votingMachine.genesisProtocol.address,contractToCall); - genericSchemeParams.paramsHash = await genericScheme.getParametersHash(genericSchemeParams.votingMachine.params,genericSchemeParams.votingMachine.genesisProtocol.address,contractToCall); - } - else { - genericSchemeParams.votingMachine = await helpers.setupAbsoluteVote(helpers.NULL_ADDRESS,50,genericScheme.address); - await genericScheme.setParameters(genericSchemeParams.votingMachine.params,genericSchemeParams.votingMachine.absoluteVote.address,contractToCall); - genericSchemeParams.paramsHash = await genericScheme.getParametersHash(genericSchemeParams.votingMachine.params,genericSchemeParams.votingMachine.absoluteVote.address,contractToCall); - } - - return genericSchemeParams; -}; - -const setup = async function (accounts,contractToCall = 0,reputationAccount=0,genesisProtocol = false,tokenAddress=0) { - var testSetup = new helpers.TestSetup(); - testSetup.standardTokenMock = await ERC20Mock.new(accounts[1],100); - testSetup.genericScheme = await GenericScheme.new(); - var controllerCreator = await ControllerCreator.new({gas: constants.ARC_GAS_LIMIT}); - var daoTracker = await DAOTracker.new({gas: constants.ARC_GAS_LIMIT}); - testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); - testSetup.reputationArray = [20,10,70]; - - if (reputationAccount === 0) { - testSetup.org = await helpers.setupOrganizationWithArrays(testSetup.daoCreator,[accounts[0],accounts[1],accounts[2]],[1000,1000,1000],testSetup.reputationArray); - } else { - testSetup.org = await helpers.setupOrganizationWithArrays(testSetup.daoCreator,[accounts[0],accounts[1],reputationAccount],[1000,1000,1000],testSetup.reputationArray); - } - testSetup.genericSchemeParams= await setupGenericSchemeParams(testSetup.genericScheme,accounts,contractToCall,genesisProtocol,tokenAddress); - var permissions = "0x00000010"; - - - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, - [testSetup.genericScheme.address], - [testSetup.genericSchemeParams.paramsHash],[permissions],"metaData"); - - return testSetup; -}; - -const createCallToActionMock = async function(_avatar,_actionMock) { - return await new web3.eth.Contract(_actionMock.abi).methods.test2(_avatar).encodeABI(); -}; - -contract('UGenericScheme', function(accounts) { - before(function() { - helpers.etherForEveryone(accounts); - }); - it("setParameters", async function() { - var genericScheme = await GenericScheme.new(); - var absoluteVote = await AbsoluteVote.new(); - await genericScheme.setParameters("0x1234",absoluteVote.address,accounts[0]); - var paramHash = await genericScheme.getParametersHash("0x1234",absoluteVote.address,accounts[0]); - var parameters = await genericScheme.parameters(paramHash); - assert.equal(parameters[0],absoluteVote.address); - assert.equal(parameters[2],accounts[0]); - }); - - - it("proposeCall log", async function() { - - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - var callData = await createCallToActionMock(testSetup.org.avatar.address,actionMock); - - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address, - callData,0,helpers.NULL_HASH); - assert.equal(tx.logs.length, 1); - assert.equal(tx.logs[0].event, "NewCallProposal"); - }); - - it("execute proposeCall -no decision - proposal data delete", async function() { - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - var callData = await createCallToActionMock(testSetup.org.avatar.address,actionMock); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - await testSetup.genericSchemeParams.votingMachine.absoluteVote.vote(proposalId,0,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - //check organizationsProposals after execution - var organizationProposal = await testSetup.genericScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); - assert.equal(organizationProposal.passed,false); - assert.equal(organizationProposal.callData,null); - }); - - it("execute proposeVote -positive decision - proposal data delete", async function() { - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - var callData = await createCallToActionMock(testSetup.org.avatar.address,actionMock); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - var organizationProposal = await testSetup.genericScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); - assert.equal(organizationProposal[0],callData,helpers.NULL_HASH); - await testSetup.genericSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - //check organizationsProposals after execution - organizationProposal = await testSetup.genericScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); - assert.equal(organizationProposal.callData,null);//new contract address - }); - - it("execute proposeVote -positive decision - destination reverts", async function() { - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - var callData = await createCallToActionMock(helpers.NULL_ADDRESS,actionMock); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - - await testSetup.genericSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - //actionMock revert because msg.sender is not the _addr param at actionMock thpugh the generic scheme not . - var organizationProposal = await testSetup.genericScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); - assert.equal(organizationProposal.exist,true);//new contract address - assert.equal(organizationProposal.passed,true);//new contract address - //can call execute - await testSetup.genericScheme.execute(testSetup.org.avatar.address, proposalId); - - }); - - - it("execute proposeVote -positive decision - destination reverts and then active", async function() { - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - var activationTime = (await web3.eth.getBlock("latest")).timestamp + 1000; - await actionMock.setActivationTime(activationTime); - var callData = await new web3.eth.Contract(actionMock.abi).methods.test3().encodeABI(); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - - await testSetup.genericSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - //actionMock revert because msg.sender is not the _addr param at actionMock thpugh the generic scheme not . - var organizationProposal = await testSetup.genericScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); - assert.equal(organizationProposal.exist,true);//new contract address - assert.equal(organizationProposal.passed,true);//new contract address - //can call execute - await testSetup.genericScheme.execute(testSetup.org.avatar.address, proposalId); - await helpers.increaseTime(1001); - await testSetup.genericScheme.execute(testSetup.org.avatar.address, proposalId); - - organizationProposal = await testSetup.genericScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); - assert.equal(organizationProposal.exist,false);//new contract address - assert.equal(organizationProposal.passed,false);//new contract address - try { - await testSetup.genericScheme.execute(testSetup.org.avatar.address, proposalId); - assert(false, "cannot call execute after it been executed"); - } catch(error) { - helpers.assertVMException(error); - } - }); - - - - it("execute proposeVote without return value-positive decision - check action", async function() { - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.withoutReturnValue(testSetup.org.avatar.address).encodeABI(); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,encodeABI,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - - await testSetup.genericSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - - }); - - it("execute should fail if not executed from votingMachine", async function() { - var actionMock =await ActionMock.new(); - var testSetup = await setup(accounts,actionMock.address); - const encodeABI = await new web3.eth.Contract(actionMock.abi).methods.withoutReturnValue(testSetup.org.avatar.address).encodeABI(); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,encodeABI,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - - try { - await testSetup.genericScheme.execute(testSetup.org.avatar.address, proposalId); - assert(false, "execute should fail if not executed from votingMachine"); - } catch(error) { - helpers.assertVMException(error); - } - - }); - - it("execute proposeVote -positive decision - check action - with GenesisProtocol", async function() { - var actionMock =await ActionMock.new(); - var standardTokenMock = await ERC20Mock.new(accounts[0],1000); - var testSetup = await setup(accounts,actionMock.address,0,true,standardTokenMock.address); - var value = 123; - var callData = await createCallToActionMock(testSetup.org.avatar.address,actionMock); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,value,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - //transfer some eth to avatar - await web3.eth.sendTransaction({from:accounts[0],to:testSetup.org.avatar.address, value: web3.utils.toWei('1', "ether")}); - assert.equal(await web3.eth.getBalance(actionMock.address),0); - tx = await testSetup.genericSchemeParams.votingMachine.genesisProtocol.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - await testSetup.genericScheme.getPastEvents('ProposalExecutedByVotingMachine', { - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ProposalExecutedByVotingMachine"); - assert.equal(events[0].args._param,1); - }); - assert.equal(await web3.eth.getBalance(actionMock.address),value); - }); - - it("execute proposeVote -negative decision - check action - with GenesisProtocol", async function() { - var actionMock =await ActionMock.new(); - var standardTokenMock = await ERC20Mock.new(accounts[0],1000); - var testSetup = await setup(accounts,actionMock.address,0,true,standardTokenMock.address); - - var callData = await createCallToActionMock(testSetup.org.avatar.address,actionMock); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - tx = await testSetup.genericSchemeParams.votingMachine.genesisProtocol.vote(proposalId,2,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - await testSetup.genericScheme.getPastEvents('ProposalExecutedByVotingMachine', { - fromBlock: tx.blockNumber, - toBlock: 'latest' - }) - .then(function(events){ - assert.equal(events[0].event,"ProposalExecutedByVotingMachine"); - assert.equal(events[0].args._param,2); - }); - }); - - it("Wallet - execute proposeVote -positive decision - check action - with GenesisProtocol", async function() { - var wallet =await Wallet.new(); - await web3.eth.sendTransaction({from:accounts[0],to:wallet.address, value: web3.utils.toWei('1', "ether")}); - var standardTokenMock = await ERC20Mock.new(accounts[0],1000); - var testSetup = await setup(accounts,wallet.address,0,true,standardTokenMock.address); - var callData = await new web3.eth.Contract(wallet.abi).methods.pay(accounts[1]).encodeABI(); - var tx = await testSetup.genericScheme.proposeCall(testSetup.org.avatar.address,callData,0,helpers.NULL_HASH); - var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - assert.equal(await web3.eth.getBalance(wallet.address),web3.utils.toWei('1', "ether")); - await testSetup.genericSchemeParams.votingMachine.genesisProtocol.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); - assert.equal(await web3.eth.getBalance(wallet.address),web3.utils.toWei('1', "ether")); - await wallet.transferOwnership(testSetup.org.avatar.address); - await testSetup.genericScheme.execute(testSetup.org.avatar.address, proposalId); - assert.equal(await web3.eth.getBalance(wallet.address),0); - }); - -}); diff --git a/test/upgradescheme.js b/test/upgradescheme.js index 74cceba2..8bfcceb9 100644 --- a/test/upgradescheme.js +++ b/test/upgradescheme.js @@ -20,28 +20,36 @@ export class UpgradeSchemeParams { const setupUpgradeSchemeParams = async function( upgradeScheme, + avatarAddress ) { var upgradeSchemeParams = new UpgradeSchemeParams(); upgradeSchemeParams.votingMachine = await helpers.setupAbsoluteVote(helpers.NULL_ADDRESS,50,upgradeScheme.address); - await upgradeScheme.setParameters(upgradeSchemeParams.votingMachine.params,upgradeSchemeParams.votingMachine.absoluteVote.address); - upgradeSchemeParams.paramsHash = await upgradeScheme.getParametersHash(upgradeSchemeParams.votingMachine.params,upgradeSchemeParams.votingMachine.absoluteVote.address); + await upgradeScheme.initialize(avatarAddress, + upgradeSchemeParams.votingMachine.absoluteVote.address, + upgradeSchemeParams.votingMachine.params); + upgradeSchemeParams.paramsHash = helpers.NULL_HASH; return upgradeSchemeParams; }; const setupNewController = async function (accounts,permission='0x00000000') { - var token = await DAOToken.new("TEST","TST",0); + var token = await DAOToken.new(); + await token.initialize("TEST","TST",0,accounts[0]); // set up a reputation system var reputation = await Reputation.new(); + await reputation.initialize(accounts[0]); var avatar = await Avatar.new('name', token.address, reputation.address); + await avatar.initialize('name', token.address, reputation.address,accounts[0]); var _controller; if (permission !== '0'){ - _controller = await Controller.new(avatar.address,{from:accounts[1],gas: constants.ARC_GAS_LIMIT}); - await _controller.registerScheme(accounts[0],helpers.NULL_HASH,permission,avatar.address,{from:accounts[1]}); - await _controller.unregisterSelf(avatar.address,{from:accounts[1]}); + _controller = await Controller.new({from:accounts[1],gas: constants.ARC_GAS_LIMIT}); + await _controller.initialize(avatar.address,accounts[1],{from:accounts[1],gas: constants.ARC_GAS_LIMIT}); + await _controller.registerScheme(accounts[0],permission,{from:accounts[1]}); + await _controller.unregisterSelf({from:accounts[1]}); } else { - _controller = await Controller.new(avatar.address,{gas: constants.ARC_GAS_LIMIT}); + _controller = await Controller.new({gas: constants.ARC_GAS_LIMIT}); + await _controller.initialize(avatar.address,accounts[0]); } return _controller; }; @@ -57,11 +65,11 @@ const setup = async function (accounts) { testSetup.daoCreator = await DaoCreator.new(controllerCreator.address,daoTracker.address,{gas:constants.ARC_GAS_LIMIT}); testSetup.reputationArray = [20,40,70]; testSetup.org = await helpers.setupOrganizationWithArrays(testSetup.daoCreator,[accounts[0],accounts[1],accounts[2]],[1000,0,0],testSetup.reputationArray); - testSetup.upgradeSchemeParams= await setupUpgradeSchemeParams(testSetup.upgradeScheme); + testSetup.upgradeSchemeParams= await setupUpgradeSchemeParams(testSetup.upgradeScheme,testSetup.org.avatar.address); var permissions = "0x0000000a"; - await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.upgradeScheme.address],[testSetup.upgradeSchemeParams.paramsHash],[permissions],"metaData"); + await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address,[testSetup.upgradeScheme.address],[permissions],"metaData"); return testSetup; }; @@ -71,13 +79,11 @@ contract('UpgradeScheme', accounts => { helpers.etherForEveryone(accounts); }); - it("setParameters", async() => { + it("initialize", async() => { var upgradeScheme = await UpgradeScheme.new(); var absoluteVote = await AbsoluteVote.new(); - await upgradeScheme.setParameters("0x1234",absoluteVote.address); - var paramHash = await upgradeScheme.getParametersHash("0x1234",absoluteVote.address); - var parameters = await upgradeScheme.parameters(paramHash); - assert.equal(parameters[1],absoluteVote.address); + await upgradeScheme.initialize(helpers.SOME_ADDRESS,absoluteVote.address,"0x1234"); + assert.equal(await upgradeScheme.votingMachine(),absoluteVote.address); }); @@ -85,7 +91,7 @@ contract('UpgradeScheme', accounts => { var testSetup = await setup(accounts); var newController = await setupNewController(accounts); - var tx = await testSetup.upgradeScheme.proposeUpgrade(testSetup.org.avatar.address,newController.address,helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeUpgrade(newController.address,helpers.NULL_HASH); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewUpgradeProposal"); var votingMachine = await helpers.getValueFromLogs(tx, '_intVoteInterface',1); @@ -95,7 +101,7 @@ contract('UpgradeScheme', accounts => { it("proposeChangeUpgradingScheme log", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(testSetup.org.avatar.address,accounts[0],"0x00000000",helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(accounts[0],helpers.NULL_HASH); assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "ChangeUpgradeSchemeProposal"); var votingMachine = await helpers.getValueFromLogs(tx, '_intVoteInterface',1); @@ -107,122 +113,122 @@ contract('UpgradeScheme', accounts => { var newController = await setupNewController(accounts); assert.notEqual(newController.address,await testSetup.org.avatar.owner()); - var tx = await testSetup.upgradeScheme.proposeUpgrade(testSetup.org.avatar.address,newController.address,helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeUpgrade(newController.address,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); //check organizationsProposals before execution - var organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],newController.address);//new contract address - assert.equal(organizationProposal[2].toNumber(),1);//proposalType + assert.equal(organizationProposal[1].toNumber(),1);//proposalType await testSetup.upgradeSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); assert.equal(newController.address,await testSetup.org.avatar.owner()); //check organizationsProposals after execution - organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address - assert.equal(organizationProposal[2],0);//proposalType + assert.equal(organizationProposal[1],0);//proposalType }); it("execute proposal upgrade controller - no decision (same for update scheme) - proposal data delete", async function() { var testSetup = await setup(accounts); var newController = await setupNewController(accounts); - var tx = await testSetup.upgradeScheme.proposeUpgrade(testSetup.org.avatar.address,newController.address,helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeUpgrade(newController.address,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); //check organizationsProposals before execution - var organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],newController.address);//new contract address - assert.equal(organizationProposal[2].toNumber(),1);//proposalType + assert.equal(organizationProposal[1].toNumber(),1);//proposalType //Vote with reputation to trigger execution await testSetup.upgradeSchemeParams.votingMachine.absoluteVote.vote(proposalId,0,0,helpers.NULL_ADDRESS,{from:accounts[2]}); //should not upgrade because the decision is "no" assert.notEqual(newController.address,await testSetup.org.avatar.owner()); //check organizationsProposals after execution - organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address - assert.equal(organizationProposal[2],0);//proposalType + assert.equal(organizationProposal[1],0);//proposalType }); it("execute proposal ChangeUpgradingScheme - yes decision - proposal data delete", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(testSetup.org.avatar.address,accounts[0],"0x00000002",helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(accounts[0],helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); //check organizationsProposals before execution - var organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],accounts[0]);//new contract address - assert.equal(organizationProposal[2].toNumber(),2);//proposalType + assert.equal(organizationProposal[1].toNumber(),2);//proposalType //check schemes registration before execution var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),false); - assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address,testSetup.org.avatar.address),true); + assert.equal(await controller.isSchemeRegistered(accounts[0]),false); + assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address),true); await testSetup.upgradeSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); //check organizationsProposals after execution - organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address - assert.equal(organizationProposal[2],0);//proposalType + assert.equal(organizationProposal[1],0);//proposalType //check if scheme upgraded - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address,testSetup.org.avatar.address),false); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address),false); }); it("execute proposal ChangeUpgradingScheme - yes decision - check approve increase fee ", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(testSetup.org.avatar.address,accounts[0],"0x00000002",helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(accounts[0],helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); //check organizationsProposals before execution - var organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],accounts[0]);//new contract address - assert.equal(organizationProposal[2].toNumber(),2);//proposalType + assert.equal(organizationProposal[1].toNumber(),2);//proposalType //check schemes registration before execution var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),false); - assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address,testSetup.org.avatar.address),true); + assert.equal(await controller.isSchemeRegistered(accounts[0]),false); + assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address),true); await testSetup.upgradeSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); //check organizationsProposals after execution - organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address - assert.equal(organizationProposal[2],0);//proposalType + assert.equal(organizationProposal[1],0);//proposalType //check if scheme upgraded - assert.equal(await controller.isSchemeRegistered(accounts[0],testSetup.org.avatar.address),true); - assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address,testSetup.org.avatar.address),false); + assert.equal(await controller.isSchemeRegistered(accounts[0]),true); + assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address),false); }); it("execute proposal ChangeUpgradingScheme - yes decision - check upgrade it self. ", async function() { var testSetup = await setup(accounts); - var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(testSetup.org.avatar.address,testSetup.upgradeScheme.address,"0x00000002",helpers.NULL_HASH); + var tx = await testSetup.upgradeScheme.proposeChangeUpgradingScheme(testSetup.upgradeScheme.address,helpers.NULL_HASH); //Vote with reputation to trigger execution var proposalId = await helpers.getValueFromLogs(tx, '_proposalId',1); //check schemes registration before execution var controller = await Controller.at(await testSetup.org.avatar.owner()); - assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address,testSetup.org.avatar.address),true); + assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address),true); await testSetup.upgradeSchemeParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); //check organizationsProposals after execution - var organizationProposal = await testSetup.upgradeScheme.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.upgradeScheme.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address - assert.equal(organizationProposal[2],0);//proposalType + assert.equal(organizationProposal[1],0);//proposalType //schemes should still be registered - assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address,testSetup.org.avatar.address),true); + assert.equal(await controller.isSchemeRegistered(testSetup.upgradeScheme.address),true); }); }); diff --git a/test/voteinorganization.js b/test/voteinorganization.js index d98d8889..d80faa08 100644 --- a/test/voteinorganization.js +++ b/test/voteinorganization.js @@ -21,26 +21,24 @@ const setupVoteInOrganizationParams = async function( accounts, genesisProtocol = false, tokenAddress = 0, - avatar + avatarAddress ) { var voteInOrganizationParams = new VoteInOrganizationParams(); + voteInOrganizationParams.paramsHash = helpers.NULL_HASH; if (genesisProtocol === true){ - voteInOrganizationParams.votingMachine = await helpers.setupGenesisProtocol(accounts,tokenAddress,avatar,helpers.NULL_ADDRESS); - - await voteInOrganization.setParameters( - voteInOrganizationParams.votingMachine.params, - voteInOrganizationParams.votingMachine.genesisProtocol.address); - voteInOrganizationParams.paramsHash = await voteInOrganization.getParametersHash( - voteInOrganizationParams.votingMachine.params, - voteInOrganizationParams.votingMachine.genesisProtocol.address - ); + voteInOrganizationParams.votingMachine = await helpers.setupGenesisProtocol(accounts,tokenAddress,helpers.NULL_ADDRESS); + await voteInOrganization.initialize( avatarAddress, + voteInOrganizationParams.votingMachine.genesisProtocol.address, + voteInOrganizationParams.votingMachine.params + ); + } else { voteInOrganizationParams.votingMachine = await helpers.setupAbsoluteVote(helpers.NULL_ADDRESS,50); - await voteInOrganization.setParameters(voteInOrganizationParams.votingMachine.params, - voteInOrganizationParams.votingMachine.absoluteVote.address); - voteInOrganizationParams.paramsHash = await voteInOrganization.getParametersHash(voteInOrganizationParams.votingMachine.params, - voteInOrganizationParams.votingMachine.absoluteVote.address); + await voteInOrganization.initialize(avatarAddress, + voteInOrganizationParams.votingMachine.absoluteVote.address, + voteInOrganizationParams.votingMachine.params + ); } return voteInOrganizationParams; @@ -65,12 +63,12 @@ const setup = async function (accounts,reputationAccount=0,genesisProtocol = fal accounts, genesisProtocol, tokenAddress, - testSetup.org.avatar); + testSetup.org.avatar.address); var permissions = "0x00000010"; await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, [testSetup.voteInOrganization.address,accounts[3]], - [testSetup.voteInOrganizationParams.paramsHash,helpers.NULL_HASH],[permissions,permissions],"metaData"); + [permissions,permissions],"metaData"); return testSetup; }; @@ -79,13 +77,18 @@ contract('VoteInOrganizationScheme', accounts => { before(function() { helpers.etherForEveryone(accounts); }); - it("setParameters", async() => { + it("initialize", async() => { var voteInOrganization = await VoteInOrganizationScheme.new(); var absoluteVote = await AbsoluteVote.new(); - await voteInOrganization.setParameters("0x1234",absoluteVote.address); - var paramHash = await voteInOrganization.getParametersHash("0x1234",absoluteVote.address); - var parameters = await voteInOrganization.parameters(paramHash); - assert.equal(parameters[0],absoluteVote.address); + await voteInOrganization.initialize(helpers.SOME_ADDRESS,absoluteVote.address,"0x1234"); + + assert.equal(await voteInOrganization.votingMachine(),absoluteVote.address); + try { + await voteInOrganization.initialize(helpers.SOME_ADDRESS,absoluteVote.address,"0x1234"); + assert(false, "cannot initialize twice"); + } catch(error) { + helpers.assertVMException(error); + } }); @@ -93,8 +96,9 @@ contract('VoteInOrganizationScheme', accounts => { var testSetup = await setup(accounts); var anotherTestSetup = await setup(accounts); - var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(testSetup.org.reputation.address, - anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); + var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(); + await absoluteVoteExecuteMock.initialize(testSetup.org.reputation.address, + anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); var tx = await absoluteVoteExecuteMock.propose(2, anotherTestSetup.voteInOrganizationParams.votingMachine.params, @@ -102,7 +106,7 @@ contract('VoteInOrganizationScheme', accounts => { accounts[0],helpers.NULL_ADDRESS); const proposalId = await helpers.getProposalId(tx,anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote, 'NewProposal'); - tx = await testSetup.voteInOrganization.proposeVote(testSetup.org.avatar.address, + tx = await testSetup.voteInOrganization.proposeVote( anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address, proposalId,1,helpers.NULL_HASH); assert.equal(tx.logs.length, 1); @@ -114,8 +118,9 @@ contract('VoteInOrganizationScheme', accounts => { var testSetup = await setup(accounts); var anotherTestSetup = await setup(accounts); - var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(testSetup.org.reputation.address, - anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); + var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(); + await absoluteVoteExecuteMock.initialize(testSetup.org.reputation.address, + anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); var tx = await absoluteVoteExecuteMock.propose(2, anotherTestSetup.voteInOrganizationParams.votingMachine.params, anotherTestSetup.org.avatar.address, @@ -123,13 +128,13 @@ contract('VoteInOrganizationScheme', accounts => { helpers.NULL_ADDRESS); const originalProposalId = await helpers.getProposalId(tx,anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote, 'NewProposal'); - tx = await testSetup.voteInOrganization.proposeVote(testSetup.org.avatar.address, + tx = await testSetup.voteInOrganization.proposeVote( anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address, originalProposalId,1,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); await testSetup.voteInOrganizationParams.votingMachine.absoluteVote.vote(proposalId,0,0,helpers.NULL_ADDRESS,{from:accounts[2]}); //check organizationsProposals after execution - var organizationProposal = await testSetup.voteInOrganization.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.voteInOrganization.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address }); @@ -139,9 +144,10 @@ contract('VoteInOrganizationScheme', accounts => { var anotherTestSetup = await setup(accounts); var anotherController = await Controller.at(await anotherTestSetup.org.reputation.owner()); //mint reputation to avatar in the other dao. - await anotherController.mintReputation(10000,testSetup.org.avatar.address,anotherTestSetup.org.avatar.address,{from:accounts[3]}); - var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(anotherTestSetup.org.reputation.address, - anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); + await anotherController.mintReputation(10000,testSetup.org.avatar.address,{from:accounts[3]}); + var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(); + await absoluteVoteExecuteMock.initialize(anotherTestSetup.org.reputation.address, + anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); var tx = await absoluteVoteExecuteMock.propose(2, anotherTestSetup.voteInOrganizationParams.votingMachine.params, anotherTestSetup.org.avatar.address, @@ -149,15 +155,15 @@ contract('VoteInOrganizationScheme', accounts => { helpers.NULL_ADDRESS); const originalProposalId = await helpers.getProposalId(tx,anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote, 'NewProposal'); - tx = await testSetup.voteInOrganization.proposeVote(testSetup.org.avatar.address, + tx = await testSetup.voteInOrganization.proposeVote( anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address, originalProposalId,1,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - var organizationProposal = await testSetup.voteInOrganization.organizationsProposals(testSetup.org.avatar.address,proposalId); + var organizationProposal = await testSetup.voteInOrganization.organizationProposals(proposalId); assert.equal(organizationProposal[0],anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address);//new contract address await testSetup.voteInOrganizationParams.votingMachine.absoluteVote.vote(proposalId,1,0,helpers.NULL_ADDRESS,{from:accounts[2]}); //check organizationsProposals after execution - organizationProposal = await testSetup.voteInOrganization.organizationsProposals(testSetup.org.avatar.address,proposalId); + organizationProposal = await testSetup.voteInOrganization.organizationProposals(proposalId); assert.equal(organizationProposal[0],0x0000000000000000000000000000000000000000);//new contract address }); @@ -165,8 +171,9 @@ contract('VoteInOrganizationScheme', accounts => { var testSetup = await setup(accounts); var anotherTestSetup = await setup(accounts,testSetup.org.avatar.address); - var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(anotherTestSetup.org.reputation.address, - anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); + var absoluteVoteExecuteMock = await AbsoluteVoteExecuteMock.new(); + await absoluteVoteExecuteMock.initialize(anotherTestSetup.org.reputation.address, + anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address); var tx = await absoluteVoteExecuteMock.propose(2, anotherTestSetup.voteInOrganizationParams.votingMachine.params, anotherTestSetup.org.avatar.address, @@ -174,7 +181,7 @@ contract('VoteInOrganizationScheme', accounts => { helpers.NULL_ADDRESS); const originalProposalId = await helpers.getProposalId(tx,anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote, 'NewProposal'); - tx = await testSetup.voteInOrganization.proposeVote(testSetup.org.avatar.address, + tx = await testSetup.voteInOrganization.proposeVote( anotherTestSetup.voteInOrganizationParams.votingMachine.absoluteVote.address, originalProposalId,1,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); @@ -188,11 +195,13 @@ contract('VoteInOrganizationScheme', accounts => { var anotherTestSetup = await setup(accounts,0,true,standardTokenMock.address); var reputation = await Reputation.new(); + await reputation.initialize(accounts[0]); await reputation.mint(testSetup.org.avatar.address,100); - var genesisProtocolCallbacksMock = await GenesisProtocolCallbacksMock.new(reputation.address, - standardTokenMock.address, - anotherTestSetup.voteInOrganizationParams.votingMachine.genesisProtocol.address); + var genesisProtocolCallbacksMock = await GenesisProtocolCallbacksMock.new(); + await genesisProtocolCallbacksMock.initialize(reputation.address, + standardTokenMock.address, + anotherTestSetup.voteInOrganizationParams.votingMachine.genesisProtocol.address); await reputation.transferOwnership(genesisProtocolCallbacksMock.address); var tx = await genesisProtocolCallbacksMock.propose(2, anotherTestSetup.voteInOrganizationParams.votingMachine.params, @@ -200,7 +209,7 @@ contract('VoteInOrganizationScheme', accounts => { accounts[0], helpers.NULL_ADDRESS); var originalProposalId = await helpers.getValueFromLogs(tx, '_proposalId'); - tx = await testSetup.voteInOrganization.proposeVote(testSetup.org.avatar.address, + tx = await testSetup.voteInOrganization.proposeVote( anotherTestSetup.voteInOrganizationParams.votingMachine.genesisProtocol.address, originalProposalId,1,helpers.NULL_HASH); var proposalId = await helpers.getValueFromLogs(tx, '_proposalId'); diff --git a/test/votingmachinecallbacks.js b/test/votingmachinecallbacks.js index d2043402..81571927 100644 --- a/test/votingmachinecallbacks.js +++ b/test/votingmachinecallbacks.js @@ -20,7 +20,6 @@ const setup = async function (accounts) { var permissions = "0x00000000"; await testSetup.daoCreator.setSchemes(testSetup.org.avatar.address, [testSetup.arcVotingMachineCallbacksMock.address], - [helpers.NULL_HASH], [permissions],"metaData"); await testSetup.arcVotingMachineCallbacksMock.propose(proposalId, testSetup.org.avatar.address,