I created a Solidity smart contract that accepts two user addresses, to automate the creation of joint savings accounts. These two addresses will be able to control a joint savings account.
The smart contract uses ether management functions to implement a financial institution’s requirements for providing the features of the joint savings account. These features will consist of the ability to deposit and withdraw funds from the account.
See the file joint_savings.sol containing the smart contract.
The folder 'execution_results' contains images confirming the deposit and withdrawal transactions designed to test the JointSavings
functionality in the Remix VM (London) worked as expected.
The steps I completed are as follows:
- Created a joint savings account contract in Solidity
- Compiled and deployed the contract in the Remix VM (London)
- Interacted with the deployed smart contract
I created the smart contract for a joint savings account in Solidity. See part of the contract in the image below:
The full contract can be found in joint_savings.sol.
I compiled the smart contract as shown below:
I then deployed the contract, as shown below:
Once the contract was deployed, I tested its functionality.
I used the setAccounts
function to define the authorized Ethereum addresses that will be able to withdraw funds from the contract:
I tested the deposit functionality of the smart contract by sending the following amounts of ether. After each transaction, I used the contractBalance
function to verify that the funds were added to the contract.
I used the website Ethereum Unit Converter to assist doing the conversions of ether to wei.
Once I'd successfully deposited funds into the contract, I tested the contract’s withdrawal functionality.
Use the lastToWithdraw
and lastWithdrawAmount
functions to verify that the address and amount were correct
Tech used includes: