-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d2b2d7
commit b432e17
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
contract Day4 { | ||
address owner; | ||
//Create a constructor() to set the owner of contract | ||
constructor() { | ||
owner = msg.sender; | ||
} | ||
//Create a payable function send(address type array for storing addresses, uint type array to store the amount). | ||
|
||
function send(address payable[] memory to, uint256[] memory amount) | ||
public | ||
payable | ||
ownerOnly | ||
{ | ||
require(to.length == amount.length, "to must be same length as amount"); | ||
for (uint256 i = 0; i < to.length; i++) { | ||
to[i].transfer(amount[i]); //to array - 0x00 0x01 0x02 | ||
//amount array - 10 20 30 | ||
} | ||
} | ||
|
||
modifier ownerOnly() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
} |