-
Notifications
You must be signed in to change notification settings - Fork 0
Use proxy factory for NFTs #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Agusx1211
wants to merge
14
commits into
master
Choose a base branch
from
factory
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
310246d
Use proxy factory for NFTs
Agusx1211 318994e
Update GA node version
Agusx1211 7c9012f
Add coverage and simplify init function
Agusx1211 0efefae
Add ownable tests
Agusx1211 f83844c
Ignore errors on coverage ci
Agusx1211 283675b
Add ownable fail transfer owner test
Agusx1211 061ac35
Add tests for ERC-165
Agusx1211 6c983ca
Fix coverage node version GA
Agusx1211 253d42e
Test transfer to address(0)
Agusx1211 1d67fa1
Use ERC1155 with custom packed bits
Agusx1211 689507c
Test custom bits on factory
Agusx1211 81cee97
Update yarn.lock
Agusx1211 34d49e3
Use commit for gitpkg
Agusx1211 d57bc30
Update events
Agusx1211 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 contains hidden or 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 contains hidden or 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
10 changes: 10 additions & 0 deletions
10
src/artifacts/@openzeppelin/contracts/proxy/Clones.sol/Clones.json
This file contains hidden or 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,10 @@ | ||
| { | ||
| "_format": "hh-sol-artifact-1", | ||
| "contractName": "Clones", | ||
| "sourceName": "@openzeppelin/contracts/proxy/Clones.sol", | ||
| "abi": [], | ||
| "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220844b8a2921660edc3cd3c4751c12436811a7acb432eaf78b6b14d1550f6c756a64736f6c63430007040033", | ||
| "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220844b8a2921660edc3cd3c4751c12436811a7acb432eaf78b6b14d1550f6c756a64736f6c63430007040033", | ||
| "linkReferences": {}, | ||
| "deployedLinkReferences": {} | ||
| } |
73 changes: 73 additions & 0 deletions
73
src/artifacts/contracts/NiftyupFactory.sol/NiftyupFactory.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
.../contracts/utils/Context.sol/Context.json → ...tils/Initializable.sol/Initializable.json
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
...contracts/access/Ownable.sol/Ownable.json → .../contracts/utils/Ownable.sol/Ownable.json
This file contains hidden or 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 contains hidden or 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,32 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.7.0; | ||
|
|
||
| import '@openzeppelin/contracts/proxy/Clones.sol'; | ||
| import "./NiftyupNFT.sol"; | ||
|
|
||
|
|
||
| contract NiftyupFactory { | ||
| NiftyupNFT immutable public implementation; | ||
|
|
||
| event CreatedNFT(address indexed creator, address indexed owner, address indexed nft); | ||
|
|
||
| constructor() { | ||
| NiftyupNFT imp = new NiftyupNFT(); | ||
| imp.initialize(address(this)); | ||
| implementation = imp; | ||
| } | ||
|
|
||
| /** | ||
| * @notice Creates a new NiftyNFT proxy contract instance | ||
| * @param _owner Owner of the NFT contract | ||
| * @return Address of the created NFT contract | ||
| */ | ||
| function create(address _owner) external returns (address) { | ||
| NiftyupNFT clone = NiftyupNFT(Clones.clone(address(implementation))); | ||
| clone.initialize(_owner); | ||
|
|
||
| emit CreatedNFT(msg.sender, _owner, address(clone)); | ||
|
|
||
| return address(clone); | ||
| } | ||
| } | ||
This file contains hidden or 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 contains hidden or 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,35 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity >=0.4.24 <0.8.0; | ||
|
|
||
|
|
||
| /** | ||
| * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed | ||
| * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an | ||
| * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer | ||
| * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. | ||
| * | ||
| * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as | ||
| * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. | ||
| * | ||
| * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure | ||
| * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. | ||
| * | ||
| * Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/8e0296096449d9b1cd7c5631e917330635244c37/contracts/proxy/Initializable.sol | ||
| * | ||
| */ | ||
| abstract contract Initializable { | ||
| /** | ||
| * @dev Indicates that the contract has been initialized. | ||
| */ | ||
| bool private _initialized; | ||
|
|
||
| /** | ||
| * @dev Modifier to protect an initializer function from being invoked twice. | ||
| */ | ||
| modifier initializer() { | ||
| require(!_initialized, "Initializable: contract is already initialized"); | ||
| _initialized = true; | ||
|
|
||
| _; | ||
| } | ||
| } |
This file contains hidden or 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,76 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.7.0; | ||
|
|
||
|
|
||
| /** | ||
| * @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. | ||
| * | ||
| * Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/e6f26b46fc8015f1b9b09bb85297464069302125/contracts/access/Ownable.sol | ||
| * | ||
| */ | ||
| abstract contract Ownable { | ||
| address private _owner; | ||
|
|
||
| event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); | ||
|
|
||
| /** | ||
| * @dev Initializes the contract setting the deployer as the initial owner. | ||
| */ | ||
| constructor() { | ||
| _transferOwnership(msg.sender); | ||
| } | ||
|
|
||
| /** | ||
| * @dev Returns the address of the current owner. | ||
| */ | ||
| function owner() public view virtual returns (address) { | ||
| return _owner; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Throws if called by any account other than the owner. | ||
| */ | ||
| modifier onlyOwner() { | ||
| require(owner() == msg.sender, "Ownable: caller is not the owner"); | ||
| _; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Leaves the contract without owner. It will not be possible to call | ||
| * `onlyOwner` functions anymore. Can only be called by the current owner. | ||
| * | ||
| * NOTE: Renouncing ownership will leave the contract without an owner, | ||
| * thereby removing 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); | ||
| } | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,71 @@ | ||
| "use strict"; | ||
| /* Autogenerated file. Do not edit manually. */ | ||
| /* tslint:disable */ | ||
| /* eslint-disable */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Ownable__factory = void 0; | ||
| const ethers_1 = require("ethers"); | ||
| const _abi = [ | ||
| { | ||
| anonymous: false, | ||
| inputs: [ | ||
| { | ||
| indexed: true, | ||
| internalType: "address", | ||
| name: "previousOwner", | ||
| type: "address", | ||
| }, | ||
| { | ||
| indexed: true, | ||
| internalType: "address", | ||
| name: "newOwner", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| name: "OwnershipTransferred", | ||
| type: "event", | ||
| }, | ||
| { | ||
| inputs: [], | ||
| name: "owner", | ||
| outputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| stateMutability: "view", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [], | ||
| name: "renounceOwnership", | ||
| outputs: [], | ||
| stateMutability: "nonpayable", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "newOwner", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| name: "transferOwnership", | ||
| outputs: [], | ||
| stateMutability: "nonpayable", | ||
| type: "function", | ||
| }, | ||
| ]; | ||
| class Ownable__factory { | ||
| static createInterface() { | ||
| return new ethers_1.utils.Interface(_abi); | ||
| } | ||
| static connect(address, signerOrProvider) { | ||
| return new ethers_1.Contract(address, _abi, signerOrProvider); | ||
| } | ||
| } | ||
| exports.Ownable__factory = Ownable__factory; | ||
| Ownable__factory.abi = _abi; |
This file contains hidden or 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,5 +1,9 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.NiftyupNFT__factory = void 0; | ||
| exports.Ownable__factory = exports.NiftyupNFT__factory = exports.NiftyupFactory__factory = void 0; | ||
| var NiftyupFactory__factory_1 = require("./factories/NiftyupFactory__factory"); | ||
| Object.defineProperty(exports, "NiftyupFactory__factory", { enumerable: true, get: function () { return NiftyupFactory__factory_1.NiftyupFactory__factory; } }); | ||
| var NiftyupNFT__factory_1 = require("./factories/NiftyupNFT__factory"); | ||
| Object.defineProperty(exports, "NiftyupNFT__factory", { enumerable: true, get: function () { return NiftyupNFT__factory_1.NiftyupNFT__factory; } }); | ||
| var Ownable__factory_1 = require("./factories/Ownable__factory"); | ||
| Object.defineProperty(exports, "Ownable__factory", { enumerable: true, get: function () { return Ownable__factory_1.Ownable__factory; } }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.