Merge branch 'feat/fleek-erc721' into test/foundry
This commit is contained in:
commit
47c0b8d1bb
|
|
@ -10,4 +10,4 @@ package-lock.json
|
|||
|
||||
# Foundry
|
||||
out
|
||||
forge-cache
|
||||
forge-cache
|
||||
|
|
|
|||
|
|
@ -139,6 +139,35 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
|||
return super.supportsInterface(interfaceId);
|
||||
}
|
||||
|
||||
function transferFrom(
|
||||
address from,
|
||||
address to,
|
||||
uint256 tokenId
|
||||
) public virtual override {
|
||||
super.transferFrom(from, to, tokenId);
|
||||
_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 to,
|
||||
uint256 tokenId,
|
||||
bytes memory data
|
||||
) public virtual override {
|
||||
super._safeTransfer(from, to, tokenId, data);
|
||||
_clearTokenControllers(tokenId);
|
||||
}
|
||||
|
||||
|
||||
function _baseURI() internal view virtual override returns (string memory) {
|
||||
return "data:application/json;base64,";
|
||||
}
|
||||
|
|
@ -212,4 +241,10 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
|||
delete _apps[tokenId];
|
||||
}
|
||||
}
|
||||
|
||||
function _clearTokenControllers(
|
||||
uint256 tokenId
|
||||
) internal {
|
||||
// TODO: Remove token controllers from AccessControl
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
// npx hardhat run scripts/mint.js --network polygonMumbai
|
||||
|
||||
// TODO: make this arguments
|
||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
||||
const params = [
|
||||
'0x7ED735b7095C05d78dF169F991f2b7f1A1F1A049', // to
|
||||
'Fleek App', // name
|
||||
'Description', // description
|
||||
'https://fleek.network/fleek-network-logo-minimal.png', // image
|
||||
'https://fleek.co/', // external url
|
||||
'fleek.eth', // ens
|
||||
'6ea6ad16c46ae85faced7e50555ff7368422f57', // commit hash
|
||||
'https://github.com/org/repo', // repo
|
||||
'fleek', // author
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const contract = await hre.ethers.getContractAt(
|
||||
'FleekERC721',
|
||||
contractAddress
|
||||
);
|
||||
|
||||
const transaction = await contract.mint(...params);
|
||||
|
||||
console.log('Response: ', transaction);
|
||||
})();
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// npx hardhat run scripts/tokenURI.js --network polygonMumbai
|
||||
|
||||
// TODO: make this arguments
|
||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
||||
const tokenId = 3;
|
||||
|
||||
(async () => {
|
||||
const contract = await hre.ethers.getContractAt(
|
||||
'FleekERC721',
|
||||
contractAddress
|
||||
);
|
||||
|
||||
const transaction = await contract.tokenURI(tokenId);
|
||||
|
||||
const parsed = JSON.parse(
|
||||
Buffer.from(transaction.slice(29), 'base64').toString('utf-8')
|
||||
);
|
||||
|
||||
console.log('Response: ', parsed);
|
||||
})();
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// npx hardhat run scripts/upgrade.js --network polygonMumbai
|
||||
|
||||
// TODO: make this arguments
|
||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
||||
const params = [
|
||||
3, // tokenId
|
||||
'97e7908f70f0862d753c66689ff09e70caa43df2', // commit hash
|
||||
'https://github.com/org/new-repo', // repo
|
||||
'new-author', // author
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const contract = await hre.ethers.getContractAt(
|
||||
'FleekERC721',
|
||||
contractAddress
|
||||
);
|
||||
|
||||
const transaction = await contract.upgradeTokenBuild(...params);
|
||||
|
||||
console.log('Response: ', transaction);
|
||||
})();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
public
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
overrides: [],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['react', '@typescript-eslint', 'simple-import-sort'],
|
||||
rules: {
|
||||
'@typescript-eslint/explicit-function-return-type': [
|
||||
'error',
|
||||
{ allowExpressions: true },
|
||||
],
|
||||
'@typescript-eslint/no-namespace': 'off',
|
||||
'simple-import-sort/imports': 2,
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'no-console': 'error',
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
dist
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"semi": true,
|
||||
"useTabs": false,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"endOfLine": "crlf"
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/svg+xml"
|
||||
href="https://lh3.googleusercontent.com/a-/ACNPEu94rLyADmAJ80HamM8yp4ddV3AzoaMz3whdBH0D=s80-p"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Minimal UI for Sites as NFTs. Fleek XYZ"
|
||||
/>
|
||||
<title>Sites as NFTS</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "sites-as-nfts",
|
||||
"version": "0.0.1",
|
||||
"description": "Minimal UI for sites as NFTs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"author": "Fleek",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"path": "^0.12.7",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.2.3",
|
||||
"@types/node": "^18.11.9",
|
||||
"@types/react": "^18.0.25",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||
"@typescript-eslint/parser": "^5.45.0",
|
||||
"@vitejs/plugin-react": "^2.2.0",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.6",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"prettier": "^2.8.0",
|
||||
"ts-loader": "^9.4.1",
|
||||
"typescript": "^4.9.3",
|
||||
"vite": "^3.2.4",
|
||||
"vite-tsconfig-paths": "^3.6.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.main {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import React from 'react';
|
||||
import './App.css';
|
||||
|
||||
export const App = () => {
|
||||
return (
|
||||
<div className="main">
|
||||
<h1>Welcome to Sites as NFTs by Fleek</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
:root {
|
||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import { App } from './App';
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
);
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "ES2020",
|
||||
"target": "ESNext",
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"rootDirs": ["src"],
|
||||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@/*": ["*"]
|
||||
},
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"skipLibCheck": true,
|
||||
"isolatedModules": true,
|
||||
"types": ["vite/client"]
|
||||
},
|
||||
"include": ["./src", "./*.ts"]
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tsconfigPaths()],
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue