Giter Site home page Giter Site logo

joint-savings's Introduction

Joint Savings Contract

The goal of this project was to create a contract that can send ETH to either one of two savings accounts. This contract will have a withdraw function that requires that the recipient of the funds in the smart contract are your two savings accounts. Otherwise, funds will not be withdrawn. There is a deposit function and a fallback function that can be used to send funds into the contract. There is a function setAccounts that will take in two payable addresses account1 and account2 that will receive savings from our smart contract.

Testing Contract Functionality

Using deposit function to deposit funds

I was able to send 1 Ether, 10 Ether and 5 Ether to the contract address using the deposit function. The contractBalance would show the balance of the contract in wei.

Withdrawing funds to accountOne

Using the withdraw function I was able to withdraw 5 Ether to accountOne. You can confirm using lastToWithdraw, lastWithdrawAmount and contractBalance to check if the withdraw was successfull.

Withdrawing funds to accountTwo

I was able to withdraw 10 Ether to accountTwo. I can confirm using lastToWithdraw, lastWithdrawAmount and contractBalance to check if the withdraw was successfull.

Improvements

I would add a modifier onlyOwner to the contract that would require msg.sender to equal owner of the deployed contract. Then add the modifier to setAccounts funtion son only the owner can set the accounts.

joint-savings's People

Contributors

mmsaki avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.