UserAccountInterface.sol
1 pragma solidity >=0.5.0 <0.7.0; 2 3 import "./ERC725.sol"; 4 import "./Signer.sol"; 5 /** 6 * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) 7 * @notice A common user account interface 8 */ 9 contract UserAccountInterface is ERC725, Signer { 10 11 /** 12 * @notice calls another contract 13 * @param _to destination of call 14 * @param _value call ether value (in wei) 15 * @param _data call data 16 * @return internal transaction status and returned data 17 */ 18 function call( 19 address _to, 20 uint256 _value, 21 bytes calldata _data 22 ) 23 external 24 returns(bool success, bytes memory returndata); 25 26 /** 27 * @notice Approves `_to` spending ERC20 `_baseToken` a total of `_value` and calls `_to` with `_data`. Useful for a better UX on ERC20 token use, and avoid race conditions. 28 * @param _baseToken ERC20 token being approved to spend 29 * @param _to Destination of contract accepting this ERC20 token payments through approve 30 * @param _value amount of ERC20 being approved 31 * @param _data abi encoded calldata to be executed in `_to` after approval. 32 * @return internal transaction status and returned data 33 */ 34 function approveAndCall( 35 address _baseToken, 36 address _to, 37 uint256 _value, 38 bytes calldata _data 39 ) 40 external 41 returns(bool success, bytes memory returndata); 42 43 /** 44 * @notice creates new contract based on input `_code` and transfer `_value` ETH to this instance 45 * @param _value amount ether in wei to sent to deployed address at its initialization 46 * @param _code contract code 47 * @return creation success status and created contract address 48 */ 49 function create( 50 uint256 _value, 51 bytes calldata _code 52 ) 53 external 54 returns(address createdContract); 55 56 /** 57 * @notice creates deterministic address contract using on input `_code` and transfer `_value` ETH to this instance 58 * @param _value amount ether in wei to sent to deployed address at its initialization 59 * @param _code contract code 60 * @param _salt changes the resulting address 61 * @return creation success status and created contract address 62 */ 63 function create2( 64 uint256 _value, 65 bytes calldata _code, 66 bytes32 _salt 67 ) 68 external 69 returns(address createdContract); 70 71 /** 72 * @notice Defines recoveryContract address. 73 * @param _recovery address of recoveryContract contract 74 */ 75 function setRecovery(address _recovery) external; 76 77 /** 78 * @notice Changes actor contract 79 * @param _actor Contract which can call actions from this contract 80 */ 81 function setActor(address _actor) external; 82 83 /** 84 * @notice Replace owner address. 85 * @param newOwner address of externally owned account or ERC1271 contract to control this account 86 */ 87 function changeOwner(address newOwner) external; 88 89 /** 90 * @notice Defines the new owner and disable actor. Can only be called by recovery. 91 * @param newOwner an ERC1271 contract 92 */ 93 function recover(address newOwner) external; 94 }