-
Notifications
You must be signed in to change notification settings - Fork 1
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
31 changed files
with
2,508 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 |
---|---|---|
|
@@ -9,6 +9,7 @@ out/ | |
|
||
# Docs | ||
docs/ | ||
.idea/ | ||
|
||
# Dotenv file | ||
.env |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/permit2"] | ||
path = lib/permit2 | ||
url = https://github.com/Uniswap/permit2 |
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,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/** | ||
* @dev Interface of the ERC1271 standard signature validation method for | ||
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. | ||
* | ||
* _Available since v4.1._ | ||
*/ | ||
interface IERC1271 { | ||
/** | ||
* @dev Should return whether the signature provided is valid for the provided data | ||
* @param hash Hash of the data to be signed | ||
* @param signature Signature byte array associated with _data | ||
*/ | ||
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); | ||
} |
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,84 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol) | ||
|
||
pragma solidity 0.8.27; | ||
|
||
/** | ||
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for | ||
* deploying minimal proxy contracts, also known as "clones". | ||
* | ||
* > To simply and cheaply clone contract functionality in an immutable way, this standard specifies | ||
* > a minimal bytecode implementation that delegates all calls to a known, fixed address. | ||
* | ||
* The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` | ||
* (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the | ||
* deterministic method. | ||
* | ||
* _Available since v3.4._ | ||
*/ | ||
library Clones { | ||
/** | ||
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. | ||
* | ||
* This function uses the create opcode, which should never revert. | ||
*/ | ||
function clone(address implementation) internal returns (address instance) { | ||
assembly ("memory-safe") { | ||
let ptr := mload(0x40) | ||
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) | ||
mstore(add(ptr, 0x14), shl(0x60, implementation)) | ||
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) | ||
instance := create(0, ptr, 0x37) | ||
} | ||
require(instance != address(0), "ERC1167: create failed"); | ||
} | ||
|
||
/** | ||
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. | ||
* | ||
* This function uses the create2 opcode and a `salt` to deterministically deploy | ||
* the clone. Using the same `implementation` and `salt` multiple time will revert, since | ||
* the clones cannot be deployed twice at the same address. | ||
*/ | ||
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { | ||
assembly ("memory-safe") { | ||
let ptr := mload(0x40) | ||
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) | ||
mstore(add(ptr, 0x14), shl(0x60, implementation)) | ||
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) | ||
instance := create2(0, ptr, 0x37, salt) | ||
} | ||
require(instance != address(0), "ERC1167: create2 failed"); | ||
} | ||
|
||
/** | ||
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. | ||
*/ | ||
function predictDeterministicAddress( | ||
address implementation, | ||
bytes32 salt, | ||
address deployer | ||
) internal pure returns (address predicted) { | ||
assembly ("memory-safe") { | ||
let ptr := mload(0x40) | ||
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) | ||
mstore(add(ptr, 0x14), shl(0x60, implementation)) | ||
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) | ||
mstore(add(ptr, 0x38), shl(0x60, deployer)) | ||
mstore(add(ptr, 0x4c), salt) | ||
mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) | ||
predicted := keccak256(add(ptr, 0x37), 0x55) | ||
} | ||
} | ||
|
||
/** | ||
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. | ||
*/ | ||
function predictDeterministicAddress(address implementation, bytes32 salt) | ||
internal | ||
view | ||
returns (address predicted) | ||
{ | ||
return predictDeterministicAddress(implementation, salt, address(this)); | ||
} | ||
} |
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,125 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) | ||
|
||
pragma solidity 0.8.27; | ||
|
||
import "../../utils/introspection/IERC165.sol"; | ||
|
||
/** | ||
* @dev Required interface of an ERC1155 compliant contract, as defined in the | ||
* https://eips.ethereum.org/EIPS/eip-1155[EIP]. | ||
* | ||
* _Available since v3.1._ | ||
*/ | ||
interface IERC1155 is IERC165 { | ||
/** | ||
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. | ||
*/ | ||
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); | ||
|
||
/** | ||
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all | ||
* transfers. | ||
*/ | ||
event TransferBatch( | ||
address indexed operator, | ||
address indexed from, | ||
address indexed to, | ||
uint256[] ids, | ||
uint256[] values | ||
); | ||
|
||
/** | ||
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to | ||
* `approved`. | ||
*/ | ||
event ApprovalForAll(address indexed account, address indexed operator, bool approved); | ||
|
||
/** | ||
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. | ||
* | ||
* If an {URI} event was emitted for `id`, the standard | ||
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value | ||
* returned by {IERC1155MetadataURI-uri}. | ||
*/ | ||
event URI(string value, uint256 indexed id); | ||
|
||
/** | ||
* @dev Returns the amount of tokens of token type `id` owned by `account`. | ||
* | ||
* Requirements: | ||
* | ||
* - `account` cannot be the zero address. | ||
*/ | ||
function balanceOf(address account, uint256 id) external view returns (uint256); | ||
|
||
/** | ||
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. | ||
* | ||
* Requirements: | ||
* | ||
* - `accounts` and `ids` must have the same length. | ||
*/ | ||
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) | ||
external | ||
view | ||
returns (uint256[] memory); | ||
|
||
/** | ||
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, | ||
* | ||
* Emits an {ApprovalForAll} event. | ||
* | ||
* Requirements: | ||
* | ||
* - `operator` cannot be the caller. | ||
*/ | ||
function setApprovalForAll(address operator, bool approved) external; | ||
|
||
/** | ||
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens. | ||
* | ||
* See {setApprovalForAll}. | ||
*/ | ||
function isApprovedForAll(address account, address operator) external view returns (bool); | ||
|
||
/** | ||
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`. | ||
* | ||
* Emits a {TransferSingle} event. | ||
* | ||
* Requirements: | ||
* | ||
* - `to` cannot be the zero address. | ||
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. | ||
* - `from` must have a balance of tokens of type `id` of at least `amount`. | ||
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the | ||
* acceptance magic value. | ||
*/ | ||
function safeTransferFrom( | ||
address from, | ||
address to, | ||
uint256 id, | ||
uint256 amount, | ||
bytes calldata data | ||
) external; | ||
|
||
/** | ||
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. | ||
* | ||
* Emits a {TransferBatch} event. | ||
* | ||
* Requirements: | ||
* | ||
* - `ids` and `amounts` must have the same length. | ||
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the | ||
* acceptance magic value. | ||
*/ | ||
function safeBatchTransferFrom( | ||
address from, | ||
address to, | ||
uint256[] calldata ids, | ||
uint256[] calldata amounts, | ||
bytes calldata data | ||
) external; | ||
} |
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,82 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) | ||
|
||
pragma solidity 0.8.27; | ||
|
||
/** | ||
* @dev Interface of the ERC20 standard as defined in the EIP. | ||
*/ | ||
interface IERC20 { | ||
/** | ||
* @dev Emitted when `value` tokens are moved from one account (`from`) to | ||
* another (`to`). | ||
* | ||
* Note that `value` may be zero. | ||
*/ | ||
event Transfer(address indexed from, address indexed to, uint256 value); | ||
|
||
/** | ||
* @dev Emitted when the allowance of a `spender` for an `owner` is set by | ||
* a call to {approve}. `value` is the new allowance. | ||
*/ | ||
event Approval(address indexed owner, address indexed spender, uint256 value); | ||
|
||
/** | ||
* @dev Returns the amount of tokens in existence. | ||
*/ | ||
function totalSupply() external view returns (uint256); | ||
|
||
/** | ||
* @dev Returns the amount of tokens owned by `account`. | ||
*/ | ||
function balanceOf(address account) external view returns (uint256); | ||
|
||
/** | ||
* @dev Moves `amount` tokens from the caller's account to `to`. | ||
* | ||
* Returns a boolean value indicating whether the operation succeeded. | ||
* | ||
* Emits a {Transfer} event. | ||
*/ | ||
function transfer(address to, uint256 amount) external returns (bool); | ||
|
||
/** | ||
* @dev Returns the remaining number of tokens that `spender` will be | ||
* allowed to spend on behalf of `owner` through {transferFrom}. This is | ||
* zero by default. | ||
* | ||
* This value changes when {approve} or {transferFrom} are called. | ||
*/ | ||
function allowance(address owner, address spender) external view returns (uint256); | ||
|
||
/** | ||
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens. | ||
* | ||
* Returns a boolean value indicating whether the operation succeeded. | ||
* | ||
* IMPORTANT: Beware that changing an allowance with this method brings the risk | ||
* that someone may use both the old and the new allowance by unfortunate | ||
* transaction ordering. One possible solution to mitigate this race | ||
* condition is to first reduce the spender's allowance to 0 and set the | ||
* desired value afterwards: | ||
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 | ||
* | ||
* Emits an {Approval} event. | ||
*/ | ||
function approve(address spender, uint256 amount) external returns (bool); | ||
|
||
/** | ||
* @dev Moves `amount` tokens from `from` to `to` using the | ||
* allowance mechanism. `amount` is then deducted from the caller's | ||
* allowance. | ||
* | ||
* Returns a boolean value indicating whether the operation succeeded. | ||
* | ||
* Emits a {Transfer} event. | ||
*/ | ||
function transferFrom( | ||
address from, | ||
address to, | ||
uint256 amount | ||
) external returns (bool); | ||
} |
Oops, something went wrong.