// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; // The goal here is to create a multi-sig wallet safe // Eventually the deployer will have to decide how many sigs are needed for the tranx to be approved // The deployer will also be able to add/remove the allowed addresses // BEFORE we get to that, let's create a SIMPLE wallet safe // We'll expand upon its functionalities to make it a multi-sig safe bit by bit // Create a cotract called Safe that: (This is how to make a wallet) // 1 - Keeps track of users balance (balances mapping) // 2 - Shows how many users have funds in the Safe // 3 - Each user is represented by a Struct with at least: address, balance, unique ID // 4 - A user can deposit, withdraw and tranfer funds to other users // NB - no need to create a new token: we'll use ETH // Use OpenZeppelin's SafeMath for uint operations contract Safe { mapping(address => uint256) public balances; //balances[msg.sender] (how to call mapping) struct User{ address userAddress; uint256 userBalance; uint256 userID; } User[] public users; // functions for withdraw, transfer and deposit go below here //function withdrawFunds() external { //require(msg.sender = User); // msg.sender.transfer(address(uint256)); } function withdrawFunds() external { //checks, effects, interactions require(balances[msg.sender] >= msg.value, "Error! Insufficient Funds"); balances(msg.sender) -= msg.value; msg.sender.transfer(msg.value); } function transferFunds(uint256 a, uint256 b) internal pure returns (uint256) { address(User).transfer(_amount); return a + b; } function depositFunds(uint256 a, uint256 b) internal pure returns (uint256) { require(msg.value == _amount); return a - b; } }
0.4.18