fix merge conflicts.
This commit is contained in:
commit
d1621cea50
|
|
@ -4,6 +4,7 @@ node_modules
|
||||||
# hardhat
|
# hardhat
|
||||||
cache
|
cache
|
||||||
artifacts
|
artifacts
|
||||||
|
deployments/localhost
|
||||||
|
|
||||||
# NPM
|
# NPM
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "lib/forge-std"]
|
||||||
|
path = lib/forge-std
|
||||||
|
url = https://github.com/foundry-rs/forge-std
|
||||||
|
|
@ -40,10 +40,21 @@ abstract contract FleekAccessControl is AccessControl {
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isTokenController(
|
||||||
|
uint256 tokenId,
|
||||||
|
address account
|
||||||
|
) public view returns (bool) {
|
||||||
|
return hasRole(_tokenRole(tokenId, "CONTROLLER"), account);
|
||||||
|
}
|
||||||
|
|
||||||
function _tokenRole(
|
function _tokenRole(
|
||||||
uint256 tokenId,
|
uint256 tokenId,
|
||||||
string memory role
|
string memory role
|
||||||
) internal pure returns (bytes32) {
|
) internal pure returns (bytes32) {
|
||||||
return keccak256(abi.encodePacked("TOKEN_", role, tokenId));
|
return keccak256(abi.encodePacked("TOKEN_", role, tokenId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _clearTokenControllers(uint256 tokenId) internal {
|
||||||
|
// TODO: Remove token controllers from AccessControl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
using Counters for Counters.Counter;
|
using Counters for Counters.Counter;
|
||||||
|
|
||||||
event NewBuild(uint256 indexed token, string indexed commit_hash);
|
event NewBuild(uint256 indexed token, string indexed commit_hash);
|
||||||
|
|
||||||
event NewTokenName(uint256 indexed token, string indexed name);
|
event NewTokenName(uint256 indexed token, string indexed name);
|
||||||
event NewTokenDescription(uint256 indexed token, string indexed description);
|
event NewTokenDescription(uint256 indexed token, string indexed description);
|
||||||
event NewTokenImage(uint256 indexed token, string indexed image);
|
event NewTokenImage(uint256 indexed token, string indexed image);
|
||||||
|
|
@ -139,35 +138,31 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
return super.supportsInterface(interfaceId);
|
return super.supportsInterface(interfaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferFrom(
|
/**
|
||||||
address from,
|
* @dev Override of _beforeTokenTransfer of ERC721.
|
||||||
address to,
|
* Here it needs to update the token controller roles for mint, burn and transfer.
|
||||||
uint256 tokenId
|
* IMPORTANT: The function for clearing token controllers is not implemented yet.
|
||||||
) public virtual override {
|
*/
|
||||||
super.transferFrom(from, to, tokenId);
|
function _beforeTokenTransfer(
|
||||||
_clearTokenControllers(tokenId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function safeTransferFrom(
|
|
||||||
address from,
|
|
||||||
address to,
|
|
||||||
uint256 tokenId
|
|
||||||
) public virtual override {
|
|
||||||
super.safeTransferFrom(from, to, tokenId, "");
|
|
||||||
_clearTokenControllers(tokenId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function safeTransferFrom(
|
|
||||||
address from,
|
address from,
|
||||||
address to,
|
address to,
|
||||||
uint256 tokenId,
|
uint256 tokenId,
|
||||||
bytes memory data
|
uint256 batchSize
|
||||||
) public virtual override {
|
) internal virtual override {
|
||||||
super._safeTransfer(from, to, tokenId, data);
|
if (from != address(0) && to != address(0)) {
|
||||||
_clearTokenControllers(tokenId);
|
// Transfer
|
||||||
|
_clearTokenControllers(tokenId);
|
||||||
|
_grantRole(_tokenRole(tokenId, "CONTROLLER"), to);
|
||||||
|
} else if (from == address(0)) {
|
||||||
|
// Mint
|
||||||
|
_grantRole(_tokenRole(tokenId, "CONTROLLER"), to);
|
||||||
|
} else if (to == address(0)) {
|
||||||
|
// Burn
|
||||||
|
_clearTokenControllers(tokenId);
|
||||||
|
}
|
||||||
|
super._beforeTokenTransfer(from, to, tokenId, batchSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function _baseURI() internal view virtual override returns (string memory) {
|
function _baseURI() internal view virtual override returns (string memory) {
|
||||||
return "data:application/json;base64,";
|
return "data:application/json;base64,";
|
||||||
}
|
}
|
||||||
|
|
@ -230,21 +225,10 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
function burn(
|
function burn(
|
||||||
uint256 tokenId
|
uint256 tokenId
|
||||||
) public virtual requireTokenOwner(tokenId) {
|
) public virtual requireTokenOwner(tokenId) {
|
||||||
_requireMinted(tokenId);
|
|
||||||
require(
|
|
||||||
ownerOf(tokenId) == msg.sender,
|
|
||||||
"FleekERC721: must be token owner"
|
|
||||||
);
|
|
||||||
super._burn(tokenId);
|
super._burn(tokenId);
|
||||||
|
|
||||||
if (bytes(_apps[tokenId].external_url).length != 0) {
|
if (bytes(_apps[tokenId].external_url).length != 0) {
|
||||||
delete _apps[tokenId];
|
delete _apps[tokenId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _clearTokenControllers(
|
|
||||||
uint256 tokenId
|
|
||||||
) internal {
|
|
||||||
// TODO: Remove token controllers from AccessControl
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
80001
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -25,7 +25,7 @@ const config: HardhatUserConfig = {
|
||||||
localhost: {
|
localhost: {
|
||||||
chainId: 31337,
|
chainId: 31337,
|
||||||
},
|
},
|
||||||
polygonMumbai: {
|
mumbai: {
|
||||||
url: API_URL,
|
url: API_URL,
|
||||||
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [],
|
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [],
|
||||||
saveDeployments: true,
|
saveDeployments: true,
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "hardhat test",
|
"test": "hardhat test && forge test --via-ir",
|
||||||
|
"test:foundry": "forge test --via-ir",
|
||||||
|
"test:hardhat": "hardhat test",
|
||||||
"format": "prettier --write \"./**/*.{js,ts,sol}\"",
|
"format": "prettier --write \"./**/*.{js,ts,sol}\"",
|
||||||
"node:hh": "hardhat node --tags local",
|
"node:hardhat": "hardhat node --tags local",
|
||||||
"deploy:local": "hardhat deploy --tags local",
|
"deploy:local": "hardhat deploy --tags local",
|
||||||
"deploy:mumbai": "hardhat deploy --tags mumbai",
|
"deploy:mumbai": "hardhat deploy --tags mumbai --network mumbai",
|
||||||
"interact": "npx hardhat run deploy/interact.js --network hardhat",
|
|
||||||
"compile": "hardhat compile"
|
"compile": "hardhat compile"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// npx hardhat run scripts/mint.js --network polygonMumbai
|
// npx hardhat run scripts/mint.js --network mumbai
|
||||||
|
const { getContract } = require('./util');
|
||||||
|
|
||||||
// TODO: make this arguments
|
// TODO: make this arguments
|
||||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
|
||||||
const params = [
|
const params = [
|
||||||
'0x7ED735b7095C05d78dF169F991f2b7f1A1F1A049', // to
|
'0x7ED735b7095C05d78dF169F991f2b7f1A1F1A049', // to
|
||||||
'Fleek App', // name
|
'Fleek App', // name
|
||||||
|
|
@ -15,10 +15,7 @@ const params = [
|
||||||
];
|
];
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const contract = await hre.ethers.getContractAt(
|
const contract = getContract('FleekERC721');
|
||||||
'FleekERC721',
|
|
||||||
contractAddress
|
|
||||||
);
|
|
||||||
|
|
||||||
const transaction = await contract.mint(...params);
|
const transaction = await contract.mint(...params);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
// npx hardhat run scripts/tokenURI.js --network polygonMumbai
|
// npx hardhat run scripts/tokenURI.js --network mumbai
|
||||||
|
const { getContract } = require('./util');
|
||||||
|
|
||||||
// TODO: make this arguments
|
// TODO: make this arguments
|
||||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
const tokenId = 1;
|
||||||
const tokenId = 3;
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const contract = await hre.ethers.getContractAt(
|
const contract = await getContract('FleekERC721');
|
||||||
'FleekERC721',
|
|
||||||
contractAddress
|
|
||||||
);
|
|
||||||
|
|
||||||
const transaction = await contract.tokenURI(tokenId);
|
const transaction = await contract.tokenURI(tokenId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,18 @@
|
||||||
// npx hardhat run scripts/upgrade.js --network polygonMumbai
|
// npx hardhat run scripts/upgrade.js --network mumbai
|
||||||
|
const { getContract } = require('./util');
|
||||||
|
|
||||||
// TODO: make this arguments
|
// TODO: make this arguments
|
||||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
|
||||||
const params = [
|
const params = [
|
||||||
3, // tokenId
|
1, // tokenId
|
||||||
'97e7908f70f0862d753c66689ff09e70caa43df2', // commit hash
|
'97e7908f70f0862d753c66689ff09e70caa43df2', // commit hash
|
||||||
'https://github.com/org/new-repo', // repo
|
'https://github.com/org/new-repo', // repo
|
||||||
'new-author', // author
|
'new-author', // author
|
||||||
];
|
];
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const contract = await hre.ethers.getContractAt(
|
const contract = await getContract('FleekERC721');
|
||||||
'FleekERC721',
|
|
||||||
contractAddress
|
|
||||||
);
|
|
||||||
|
|
||||||
const transaction = await contract.upgradeTokenBuild(...params);
|
const transaction = await contract.setTokenBuild(...params);
|
||||||
|
|
||||||
console.log('Response: ', transaction);
|
console.log('Response: ', transaction);
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
module.exports.getContract = async function (contractName) {
|
||||||
|
const {
|
||||||
|
address,
|
||||||
|
} = require(`../deployments/${hre.network.name}/${contractName}.json`);
|
||||||
|
|
||||||
|
return hre.ethers.getContractAt(contractName, address);
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue