package-installer-cli 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bundle-standalone/cli-with-packages.js +568 -369
- data/bundle-standalone/template.json +87 -14
- data/bundle-standalone/templates/c++_c/crow/template/CMakeLists.txt +18 -0
- data/bundle-standalone/templates/c++_c/crow/template/README.md +11 -0
- data/bundle-standalone/templates/c++_c/crow/template/include/routes.hpp +19 -0
- data/bundle-standalone/templates/c++_c/crow/template/main.cpp +12 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/README.md +36 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/eslint.config.mjs +16 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/middleware.ts +18 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/next.config.ts +7 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/package.json +28 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/pnpm-lock.yaml +3819 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/postcss.config.mjs +5 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/public/file.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/public/globe.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/public/next.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/public/vercel.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/public/window.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/src/app/favicon.ico +0 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/src/app/globals.css +26 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/src/app/layout.tsx +34 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/src/app/page.tsx +33 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/src/lib/auth0.ts +3 -0
- data/bundle-standalone/templates/combination-templates/nextjs-auth0-shadcn/tsconfig.json +27 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/README.md +36 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/components.json +21 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/eslint.config.mjs +16 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/middleware.ts +12 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/next.config.ts +7 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/package.json +37 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/pnpm-lock.yaml +4113 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/postcss.config.mjs +5 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/public/file.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/public/globe.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/public/next.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/public/vercel.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/public/window.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/app/favicon.ico +0 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/app/globals.css +122 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/app/layout.tsx +55 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/app/page.tsx +10 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/components/ui/button.tsx +59 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/components/ui/card.tsx +92 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/components/ui/input.tsx +21 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/components/ui/textarea.tsx +18 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/lib/utils.ts +6 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/src/middleware.ts +12 -0
- data/bundle-standalone/templates/combination-templates/nextjs-clerk-shadcn/tsconfig.json +27 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/README.md +36 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/eslint.config.mjs +16 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/middleware.ts +0 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/next.config.ts +7 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/package.json +28 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/pnpm-lock.yaml +3862 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/postcss.config.mjs +5 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/public/file.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/public/globe.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/public/next.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/public/vercel.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/public/window.svg +1 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/app/api/auth/[...nextauth]/route.ts +6 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/app/favicon.ico +0 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/app/globals.css +26 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/app/layout.tsx +39 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/app/page.tsx +10 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/lib/auth-provider.tsx +7 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/src/lib/auth.ts +126 -0
- data/bundle-standalone/templates/combination-templates/nextjs-next-auth-shadcn/tsconfig.json +27 -0
- data/bundle-standalone/templates/game/unity/template/README.md +3 -0
- data/bundle-standalone/templates/game/unity/template/Scripts/PlayerController.cs +25 -0
- data/bundle-standalone/templates/game/unreal/template/README.md +3 -0
- data/bundle-standalone/templates/game/unreal/template/Source/PlayerCharacter.cpp +33 -0
- data/bundle-standalone/templates/game/unreal/template/Source/PlayerCharacter.h +20 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/index.html +13 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/package.json +18 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/public/vite.svg +1 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/src/app.css +25 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/src/app.jsx +43 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/src/assets/preact.svg +1 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/src/index.css +68 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/src/main.jsx +5 -0
- data/bundle-standalone/templates/javascript/preactjs/javascript/template/vite.config.js +7 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/index.html +13 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/package.json +20 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/public/vite.svg +1 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/src/app.css +25 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/src/app.tsx +43 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/src/assets/preact.svg +1 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/src/index.css +68 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/src/main.tsx +5 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/tsconfig.app.json +33 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/tsconfig.json +7 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/tsconfig.node.json +26 -0
- data/bundle-standalone/templates/javascript/preactjs/typescript/template/vite.config.ts +7 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/README.md +28 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/index.html +13 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/package.json +18 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/public/vite.svg +1 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/src/App.css +27 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/src/App.jsx +35 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/src/assets/solid.svg +1 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/src/index.css +68 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/src/index.jsx +8 -0
- data/bundle-standalone/templates/javascript/solidjs/javascript/template/vite.config.js +6 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/README.md +28 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/index.html +13 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/package.json +20 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/public/vite.svg +1 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/src/App.css +27 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/src/App.tsx +35 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/src/assets/solid.svg +1 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/src/index.css +68 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/src/index.tsx +8 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/tsconfig.app.json +29 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/tsconfig.json +7 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/tsconfig.node.json +26 -0
- data/bundle-standalone/templates/javascript/solidjs/typescript/template/vite.config.ts +6 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/README.md +43 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/index.html +13 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/jsconfig.json +33 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/package.json +16 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/public/vite.svg +1 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/src/App.svelte +47 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/src/app.css +79 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/src/assets/svelte.svg +1 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/src/lib/Counter.svelte +10 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/src/main.js +9 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/svelte.config.js +8 -0
- data/bundle-standalone/templates/javascript/sveltejs/javascript/template/vite.config.js +7 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/README.md +47 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/index.html +13 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/package.json +21 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/public/vite.svg +1 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/src/App.svelte +47 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/src/app.css +79 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/src/assets/svelte.svg +1 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/src/lib/Counter.svelte +10 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/src/main.ts +9 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/svelte.config.js +8 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/tsconfig.app.json +21 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/tsconfig.json +7 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/tsconfig.node.json +26 -0
- data/bundle-standalone/templates/javascript/sveltejs/typescript/template/vite.config.ts +7 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/README.md +50 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/app/(tabs)/_layout.jsx +35 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/app/(tabs)/explore.jsx +112 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/app/(tabs)/index.jsx +98 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/app/_layout.jsx +24 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/app/modal.jsx +29 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/app.json +48 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/android-icon-background.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/android-icon-foreground.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/android-icon-monochrome.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/favicon.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/icon.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/partial-react-logo.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/react-logo.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/react-logo@2x.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/react-logo@3x.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/assets/images/splash-icon.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/external-link.jsx +25 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/haptic-tab.jsx +18 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/hello-wave.jsx +19 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/parallax-scroll-view.jsx +79 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/themed-text.jsx +60 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/themed-view.jsx +14 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/ui/collapsible.jsx +45 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/ui/icon-symbol.ios.jsx +32 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/components/ui/icon-symbol.jsx +41 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/constants/theme.js +53 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/eslint.config.js +10 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/hooks/use-color-scheme.js +1 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/hooks/use-color-scheme.web.js +21 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/hooks/use-theme-color.js +21 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/jsconfig.json +17 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/package.json +47 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/pnpm-workspace.yaml +1 -0
- data/bundle-standalone/templates/mobile/react-native/javascript/expo-cli-template/scripts/reset-project.js +112 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/README.md +50 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/app/(tabs)/_layout.tsx +35 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/app/(tabs)/explore.tsx +112 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/app/(tabs)/index.tsx +98 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/app/_layout.tsx +24 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/app/modal.tsx +29 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/app.json +48 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/android-icon-background.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/android-icon-foreground.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/android-icon-monochrome.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/favicon.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/icon.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/partial-react-logo.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/react-logo.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/react-logo@2x.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/react-logo@3x.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/assets/images/splash-icon.png +0 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/external-link.tsx +25 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/haptic-tab.tsx +18 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/hello-wave.tsx +19 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/parallax-scroll-view.tsx +79 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/themed-text.tsx +60 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/themed-view.tsx +14 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/ui/collapsible.tsx +45 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/ui/icon-symbol.ios.tsx +32 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/components/ui/icon-symbol.tsx +41 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/constants/theme.ts +53 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/eslint.config.js +10 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/hooks/use-color-scheme.ts +1 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/hooks/use-color-scheme.web.ts +21 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/hooks/use-theme-color.ts +21 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/package.json +47 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/pnpm-workspace.yaml +1 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/scripts/reset-project.js +112 -0
- data/bundle-standalone/templates/mobile/react-native/typescript/expo-cli-template/tsconfig.json +17 -0
- data/bundle-standalone/templates/python/bottle/template/README.md +0 -0
- data/bundle-standalone/templates/python/bottle/template/main.py +6 -0
- data/bundle-standalone/templates/python/bottle/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/dash/template/README.md +0 -0
- data/bundle-standalone/templates/python/dash/template/main.py +6 -0
- data/bundle-standalone/templates/python/dash/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/falcon/template/README.md +0 -0
- data/bundle-standalone/templates/python/falcon/template/main.py +6 -0
- data/bundle-standalone/templates/python/falcon/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/fastapi/template/README.md +0 -0
- data/bundle-standalone/templates/python/fastapi/template/main.py +27 -0
- data/bundle-standalone/templates/python/fastapi/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/pyramid/template/README.md +0 -0
- data/bundle-standalone/templates/python/pyramid/template/main.py +6 -0
- data/bundle-standalone/templates/python/pyramid/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/quart/template/README.md +0 -0
- data/bundle-standalone/templates/python/quart/template/main.py +6 -0
- data/bundle-standalone/templates/python/quart/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/streamlit/template/README.md +0 -0
- data/bundle-standalone/templates/python/streamlit/template/main.py +6 -0
- data/bundle-standalone/templates/python/streamlit/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/python/tornado/template/README.md +0 -0
- data/bundle-standalone/templates/python/tornado/template/main.py +6 -0
- data/bundle-standalone/templates/python/tornado/template/pyproject.toml +7 -0
- data/bundle-standalone/templates/template.json +87 -14
- data/bundle-standalone/templates/web3/anchor/template/Anchor.toml +6 -0
- data/bundle-standalone/templates/web3/anchor/template/Cargo.toml +23 -0
- data/bundle-standalone/templates/web3/anchor/template/README.md +10 -0
- data/bundle-standalone/templates/web3/anchor/template/migrations/deploy.ts +27 -0
- data/bundle-standalone/templates/web3/anchor/template/programs/mysolanaapp/src/lib.rs +40 -0
- data/bundle-standalone/templates/web3/anchor/template/tests/mysolanaapp.ts +26 -0
- data/bundle-standalone/templates/web3/ethersjs/template/README.md +12 -0
- data/bundle-standalone/templates/web3/ethersjs/template/contracts/SimpleStorage.sol +17 -0
- data/bundle-standalone/templates/web3/ethersjs/template/hardhat.config.js +8 -0
- data/bundle-standalone/templates/web3/ethersjs/template/package.json +29 -0
- data/bundle-standalone/templates/web3/ethersjs/template/scripts/deploy.ts +18 -0
- data/bundle-standalone/templates/web3/ethersjs/template/scripts/interact.ts +17 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/01_data-types/DataTypes.sol +37 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/01_data-types/SolidityOperations.sol +48 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/02_contructors/Constructor.sol +16 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/03_variables/Variables.sol +31 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/04_functions/Functions.sol +19 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/05_visibility/FunctionVisibility.sol +39 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/06_pure_and_view_functions/PureAndViewFunction.sol +19 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/07_function_modifiers/Modifiers.sol +27 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/09_events/Events.sol +19 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/10_error_handling/ErrorHandling.sol +25 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/11_fallback_function/Fallback.sol +7 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/12_for_loop/ForLoop.sol +15 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/13_array/Array.sol +40 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/14_mapping/Mapping.sol +21 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/14_mapping/NestedMapping.sol +25 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/15_enum/Enum.sol +22 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/16_struct/Struct.sol +23 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/17_payable_modifier/Payable.sol +26 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/18_imports/Contract1.sol +15 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/18_imports/Contract2.sol +11 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/19_contract_cleanup/Cleanup.sol +18 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/20_memory_and_storage/MemoryAndStorage.sol +20 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/21_inheritance/Inheritance.sol +67 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/22_if_statement/if-statement.sol +22 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/23_libraries/libraries.sol +31 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/23_libraries/safemath.sol +116 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/24_interface/interface.sol +88 -0
- data/bundle-standalone/templates/web3/solidity/solidity-learning/README.md +423 -0
- data/bundle-standalone/templates/web3/solidity/uniswap-simple-swap/SimpleSwap.sol +46 -0
- metadata +369 -93
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/App.jsx +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/Gemfile +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/README.md +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/__tests__/App.test.tsx +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/build.gradle +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/debug.keystore +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/proguard-rules.pro +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/AndroidManifest.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/java/com/template/MainActivity.kt +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/java/com/template/MainApplication.kt +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/values/strings.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/app/src/main/res/values/styles.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/build.gradle +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/gradle/wrapper/gradle-wrapper.properties +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/gradle.properties +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/gradlew +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/gradlew.bat +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/android/settings.gradle +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/app.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/babel.config.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/index.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/Podfile +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template/AppDelegate.swift +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template/Images.xcassets/Contents.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template/Info.plist +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template/LaunchScreen.storyboard +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template/PrivacyInfo.xcprivacy +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template.xcodeproj/project.pbxproj +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/ios/template.xcodeproj/xcshareddata/xcschemes/template.xcscheme +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/jest.config.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/metro.config.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/javascript/{template → react-native-cli-template}/package.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/App.tsx +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/Gemfile +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/README.md +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/__tests__/App.test.tsx +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/build.gradle +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/debug.keystore +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/proguard-rules.pro +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/AndroidManifest.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/java/com/template/MainActivity.kt +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/java/com/template/MainApplication.kt +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/values/strings.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/app/src/main/res/values/styles.xml +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/build.gradle +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/gradle/wrapper/gradle-wrapper.properties +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/gradle.properties +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/gradlew +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/gradlew.bat +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/android/settings.gradle +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/app.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/babel.config.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/index.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/Podfile +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template/AppDelegate.swift +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template/Images.xcassets/Contents.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template/Info.plist +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template/LaunchScreen.storyboard +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template/PrivacyInfo.xcprivacy +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template.xcodeproj/project.pbxproj +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/ios/template.xcodeproj/xcshareddata/xcschemes/template.xcscheme +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/jest.config.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/metro.config.js +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/package.json +0 -0
- /data/bundle-standalone/templates/mobile/react-native/typescript/{template → react-native-cli-template}/tsconfig.json +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
use anchor_lang::prelude::*;
|
|
2
|
+
|
|
3
|
+
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
|
|
4
|
+
|
|
5
|
+
#[program]
|
|
6
|
+
pub mod mysolanaapp {
|
|
7
|
+
use super::*;
|
|
8
|
+
|
|
9
|
+
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
|
|
10
|
+
let account = &mut ctx.accounts.base_account;
|
|
11
|
+
account.data = 42;
|
|
12
|
+
Ok(())
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
pub fn update(ctx: Context<Update>, data: u64) -> Result<()> {
|
|
16
|
+
let account = &mut ctx.accounts.base_account;
|
|
17
|
+
account.data = data;
|
|
18
|
+
Ok(())
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#[derive(Accounts)]
|
|
23
|
+
pub struct Initialize<'info> {
|
|
24
|
+
#[account(init, payer = user, space = 8 + 8)]
|
|
25
|
+
pub base_account: Account<'info, BaseAccount>,
|
|
26
|
+
#[account(mut)]
|
|
27
|
+
pub user: Signer<'info>,
|
|
28
|
+
pub system_program: Program<'info, System>,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#[derive(Accounts)]
|
|
32
|
+
pub struct Update<'info> {
|
|
33
|
+
#[account(mut)]
|
|
34
|
+
pub base_account: Account<'info, BaseAccount>,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[account]
|
|
38
|
+
pub struct BaseAccount {
|
|
39
|
+
pub data: u64,
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { Program } from "@coral-xyz/anchor";
|
|
3
|
+
import { Mysolanaapp } from "../target/types/mysolanaapp";
|
|
4
|
+
import assert from "assert";
|
|
5
|
+
|
|
6
|
+
describe("mysolanaapp", () => {
|
|
7
|
+
const provider = anchor.AnchorProvider.env();
|
|
8
|
+
anchor.setProvider(provider);
|
|
9
|
+
|
|
10
|
+
const program = anchor.workspace.Mysolanaapp as Program<Mysolanaapp>;
|
|
11
|
+
const baseAccount = anchor.web3.Keypair.generate();
|
|
12
|
+
|
|
13
|
+
it("Initialize the account!", async () => {
|
|
14
|
+
await program.methods.initialize()
|
|
15
|
+
.accounts({
|
|
16
|
+
baseAccount: baseAccount.publicKey,
|
|
17
|
+
user: provider.wallet.publicKey,
|
|
18
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
19
|
+
})
|
|
20
|
+
.signers([baseAccount])
|
|
21
|
+
.rpc();
|
|
22
|
+
|
|
23
|
+
const account = await program.account.baseAccount.fetch(baseAccount.publicKey);
|
|
24
|
+
assert.ok(account.data.eq(new anchor.BN(42)));
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Ethers.js + Solidity Template
|
|
2
|
+
|
|
3
|
+
This template includes:
|
|
4
|
+
- A basic Solidity contract (SimpleStorage)
|
|
5
|
+
- Deployment and interaction scripts using Ethers.js
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
```bash
|
|
9
|
+
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox ethers
|
|
10
|
+
npx hardhat compile
|
|
11
|
+
node scripts/deploy.js
|
|
12
|
+
node scripts/interact.js
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
contract SimpleStorage {
|
|
5
|
+
uint256 private data;
|
|
6
|
+
|
|
7
|
+
event DataUpdated(uint256 newValue);
|
|
8
|
+
|
|
9
|
+
function set(uint256 _data) public {
|
|
10
|
+
data = _data;
|
|
11
|
+
emit DataUpdated(_data);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function get() public view returns (uint256) {
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ethersjs-web3-template",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A simple template for Web3 projects using Ethers.js",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "node index.js",
|
|
9
|
+
"dev": "nodemon index.js",
|
|
10
|
+
"test": "echo \"No test specified\" && exit 0"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"web3",
|
|
14
|
+
"ethers",
|
|
15
|
+
"ethereum",
|
|
16
|
+
"smart-contract",
|
|
17
|
+
"blockchain",
|
|
18
|
+
"template"
|
|
19
|
+
],
|
|
20
|
+
"author": "Sharique Chaudhary",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"ethers": "^6.13.0",
|
|
24
|
+
"dotenv": "^16.4.5"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"nodemon": "^3.1.0"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
|
|
6
|
+
const wallet = new ethers.Wallet("YOUR_PRIVATE_KEY_HERE", provider);
|
|
7
|
+
|
|
8
|
+
const contractPath = path.resolve("artifacts/contracts/SimpleStorage.sol/SimpleStorage.json");
|
|
9
|
+
const contractJSON = JSON.parse(fs.readFileSync(contractPath, "utf8"));
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
const factory = new ethers.ContractFactory(contractJSON.abi, contractJSON.bytecode, wallet);
|
|
13
|
+
const contract = await factory.deploy();
|
|
14
|
+
await contract.waitForDeployment();
|
|
15
|
+
console.log("Contract deployed to:", contract.target);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
|
|
3
|
+
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
|
|
4
|
+
const contractAddress = "DEPLOYED_CONTRACT_ADDRESS";
|
|
5
|
+
const abi = [
|
|
6
|
+
"function set(uint256 _data) public",
|
|
7
|
+
"function get() public view returns (uint256)"
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const contract = new ethers.Contract(contractAddress, abi, provider);
|
|
11
|
+
|
|
12
|
+
async function readData() {
|
|
13
|
+
const value = await contract.get();
|
|
14
|
+
console.log("Stored value:", value.toString());
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
readData();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
pragma solidity ^0.8.0;
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
contract DataTypes {
|
|
5
|
+
// Boolean
|
|
6
|
+
bool public isTrue = true;
|
|
7
|
+
|
|
8
|
+
// Integer
|
|
9
|
+
int public myInt = -42; // int8 to int256
|
|
10
|
+
uint public myUint = 42; // uint8 to uint256
|
|
11
|
+
|
|
12
|
+
// Address
|
|
13
|
+
// this is my metamask ethereum public key
|
|
14
|
+
// you can me some ethereum
|
|
15
|
+
address public myAddress = 0x42B603B561606Af0FeE2eE10316bEA96722a060d;
|
|
16
|
+
|
|
17
|
+
// Bytes
|
|
18
|
+
bytes1 public myBytes1 = 0x12;
|
|
19
|
+
bytes32 public myBytes32 = 0x1234567890123456789012345678901234567890123456789012345678901234;
|
|
20
|
+
|
|
21
|
+
// String
|
|
22
|
+
string public myString = "Hello, Solidity!";
|
|
23
|
+
|
|
24
|
+
// Array
|
|
25
|
+
uint[] public myArray = [1, 2, 3, 4, 5];
|
|
26
|
+
|
|
27
|
+
// Struct
|
|
28
|
+
struct Person {
|
|
29
|
+
string name;
|
|
30
|
+
uint age;
|
|
31
|
+
}
|
|
32
|
+
Person public person = Person("Alice", 30);
|
|
33
|
+
|
|
34
|
+
// Enum
|
|
35
|
+
enum Status { Pending, Active, Inactive }
|
|
36
|
+
Status public status = Status.Active;
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
pragma solidity ^0.8.0;
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
contract Operations {
|
|
5
|
+
// Arithmetic Operations
|
|
6
|
+
uint256 public variable_add = 70;
|
|
7
|
+
uint256 public variable_sub = 50;
|
|
8
|
+
uint256 public variable_mul = 25;
|
|
9
|
+
uint256 public variable_div = 80;
|
|
10
|
+
uint256 public variable_mod = 68;
|
|
11
|
+
|
|
12
|
+
function getResults() public {
|
|
13
|
+
variable_add += 25;
|
|
14
|
+
variable_sub -= 30;
|
|
15
|
+
variable_mul *= 25;
|
|
16
|
+
variable_div /= 5;
|
|
17
|
+
variable_mod %= 60;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
uint256 public a = 10;
|
|
22
|
+
uint256 public b = 90;
|
|
23
|
+
// Comparison Operations
|
|
24
|
+
function isEqual(uint256 x, uint256 y) public pure returns (bool) {
|
|
25
|
+
return x == y;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isGreater(uint256 x, uint256 y) public pure returns (bool) {
|
|
29
|
+
return x > y;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isLess(uint256 x, uint256 y) public pure returns (bool) {
|
|
33
|
+
return x < y;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Logical Operations
|
|
37
|
+
function and(bool x, bool y) public pure returns (bool) {
|
|
38
|
+
return x && y;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function or(bool x, bool y) public pure returns (bool) {
|
|
42
|
+
return x || y;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function not(bool x) public pure returns (bool) {
|
|
46
|
+
return !x;
|
|
47
|
+
}
|
|
48
|
+
}
|
data/bundle-standalone/templates/web3/solidity/solidity-learning/02_contructors/Constructor.sol
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pragma solidity ^0.8.0;
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
contract Constructor {
|
|
5
|
+
uint256 public x;
|
|
6
|
+
uint256 public y;
|
|
7
|
+
address public owner;
|
|
8
|
+
uint256 public createdAt;
|
|
9
|
+
|
|
10
|
+
constructor(uint256 _x, uint256 _y) {
|
|
11
|
+
x = _x;
|
|
12
|
+
y = _y;
|
|
13
|
+
owner = msg.sender;
|
|
14
|
+
createdAt = block.timestamp;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/variables-in-solidity-smart-contracts/
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract SampleContract {
|
|
8
|
+
//state variable of data type unint declared called "storedData"
|
|
9
|
+
//Data in this variable will be saved to the block chain
|
|
10
|
+
uint256 public storedData;
|
|
11
|
+
|
|
12
|
+
function getResult() public pure returns (uint256) {
|
|
13
|
+
//local variable
|
|
14
|
+
uint256 a = 7;
|
|
15
|
+
//local variable
|
|
16
|
+
uint256 b = 3;
|
|
17
|
+
uint256 result = a + b;
|
|
18
|
+
//access the local variable
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getSenderOfTransaction() public view returns (address) {
|
|
23
|
+
//access global variables
|
|
24
|
+
return msg.sender;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getChainId() public view returns (uint256) {
|
|
28
|
+
//access global variables
|
|
29
|
+
return block.chainid;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/functions
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
string private name;
|
|
9
|
+
|
|
10
|
+
//Functions that create transaction on block chain
|
|
11
|
+
function setName(string memory newName) public {
|
|
12
|
+
name = newName;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//Functions that do not create transaction on block chain (view and pure)
|
|
16
|
+
function getName() public view returns (string memory) {
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/visibility
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
// Private – A private function/state variable is only available inside the contract that defines it. It is generally good practice to keep functions private.
|
|
9
|
+
// Internal – A internal function/state variable is only available inside the contract that defines it AND any contracts that inherit it
|
|
10
|
+
// External – An external function can only be called by external contacts. Not visible inside the contract that defines it.
|
|
11
|
+
// Public – A public function/state variable is available to any contract or third party that wants to call it. Public is the default if visibility is not specified.
|
|
12
|
+
|
|
13
|
+
// private state variable
|
|
14
|
+
string private name;
|
|
15
|
+
uint256 internal age = 35;
|
|
16
|
+
string public id = "123";
|
|
17
|
+
|
|
18
|
+
// public function
|
|
19
|
+
function setName(string memory newName) public {
|
|
20
|
+
name = newName;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// public function
|
|
24
|
+
function getName() public view returns (string memory) {
|
|
25
|
+
return name;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getAge() public view returns (uint256) {
|
|
29
|
+
return privateFunction();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function privateFunction() private view returns (uint256) {
|
|
33
|
+
return age;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function externalFunction() external pure returns (string memory) {
|
|
37
|
+
return "external-function";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/pure-and-view
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
string private name = "John Doe";
|
|
9
|
+
|
|
10
|
+
// View functions are read only functions and do not modify the state of the block chain. In other words if you want to read data from the block chain one can use view.
|
|
11
|
+
function getName() public view returns (string memory) {
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Pure functions are more restrictive then view functions and do not modify the state AND do not read the state of the block chain.
|
|
16
|
+
function sum(int256 a, int256 b) public pure returns (int256) {
|
|
17
|
+
return a + b;
|
|
18
|
+
}
|
|
19
|
+
}
|
data/bundle-standalone/templates/web3/solidity/solidity-learning/07_function_modifiers/Modifiers.sol
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/function-modifiers
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
address public owner;
|
|
9
|
+
string private name;
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
owner = msg.sender;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
modifier onlyOwner() {
|
|
16
|
+
require(msg.sender == owner, "Not owner");
|
|
17
|
+
_;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function setName(string memory newName) public onlyOwner {
|
|
21
|
+
name = newName;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getName() public view returns (string memory) {
|
|
25
|
+
return name;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/events
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
string private name;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// event declaration
|
|
12
|
+
event nameEvent(string newName);
|
|
13
|
+
|
|
14
|
+
function setName(string memory newName) public {
|
|
15
|
+
name = newName;
|
|
16
|
+
// event emit
|
|
17
|
+
emit nameEvent(newName);
|
|
18
|
+
}
|
|
19
|
+
}
|
data/bundle-standalone/templates/web3/solidity/solidity-learning/10_error_handling/ErrorHandling.sol
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/error-handling
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
// Assert – is used to check for conditions that should never be possible. Asserts should always evaluate to true and should never fail. If it does fail then there is a bug in the code and the assert will use up all gas and the transaction will be rolled back.
|
|
9
|
+
// Require – Is used to evaluate inputs, preconditions and outputs of functions. If not true solidity with throw an error and fail. The require statement will accept an optional error message. If there is a failure it will NOT use up all gas.
|
|
10
|
+
// Revert – Is similar to require but only takes one argument which is the error message. Revert might be better to use when the condition to check is complex.
|
|
11
|
+
uint256 public balance;
|
|
12
|
+
|
|
13
|
+
function deposit(uint256 amount) public {
|
|
14
|
+
uint256 oldBalance = balance;
|
|
15
|
+
uint256 newBalance = balance + amount;
|
|
16
|
+
require(newBalance >= oldBalance, "Overflow");
|
|
17
|
+
|
|
18
|
+
balance += amount;
|
|
19
|
+
assert(balance >= amount);
|
|
20
|
+
|
|
21
|
+
if (balance < amount) {
|
|
22
|
+
revert("underflow");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/for-loop
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
uint256 public loopCount;
|
|
9
|
+
|
|
10
|
+
function doLoop(uint256 n) public {
|
|
11
|
+
for (uint256 i = 0; i < n; i++) {
|
|
12
|
+
loopCount += 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/array
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
uint256[] public myArray; //this is a dynamic array of type uint
|
|
9
|
+
uint256[] public myArray2 = [1, 2, 3, 4]; //this is a dynamic array with 1, 2 and 3 as default values
|
|
10
|
+
uint256[10] public myFixedSizeArray; //this is a fixed size array of type uint
|
|
11
|
+
|
|
12
|
+
uint256[] intergerArray; //sample array of integers
|
|
13
|
+
bool[] boolArray; //sample array of booleans
|
|
14
|
+
address[] addressArray; //sample array of address
|
|
15
|
+
|
|
16
|
+
function pushIsToAdd(uint256 i) public {
|
|
17
|
+
myArray.push(i);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getItemInArray(uint256 index) public view returns (uint256) {
|
|
21
|
+
return myArray[index];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function updateTheArray(uint256 locationInArray, uint256 valueToChange) public {
|
|
25
|
+
myArray[locationInArray] = valueToChange;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function remove(uint256 index) public {
|
|
29
|
+
delete myArray[index];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function removeAndCompact(uint256 index) public {
|
|
33
|
+
myArray[index] = myArray[myArray.length - 1];
|
|
34
|
+
myArray.pop();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getLength() public view returns (uint256) {
|
|
38
|
+
return myArray.length;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/how-to-create-a-map-in-a-solidity-smart-contract/
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
mapping(address => bool) public myMap; // mapping syntax
|
|
9
|
+
|
|
10
|
+
function set(address _addr, bool i) public {
|
|
11
|
+
myMap[_addr] = i;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function get(address _addr) public view returns (bool) {
|
|
15
|
+
return myMap[_addr];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function remove(address _addr) public {
|
|
19
|
+
delete myMap[_addr];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/how-to-create-a-map-in-a-solidity-smart-contract/
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract NestedMapsContract {
|
|
8
|
+
mapping(address => mapping(address => uint256)) public allowance; // nested mapping syntax
|
|
9
|
+
|
|
10
|
+
function get(address _addressOwner, address _addressSpender) public view returns (uint256) {
|
|
11
|
+
return allowance[_addressOwner][_addressSpender];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function set(
|
|
15
|
+
address _addressOwner,
|
|
16
|
+
address _addressSpender,
|
|
17
|
+
uint256 amount
|
|
18
|
+
) public {
|
|
19
|
+
allowance[_addressOwner][_addressSpender] = amount;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function remove(address _addressOwner, address _addressSpender) public {
|
|
23
|
+
delete allowance[_addressOwner][_addressSpender];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/enum
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
enum Status {
|
|
9
|
+
Pending,
|
|
10
|
+
Shipped,
|
|
11
|
+
Accepted,
|
|
12
|
+
Rejected,
|
|
13
|
+
Canceled
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Status public status;
|
|
17
|
+
|
|
18
|
+
function ship() public {
|
|
19
|
+
require(status == Status.Pending);
|
|
20
|
+
status = Status.Shipped;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/struct
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
struct Todo {
|
|
9
|
+
string text;
|
|
10
|
+
bool completed;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Todo[] public todos;
|
|
14
|
+
|
|
15
|
+
function create(string memory _text) public {
|
|
16
|
+
todos.push(Todo(_text, false));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function get(uint256 _index) public view returns (string memory, bool) {
|
|
20
|
+
Todo storage todo = todos[_index];
|
|
21
|
+
return (todo.text, todo.completed);
|
|
22
|
+
}
|
|
23
|
+
}
|
data/bundle-standalone/templates/web3/solidity/solidity-learning/17_payable_modifier/Payable.sol
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/payable-functions
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
contract MyContract {
|
|
8
|
+
address payable public owner;
|
|
9
|
+
|
|
10
|
+
constructor() payable {
|
|
11
|
+
owner = payable(msg.sender);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
modifier onlyOwner() {
|
|
15
|
+
require(msg.sender == owner, "Not owner");
|
|
16
|
+
_;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function withdraw(uint256 amount) public onlyOwner {
|
|
20
|
+
owner.transfer(amount);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function transfer(address payable _to, uint256 amount) public onlyOwner {
|
|
24
|
+
_to.transfer(amount);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// https://cryptomarketpool.com/importing-into-a-contract
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
import "./Contract2.sol";
|
|
8
|
+
|
|
9
|
+
contract MyContract {
|
|
10
|
+
Contract2 public contract2 = new Contract2();
|
|
11
|
+
|
|
12
|
+
function callOtherContract(uint256 a, uint256 b) public view returns (uint256) {
|
|
13
|
+
return contract2.sum(a, b);
|
|
14
|
+
}
|
|
15
|
+
}
|