-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
14 changed files
with
788 additions
and
58 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 P2P.org | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
// SPDX-FileCopyrightText: 2024 P2P Validator <[email protected]> | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.27; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import "../src/MerkleAirdrop.sol"; | ||
|
||
contract Deploy is Script { | ||
function run() | ||
external | ||
returns (MerkleAirdrop merkleAirdrop) | ||
{ | ||
uint256 deployerKey = vm.envUint("PRIVATE_KEY"); | ||
|
||
vm.startBroadcast(deployerKey); | ||
merkleAirdrop = new MerkleAirdrop(bytes32(0)); | ||
vm.stopBroadcast(); | ||
|
||
return merkleAirdrop; | ||
} | ||
} |
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,83 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../utils/Context.sol"; | ||
|
||
/** | ||
* @dev Contract module which provides a basic access control mechanism, where | ||
* there is an account (an owner) that can be granted exclusive access to | ||
* specific functions. | ||
* | ||
* By default, the owner account will be the one that deploys the contract. This | ||
* can later be changed with {transferOwnership}. | ||
* | ||
* This module is used through inheritance. It will make available the modifier | ||
* `onlyOwner`, which can be applied to your functions to restrict their use to | ||
* the owner. | ||
*/ | ||
abstract contract Ownable is Context { | ||
address private _owner; | ||
|
||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); | ||
|
||
/** | ||
* @dev Initializes the contract setting the deployer as the initial owner. | ||
*/ | ||
constructor() { | ||
_transferOwnership(_msgSender()); | ||
} | ||
|
||
/** | ||
* @dev Throws if called by any account other than the owner. | ||
*/ | ||
modifier onlyOwner() { | ||
_checkOwner(); | ||
_; | ||
} | ||
|
||
/** | ||
* @dev Returns the address of the current owner. | ||
*/ | ||
function owner() public view virtual returns (address) { | ||
return _owner; | ||
} | ||
|
||
/** | ||
* @dev Throws if the sender is not the owner. | ||
*/ | ||
function _checkOwner() internal view virtual { | ||
require(owner() == _msgSender(), "Ownable: caller is not the owner"); | ||
} | ||
|
||
/** | ||
* @dev Leaves the contract without owner. It will not be possible to call | ||
* `onlyOwner` functions. Can only be called by the current owner. | ||
* | ||
* NOTE: Renouncing ownership will leave the contract without an owner, | ||
* thereby disabling any functionality that is only available to the owner. | ||
*/ | ||
function renounceOwnership() public virtual onlyOwner { | ||
_transferOwnership(address(0)); | ||
} | ||
|
||
/** | ||
* @dev Transfers ownership of the contract to a new account (`newOwner`). | ||
* Can only be called by the current owner. | ||
*/ | ||
function transferOwnership(address newOwner) public virtual onlyOwner { | ||
require(newOwner != address(0), "Ownable: new owner is the zero address"); | ||
_transferOwnership(newOwner); | ||
} | ||
|
||
/** | ||
* @dev Transfers ownership of the contract to a new account (`newOwner`). | ||
* Internal function without access restriction. | ||
*/ | ||
function _transferOwnership(address newOwner) internal virtual { | ||
address oldOwner = _owner; | ||
_owner = newOwner; | ||
emit OwnershipTransferred(oldOwner, newOwner); | ||
} | ||
} |
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,57 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "./Ownable.sol"; | ||
|
||
/** | ||
* @dev Contract module which provides access control mechanism, where | ||
* there is an account (an owner) that can be granted exclusive access to | ||
* specific functions. | ||
* | ||
* By default, the owner account will be the one that deploys the contract. This | ||
* can later be changed with {transferOwnership} and {acceptOwnership}. | ||
* | ||
* This module is used through inheritance. It will make available all functions | ||
* from parent (Ownable). | ||
*/ | ||
abstract contract Ownable2Step is Ownable { | ||
address private _pendingOwner; | ||
|
||
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); | ||
|
||
/** | ||
* @dev Returns the address of the pending owner. | ||
*/ | ||
function pendingOwner() public view virtual returns (address) { | ||
return _pendingOwner; | ||
} | ||
|
||
/** | ||
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. | ||
* Can only be called by the current owner. | ||
*/ | ||
function transferOwnership(address newOwner) public virtual override onlyOwner { | ||
_pendingOwner = newOwner; | ||
emit OwnershipTransferStarted(owner(), newOwner); | ||
} | ||
|
||
/** | ||
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. | ||
* Internal function without access restriction. | ||
*/ | ||
function _transferOwnership(address newOwner) internal virtual override { | ||
delete _pendingOwner; | ||
super._transferOwnership(newOwner); | ||
} | ||
|
||
/** | ||
* @dev The new owner accepts the ownership transfer. | ||
*/ | ||
function acceptOwnership() public virtual { | ||
address sender = _msgSender(); | ||
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); | ||
_transferOwnership(sender); | ||
} | ||
} |
Oops, something went wrong.