├── .env.example
├── .eslintrc.json
├── .gitignore
├── .prettierrc.js
├── README.md
├── additional.d.ts
├── assets
├── imagePlaceholder.png
└── imagePlaceholder.svg
├── components
├── ui
│ ├── generalComponents
│ │ ├── Button.tsx
│ │ ├── Card.tsx
│ │ ├── CheckboxInput.tsx
│ │ ├── DropdownInput.tsx
│ │ ├── ImageInput.tsx
│ │ ├── Profile.tsx
│ │ ├── RadioInput.tsx
│ │ ├── SubmitButton.tsx
│ │ ├── TextInput.tsx
│ │ └── index.ts
│ ├── homepage
│ │ └── index.tsx
│ ├── mintErc1155
│ │ ├── Heading.tsx
│ │ └── index.tsx
│ ├── mintErc20
│ │ ├── Heading.tsx
│ │ └── index.tsx
│ ├── mintErc721
│ │ ├── Heading.tsx
│ │ └── index.tsx
│ ├── mintMultipleNft
│ │ ├── Heading.tsx
│ │ └── index.tsx
│ ├── mintSingleNft
│ │ ├── Heading.tsx
│ │ └── index.tsx
│ ├── modal
│ │ └── index.tsx
│ ├── navbar
│ │ └── index.tsx
│ ├── nftPage
│ │ ├── Collection.tsx
│ │ ├── CustomNftMetadataProps.ts
│ │ ├── Description.tsx
│ │ ├── Details.tsx
│ │ ├── NameDetails.tsx
│ │ ├── NftCard.tsx
│ │ ├── NftCollectionTokenProps.ts
│ │ ├── NftMetadataProps.ts
│ │ ├── NftTransactionsProps.ts
│ │ ├── Properties.tsx
│ │ ├── PropertiesCard.tsx
│ │ ├── TransactionCard.tsx
│ │ ├── Transactions.tsx
│ │ └── index.tsx
│ └── profile
│ │ ├── cryptoCard.tsx
│ │ ├── index.tsx
│ │ └── nftCard.tsx
└── wallet
│ ├── connectWallet
│ ├── enums.ts
│ └── index.ts
│ └── metamask
│ ├── addMetamaskChain.ts
│ ├── connectMetamask.ts
│ ├── getWalletAddress.ts
│ ├── isMetamaskConnected.ts
│ └── switchMetamaskNetwork.ts
├── contract-dev
├── contracts
│ ├── DappTools.sol
│ └── IDappTools.sol
├── hardhat.config.js
├── package-lock.json
├── package.json
└── scripts
│ └── deploy.js
├── data
├── homepageInfo.json
├── licences.json
├── networks.json
└── profiles.json
├── dev.md
├── next-env.d.ts
├── next.config.js
├── package-lock.json
├── package.json
├── pages
├── 404.tsx
├── _app.tsx
├── api
│ ├── erc1155
│ │ └── index.ts
│ ├── erc20
│ │ └── index.ts
│ ├── erc20x
│ │ └── index.ts
│ ├── erc721
│ │ └── index.ts
│ ├── hello.ts
│ ├── nft-collection
│ │ └── index.ts
│ └── single-nft
│ │ └── index.ts
├── erc1155.tsx
├── erc20.tsx
├── erc721.tsx
├── index.tsx
├── mintNft.tsx
├── mintNftCollection.tsx
├── nft.tsx
└── profile.tsx
├── postcss.config.js
├── public
├── erc1155.svg
├── erc20.svg
├── erc20x.svg
├── erc721.svg
├── favicon.ico
├── logo-white.svg
├── logo.svg
├── nft-collection.svg
├── nft-single.svg
├── profile
│ ├── Nonit.png
│ ├── Raghav.png
│ ├── Sparsh.png
│ ├── github.svg
│ ├── gmail.svg
│ ├── hb.png
│ ├── nonit.png
│ ├── raghav.png
│ ├── sparsh.png
│ └── twitter.svg
├── share.svg
├── share_filled.svg
├── vercel.svg
└── warning.svg
├── styles
└── globals.css
├── subgraph
├── abis
│ ├── DappTools.json
│ ├── IAccessControl.json
│ ├── IERC1155MetadataURI.json
│ ├── IERC20Metadata.json
│ ├── IERC721Metadata.json
│ ├── Ownable.json
│ └── Pausable.json
├── networks.json
├── package-lock.json
├── package.json
├── schema.graphql
├── setup.md
├── src
│ ├── accesscontrol.ts
│ ├── dapp-tools.ts
│ ├── erc1155.ts
│ ├── erc20.ts
│ ├── erc721.ts
│ ├── fetch
│ │ ├── accesscontrol.ts
│ │ ├── account.ts
│ │ ├── erc1155.ts
│ │ ├── erc165.ts
│ │ ├── erc20.ts
│ │ ├── erc721.ts
│ │ ├── governor.ts
│ │ ├── ownable.ts
│ │ ├── pausable.ts
│ │ ├── timelock.ts
│ │ └── voting.ts
│ ├── ownable.ts
│ └── pausable.ts
├── subgraph.yaml
└── tsconfig.json
├── tailwind.config.js
├── tsconfig.json
└── utils
├── contract_compiler.ts
├── contract_deployer.ts
├── contracts
├── BurnMintSuperToken.sol
├── BurnableSuperToken.sol
├── CappedSuperToken.sol
├── MintableSuperToken.sol
├── NFTCollection.sol
├── NativeSuperToken.sol
├── NativeSuperTokenDeployer.sol
└── SingleNFT.sol
├── erc20x.ts
├── getIPFSUrl.ts
├── getLicences.ts
├── imports
├── @openzeppelin
│ └── contracts
│ │ ├── access
│ │ ├── AccessControl.sol
│ │ ├── AccessControlCrossChain.sol
│ │ ├── AccessControlEnumerable.sol
│ │ ├── IAccessControl.sol
│ │ ├── IAccessControlEnumerable.sol
│ │ └── Ownable.sol
│ │ ├── crosschain
│ │ ├── CrossChainEnabled.sol
│ │ ├── amb
│ │ │ ├── CrossChainEnabledAMB.sol
│ │ │ └── LibAMB.sol
│ │ ├── arbitrum
│ │ │ ├── CrossChainEnabledArbitrumL1.sol
│ │ │ ├── CrossChainEnabledArbitrumL2.sol
│ │ │ ├── LibArbitrumL1.sol
│ │ │ └── LibArbitrumL2.sol
│ │ ├── errors.sol
│ │ ├── optimism
│ │ │ ├── CrossChainEnabledOptimism.sol
│ │ │ └── LibOptimism.sol
│ │ └── polygon
│ │ │ └── CrossChainEnabledPolygonChild.sol
│ │ ├── finance
│ │ ├── PaymentSplitter.sol
│ │ └── VestingWallet.sol
│ │ ├── governance
│ │ ├── Governor.sol
│ │ ├── IGovernor.sol
│ │ ├── TimelockController.sol
│ │ ├── compatibility
│ │ │ ├── GovernorCompatibilityBravo.sol
│ │ │ └── IGovernorCompatibilityBravo.sol
│ │ ├── extensions
│ │ │ ├── GovernorCountingSimple.sol
│ │ │ ├── GovernorPreventLateQuorum.sol
│ │ │ ├── GovernorProposalThreshold.sol
│ │ │ ├── GovernorSettings.sol
│ │ │ ├── GovernorTimelockCompound.sol
│ │ │ ├── GovernorTimelockControl.sol
│ │ │ ├── GovernorVotes.sol
│ │ │ ├── GovernorVotesComp.sol
│ │ │ ├── GovernorVotesQuorumFraction.sol
│ │ │ └── IGovernorTimelock.sol
│ │ └── utils
│ │ │ ├── IVotes.sol
│ │ │ └── Votes.sol
│ │ ├── interfaces
│ │ ├── IERC1155.sol
│ │ ├── IERC1155MetadataURI.sol
│ │ ├── IERC1155Receiver.sol
│ │ ├── IERC1271.sol
│ │ ├── IERC1363.sol
│ │ ├── IERC1363Receiver.sol
│ │ ├── IERC1363Spender.sol
│ │ ├── IERC165.sol
│ │ ├── IERC1820Implementer.sol
│ │ ├── IERC1820Registry.sol
│ │ ├── IERC20.sol
│ │ ├── IERC20Metadata.sol
│ │ ├── IERC2981.sol
│ │ ├── IERC3156.sol
│ │ ├── IERC3156FlashBorrower.sol
│ │ ├── IERC3156FlashLender.sol
│ │ ├── IERC721.sol
│ │ ├── IERC721Enumerable.sol
│ │ ├── IERC721Metadata.sol
│ │ ├── IERC721Receiver.sol
│ │ ├── IERC777.sol
│ │ ├── IERC777Recipient.sol
│ │ ├── IERC777Sender.sol
│ │ ├── draft-IERC1822.sol
│ │ └── draft-IERC2612.sol
│ │ ├── metatx
│ │ ├── ERC2771Context.sol
│ │ └── MinimalForwarder.sol
│ │ ├── proxy
│ │ ├── Clones.sol
│ │ ├── ERC1967
│ │ │ ├── ERC1967Proxy.sol
│ │ │ └── ERC1967Upgrade.sol
│ │ ├── Proxy.sol
│ │ ├── beacon
│ │ │ ├── BeaconProxy.sol
│ │ │ ├── IBeacon.sol
│ │ │ └── UpgradeableBeacon.sol
│ │ ├── transparent
│ │ │ ├── ProxyAdmin.sol
│ │ │ └── TransparentUpgradeableProxy.sol
│ │ └── utils
│ │ │ ├── Initializable.sol
│ │ │ └── UUPSUpgradeable.sol
│ │ ├── security
│ │ ├── Pausable.sol
│ │ ├── PullPayment.sol
│ │ └── ReentrancyGuard.sol
│ │ ├── token
│ │ ├── ERC1155
│ │ │ ├── ERC1155.sol
│ │ │ ├── IERC1155.sol
│ │ │ ├── IERC1155Receiver.sol
│ │ │ ├── extensions
│ │ │ │ ├── ERC1155Burnable.sol
│ │ │ │ ├── ERC1155Pausable.sol
│ │ │ │ ├── ERC1155Supply.sol
│ │ │ │ ├── ERC1155URIStorage.sol
│ │ │ │ └── IERC1155MetadataURI.sol
│ │ │ ├── presets
│ │ │ │ └── ERC1155PresetMinterPauser.sol
│ │ │ └── utils
│ │ │ │ ├── ERC1155Holder.sol
│ │ │ │ └── ERC1155Receiver.sol
│ │ ├── ERC20
│ │ │ ├── ERC20.sol
│ │ │ ├── IERC20.sol
│ │ │ ├── extensions
│ │ │ │ ├── ERC20Burnable.sol
│ │ │ │ ├── ERC20Capped.sol
│ │ │ │ ├── ERC20FlashMint.sol
│ │ │ │ ├── ERC20Pausable.sol
│ │ │ │ ├── ERC20Snapshot.sol
│ │ │ │ ├── ERC20Votes.sol
│ │ │ │ ├── ERC20VotesComp.sol
│ │ │ │ ├── ERC20Wrapper.sol
│ │ │ │ ├── IERC20Metadata.sol
│ │ │ │ ├── draft-ERC20Permit.sol
│ │ │ │ └── draft-IERC20Permit.sol
│ │ │ ├── presets
│ │ │ │ ├── ERC20PresetFixedSupply.sol
│ │ │ │ └── ERC20PresetMinterPauser.sol
│ │ │ └── utils
│ │ │ │ ├── SafeERC20.sol
│ │ │ │ └── TokenTimelock.sol
│ │ ├── ERC721
│ │ │ ├── ERC721.sol
│ │ │ ├── IERC721.sol
│ │ │ ├── IERC721Receiver.sol
│ │ │ ├── extensions
│ │ │ │ ├── ERC721Burnable.sol
│ │ │ │ ├── ERC721Enumerable.sol
│ │ │ │ ├── ERC721Pausable.sol
│ │ │ │ ├── ERC721Royalty.sol
│ │ │ │ ├── ERC721URIStorage.sol
│ │ │ │ ├── IERC721Enumerable.sol
│ │ │ │ ├── IERC721Metadata.sol
│ │ │ │ └── draft-ERC721Votes.sol
│ │ │ ├── presets
│ │ │ │ └── ERC721PresetMinterPauserAutoId.sol
│ │ │ └── utils
│ │ │ │ └── ERC721Holder.sol
│ │ ├── ERC777
│ │ │ ├── ERC777.sol
│ │ │ ├── IERC777.sol
│ │ │ ├── IERC777Recipient.sol
│ │ │ ├── IERC777Sender.sol
│ │ │ └── presets
│ │ │ │ └── ERC777PresetFixedSupply.sol
│ │ └── common
│ │ │ └── ERC2981.sol
│ │ ├── utils
│ │ ├── Address.sol
│ │ ├── Arrays.sol
│ │ ├── Base64.sol
│ │ ├── Checkpoints.sol
│ │ ├── Context.sol
│ │ ├── Counters.sol
│ │ ├── Create2.sol
│ │ ├── Multicall.sol
│ │ ├── StorageSlot.sol
│ │ ├── Strings.sol
│ │ ├── Timers.sol
│ │ ├── cryptography
│ │ │ ├── ECDSA.sol
│ │ │ ├── MerkleProof.sol
│ │ │ ├── SignatureChecker.sol
│ │ │ └── draft-EIP712.sol
│ │ ├── escrow
│ │ │ ├── ConditionalEscrow.sol
│ │ │ ├── Escrow.sol
│ │ │ └── RefundEscrow.sol
│ │ ├── introspection
│ │ │ ├── ERC165.sol
│ │ │ ├── ERC165Checker.sol
│ │ │ ├── ERC165Storage.sol
│ │ │ ├── ERC1820Implementer.sol
│ │ │ ├── IERC165.sol
│ │ │ ├── IERC1820Implementer.sol
│ │ │ └── IERC1820Registry.sol
│ │ ├── math
│ │ │ ├── Math.sol
│ │ │ ├── SafeCast.sol
│ │ │ ├── SafeMath.sol
│ │ │ ├── SignedMath.sol
│ │ │ └── SignedSafeMath.sol
│ │ └── structs
│ │ │ ├── BitMaps.sol
│ │ │ ├── DoubleEndedQueue.sol
│ │ │ ├── EnumerableMap.sol
│ │ │ └── EnumerableSet.sol
│ │ └── vendor
│ │ ├── amb
│ │ └── IAMB.sol
│ │ ├── arbitrum
│ │ ├── IArbSys.sol
│ │ ├── IBridge.sol
│ │ ├── IInbox.sol
│ │ ├── IMessageProvider.sol
│ │ └── IOutbox.sol
│ │ ├── compound
│ │ └── ICompoundTimelock.sol
│ │ ├── optimism
│ │ └── ICrossDomainMessenger.sol
│ │ └── polygon
│ │ └── IFxMessageProcessor.sol
├── @superfluid-finance
│ └── ethereum-contracts
│ │ └── contracts
│ │ ├── agreements
│ │ ├── AgreementBase.sol
│ │ ├── AgreementLibrary.sol
│ │ ├── ConstantFlowAgreementV1.sol
│ │ └── InstantDistributionAgreementV1.sol
│ │ ├── apps
│ │ ├── CFAv1Library.sol
│ │ ├── IDAv1Library.sol
│ │ └── SuperAppBase.sol
│ │ ├── gov
│ │ ├── SuperfluidGovernanceBase.sol
│ │ └── SuperfluidGovernanceII.sol
│ │ ├── interfaces
│ │ ├── agreements
│ │ │ ├── IConstantFlowAgreementV1.sol
│ │ │ └── IInstantDistributionAgreementV1.sol
│ │ ├── superfluid
│ │ │ ├── CustomSuperTokenBase.sol
│ │ │ ├── Definitions.sol
│ │ │ ├── ISuperAgreement.sol
│ │ │ ├── ISuperApp.sol
│ │ │ ├── ISuperToken.sol
│ │ │ ├── ISuperTokenFactory.sol
│ │ │ ├── ISuperfluid.sol
│ │ │ ├── ISuperfluidGovernance.sol
│ │ │ └── ISuperfluidToken.sol
│ │ ├── tokens
│ │ │ ├── ERC20WithTokenInfo.sol
│ │ │ ├── IMaticBridgedNativeSuperToken.sol
│ │ │ ├── IPureSuperToken.sol
│ │ │ ├── ISETH.sol
│ │ │ └── TokenInfo.sol
│ │ └── utils
│ │ │ ├── IMultiSigWallet.sol
│ │ │ ├── IRelayRecipient.sol
│ │ │ └── IResolver.sol
│ │ ├── libs
│ │ ├── BaseRelayRecipient.sol
│ │ ├── CallUtils.sol
│ │ ├── ERC1820RegistryCompiled.sol
│ │ ├── ERC777Helper.sol
│ │ ├── FixedSizeData.sol
│ │ ├── Int96SafeMath.sol
│ │ ├── SlotsBitmapLibrary.sol
│ │ └── UInt128SafeMath.sol
│ │ ├── mocks
│ │ ├── AgreementMock.sol
│ │ ├── CFAAppMocks.sol
│ │ ├── CFALibraryMock.sol
│ │ ├── CallUtilsMock.sol
│ │ ├── CallUtilsTester.sol
│ │ ├── CustomSuperTokenMock.sol
│ │ ├── ERC777SenderRecipientMock.sol
│ │ ├── FakeSuperfluidMock.sol
│ │ ├── ForwarderMock.sol
│ │ ├── IDASuperAppTester.sol
│ │ ├── IDAv1LibraryMock.sol
│ │ ├── MockSmartWallet.sol
│ │ ├── MultiFlowTesterApp.sol
│ │ ├── SuperAppMocks.sol
│ │ ├── SuperTokenFactoryMock.sol
│ │ ├── SuperTokenMock.sol
│ │ ├── SuperfluidDestructorMock.sol
│ │ ├── SuperfluidGovernanceIIMock.sol
│ │ ├── SuperfluidMock.sol
│ │ ├── UUPSProxiableMock.sol
│ │ └── UtilsTester.sol
│ │ ├── superfluid
│ │ ├── FullUpgradableSuperTokenProxy.sol
│ │ ├── SuperToken.sol
│ │ ├── SuperTokenFactory.sol
│ │ ├── Superfluid.sol
│ │ └── SuperfluidToken.sol
│ │ ├── tokens
│ │ ├── MaticBridgedNativeSuperToken.sol
│ │ ├── PureSuperToken.sol
│ │ └── SETH.sol
│ │ ├── upgradability
│ │ ├── UUPSProxiable.sol
│ │ ├── UUPSProxy.sol
│ │ └── UUPSUtils.sol
│ │ └── utils
│ │ ├── BatchLiquidator.sol
│ │ ├── Resolver.sol
│ │ ├── SuperUpgrader.sol
│ │ ├── SuperfluidFrameworkDeployer.sol
│ │ ├── SuperfluidLoader.sol
│ │ ├── TOGA.sol
│ │ ├── TestGovernance.sol
│ │ ├── TestToken.sol
│ │ └── TokenCustodian.sol
├── IForwarder.sol
├── SuperTokenBase.sol
├── SuperTokenStorage.sol
└── UUPSProxy.sol
├── nft
├── getNftImage.ts
├── tranformNftData.ts
└── uploadIpfsData.ts
├── nft_collection.ts
├── single_nft.ts
├── string_formatter.ts
├── type_functions.ts
├── types.ts
├── wallet
└── ud-web3modal.ts
└── wallet_token_details.ts
/.env.example:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_WALLET_CONNECT_INFURA_ID='API_KEY_FROM_WALLET_CONNECT_DASHBOARD'
2 | NEXT_PUBLIC_COVALENT_API_KEY='API_KEY_FROM_COVALENT'
3 | NEXT_PUBLIC_COVALENT_BASEURL=https://api.covalenthq.com/v1
4 | NEXT_PUBLIC_NFT_STORAGE_API_KEY='NEXT_PUBLIC_NFT_STORAGE_API_KEY'
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # dirs
9 | build
10 | generated
11 | artifacts
12 | cache
13 |
14 | # testing
15 | /coverage
16 |
17 | # next.js
18 | /.next/
19 | /out/
20 |
21 | # production
22 | /build
23 |
24 | # misc
25 | .DS_Store
26 | *.pem
27 |
28 | # debug
29 | npm-debug.log*
30 | yarn-debug.log*
31 | yarn-error.log*
32 | .pnpm-debug.log*
33 |
34 | # local env files
35 | .env*.local
36 | .env
37 |
38 | # vercel
39 | .vercel
40 |
41 | # typescript
42 | *.tsbuildinfo
43 |
44 | # VS Code
45 | .vscode
46 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: "all",
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | };
8 |
--------------------------------------------------------------------------------
/additional.d.ts:
--------------------------------------------------------------------------------
1 | interface Window {
2 | ethereum: any;
3 | }
--------------------------------------------------------------------------------
/assets/imagePlaceholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/assets/imagePlaceholder.png
--------------------------------------------------------------------------------
/assets/imagePlaceholder.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/Button.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | interface ButtonProps {
4 | title: string;
5 | leftIcon?: JSX.Element;
6 | rightIcon?: JSX.Element;
7 | onClick?: VoidFunction;
8 | size?: 'sm' | 'lg';
9 | }
10 |
11 | const Button = ({ title, leftIcon, rightIcon, onClick, size = 'lg' }: ButtonProps) => {
12 | return (
13 |
14 |
15 |
16 |
17 |
18 | {leftIcon}
19 |
20 |
21 |
24 | {title}
25 |
26 |
27 |
28 | {rightIcon}
29 |
30 |
31 |
32 | );
33 | };
34 |
35 | export default Button;
36 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/Card.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable @next/next/no-img-element */
2 | import React from 'react';
3 |
4 | export interface CardProps {
5 | title: string;
6 | subtitle: string;
7 | description?: string;
8 | icon?: string;
9 |
10 | secondaryTitle?: string;
11 | actionBtnText?: string;
12 | actionBtnLink?: string;
13 | }
14 |
15 | const Card = ({ title, subtitle, description, icon, secondaryTitle, actionBtnText, actionBtnLink }: CardProps) => {
16 | return (
17 |
18 |
19 |
20 |
21 |
22 |
23 |
{title}
24 |
{subtitle}
25 |
26 |
27 |
28 |
{secondaryTitle || title}
29 |
30 |
{description}
31 |
32 | {/* {actionBtnText && (
33 |
34 | {actionBtnText}
35 |
36 | )} */}
37 |
38 |
39 |
40 | );
41 | };
42 |
43 | export default Card;
44 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/CheckboxInput.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | interface CheckboxInputProps {
4 | id: string;
5 | label: string;
6 | value: boolean;
7 | setValue: React.Dispatch>;
8 | }
9 |
10 | const CheckboxInput = ({ id, label, setValue, value }: CheckboxInputProps) => {
11 | return (
12 |
13 | {
19 | setValue(e.currentTarget.checked);
20 | }}
21 | />
22 |
23 | {label}
24 |
25 |
26 | );
27 | };
28 |
29 | export default CheckboxInput;
30 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/ImageInput.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable @next/next/no-img-element */
2 | import React from 'react';
3 | import imagePlaceholder from '../../../assets/imagePlaceholder.svg';
4 |
5 | interface ImageInputProps {
6 | id: string;
7 | label: string;
8 | image?: File;
9 | imageOnChange?: (imageFile: File) => void;
10 | }
11 |
12 | const ImageInput = ({ id, label, image, imageOnChange }: ImageInputProps) => {
13 | return (
14 | <>
15 |
16 |
{label}
17 |
18 |
23 |
24 |
25 |
{
32 | e.currentTarget.files && imageOnChange && imageOnChange(e.currentTarget.files[0]);
33 | }}
34 | />
35 |
36 | >
37 | );
38 | };
39 |
40 | export default ImageInput;
41 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/SubmitButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | interface SubmitButtonProps {
4 | title: string;
5 | disabled?: boolean;
6 | leftIcon?: JSX.Element;
7 | rightIcon?: JSX.Element;
8 | id: string;
9 | }
10 |
11 | const SubmitButton = ({ title, leftIcon, rightIcon, disabled = false, id }: SubmitButtonProps) => {
12 | return (
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {leftIcon}
21 |
22 |
23 |
{title}
24 |
25 |
26 | {rightIcon}
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | );
35 | };
36 |
37 | export default SubmitButton;
38 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/TextInput.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export enum TextInputTypes {
4 | TEXT = 'text',
5 | PASSWORD = 'password',
6 | EMAIL = 'email',
7 | NUMBER = 'number',
8 | URL = 'url',
9 | DATE = 'date',
10 | DATETIME_LOCAL = 'datetime-local',
11 | MONTH = 'month',
12 | WEEK = 'week',
13 | TIME = 'time',
14 | SEARCH = 'search',
15 | TEL = 'tel',
16 | // CHECKBOX = 'checkbox',
17 | // IMAGE = 'image',
18 | // RADIO = 'radio',
19 | }
20 |
21 | interface TextInputProps {
22 | id: string;
23 | label: string;
24 | type: TextInputTypes;
25 | value: string;
26 | setValue: React.Dispatch>;
27 | minNum?: number;
28 | maxNum?: number;
29 | disabled?: boolean;
30 | }
31 |
32 | const TextInput = ({ id, label, type, value, setValue, minNum, maxNum, disabled = false }: TextInputProps) => {
33 | return (
34 |
35 |
36 | {label}
37 |
38 |
39 | {
45 | setValue(e.currentTarget.value);
46 | }}
47 | min={minNum}
48 | max={maxNum}
49 | disabled={disabled}
50 | />
51 |
52 | );
53 | };
54 |
55 | export default TextInput;
56 |
--------------------------------------------------------------------------------
/components/ui/generalComponents/index.ts:
--------------------------------------------------------------------------------
1 | import Card, { CardProps } from './Card';
2 | import Button from './Button';
3 | import SubmitButton from './SubmitButton';
4 | import ImageInput from './ImageInput';
5 | import CheckboxInput from './CheckboxInput';
6 | import TextInput, { TextInputTypes } from './TextInput';
7 |
8 | export { Card, Button, TextInput, TextInputTypes, SubmitButton, ImageInput, CheckboxInput };
9 | export type { CardProps };
10 |
--------------------------------------------------------------------------------
/components/ui/mintErc1155/Heading.tsx:
--------------------------------------------------------------------------------
1 | const Heading = () => {
2 | return (
3 |
4 |
5 |
6 |
7 |
ERC1155
8 |
9 | A standard interface for contracts that manage multiple token types. A single deployed
10 | contract may include any combination of fungible tokens, non-fungible tokens or other
11 | configurations (e.g. semi-fungible tokens). The idea is simple and seeks to create a smart
12 | contract interface that can represent and control any number of fungible and non-fungible
13 | token types. In this way, the ERC-1155 token can do the same functions as an ERC-20 and
14 | ERC-721 token, and even both at the same time. And best of all, improving the functionality
15 | of both standards, making it more efficient, and correcting obvious implementation errors on
16 | the ERC-20 and ERC-721 standards.
17 |
18 |
19 |
20 |
21 |
22 | );
23 | };
24 |
25 | export default Heading;
26 |
--------------------------------------------------------------------------------
/components/ui/mintErc20/Heading.tsx:
--------------------------------------------------------------------------------
1 | const Heading = () => {
2 | return (
3 |
4 |
5 |
6 |
7 |
ERC20
8 |
9 | An ERC20 token contract keeps track of fungible tokens: any one token is exactly equal to
10 | any other token; no tokens have special rights or behavior associated with them. This makes
11 | ERC20 tokens useful for things like a medium of exchange currency, voting rights, staking,
12 | and more.
13 |
14 |
15 |
16 |
17 |
18 | );
19 | };
20 |
21 | export default Heading;
22 |
--------------------------------------------------------------------------------
/components/ui/mintErc721/Heading.tsx:
--------------------------------------------------------------------------------
1 | const Heading = () => {
2 | return (
3 |
4 |
5 |
6 |
7 |
ERC721
8 |
9 | You can make a fungible token using ERC20, but what if not all tokens are alike? This comes
10 | up in situations like real estate, voting rights, or collectibles, where some items are
11 | valued more than others, due to their usefulness, rarity, etc. ERC721 is a standard for
12 | representing ownership of non-fungible tokens, that is, where each token is unique.
13 |
14 |
15 |
16 |
17 |
18 | );
19 | };
20 |
21 | export default Heading;
22 |
--------------------------------------------------------------------------------
/components/ui/mintMultipleNft/Heading.tsx:
--------------------------------------------------------------------------------
1 | const Heading = () => {
2 | return (
3 |
4 |
5 |
6 |
7 |
NFT Collection
8 |
9 | {
10 | "Allows you to mint multiple assets in one go. Even if each item in the collection is the same image, suppose, it would still have a unique ID on chain for distinction. That's more than enough to be known to mint your own collection."
11 | }
12 |
13 |
14 |
15 |
16 |
17 | );
18 | };
19 |
20 | export default Heading;
21 |
--------------------------------------------------------------------------------
/components/ui/mintSingleNft/Heading.tsx:
--------------------------------------------------------------------------------
1 | const Heading = () => {
2 | return (
3 |
4 |
5 |
6 |
7 |
Single NFT
8 |
9 | {
10 | "Allows you to mint a unique piece of art, one at a time. This is for you if have only one image(or any other media file). But remember that you won't get to expand this into a collection later. That's more than enough to be known to mint your own unique NFT."
11 | }
12 |
13 |
14 |
15 |
16 |
17 | );
18 | };
19 |
20 | export default Heading;
21 |
--------------------------------------------------------------------------------
/components/ui/nftPage/CustomNftMetadataProps.ts:
--------------------------------------------------------------------------------
1 | export default interface CustomNftMetadataProps {
2 | nft_data: {
3 | image: string;
4 | };
5 | }
6 |
--------------------------------------------------------------------------------
/components/ui/nftPage/Description.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Description = ({ description }: { description: string | null }) => {
4 | return (
5 |
6 |
7 |
8 | Description
9 |
10 |
11 |
18 |
19 |
20 |
21 |
22 |
23 | {description || 'Description Not Available'}
24 |
25 |
26 | );
27 | };
28 |
29 | export default Description;
30 |
--------------------------------------------------------------------------------
/components/ui/nftPage/NftCollectionTokenProps.ts:
--------------------------------------------------------------------------------
1 | export default interface NftCollectionTokenProps {
2 | contract_decimals: number;
3 | contract_name: string;
4 | contract_ticker_symbol: string;
5 | contract_address: string;
6 | supports_erc: any;
7 | logo_url: string;
8 | token_id: string;
9 | }
10 |
--------------------------------------------------------------------------------
/components/ui/nftPage/NftMetadataProps.ts:
--------------------------------------------------------------------------------
1 | export default interface NftMetadataProps {
2 | contract_decimals: number;
3 | contract_name: string;
4 | contract_ticker_symbol: string;
5 | contract_address: string;
6 | supports_erc: Array;
7 | logo_url: string;
8 | type: string;
9 | nft_data: Array<{
10 | token_id: string;
11 | token_balance: string;
12 | token_url: string;
13 | supports_erc: Array;
14 | token_price_wei: any;
15 | token_quote_rate_eth: any;
16 | original_owner: string;
17 | external_data: {
18 | name: any;
19 | description: any;
20 | image: string;
21 | image_256: string;
22 | image_512: string;
23 | image_1024: string;
24 | animation_url: any;
25 | external_url: any;
26 | attributes: Array<{
27 | trait_type: string;
28 | value: string;
29 | }>;
30 | owner: any;
31 | };
32 | owner: string;
33 | owner_address: string;
34 | burned: boolean;
35 | }>;
36 | }
37 |
--------------------------------------------------------------------------------
/components/ui/nftPage/NftTransactionsProps.ts:
--------------------------------------------------------------------------------
1 | export default interface NftTransactionsProps {
2 | contract_decimals: number;
3 | contract_name: string;
4 | contract_ticker_symbol: string;
5 | contract_address: string;
6 | supports_erc: string[];
7 | logo_url: string;
8 | type: string;
9 | nft_transactions: NftTransaction[];
10 | }
11 |
12 | export interface NftTransaction {
13 | block_signed_at: string;
14 | block_height: number;
15 | tx_hash: string;
16 | tx_offset: number;
17 | successful: boolean;
18 | from_address: string;
19 | from_address_label: any;
20 | to_address: string;
21 | to_address_label: string;
22 | value: string;
23 | value_quote: number;
24 | gas_offered: number;
25 | gas_spent: number;
26 | gas_price: number;
27 | fees_paid?: string;
28 | gas_quote: number;
29 | gas_quote_rate: number;
30 | log_events: LogEvent[];
31 | }
32 |
33 | export interface LogEvent {
34 | block_signed_at: string;
35 | block_height: number;
36 | tx_offset: number;
37 | log_offset: number;
38 | tx_hash: string;
39 | raw_log_topics: string[];
40 | sender_contract_decimals: any;
41 | sender_name: any;
42 | sender_contract_ticker_symbol: any;
43 | sender_address: string;
44 | sender_address_label?: string;
45 | sender_logo_url: any;
46 | raw_log_data?: string;
47 | decoded: Decoded;
48 | }
49 |
50 | export interface Decoded {
51 | name: string;
52 | signature: string;
53 | params: Param[];
54 | }
55 |
56 | export interface Param {
57 | name: string;
58 | type: string;
59 | indexed: boolean;
60 | decoded: boolean;
61 | value?: string;
62 | }
63 |
--------------------------------------------------------------------------------
/components/ui/nftPage/PropertiesCard.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | interface PropertiesCardProps {
4 | traitType: string;
5 | value: string;
6 | }
7 |
8 | const PropertiesCard = ({ traitType, value }: PropertiesCardProps) => {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 | {value}
16 |
17 | {traitType}
18 |
19 |
20 |
21 | );
22 | };
23 |
24 | export default PropertiesCard;
25 |
--------------------------------------------------------------------------------
/components/ui/nftPage/TransactionCard.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { NFTTransaction } from '../../../utils/types';
3 |
4 | const TransactionCard = ({
5 | from_address,
6 | from_address_label,
7 | to_address,
8 | to_address_label,
9 | block_signed_at,
10 | value,
11 | }: NFTTransaction) => {
12 | const price = Number.parseFloat(value) / 10 ** 18;
13 | const date = new Date(block_signed_at);
14 |
15 | let dateString = (date.getUTCDate() < 10 ? '0' : '') + date.getUTCDate().toString();
16 | dateString = dateString + '/' + (date.getUTCMonth() < 10 ? '0' : '') + date.getUTCMonth().toString();
17 | dateString = dateString + '/' + date.getUTCFullYear().toString();
18 |
19 | return (
20 |
21 |
{price != 0 ? 'Sale' : 'Transfer'}
22 |
{price != 0 ? price : 'NA'}
23 |
{from_address_label || from_address}
24 |
{to_address_label || to_address}
25 |
{dateString}
26 |
27 | );
28 | };
29 |
30 | export default TransactionCard;
31 |
--------------------------------------------------------------------------------
/components/wallet/connectWallet/enums.ts:
--------------------------------------------------------------------------------
1 | export enum wallets {
2 | ANY = 'any',
3 | METAMASK = 'injected',
4 | WALLETCONNECT = 'walletconnect',
5 | }
6 |
--------------------------------------------------------------------------------
/components/wallet/metamask/addMetamaskChain.ts:
--------------------------------------------------------------------------------
1 | import isMetamaskConnected from './isMetamaskConnected';
2 |
3 | interface AddEthereumChainParameter {
4 | chainId: number;
5 | chainName: string;
6 | nativeCurrency: {
7 | name: string;
8 | symbol: string;
9 | decimals: 18;
10 | };
11 | rpcUrls: string[];
12 | blockExplorerUrls?: string[];
13 | iconUrls?: string[];
14 | }
15 |
16 | async function addMetamaskChain({
17 | chainId,
18 | chainName,
19 | rpcUrls,
20 | blockExplorerUrls,
21 | iconUrls,
22 | }: AddEthereumChainParameter) {
23 | const { ethereum } = window;
24 |
25 | if (!isMetamaskConnected()) {
26 | console.log('MetaMask is not installed!');
27 | return null;
28 | }
29 |
30 | const hexChainId = '0x' + chainId.toString(16);
31 | try {
32 | await ethereum.request({
33 | method: 'wallet_addEthereumChain',
34 | params: [
35 | {
36 | chainId: hexChainId,
37 | chainName: chainName,
38 | rpcUrls: rpcUrls,
39 | },
40 | ],
41 | });
42 | } catch (addError) {
43 | console.error(addError);
44 | }
45 | }
46 |
47 | export default addMetamaskChain;
48 |
--------------------------------------------------------------------------------
/components/wallet/metamask/connectMetamask.ts:
--------------------------------------------------------------------------------
1 | import isMetamaskConnected from './isMetamaskConnected';
2 |
3 | async function connectMetamask(): Promise {
4 | const { ethereum } = window;
5 |
6 | // Check if Metamask is installed
7 | if (!isMetamaskConnected()) {
8 | console.log('MetaMask is not installed!');
9 | return null;
10 | }
11 |
12 | // Request a connection to Metamask Extension -> returns connected wallet's public address in a array
13 | const walletPublicAddress = await ethereum.request({ method: 'eth_requestAccounts' });
14 |
15 | return walletPublicAddress[0];
16 | }
17 |
18 | export default connectMetamask;
19 |
--------------------------------------------------------------------------------
/components/wallet/metamask/getWalletAddress.ts:
--------------------------------------------------------------------------------
1 | import isMetamaskConnected from './isMetamaskConnected';
2 |
3 | async function getWalletAddress(): Promise {
4 | const { ethereum } = window;
5 |
6 | // Check if Metamask is installed
7 | if (!isMetamaskConnected()) {
8 | console.log('MetaMask is not installed!');
9 | return null;
10 | }
11 |
12 | // Request a connection to Metamask Extension -> returns connected wallet's public address in a array
13 | const walletPublicAddress = await ethereum.request({ method: 'eth_accounts' });
14 |
15 | return walletPublicAddress[0];
16 | }
17 |
18 | export default getWalletAddress;
19 |
--------------------------------------------------------------------------------
/components/wallet/metamask/isMetamaskConnected.ts:
--------------------------------------------------------------------------------
1 | function isMetamaskConnected(): boolean {
2 | if (typeof window == 'undefined') {
3 | return false;
4 | }
5 |
6 | const { ethereum } = window;
7 |
8 | // Check if Metamask is installed
9 | if (ethereum && ethereum.isMetaMask) {
10 | return true;
11 | }
12 |
13 | return false;
14 | }
15 |
16 | export default isMetamaskConnected;
17 |
--------------------------------------------------------------------------------
/components/wallet/metamask/switchMetamaskNetwork.ts:
--------------------------------------------------------------------------------
1 | import isMetamaskConnected from './isMetamaskConnected';
2 |
3 | async function switchMetamaskNetwork(chainId: number) {
4 | const { ethereum } = window;
5 |
6 | const hexChainId = '0x' + chainId.toString(16);
7 |
8 | console.log(hexChainId);
9 |
10 | // Check if Metamask is installed
11 | if (!isMetamaskConnected()) {
12 | console.log('MetaMask is not installed!');
13 | return null;
14 | }
15 |
16 | try {
17 | const walletPublicAddress = await ethereum.request({
18 | method: 'wallet_switchEthereumChain',
19 | params: [
20 | {
21 | chainId: hexChainId,
22 | },
23 | ],
24 | });
25 | } catch (switchError) {
26 | console.error(switchError);
27 | }
28 | }
29 |
30 | export default switchMetamaskNetwork;
31 |
--------------------------------------------------------------------------------
/contract-dev/contracts/DappTools.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity ^0.8.0;
3 |
4 | import {Token, IDappTools} from './IDappTools.sol';
5 | import '@openzeppelin/contracts/access/Ownable.sol';
6 |
7 | contract DappTools is IDappTools, Ownable {
8 | uint256 private _fees;
9 |
10 | constructor(uint256 fees_) {
11 | _fees = fees_;
12 | }
13 |
14 | function register(
15 | address contract_address,
16 | address deployer,
17 | Token kind
18 | ) public payable virtual override returns (bool) {
19 | require(msg.value >= _fees, 'DappTools: insufficient funds provided');
20 | _register(contract_address, deployer, kind);
21 | return true;
22 | }
23 |
24 | function fees() public view returns (uint256) {
25 | return _fees;
26 | }
27 |
28 | function updateFees(uint256 fees_) public onlyOwner {
29 | _fees = fees_;
30 | }
31 |
32 | function withdrawFees() public payable onlyOwner {
33 | payable(owner()).transfer(_fees);
34 | _fees = 0;
35 | }
36 |
37 | function _register(
38 | address contract_address,
39 | address deployer,
40 | Token kind
41 | ) internal virtual {
42 | require(contract_address != address(0), 'DappTools: token contract cannot have a zero address');
43 | require(deployer != address(0), 'DappTools: deployer cannot be a zero address');
44 |
45 | // IMPORTANT: check here that if contract with address `contract_address` is actually of Token `kind`.
46 |
47 | emit RegisterToken(contract_address, deployer, kind);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/contract-dev/contracts/IDappTools.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity ^0.8.0;
3 |
4 | enum Token {
5 | ERC20,
6 | ERC721,
7 | ERC1155,
8 | ERC20x
9 | }
10 |
11 | /**
12 | * @dev Interface of the DappTools contract.
13 | */
14 | interface IDappTools {
15 | /**
16 | * @dev Emitted when a deployer registers a deployed token contract with DappTools
17 | *
18 | * Note that `contract_address` and `deployer` cannot be zero address. Value of
19 | * kind is derived from the enum `Token`.
20 | */
21 | event RegisterToken(address indexed contract_address, address indexed deployer, Token kind);
22 |
23 | /**
24 | * @dev Registers the token for DappTools services
25 | *
26 | * Returns a boolean value indicating whether the operation succeeded.
27 | *
28 | * Emits a {RegisterToken} event.
29 | */
30 | function register(
31 | address contract_address,
32 | address deployer,
33 | Token kind
34 | ) external payable returns (bool);
35 | }
36 |
--------------------------------------------------------------------------------
/contract-dev/hardhat.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type import('hardhat/config').HardhatUserConfig
3 | */
4 | require('dotenv').config({ path: __dirname + '/.env' });
5 | require('@nomiclabs/hardhat-ethers');
6 |
7 | module.exports = {
8 | solidity: '0.8.0',
9 | networks: {
10 | mumbai: {
11 | url: process.env.MUMBAI_ALCHEMY_URL || '',
12 | accounts: [`0x${process.env.MUMBAI_DEPLOYER_PRIV_KEY}`],
13 | },
14 | },
15 | };
16 |
--------------------------------------------------------------------------------
/contract-dev/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "contract-dev",
3 | "version": "1.0.0",
4 | "description": "Dapp-Tools' smart contract development",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "deploy": "npx hardhat run scripts/deploy.js --network mumbai"
9 | },
10 | "keywords": [
11 | "Smart Contracts",
12 | "Hardhat"
13 | ],
14 | "author": "Raghav Goyal",
15 | "license": "MIT",
16 | "devDependencies": {
17 | "@nomiclabs/hardhat-ethers": "^2.0.6",
18 | "dotenv": "^16.0.1",
19 | "ethers": "^5.6.8",
20 | "hardhat": "^2.9.7"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/contract-dev/scripts/deploy.js:
--------------------------------------------------------------------------------
1 | const hre = require('hardhat');
2 |
3 | async function main() {
4 | // DappTools ------------------------------------------------------
5 | console.log('Starting Deployment');
6 | const contractFactory = await hre.ethers.getContractFactory('DappTools');
7 | const contract = await contractFactory.deploy(0);
8 | await contract.deployed();
9 | const contractAddress = contract.address;
10 | console.log(`DappTools deployed to : ${contractAddress}`);
11 | }
12 |
13 | main()
14 | .then(() => console.log('Deployment Successful ✅'))
15 | .catch((error) => {
16 | console.error(error);
17 | console.log('Deployment Failed ❌');
18 | });
19 |
--------------------------------------------------------------------------------
/data/licences.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "No License",
5 | "value": "None"
6 | },
7 | {
8 | "id": 2,
9 | "name": "The Unlicense",
10 | "value": "Unlicense"
11 | },
12 | {
13 | "id": 3,
14 | "name": "MIT License",
15 | "value": "MIT"
16 | },
17 | {
18 | "id": 4,
19 | "name": "GNU General Public License v2.0",
20 | "value": "GNU GPLv2"
21 | },
22 | {
23 | "id": 5,
24 | "name": "GNU General Public License v3.0",
25 | "value": "GNU GPLv3"
26 | },
27 | {
28 | "id": 6,
29 | "name": "GNU Lesser General Public License v2.1",
30 | "value": "GNU LGPLv2.1"
31 | },
32 | {
33 | "id": 7,
34 | "name": "GNU Lesser General Public License v3.0",
35 | "value": "GNU LGPLv3"
36 | },
37 | {
38 | "id": 8,
39 | "name": "BSD 2-clause 'Simplified' license",
40 | "value": "BSD-2-Clause"
41 | },
42 | {
43 | "id": 9,
44 | "name": "BSD 3-clause 'New' Or 'Revised' license*",
45 | "value": "BSD-3-Clause"
46 | },
47 | {
48 | "id": 10,
49 | "name": "Mozilla Public License 2.0",
50 | "value": "MPL-2.0"
51 | },
52 | {
53 | "id": 11,
54 | "name": "Open Software License 3.0",
55 | "value": "OSL-3.0"
56 | },
57 | {
58 | "id": 12,
59 | "name": "Apache 2.0",
60 | "value": "Apache-2.0"
61 | },
62 | {
63 | "id": 13,
64 | "name": "GNU Affero General Public License",
65 | "value": "GNU AGPLv3"
66 | },
67 | {
68 | "id": 14,
69 | "name": "Business Source License",
70 | "value": "BSL 1.1"
71 | }
72 | ]
73 |
--------------------------------------------------------------------------------
/data/networks.json:
--------------------------------------------------------------------------------
1 | {
2 | "80001": {
3 | "network": "maticmum",
4 | "networkName": "Mumbai",
5 | "tokenName": "MATIC",
6 | "rpcURL": "https://matic-mumbai.chainstacklabs.com/",
7 | "blockExplorerURL": "https://mumbai.polygonscan.com/"
8 | },
9 | "137": {
10 | "network": "matic",
11 | "networkName": "Polygon",
12 | "tokenName": "MATIC",
13 | "rpcURL": "https://rpc-mainnet.maticvigil.com/",
14 | "blockExplorerURL": "https://polygonscan.com/"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/data/profiles.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "img": "/profile/Nonit.png",
4 | "name": "Nonit Mittal",
5 | "twitter": "https://twitter.com/nonit_mittal",
6 | "github": "https://github.com/nonitmittal/",
7 | "gmail": "mailto:nonitmittal@gmail.com",
8 | "about": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"
9 | },
10 | {
11 | "img": "/profile/Sparsh.png",
12 | "name": "Sparsh Agarwal",
13 | "twitter": "https://twitter.com/akathecoder",
14 | "github": "https://github.com/akathecoder",
15 | "gmail": "sparshaga25@gmail.com",
16 | "about": "Wisdom comes from experience, experience comes from mistakes."
17 | },
18 | {
19 | "img": "/profile/Raghav.png",
20 | "name": "Raghav Goyal",
21 | "twitter": "https://twitter.com/rg12301",
22 | "github": "https://github.com/rg12301",
23 | "linkedin": "https://www.linkedin.com/in/rg12301/",
24 | "gmail": "mailto:12301raghavgoyal@gmail.com",
25 | "about": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
26 | }
27 | ]
28 |
--------------------------------------------------------------------------------
/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: true,
4 | images: {
5 | domains: ['ipfs.io', 'metadata.unstoppabledomains.com'],
6 | minimumCacheTTL: 60,
7 | },
8 | };
9 |
10 | module.exports = nextConfig;
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dapp-tools",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@coinbase/wallet-sdk": "^3.3.0",
13 | "@openzeppelin/contracts": "^4.6.0",
14 | "@openzeppelin/wizard": "^0.1.0",
15 | "@tailwindcss/forms": "^0.5.2",
16 | "@types/lodash": "^4.14.182",
17 | "@uauth/dom-ui": "^1.1.0",
18 | "@uauth/js": "^2.0.0",
19 | "@uauth/web3modal": "^2.0.0",
20 | "@walletconnect/web3-provider": "^1.7.8",
21 | "authereum": "^0.1.14",
22 | "axios": "^0.27.2",
23 | "bignumber.js": "^9.0.2",
24 | "ethereum-blockies-base64": "^1.0.2",
25 | "ethers": "^5.6.8",
26 | "next": "12.1.6",
27 | "nft.storage": "^6.3.0",
28 | "react": "18.1.0",
29 | "react-dom": "18.1.0",
30 | "solc": "^0.8.14-fixed",
31 | "web3modal": "^1.9.8"
32 | },
33 | "devDependencies": {
34 | "@types/node": "17.0.39",
35 | "@types/react": "18.0.11",
36 | "@types/react-dom": "18.0.5",
37 | "autoprefixer": "^10.4.7",
38 | "eslint": "8.17.0",
39 | "eslint-config-next": "12.1.6",
40 | "postcss": "^8.4.14",
41 | "tailwindcss": "^3.0.24",
42 | "typescript": "4.7.3"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/pages/404.tsx:
--------------------------------------------------------------------------------
1 | // 404.js
2 | import Image from 'next/image';
3 | import { useRouter } from 'next/router';
4 | import { Button } from '../components/ui/generalComponents';
5 |
6 | export default function FourOhFour() {
7 | const router = useRouter();
8 |
9 | return (
10 | <>
11 |
12 |
13 |
14 |
404
15 |
Sorry we couldn't find this page.
16 |
17 | But dont worry, you can find plenty of other things on our homepage.
18 |
19 |
20 | {
23 | router.push('/');
24 | }}
25 | />
26 |
27 |
28 |
29 |
37 |
38 |
39 |
40 | >
41 | );
42 | }
43 |
--------------------------------------------------------------------------------
/pages/api/erc20x/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @author - rG
3 | *
4 | */
5 |
6 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
7 | import type { NextApiRequest, NextApiResponse } from 'next';
8 | import { erc20x, ERC20xData } from '../../../utils/erc20x';
9 |
10 | // request handler
11 | // NOTE: logs "API resolved without sending a response for /api/erc20x, this may result in stalled requests."
12 | export default function handler(
13 | req: NextApiRequest,
14 | res: NextApiResponse<{ abi: any; bytecode: any; contract: string; metadata: any } | string>,
15 | ) {
16 | const opts: ERC20xData = req.body;
17 | const cb = (result: { abi: any; bytecode: any; contract: string; metadata: any }) => {
18 | if (result) {
19 | res.status(200).send(result);
20 | } else {
21 | res.status(500).send('Error while creating contract');
22 | }
23 | };
24 | erc20x(opts, cb);
25 | }
26 |
--------------------------------------------------------------------------------
/pages/api/hello.ts:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 | import type { NextApiRequest, NextApiResponse } from 'next'
3 |
4 | type Data = {
5 | name: string
6 | }
7 |
8 | export default function handler(
9 | req: NextApiRequest,
10 | res: NextApiResponse
11 | ) {
12 | res.status(200).json({ name: 'John Doe' })
13 | }
14 |
--------------------------------------------------------------------------------
/pages/api/nft-collection/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @author - rG
3 | *
4 | */
5 |
6 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
7 | import type { NextApiRequest, NextApiResponse } from 'next';
8 | import { nftCollection, NFTCollectionData } from '../../../utils/nft_collection';
9 |
10 | // request handler
11 | // NOTE: logs "API resolved without sending a response for /api/erc20x, this may result in stalled requests."
12 | export default function handler(
13 | req: NextApiRequest,
14 | res: NextApiResponse<{ abi: any; bytecode: any; contract: string; metadata: any } | string>,
15 | ) {
16 | const opts: NFTCollectionData = req.body;
17 | const cb = (result: { abi: any; bytecode: any; contract: string; metadata: any }) => {
18 | if (result) {
19 | res.status(200).send(result);
20 | } else {
21 | res.status(500).send('Error while creating contract');
22 | }
23 | };
24 | nftCollection(opts, cb);
25 | }
26 |
--------------------------------------------------------------------------------
/pages/api/single-nft/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @author - rG
3 | *
4 | */
5 |
6 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
7 | import type { NextApiRequest, NextApiResponse } from 'next';
8 | import { singleNft, SingleNFTData } from '../../../utils/single_nft';
9 |
10 | // request handler
11 | // NOTE: logs "API resolved without sending a response for /api/erc20x, this may result in stalled requests."
12 | export default function handler(
13 | req: NextApiRequest,
14 | res: NextApiResponse<{ abi: any; bytecode: any; contract: string; metadata: any } | string>,
15 | ) {
16 | const opts: SingleNFTData = req.body;
17 | const cb = (result: { abi: any; bytecode: any; contract: string; metadata: any }) => {
18 | if (result) {
19 | res.status(200).send(result);
20 | } else {
21 | res.status(500).send('Error while creating contract');
22 | }
23 | };
24 | singleNft(opts, cb);
25 | }
26 |
--------------------------------------------------------------------------------
/pages/erc1155.tsx:
--------------------------------------------------------------------------------
1 | import type { NextPage } from 'next';
2 | import MintErc1155 from '../components/ui/mintErc1155';
3 |
4 | const Erc1155: NextPage = () => {
5 | return ;
6 | };
7 |
8 | export default Erc1155;
9 |
--------------------------------------------------------------------------------
/pages/erc20.tsx:
--------------------------------------------------------------------------------
1 | import type { NextPage } from 'next';
2 | import MintErc20 from '../components/ui/mintErc20';
3 |
4 | const Erc20: NextPage = () => {
5 | return (
6 |
7 |
8 |
9 | );
10 | };
11 |
12 | export default Erc20;
13 |
--------------------------------------------------------------------------------
/pages/erc721.tsx:
--------------------------------------------------------------------------------
1 | import type { NextPage } from 'next';
2 | import MintErc721 from '../components/ui/mintErc721';
3 |
4 | const Erc721: NextPage = () => {
5 | return (
6 |
7 |
8 |
9 | );
10 | };
11 |
12 | export default Erc721;
13 |
--------------------------------------------------------------------------------
/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import type { NextPage } from 'next';
2 | import Homepage from '../components/ui/homepage';
3 |
4 | const Home: NextPage = () => {
5 | return (
6 |
7 |
8 |
9 | );
10 | };
11 |
12 | export default Home;
13 |
--------------------------------------------------------------------------------
/pages/mintNft.tsx:
--------------------------------------------------------------------------------
1 | import type { NextPage } from 'next';
2 | import WalletModal from '../components/ui/modal';
3 | import Navbar from '../components/ui/navbar';
4 | import MintSingleNft from '../components/ui/mintSingleNft';
5 |
6 | const MintNft: NextPage = () => {
7 | return (
8 | <>
9 |
10 |
11 |
12 | >
13 | );
14 | };
15 |
16 | export default MintNft;
17 |
--------------------------------------------------------------------------------
/pages/mintNftCollection.tsx:
--------------------------------------------------------------------------------
1 | import type { NextPage } from 'next';
2 | import MintMultipleNft from '../components/ui/mintMultipleNft';
3 |
4 | const MintNftCollection: NextPage = () => {
5 | return (
6 |
7 |
8 |
9 | );
10 | };
11 |
12 | export default MintNftCollection;
13 |
--------------------------------------------------------------------------------
/pages/profile.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Profile from '../components/ui/profile';
3 |
4 | const profile = () => {
5 | return (
6 |
7 |
8 |
9 | );
10 | };
11 |
12 | export default profile;
13 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/favicon.ico
--------------------------------------------------------------------------------
/public/profile/Nonit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/Nonit.png
--------------------------------------------------------------------------------
/public/profile/Raghav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/Raghav.png
--------------------------------------------------------------------------------
/public/profile/Sparsh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/Sparsh.png
--------------------------------------------------------------------------------
/public/profile/github.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 | GitHub icon
9 |
15 |
16 |
--------------------------------------------------------------------------------
/public/profile/gmail.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 | Gmail icon
9 |
11 |
12 |
--------------------------------------------------------------------------------
/public/profile/hb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/hb.png
--------------------------------------------------------------------------------
/public/profile/nonit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/nonit.png
--------------------------------------------------------------------------------
/public/profile/raghav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/raghav.png
--------------------------------------------------------------------------------
/public/profile/sparsh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Erroders/dapp-tools/16570906fc1a5978ce00e796aa25d0896925e473/public/profile/sparsh.png
--------------------------------------------------------------------------------
/public/profile/twitter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/share.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/share_filled.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/styles/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/subgraph/abis/Ownable.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Ownable",
4 | "sourceName": "contracts/access/Ownable.sol",
5 | "abi": [
6 | {
7 | "anonymous": false,
8 | "inputs": [
9 | {
10 | "indexed": true,
11 | "internalType": "address",
12 | "name": "previousOwner",
13 | "type": "address"
14 | },
15 | {
16 | "indexed": true,
17 | "internalType": "address",
18 | "name": "newOwner",
19 | "type": "address"
20 | }
21 | ],
22 | "name": "OwnershipTransferred",
23 | "type": "event"
24 | },
25 | {
26 | "inputs": [],
27 | "name": "owner",
28 | "outputs": [
29 | {
30 | "internalType": "address",
31 | "name": "",
32 | "type": "address"
33 | }
34 | ],
35 | "stateMutability": "view",
36 | "type": "function"
37 | },
38 | {
39 | "inputs": [],
40 | "name": "renounceOwnership",
41 | "outputs": [],
42 | "stateMutability": "nonpayable",
43 | "type": "function"
44 | },
45 | {
46 | "inputs": [
47 | {
48 | "internalType": "address",
49 | "name": "newOwner",
50 | "type": "address"
51 | }
52 | ],
53 | "name": "transferOwnership",
54 | "outputs": [],
55 | "stateMutability": "nonpayable",
56 | "type": "function"
57 | }
58 | ],
59 | "bytecode": "0x",
60 | "deployedBytecode": "0x",
61 | "linkReferences": {},
62 | "deployedLinkReferences": {}
63 | }
64 |
--------------------------------------------------------------------------------
/subgraph/abis/Pausable.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Pausable",
4 | "sourceName": "contracts/security/Pausable.sol",
5 | "abi": [
6 | {
7 | "anonymous": false,
8 | "inputs": [
9 | {
10 | "indexed": false,
11 | "internalType": "address",
12 | "name": "account",
13 | "type": "address"
14 | }
15 | ],
16 | "name": "Paused",
17 | "type": "event"
18 | },
19 | {
20 | "anonymous": false,
21 | "inputs": [
22 | {
23 | "indexed": false,
24 | "internalType": "address",
25 | "name": "account",
26 | "type": "address"
27 | }
28 | ],
29 | "name": "Unpaused",
30 | "type": "event"
31 | },
32 | {
33 | "inputs": [],
34 | "name": "paused",
35 | "outputs": [
36 | {
37 | "internalType": "bool",
38 | "name": "",
39 | "type": "bool"
40 | }
41 | ],
42 | "stateMutability": "view",
43 | "type": "function"
44 | }
45 | ],
46 | "bytecode": "0x",
47 | "deployedBytecode": "0x",
48 | "linkReferences": {},
49 | "deployedLinkReferences": {}
50 | }
51 |
--------------------------------------------------------------------------------
/subgraph/networks.json:
--------------------------------------------------------------------------------
1 | {
2 | "mumbai": {
3 | "DappTools": {
4 | "address": "0xF8A5bb1BCFBc6c87eb9c4632ec4059113263aA1D",
5 | "startBlock": 26667925
6 | }
7 | },
8 | "matic": {
9 | "DappTools": {
10 | "address": "0x57AECb0e3dDF7643DF854372abb3970a9F8262B0"
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/subgraph/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Dapp Tools",
3 | "license": "UNLICENSED",
4 | "scripts": {
5 | "prepare": "graph codegen && graph build --network mumbai --network-file networks.json",
6 | "codegen": "graph codegen",
7 | "build-polygon": "graph build --network matic --network-file networks.json",
8 | "build-mumbai": "graph build --network mumbai --network-file networks.json",
9 | "auth": "graph auth --product hosted-service",
10 | "deploy": "graph deploy --product hosted-service erroders/dapp-tools"
11 | },
12 | "dependencies": {
13 | "@graphprotocol/graph-cli": "0.30.4",
14 | "@graphprotocol/graph-ts": "^0.27.0",
15 | "@openzeppelin/subgraphs": "^0.1.8"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/subgraph/setup.md:
--------------------------------------------------------------------------------
1 | 1. Write and deploy contract
2 | 2. Init graph
3 |
4 | ```shell
5 | graph init \
6 | --product hosted-service \
7 | --from-contract 0x47AECb0e3dDF7643DF854372abb3970a9F8262B0 \
8 | "Erroders/Dapp Tools" \
9 | --network mumbai \
10 | --abi "/mnt/DATA/Dev/Hackathons/Encode X Polygon/dapp-tools/contract-dev/artifacts/contracts/DappTools.sol/DappTools.json"
11 | ```
12 |
13 | 3.
--------------------------------------------------------------------------------
/subgraph/src/dapp-tools.ts:
--------------------------------------------------------------------------------
1 | import { RegisterToken } from '../generated/DappTools/DappTools';
2 | import {
3 | AccessControl,
4 | DappToolsRegisteredERC20,
5 | DappToolsRegisteredERC1155,
6 | DappToolsRegisteredERC721,
7 | Ownable,
8 | Pausable,
9 | } from '../generated/templates';
10 |
11 | export function handleRegisterToken(event: RegisterToken): void {
12 | switch (event.params.kind) {
13 | case 0:
14 | DappToolsRegisteredERC20.create(event.params.contract_address);
15 | break;
16 | case 1:
17 | DappToolsRegisteredERC721.create(event.params.contract_address);
18 | break;
19 | case 2:
20 | DappToolsRegisteredERC1155.create(event.params.contract_address);
21 | break;
22 | // For super token, needs modifications as per superfluid subgraph template
23 | case 3:
24 | DappToolsRegisteredERC20.create(event.params.contract_address);
25 | break;
26 | }
27 | AccessControl.create(event.params.contract_address);
28 | Ownable.create(event.params.contract_address);
29 | Pausable.create(event.params.contract_address);
30 | }
31 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/accesscontrol.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Address,
3 | Bytes,
4 | } from '@graphprotocol/graph-ts'
5 |
6 | import {
7 | Role,
8 | AccessControl,
9 | AccessControlRole,
10 | } from '../../generated/schema'
11 |
12 | import {
13 | fetchAccount,
14 | } from './account'
15 |
16 | import {
17 | constants,
18 | } from '@amxx/graphprotocol-utils'
19 |
20 | export function fetchRole(id: Bytes): Role {
21 | let role = new Role(id)
22 | role.save()
23 | return role
24 | }
25 |
26 | export function fetchAccessControl(address: Address): AccessControl {
27 | let contract = new AccessControl(address)
28 | contract.asAccount = address
29 | contract.save()
30 |
31 | let account = fetchAccount(address)
32 | account.asAccessControl = address
33 | account.save()
34 |
35 | return contract
36 | }
37 |
38 | export function fetchAccessControlRole(contract: AccessControl, role: Role): AccessControlRole {
39 | let id = contract.id.toHex().concat('/').concat(role.id.toHex())
40 | let acr = AccessControlRole.load(id)
41 |
42 | if (acr == null) {
43 | acr = new AccessControlRole(id)
44 | acr.contract = contract.id;
45 | acr.role = role.id;
46 | acr.admin = role.id == constants.BYTES32_ZERO
47 | ? acr.id
48 | : fetchAccessControlRole(contract, fetchRole(constants.BYTES32_ZERO)).id
49 | acr.save()
50 | }
51 |
52 | return acr as AccessControlRole
53 | }
54 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/account.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Address,
3 | } from '@graphprotocol/graph-ts'
4 |
5 | import {
6 | Account,
7 | } from '../../generated/schema'
8 |
9 | export function fetchAccount(address: Address): Account {
10 | let account = new Account(address)
11 | account.save()
12 | return account
13 | }
14 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/erc165.ts:
--------------------------------------------------------------------------------
1 | import { ethereum, Bytes } from '@graphprotocol/graph-ts'
2 |
3 | export function supportsInterface(contract: ethereum.SmartContract, interfaceId: String, expected: boolean = true): boolean {
4 | let result = ethereum.call(new ethereum.SmartContractCall(
5 | contract._name, // '',
6 | contract._address, // address,
7 | 'supportsInterface', // '',
8 | 'supportsInterface(bytes4):(bool)',
9 | [ethereum.Value.fromFixedBytes(Bytes.fromHexString(interfaceId) as Bytes)]
10 | ))
11 |
12 | return result != null && (result as Array)[0].toBoolean() == expected
13 | }
14 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/ownable.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Address,
3 | } from '@graphprotocol/graph-ts'
4 |
5 | import {
6 | Ownable,
7 | } from '../../generated/schema'
8 |
9 | import {
10 | fetchAccount,
11 | } from './account'
12 |
13 | export function fetchOwnable(address: Address): Ownable {
14 | let contract = new Ownable(address)
15 | contract.asAccount = address
16 |
17 | let account = fetchAccount(address)
18 | account.asOwnable = address
19 | account.save()
20 |
21 | return contract
22 | }
23 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/pausable.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Address,
3 | } from '@graphprotocol/graph-ts'
4 |
5 | import {
6 | Pausable,
7 | } from '../../generated/schema'
8 |
9 | import {
10 | fetchAccount,
11 | } from './account'
12 |
13 | export function fetchPausable(address: Address): Pausable {
14 | let contract = new Pausable(address)
15 | contract.asAccount = address
16 |
17 | let account = fetchAccount(address)
18 | account.asPausable = address
19 | account.save()
20 |
21 | return contract
22 | }
23 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/timelock.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Address,
3 | BigInt,
4 | Bytes,
5 | } from '@graphprotocol/graph-ts'
6 |
7 | import {
8 | Timelock,
9 | TimelockOperation,
10 | TimelockCall,
11 | } from '../../generated/schema'
12 |
13 | import {
14 | fetchAccount
15 | } from './account'
16 |
17 | export function fetchTimelock(address: Address): Timelock {
18 | let contract = Timelock.load(address)
19 |
20 | if (contract == null) {
21 | contract = new Timelock(address)
22 | contract.asAccount = address
23 | contract.save()
24 |
25 | let account = fetchAccount(address)
26 | account.asTimelock = address
27 | account.save()
28 | }
29 |
30 | return contract as Timelock
31 | }
32 |
33 | export function fetchTimelockOperation(contract: Timelock, opid: Bytes): TimelockOperation {
34 | let id = contract.id.toHex().concat('/').concat(opid.toHex())
35 | let operation = TimelockOperation.load(id)
36 |
37 | if (operation == null) {
38 | operation = new TimelockOperation(id)
39 | operation.contract = contract.id
40 | }
41 |
42 | return operation as TimelockOperation
43 | }
44 |
45 | export function fetchTimelockCall(operation: TimelockOperation, index: BigInt): TimelockCall {
46 | let id = operation.id.concat('/').concat(index.toString())
47 | let call = TimelockCall.load(id)
48 |
49 | if (call == null) {
50 | call = new TimelockCall(id)
51 | call.operation = operation.id
52 | }
53 |
54 | return call as TimelockCall
55 | }
56 |
--------------------------------------------------------------------------------
/subgraph/src/fetch/voting.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Address,
3 | } from '@graphprotocol/graph-ts'
4 |
5 | import {
6 | Account,
7 | VotingContract,
8 | VoteDelegation,
9 | VoteWeight,
10 | } from '../../generated/schema'
11 |
12 | import {
13 | constants,
14 | } from '@amxx/graphprotocol-utils'
15 |
16 | import {
17 | fetchAccount
18 | } from './account'
19 |
20 | export function fetchVoting(address: Address): VotingContract {
21 | let contract = VotingContract.load(address)
22 |
23 | if (contract == null) {
24 | contract = new VotingContract(address)
25 | contract.asAccount = address
26 | contract.totalWeight = fetchWeight(contract as VotingContract, null).id
27 | contract.save()
28 |
29 | let account = fetchAccount(address)
30 | account.asVoting = address
31 | account.save()
32 | }
33 | return contract as VotingContract
34 | }
35 |
36 | export function fetchWeight(contract: VotingContract, account: Account | null): VoteWeight {
37 | let id = contract.id.toHex().concat('/').concat(account ? account.id.toHex() : 'total')
38 | let weight = VoteWeight.load(id)
39 |
40 | if (weight == null) {
41 | weight = new VoteWeight(id)
42 | weight.contract = contract.id
43 | weight.account = account ? account.id : null
44 | weight.value = constants.BIGINT_ZERO
45 | weight.save();
46 | }
47 |
48 | return weight as VoteWeight
49 | }
50 |
51 | export function fetchDelegation(contract: VotingContract, account: Account): VoteDelegation {
52 | let delegation = new VoteDelegation(contract.id.toHex().concat('/').concat(account.id.toHex()))
53 | delegation.contract = contract.id
54 | delegation.delegator = account.id
55 |
56 | return delegation as VoteDelegation
57 | }
58 |
--------------------------------------------------------------------------------
/subgraph/src/ownable.ts:
--------------------------------------------------------------------------------
1 | import { OwnershipTransferred } from '../generated/schema';
2 |
3 | import { OwnershipTransferred as OwnershipTransferredEvent } from '../generated/templates/Ownable/Ownable';
4 |
5 | import { events, transactions } from '@amxx/graphprotocol-utils';
6 |
7 | import { fetchAccount } from './fetch/account';
8 |
9 | import { fetchOwnable } from './fetch/ownable';
10 |
11 | export function handleOwnershipTransferred(event: OwnershipTransferredEvent): void {
12 | let contract = fetchOwnable(event.address);
13 | let owner = fetchAccount(event.params.newOwner);
14 |
15 | contract.owner = owner.id;
16 | contract.save();
17 |
18 | let ev = new OwnershipTransferred(events.id(event));
19 | ev.emitter = contract.id;
20 | ev.transaction = transactions.log(event).id;
21 | ev.timestamp = event.block.timestamp;
22 | ev.contract = contract.id;
23 | ev.owner = owner.id;
24 | ev.save();
25 | }
26 |
--------------------------------------------------------------------------------
/subgraph/src/pausable.ts:
--------------------------------------------------------------------------------
1 | import { Paused } from '../generated/schema';
2 |
3 | import { Paused as PausedEvent, Unpaused as UnpausedEvent } from '../generated/templates/Pausable/Pausable';
4 |
5 | import { events, transactions } from '@amxx/graphprotocol-utils';
6 |
7 | import { fetchAccount } from './fetch/account';
8 |
9 | import { fetchPausable } from './fetch/pausable';
10 |
11 | export function handlePaused(event: PausedEvent): void {
12 | let contract = fetchPausable(event.address);
13 | contract.isPaused = true;
14 | contract.save();
15 |
16 | let ev = new Paused(events.id(event));
17 | ev.emitter = contract.id;
18 | ev.transaction = transactions.log(event).id;
19 | ev.timestamp = event.block.timestamp;
20 | ev.contract = contract.id;
21 | ev.isPaused = true;
22 | ev.save();
23 | }
24 |
25 | export function handleUnpaused(event: UnpausedEvent): void {
26 | let contract = fetchPausable(event.address);
27 | contract.isPaused = false;
28 | contract.save();
29 |
30 | let ev = new Paused(events.id(event));
31 | ev.emitter = contract.id;
32 | ev.transaction = transactions.log(event).id;
33 | ev.timestamp = event.block.timestamp;
34 | ev.contract = contract.id;
35 | ev.isPaused = false;
36 | ev.save();
37 | }
38 |
--------------------------------------------------------------------------------
/subgraph/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@graphprotocol/graph-ts/types/tsconfig.base.json",
3 | "include": ["src"]
4 | }
5 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | content: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
3 | theme: {
4 | extend: {},
5 | },
6 | plugins: [require('@tailwindcss/forms')],
7 | };
8 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true
17 | },
18 | "include": ["next-env.d.ts", "additional.d.ts", "**/*.ts", "**/*.tsx"],
19 | "exclude": ["node_modules", "subgraph", "contract-dev"]
20 | }
21 |
--------------------------------------------------------------------------------
/utils/contracts/BurnableSuperToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity ^0.8.0;
3 |
4 | import {SuperTokenBase} from "./SuperTokenBase.sol";
5 |
6 | /// @title Burnable Super Token
7 | /// @author jtriley.eth
8 | /// @notice This does not perform checks when burning
9 | contract {0} is SuperTokenBase {
10 |
11 | // /// @notice Initializer, used AFTER factory upgrade
12 | // /// @dev We MUST mint here, there is no other way to mint tokens
13 | // /// @param name Name of Super Token
14 | // /// @param symbol Symbol of Super Token
15 | // /// @param factory Super Token factory for initialization
16 | // /// @param initialSupply Initial token supply to pre-mint
17 | // /// @param receiver Receiver of pre-mint
18 | // /// @param userData Arbitrary user data for pre-mint
19 | // function initialize(
20 | // string memory name,
21 | // string memory symbol,
22 | // address factory,
23 | // uint256 initialSupply,
24 | // address receiver,
25 | // bytes memory userData
26 | // ) external {
27 | // _initialize(name, symbol, factory);
28 | // _mint(receiver, initialSupply, userData);
29 | // }
30 | function initialize() external {
31 | _initialize("{0}", "{1}", address({2}));
32 | _mint(msg.sender, {3}, "{4}");
33 | }
34 |
35 | /// @notice Burns from message sender
36 | /// @param amount Amount to burn
37 | function burn(uint256 amount, bytes memory userData) external {
38 | _burn(msg.sender, amount, userData);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/utils/contracts/MintableSuperToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity ^0.8.0;
3 |
4 | import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
5 |
6 | import {SuperTokenBase} from './SuperTokenBase.sol';
7 |
8 | /// @title Mintable Super Token
9 | /// @author jtriley.eth
10 | /// @notice Only the owner may mint
11 | contract {0} is SuperTokenBase, Ownable {
12 | // /// @notice Initializer, used AFTER factory upgrade
13 | // /// @param name Name of Super Token
14 | // /// @param symbol Symbol of Super Token
15 | // /// @param factory Super token factory for initialization
16 | // function initialize(string memory name, string memory symbol, address factory) external {
17 | // _initialize(name, symbol, factory);
18 | // }
19 | function initialize() external {
20 | _initialize("{0}", "{1}", address({2}));
21 | }
22 |
23 | /// @notice Mints tokens, only the owner may do this
24 | /// @param receiver Receiver of minted tokens
25 | /// @param amount Amount to mint
26 | function mint(
27 | address receiver,
28 | uint256 amount,
29 | bytes memory userData
30 | ) external onlyOwner {
31 | _mint(receiver, amount, userData);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/utils/contracts/NativeSuperToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity ^0.8.0;
3 |
4 | import {SuperTokenBase} from './SuperTokenBase.sol';
5 |
6 | /// @title Minimal Native Super Token
7 | /// @author jtriley.eth
8 | /// @notice Pre-minted supply. This is includes no custom logic. Used in `NativeSuperTokenDeployer`
9 | contract NativeSuperToken is SuperTokenBase {
10 | /// @dev Upgrades the super token with the factory, then initializes.
11 | /// @param name super token name
12 | /// @param symbol super token symbol
13 | /// @param factory super token factory for initialization
14 | /// @param receiver Receiver of pre-mint
15 | /// @param initialSupply Initial token supply to pre-mint
16 | function initialize(
17 | string memory name,
18 | string memory symbol,
19 | address factory,
20 | address receiver,
21 | uint256 initialSupply
22 | ) external {
23 | _initialize(name, symbol, factory);
24 | _mint(receiver, initialSupply, '');
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/utils/contracts/SingleNFT.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: {5}
2 | pragma solidity ^0.8.4;
3 |
4 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5 | import "@openzeppelin/contracts/security/Pausable.sol";
6 | import "@openzeppelin/contracts/access/AccessControl.sol";
7 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
8 |
9 | /// @custom:security-contact {4}
10 | contract {0} is ERC721, Pausable, AccessControl, ERC721Burnable {
11 | bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
12 |
13 | constructor() ERC721("{0}", "{1}") {
14 | _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
15 | _grantRole(PAUSER_ROLE, msg.sender);
16 | _safeMint(msg.sender, {2});
17 | }
18 |
19 | function _baseURI() internal pure override returns (string memory) {
20 | return "{3}";
21 | }
22 |
23 | function tokenURI(uint256 tokenId) public view override returns (string memory) {
24 | require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
25 |
26 | string memory baseURI = _baseURI();
27 | return baseURI;
28 | }
29 |
30 | function pause() public onlyRole(PAUSER_ROLE) {
31 | _pause();
32 | }
33 |
34 | function unpause() public onlyRole(PAUSER_ROLE) {
35 | _unpause();
36 | }
37 |
38 | function _beforeTokenTransfer(address from, address to, uint256 tokenId)
39 | internal
40 | whenNotPaused
41 | override
42 | {
43 | super._beforeTokenTransfer(from, to, tokenId);
44 | }
45 |
46 | // The following functions are overrides required by Solidity.
47 |
48 | function supportsInterface(bytes4 interfaceId)
49 | public
50 | view
51 | override(ERC721, AccessControl)
52 | returns (bool)
53 | {
54 | return super.supportsInterface(interfaceId);
55 | }
56 | }
--------------------------------------------------------------------------------
/utils/erc20x.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @author - rG
3 | * @resources -
4 | * https://docs.superfluid.finance/superfluid/developers/developer-guides/super-tokens
5 | * https://github.com/superfluid-finance/CustomSuperTokens
6 | *
7 | */
8 |
9 | import compile from './contract_compiler';
10 | import { readFileSync } from 'fs';
11 | import { formatContractName, stringFormat } from './string_formatter';
12 |
13 | // type for user provided data for ERC20x contract
14 | export type ERC20xData = {
15 | name: string;
16 | symbol: string;
17 | factory: string;
18 | supply: string;
19 | userData: string;
20 | type: 'Burnable' | 'BurnMint' | 'Capped' | 'Mintable';
21 | };
22 |
23 | // generate ERC20x contract using OpenZeppelin wizard solidity API
24 | // then pass it to compile method to generate ABI and bytecode
25 | export function erc20x(opts: ERC20xData, cb: any): { abi: any; bytecode: any; contract: string; metadata: any } | void {
26 | opts.name = formatContractName(opts.name);
27 | let file: string = readFileSync(`${process.cwd()}/utils/contracts/${opts.type}SuperToken.sol`, {
28 | encoding: 'utf-8',
29 | });
30 | switch (opts.type) {
31 | case 'Burnable':
32 | file = stringFormat(file, opts.name, opts.symbol, opts.factory, opts.supply, opts.userData);
33 | break;
34 | case 'BurnMint':
35 | file = stringFormat(file, opts.name, opts.symbol, opts.factory, opts.supply, opts.userData);
36 | break;
37 | case 'Capped':
38 | file = stringFormat(file, opts.name, opts.symbol, opts.factory, opts.supply);
39 | break;
40 | case 'Mintable':
41 | file = stringFormat(file, opts.name, opts.symbol, opts.factory);
42 | break;
43 | }
44 | compile(file, opts.name, cb);
45 | }
46 |
--------------------------------------------------------------------------------
/utils/getIPFSUrl.ts:
--------------------------------------------------------------------------------
1 | // source - https://www.programiz.com/javascript/regex
2 | // function to fetch IPFS hash from any ipfs URL
3 | export function getIPFSUrl(url: string): string {
4 | let ipfsLink = url;
5 | if (url && !url.includes('http') && !url.includes('ipfs')) {
6 | ipfsLink = `https://ipfs.io/ipfs/${url}`;
7 | } else if (url && url.includes('ipfs')) {
8 | const reguarExp = /ipfs:?\/+/;
9 | const hash = url.split(reguarExp)[1];
10 | ipfsLink = `https://ipfs.io/ipfs/${hash}`;
11 | }
12 | return ipfsLink;
13 | }
14 |
--------------------------------------------------------------------------------
/utils/getLicences.ts:
--------------------------------------------------------------------------------
1 | import data from '../data/licences.json';
2 |
3 | export default function getLicences(): Array<{
4 | value: string;
5 | label: string;
6 | }> {
7 | const licences: Array<{
8 | value: string;
9 | label: string;
10 | }> = data.map((v) => {
11 | return {
12 | label: v.name,
13 | value: v.value,
14 | };
15 | });
16 |
17 | return licences;
18 | }
19 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/access/AccessControlCrossChain.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControlCrossChain.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import "./AccessControl.sol";
7 | import "../crosschain/CrossChainEnabled.sol";
8 |
9 | /**
10 | * @dev An extension to {AccessControl} with support for cross-chain access management.
11 | * For each role, is extension implements an equivalent "aliased" role that is used for
12 | * restricting calls originating from other chains.
13 | *
14 | * For example, if a function `myFunction` is protected by `onlyRole(SOME_ROLE)`, and
15 | * if an address `x` has role `SOME_ROLE`, it would be able to call `myFunction` directly.
16 | * A wallet or contract at the same address on another chain would however not be able
17 | * to call this function. In order to do so, it would require to have the role
18 | * `_crossChainRoleAlias(SOME_ROLE)`.
19 | *
20 | * This aliasing is required to protect against multiple contracts living at the same
21 | * address on different chains but controlled by conflicting entities.
22 | *
23 | * _Available since v4.6._
24 | */
25 | abstract contract AccessControlCrossChain is AccessControl, CrossChainEnabled {
26 | bytes32 public constant CROSSCHAIN_ALIAS = keccak256("CROSSCHAIN_ALIAS");
27 |
28 | /**
29 | * @dev See {AccessControl-_checkRole}.
30 | */
31 | function _checkRole(bytes32 role) internal view virtual override {
32 | if (_isCrossChain()) {
33 | _checkRole(_crossChainRoleAlias(role), _crossChainSender());
34 | } else {
35 | super._checkRole(role);
36 | }
37 | }
38 |
39 | /**
40 | * @dev Returns the aliased role corresponding to `role`.
41 | */
42 | function _crossChainRoleAlias(bytes32 role) internal pure virtual returns (bytes32) {
43 | return role ^ CROSSCHAIN_ALIAS;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/access/IAccessControlEnumerable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./IAccessControl.sol";
7 |
8 | /**
9 | * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
10 | */
11 | interface IAccessControlEnumerable is IAccessControl {
12 | /**
13 | * @dev Returns one of the accounts that have `role`. `index` must be a
14 | * value between 0 and {getRoleMemberCount}, non-inclusive.
15 | *
16 | * Role bearers are not sorted in any particular way, and their ordering may
17 | * change at any point.
18 | *
19 | * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
20 | * you perform all queries on the same block. See the following
21 | * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
22 | * for more information.
23 | */
24 | function getRoleMember(bytes32 role, uint256 index) external view returns (address);
25 |
26 | /**
27 | * @dev Returns the number of accounts that have `role`. Can be used
28 | * together with {getRoleMember} to enumerate all bearers of a role.
29 | */
30 | function getRoleMemberCount(bytes32 role) external view returns (uint256);
31 | }
32 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/amb/LibAMB.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/amb/LibAMB.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import {IAMB as AMB_Bridge} from "../../vendor/amb/IAMB.sol";
7 | import "../errors.sol";
8 |
9 | /**
10 | * @dev Primitives for cross-chain aware contracts using the
11 | * [AMB](https://docs.tokenbridge.net/amb-bridge/about-amb-bridge)
12 | * family of bridges.
13 | */
14 | library LibAMB {
15 | /**
16 | * @dev Returns whether the current function call is the result of a
17 | * cross-chain message relayed by `bridge`.
18 | */
19 | function isCrossChain(address bridge) internal view returns (bool) {
20 | return msg.sender == bridge;
21 | }
22 |
23 | /**
24 | * @dev Returns the address of the sender that triggered the current
25 | * cross-chain message through `bridge`.
26 | *
27 | * NOTE: {isCrossChain} should be checked before trying to recover the
28 | * sender, as it will revert with `NotCrossChainCall` if the current
29 | * function call is not the result of a cross-chain message.
30 | */
31 | function crossChainSender(address bridge) internal view returns (address) {
32 | if (!isCrossChain(bridge)) revert NotCrossChainCall();
33 | return AMB_Bridge(bridge).messageSender();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import "../CrossChainEnabled.sol";
7 | import "./LibArbitrumL1.sol";
8 |
9 | /**
10 | * @dev [Arbitrum](https://arbitrum.io/) specialization or the
11 | * {CrossChainEnabled} abstraction the L1 side (mainnet).
12 | *
13 | * This version should only be deployed on L1 to process cross-chain messages
14 | * originating from L2. For the other side, use {CrossChainEnabledArbitrumL2}.
15 | *
16 | * The bridge contract is provided and maintained by the arbitrum team. You can
17 | * find the address of this contract on the rinkeby testnet in
18 | * [Arbitrum's developer documentation](https://developer.offchainlabs.com/docs/useful_addresses).
19 | *
20 | * _Available since v4.6._
21 | */
22 | abstract contract CrossChainEnabledArbitrumL1 is CrossChainEnabled {
23 | /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
24 | address private immutable _bridge;
25 |
26 | /// @custom:oz-upgrades-unsafe-allow constructor
27 | constructor(address bridge) {
28 | _bridge = bridge;
29 | }
30 |
31 | /**
32 | * @dev see {CrossChainEnabled-_isCrossChain}
33 | */
34 | function _isCrossChain() internal view virtual override returns (bool) {
35 | return LibArbitrumL1.isCrossChain(_bridge);
36 | }
37 |
38 | /**
39 | * @dev see {CrossChainEnabled-_crossChainSender}
40 | */
41 | function _crossChainSender() internal view virtual override onlyCrossChain returns (address) {
42 | return LibArbitrumL1.crossChainSender(_bridge);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import "../CrossChainEnabled.sol";
7 | import "./LibArbitrumL2.sol";
8 |
9 | /**
10 | * @dev [Arbitrum](https://arbitrum.io/) specialization or the
11 | * {CrossChainEnabled} abstraction the L2 side (arbitrum).
12 | *
13 | * This version should only be deployed on L2 to process cross-chain messages
14 | * originating from L1. For the other side, use {CrossChainEnabledArbitrumL1}.
15 | *
16 | * Arbitrum L2 includes the `ArbSys` contract at a fixed address. Therefore,
17 | * this specialization of {CrossChainEnabled} does not include a constructor.
18 | *
19 | * _Available since v4.6._
20 | */
21 | abstract contract CrossChainEnabledArbitrumL2 is CrossChainEnabled {
22 | /**
23 | * @dev see {CrossChainEnabled-_isCrossChain}
24 | */
25 | function _isCrossChain() internal view virtual override returns (bool) {
26 | return LibArbitrumL2.isCrossChain(LibArbitrumL2.ARBSYS);
27 | }
28 |
29 | /**
30 | * @dev see {CrossChainEnabled-_crossChainSender}
31 | */
32 | function _crossChainSender() internal view virtual override onlyCrossChain returns (address) {
33 | return LibArbitrumL2.crossChainSender(LibArbitrumL2.ARBSYS);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/arbitrum/LibArbitrumL1.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/LibArbitrumL1.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import {IBridge as ArbitrumL1_Bridge} from "../../vendor/arbitrum/IBridge.sol";
7 | import {IInbox as ArbitrumL1_Inbox} from "../../vendor/arbitrum/IInbox.sol";
8 | import {IOutbox as ArbitrumL1_Outbox} from "../../vendor/arbitrum/IOutbox.sol";
9 | import "../errors.sol";
10 |
11 | /**
12 | * @dev Primitives for cross-chain aware contracts for
13 | * [Arbitrum](https://arbitrum.io/).
14 | *
15 | * This version should only be used on L1 to process cross-chain messages
16 | * originating from L2. For the other side, use {LibArbitrumL2}.
17 | */
18 | library LibArbitrumL1 {
19 | /**
20 | * @dev Returns whether the current function call is the result of a
21 | * cross-chain message relayed by the `bridge`.
22 | */
23 | function isCrossChain(address bridge) internal view returns (bool) {
24 | return msg.sender == bridge;
25 | }
26 |
27 | /**
28 | * @dev Returns the address of the sender that triggered the current
29 | * cross-chain message through the `bridge`.
30 | *
31 | * NOTE: {isCrossChain} should be checked before trying to recover the
32 | * sender, as it will revert with `NotCrossChainCall` if the current
33 | * function call is not the result of a cross-chain message.
34 | */
35 | function crossChainSender(address bridge) internal view returns (address) {
36 | if (!isCrossChain(bridge)) revert NotCrossChainCall();
37 |
38 | address sender = ArbitrumL1_Outbox(ArbitrumL1_Bridge(bridge).activeOutbox()).l2ToL1Sender();
39 | require(sender != address(0), "LibArbitrumL1: system messages without sender");
40 |
41 | return sender;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/arbitrum/LibArbitrumL2.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/LibArbitrumL2.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import {IArbSys as ArbitrumL2_Bridge} from "../../vendor/arbitrum/IArbSys.sol";
7 | import "../errors.sol";
8 |
9 | /**
10 | * @dev Primitives for cross-chain aware contracts for
11 | * [Arbitrum](https://arbitrum.io/).
12 | *
13 | * This version should only be used on L2 to process cross-chain messages
14 | * originating from L1. For the other side, use {LibArbitrumL1}.
15 | */
16 | library LibArbitrumL2 {
17 | /**
18 | * @dev Returns whether the current function call is the result of a
19 | * cross-chain message relayed by `arbsys`.
20 | */
21 | address public constant ARBSYS = 0x0000000000000000000000000000000000000064;
22 |
23 | function isCrossChain(address arbsys) internal view returns (bool) {
24 | return ArbitrumL2_Bridge(arbsys).isTopLevelCall();
25 | }
26 |
27 | /**
28 | * @dev Returns the address of the sender that triggered the current
29 | * cross-chain message through `arbsys`.
30 | *
31 | * NOTE: {isCrossChain} should be checked before trying to recover the
32 | * sender, as it will revert with `NotCrossChainCall` if the current
33 | * function call is not the result of a cross-chain message.
34 | */
35 | function crossChainSender(address arbsys) internal view returns (address) {
36 | if (!isCrossChain(arbsys)) revert NotCrossChainCall();
37 |
38 | return
39 | ArbitrumL2_Bridge(arbsys).wasMyCallersAddressAliased()
40 | ? ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing()
41 | : msg.sender;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/errors.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/errors.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | error NotCrossChainCall();
7 | error InvalidCrossChainSender(address actual, address expected);
8 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/optimism/CrossChainEnabledOptimism.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/optimism/CrossChainEnabledOptimism.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import "../CrossChainEnabled.sol";
7 | import "./LibOptimism.sol";
8 |
9 | /**
10 | * @dev [Optimism](https://www.optimism.io/) specialization or the
11 | * {CrossChainEnabled} abstraction.
12 | *
13 | * The messenger (`CrossDomainMessenger`) contract is provided and maintained by
14 | * the optimism team. You can find the address of this contract on mainnet and
15 | * kovan in the [deployments section of Optimism monorepo](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/deployments).
16 | *
17 | * _Available since v4.6._
18 | */
19 | abstract contract CrossChainEnabledOptimism is CrossChainEnabled {
20 | /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
21 | address private immutable _messenger;
22 |
23 | /// @custom:oz-upgrades-unsafe-allow constructor
24 | constructor(address messenger) {
25 | _messenger = messenger;
26 | }
27 |
28 | /**
29 | * @dev see {CrossChainEnabled-_isCrossChain}
30 | */
31 | function _isCrossChain() internal view virtual override returns (bool) {
32 | return LibOptimism.isCrossChain(_messenger);
33 | }
34 |
35 | /**
36 | * @dev see {CrossChainEnabled-_crossChainSender}
37 | */
38 | function _crossChainSender() internal view virtual override onlyCrossChain returns (address) {
39 | return LibOptimism.crossChainSender(_messenger);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/crosschain/optimism/LibOptimism.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/optimism/LibOptimism.sol)
3 |
4 | pragma solidity ^0.8.4;
5 |
6 | import {ICrossDomainMessenger as Optimism_Bridge} from "../../vendor/optimism/ICrossDomainMessenger.sol";
7 | import "../errors.sol";
8 |
9 | /**
10 | * @dev Primitives for cross-chain aware contracts for [Optimism](https://www.optimism.io/).
11 | * See the [documentation](https://community.optimism.io/docs/developers/bridge/messaging/#accessing-msg-sender)
12 | * for the functionality used here.
13 | */
14 | library LibOptimism {
15 | /**
16 | * @dev Returns whether the current function call is the result of a
17 | * cross-chain message relayed by `messenger`.
18 | */
19 | function isCrossChain(address messenger) internal view returns (bool) {
20 | return msg.sender == messenger;
21 | }
22 |
23 | /**
24 | * @dev Returns the address of the sender that triggered the current
25 | * cross-chain message through `messenger`.
26 | *
27 | * NOTE: {isCrossChain} should be checked before trying to recover the
28 | * sender, as it will revert with `NotCrossChainCall` if the current
29 | * function call is not the result of a cross-chain message.
30 | */
31 | function crossChainSender(address messenger) internal view returns (address) {
32 | if (!isCrossChain(messenger)) revert NotCrossChainCall();
33 |
34 | return Optimism_Bridge(messenger).xDomainMessageSender();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/governance/extensions/GovernorProposalThreshold.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorProposalThreshold.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../Governor.sol";
7 |
8 | /**
9 | * @dev Extension of {Governor} for proposal restriction to token holders with a minimum balance.
10 | *
11 | * _Available since v4.3._
12 | * _Deprecated since v4.4._
13 | */
14 | abstract contract GovernorProposalThreshold is Governor {
15 | function propose(
16 | address[] memory targets,
17 | uint256[] memory values,
18 | bytes[] memory calldatas,
19 | string memory description
20 | ) public virtual override returns (uint256) {
21 | return super.propose(targets, values, calldatas, description);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/governance/extensions/GovernorVotes.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorVotes.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../Governor.sol";
7 | import "../utils/IVotes.sol";
8 |
9 | /**
10 | * @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes} token.
11 | *
12 | * _Available since v4.3._
13 | */
14 | abstract contract GovernorVotes is Governor {
15 | IVotes public immutable token;
16 |
17 | constructor(IVotes tokenAddress) {
18 | token = tokenAddress;
19 | }
20 |
21 | /**
22 | * Read the voting weight from the token's built in snapshot mechanism (see {Governor-_getVotes}).
23 | */
24 | function _getVotes(
25 | address account,
26 | uint256 blockNumber,
27 | bytes memory /*params*/
28 | ) internal view virtual override returns (uint256) {
29 | return token.getPastVotes(account, blockNumber);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/governance/extensions/GovernorVotesComp.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorVotesComp.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../Governor.sol";
7 | import "../../token/ERC20/extensions/ERC20VotesComp.sol";
8 |
9 | /**
10 | * @dev Extension of {Governor} for voting weight extraction from a Comp token.
11 | *
12 | * _Available since v4.3._
13 | */
14 | abstract contract GovernorVotesComp is Governor {
15 | ERC20VotesComp public immutable token;
16 |
17 | constructor(ERC20VotesComp token_) {
18 | token = token_;
19 | }
20 |
21 | /**
22 | * Read the voting weight from the token's built in snapshot mechanism (see {Governor-_getVotes}).
23 | */
24 | function _getVotes(
25 | address account,
26 | uint256 blockNumber,
27 | bytes memory /*params*/
28 | ) internal view virtual override returns (uint256) {
29 | return token.getPriorVotes(account, blockNumber);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/governance/extensions/IGovernorTimelock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (governance/extensions/IGovernorTimelock.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IGovernor.sol";
7 |
8 | /**
9 | * @dev Extension of the {IGovernor} for timelock supporting modules.
10 | *
11 | * _Available since v4.3._
12 | */
13 | abstract contract IGovernorTimelock is IGovernor {
14 | event ProposalQueued(uint256 proposalId, uint256 eta);
15 |
16 | function timelock() public view virtual returns (address);
17 |
18 | function proposalEta(uint256 proposalId) public view virtual returns (uint256);
19 |
20 | function queue(
21 | address[] memory targets,
22 | uint256[] memory values,
23 | bytes[] memory calldatas,
24 | bytes32 descriptionHash
25 | ) public virtual returns (uint256 proposalId);
26 | }
27 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1155.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC1155/IERC1155.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1155MetadataURI.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155MetadataURI.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC1155/extensions/IERC1155MetadataURI.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1155Receiver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155Receiver.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC1155/IERC1155Receiver.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1271.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Interface of the ERC1271 standard signature validation method for
8 | * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
9 | *
10 | * _Available since v4.1._
11 | */
12 | interface IERC1271 {
13 | /**
14 | * @dev Should return whether the signature provided is valid for the provided data
15 | * @param hash Hash of the data to be signed
16 | * @param signature Signature byte array associated with _data
17 | */
18 | function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
19 | }
20 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1363Receiver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Receiver.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | interface IERC1363Receiver {
7 | /*
8 | * Note: the ERC-165 identifier for this interface is 0x88a7ca5c.
9 | * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))
10 | */
11 |
12 | /**
13 | * @notice Handle the receipt of ERC1363 tokens
14 | * @dev Any ERC1363 smart contract calls this function on the recipient
15 | * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the
16 | * transfer. Return of other than the magic value MUST result in the
17 | * transaction being reverted.
18 | * Note: the token contract address is always the message sender.
19 | * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function
20 | * @param from address The address which are token transferred from
21 | * @param value uint256 The amount of tokens transferred
22 | * @param data bytes Additional data with no specified format
23 | * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))`
24 | * unless throwing
25 | */
26 | function onTransferReceived(
27 | address operator,
28 | address from,
29 | uint256 value,
30 | bytes memory data
31 | ) external returns (bytes4);
32 | }
33 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1363Spender.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Spender.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | interface IERC1363Spender {
7 | /*
8 | * Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
9 | * 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
10 | */
11 |
12 | /**
13 | * @notice Handle the approval of ERC1363 tokens
14 | * @dev Any ERC1363 smart contract calls this function on the recipient
15 | * after an `approve`. This function MAY throw to revert and reject the
16 | * approval. Return of other than the magic value MUST result in the
17 | * transaction being reverted.
18 | * Note: the token contract address is always the message sender.
19 | * @param owner address The address which called `approveAndCall` function
20 | * @param value uint256 The amount of tokens to be spent
21 | * @param data bytes Additional data with no specified format
22 | * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
23 | * unless throwing
24 | */
25 | function onApprovalReceived(
26 | address owner,
27 | uint256 value,
28 | bytes memory data
29 | ) external returns (bytes4);
30 | }
31 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC165.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../utils/introspection/IERC165.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1820Implementer.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Implementer.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../utils/introspection/IERC1820Implementer.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC1820Registry.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Registry.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../utils/introspection/IERC1820Registry.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC20.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC20/IERC20.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC20Metadata.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC20/extensions/IERC20Metadata.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC2981.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../utils/introspection/IERC165.sol";
7 |
8 | /**
9 | * @dev Interface for the NFT Royalty Standard.
10 | *
11 | * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
12 | * support for royalty payments across all NFT marketplaces and ecosystem participants.
13 | *
14 | * _Available since v4.5._
15 | */
16 | interface IERC2981 is IERC165 {
17 | /**
18 | * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
19 | * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
20 | */
21 | function royaltyInfo(uint256 tokenId, uint256 salePrice)
22 | external
23 | view
24 | returns (address receiver, uint256 royaltyAmount);
25 | }
26 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC3156.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./IERC3156FlashBorrower.sol";
7 | import "./IERC3156FlashLender.sol";
8 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashBorrower.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Interface of the ERC3156 FlashBorrower, as defined in
8 | * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
9 | *
10 | * _Available since v4.1._
11 | */
12 | interface IERC3156FlashBorrower {
13 | /**
14 | * @dev Receive a flash loan.
15 | * @param initiator The initiator of the loan.
16 | * @param token The loan currency.
17 | * @param amount The amount of tokens lent.
18 | * @param fee The additional amount of tokens to repay.
19 | * @param data Arbitrary data structure, intended to contain user-defined parameters.
20 | * @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan"
21 | */
22 | function onFlashLoan(
23 | address initiator,
24 | address token,
25 | uint256 amount,
26 | uint256 fee,
27 | bytes calldata data
28 | ) external returns (bytes32);
29 | }
30 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashLender.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./IERC3156FlashBorrower.sol";
7 |
8 | /**
9 | * @dev Interface of the ERC3156 FlashLender, as defined in
10 | * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
11 | *
12 | * _Available since v4.1._
13 | */
14 | interface IERC3156FlashLender {
15 | /**
16 | * @dev The amount of currency available to be lended.
17 | * @param token The loan currency.
18 | * @return The amount of `token` that can be borrowed.
19 | */
20 | function maxFlashLoan(address token) external view returns (uint256);
21 |
22 | /**
23 | * @dev The fee to be charged for a given loan.
24 | * @param token The loan currency.
25 | * @param amount The amount of tokens lent.
26 | * @return The amount of `token` to be charged for the loan, on top of the returned principal.
27 | */
28 | function flashFee(address token, uint256 amount) external view returns (uint256);
29 |
30 | /**
31 | * @dev Initiate a flash loan.
32 | * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
33 | * @param token The loan currency.
34 | * @param amount The amount of tokens lent.
35 | * @param data Arbitrary data structure, intended to contain user-defined parameters.
36 | */
37 | function flashLoan(
38 | IERC3156FlashBorrower receiver,
39 | address token,
40 | uint256 amount,
41 | bytes calldata data
42 | ) external returns (bool);
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC721.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC721/IERC721.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC721Enumerable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC721/extensions/IERC721Enumerable.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC721Metadata.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC721/extensions/IERC721Metadata.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC721Receiver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Receiver.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC721/IERC721Receiver.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC777.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC777/IERC777.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC777Recipient.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Recipient.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC777/IERC777Recipient.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/IERC777Sender.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Sender.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC777/IERC777Sender.sol";
7 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/draft-IERC1822.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
8 | * proxy whose upgrades are fully controlled by the current implementation.
9 | */
10 | interface IERC1822Proxiable {
11 | /**
12 | * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
13 | * address.
14 | *
15 | * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
16 | * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
17 | * function revert if invoked through a proxy.
18 | */
19 | function proxiableUUID() external view returns (bytes32);
20 | }
21 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/interfaces/draft-IERC2612.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/draft-IERC2612.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../token/ERC20/extensions/draft-IERC20Permit.sol";
7 |
8 | interface IERC2612 is IERC20Permit {}
9 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/metatx/ERC2771Context.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (metatx/ERC2771Context.sol)
3 |
4 | pragma solidity ^0.8.9;
5 |
6 | import "../utils/Context.sol";
7 |
8 | /**
9 | * @dev Context variant with ERC2771 support.
10 | */
11 | abstract contract ERC2771Context is Context {
12 | /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
13 | address private immutable _trustedForwarder;
14 |
15 | /// @custom:oz-upgrades-unsafe-allow constructor
16 | constructor(address trustedForwarder) {
17 | _trustedForwarder = trustedForwarder;
18 | }
19 |
20 | function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
21 | return forwarder == _trustedForwarder;
22 | }
23 |
24 | function _msgSender() internal view virtual override returns (address sender) {
25 | if (isTrustedForwarder(msg.sender)) {
26 | // The assembly code is more direct than the Solidity version using `abi.decode`.
27 | assembly {
28 | sender := shr(96, calldataload(sub(calldatasize(), 20)))
29 | }
30 | } else {
31 | return super._msgSender();
32 | }
33 | }
34 |
35 | function _msgData() internal view virtual override returns (bytes calldata) {
36 | if (isTrustedForwarder(msg.sender)) {
37 | return msg.data[:msg.data.length - 20];
38 | } else {
39 | return super._msgData();
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../Proxy.sol";
7 | import "./ERC1967Upgrade.sol";
8 |
9 | /**
10 | * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
11 | * implementation address that can be changed. This address is stored in storage in the location specified by
12 | * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
13 | * implementation behind the proxy.
14 | */
15 | contract ERC1967Proxy is Proxy, ERC1967Upgrade {
16 | /**
17 | * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
18 | *
19 | * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
20 | * function call, and allows initializating the storage of the proxy like a Solidity constructor.
21 | */
22 | constructor(address _logic, bytes memory _data) payable {
23 | assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
24 | _upgradeToAndCall(_logic, _data, false);
25 | }
26 |
27 | /**
28 | * @dev Returns the current implementation address.
29 | */
30 | function _implementation() internal view virtual override returns (address impl) {
31 | return ERC1967Upgrade._getImplementation();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/proxy/beacon/IBeacon.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev This is the interface that {BeaconProxy} expects of its beacon.
8 | */
9 | interface IBeacon {
10 | /**
11 | * @dev Must return an address that can be used as a delegate call target.
12 | *
13 | * {BeaconProxy} will check that this address is a contract.
14 | */
15 | function implementation() external view returns (address);
16 | }
17 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC1155.sol";
7 |
8 | /**
9 | * @dev Extension of {ERC1155} that allows token holders to destroy both their
10 | * own tokens and those that they have been approved to use.
11 | *
12 | * _Available since v3.1._
13 | */
14 | abstract contract ERC1155Burnable is ERC1155 {
15 | function burn(
16 | address account,
17 | uint256 id,
18 | uint256 value
19 | ) public virtual {
20 | require(
21 | account == _msgSender() || isApprovedForAll(account, _msgSender()),
22 | "ERC1155: caller is not owner nor approved"
23 | );
24 |
25 | _burn(account, id, value);
26 | }
27 |
28 | function burnBatch(
29 | address account,
30 | uint256[] memory ids,
31 | uint256[] memory values
32 | ) public virtual {
33 | require(
34 | account == _msgSender() || isApprovedForAll(account, _msgSender()),
35 | "ERC1155: caller is not owner nor approved"
36 | );
37 |
38 | _burnBatch(account, ids, values);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Pausable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC1155.sol";
7 | import "../../../security/Pausable.sol";
8 |
9 | /**
10 | * @dev ERC1155 token with pausable token transfers, minting and burning.
11 | *
12 | * Useful for scenarios such as preventing trades until the end of an evaluation
13 | * period, or having an emergency switch for freezing all token transfers in the
14 | * event of a large bug.
15 | *
16 | * _Available since v3.1._
17 | */
18 | abstract contract ERC1155Pausable is ERC1155, Pausable {
19 | /**
20 | * @dev See {ERC1155-_beforeTokenTransfer}.
21 | *
22 | * Requirements:
23 | *
24 | * - the contract must not be paused.
25 | */
26 | function _beforeTokenTransfer(
27 | address operator,
28 | address from,
29 | address to,
30 | uint256[] memory ids,
31 | uint256[] memory amounts,
32 | bytes memory data
33 | ) internal virtual override {
34 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
35 |
36 | require(!paused(), "ERC1155Pausable: token transfer while paused");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IERC1155.sol";
7 |
8 | /**
9 | * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
10 | * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
11 | *
12 | * _Available since v3.1._
13 | */
14 | interface IERC1155MetadataURI is IERC1155 {
15 | /**
16 | * @dev Returns the URI for token type `id`.
17 | *
18 | * If the `\{id\}` substring is present in the URI, it must be replaced by
19 | * clients with the actual token type ID.
20 | */
21 | function uri(uint256 id) external view returns (string memory);
22 | }
23 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./ERC1155Receiver.sol";
7 |
8 | /**
9 | * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
10 | *
11 | * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
12 | * stuck.
13 | *
14 | * @dev _Available since v3.1._
15 | */
16 | contract ERC1155Holder is ERC1155Receiver {
17 | function onERC1155Received(
18 | address,
19 | address,
20 | uint256,
21 | uint256,
22 | bytes memory
23 | ) public virtual override returns (bytes4) {
24 | return this.onERC1155Received.selector;
25 | }
26 |
27 | function onERC1155BatchReceived(
28 | address,
29 | address,
30 | uint256[] memory,
31 | uint256[] memory,
32 | bytes memory
33 | ) public virtual override returns (bytes4) {
34 | return this.onERC1155BatchReceived.selector;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IERC1155Receiver.sol";
7 | import "../../../utils/introspection/ERC165.sol";
8 |
9 | /**
10 | * @dev _Available since v3.1._
11 | */
12 | abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
13 | /**
14 | * @dev See {IERC165-supportsInterface}.
15 | */
16 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
17 | return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC20.sol";
7 | import "../../../utils/Context.sol";
8 |
9 | /**
10 | * @dev Extension of {ERC20} that allows token holders to destroy both their own
11 | * tokens and those that they have an allowance for, in a way that can be
12 | * recognized off-chain (via event analysis).
13 | */
14 | abstract contract ERC20Burnable is Context, ERC20 {
15 | /**
16 | * @dev Destroys `amount` tokens from the caller.
17 | *
18 | * See {ERC20-_burn}.
19 | */
20 | function burn(uint256 amount) public virtual {
21 | _burn(_msgSender(), amount);
22 | }
23 |
24 | /**
25 | * @dev Destroys `amount` tokens from `account`, deducting from the caller's
26 | * allowance.
27 | *
28 | * See {ERC20-_burn} and {ERC20-allowance}.
29 | *
30 | * Requirements:
31 | *
32 | * - the caller must have allowance for ``accounts``'s tokens of at least
33 | * `amount`.
34 | */
35 | function burnFrom(address account, uint256 amount) public virtual {
36 | _spendAllowance(account, _msgSender(), amount);
37 | _burn(account, amount);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Capped.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC20.sol";
7 |
8 | /**
9 | * @dev Extension of {ERC20} that adds a cap to the supply of tokens.
10 | */
11 | abstract contract ERC20Capped is ERC20 {
12 | uint256 private immutable _cap;
13 |
14 | /**
15 | * @dev Sets the value of the `cap`. This value is immutable, it can only be
16 | * set once during construction.
17 | */
18 | constructor(uint256 cap_) {
19 | require(cap_ > 0, "ERC20Capped: cap is 0");
20 | _cap = cap_;
21 | }
22 |
23 | /**
24 | * @dev Returns the cap on the token's total supply.
25 | */
26 | function cap() public view virtual returns (uint256) {
27 | return _cap;
28 | }
29 |
30 | /**
31 | * @dev See {ERC20-_mint}.
32 | */
33 | function _mint(address account, uint256 amount) internal virtual override {
34 | require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
35 | super._mint(account, amount);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC20.sol";
7 | import "../../../security/Pausable.sol";
8 |
9 | /**
10 | * @dev ERC20 token with pausable token transfers, minting and burning.
11 | *
12 | * Useful for scenarios such as preventing trades until the end of an evaluation
13 | * period, or having an emergency switch for freezing all token transfers in the
14 | * event of a large bug.
15 | */
16 | abstract contract ERC20Pausable is ERC20, Pausable {
17 | /**
18 | * @dev See {ERC20-_beforeTokenTransfer}.
19 | *
20 | * Requirements:
21 | *
22 | * - the contract must not be paused.
23 | */
24 | function _beforeTokenTransfer(
25 | address from,
26 | address to,
27 | uint256 amount
28 | ) internal virtual override {
29 | super._beforeTokenTransfer(from, to, amount);
30 |
31 | require(!paused(), "ERC20Pausable: token transfer while paused");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IERC20.sol";
7 |
8 | /**
9 | * @dev Interface for the optional metadata functions from the ERC20 standard.
10 | *
11 | * _Available since v4.1._
12 | */
13 | interface IERC20Metadata is IERC20 {
14 | /**
15 | * @dev Returns the name of the token.
16 | */
17 | function name() external view returns (string memory);
18 |
19 | /**
20 | * @dev Returns the symbol of the token.
21 | */
22 | function symbol() external view returns (string memory);
23 |
24 | /**
25 | * @dev Returns the decimals places of the token.
26 | */
27 | function decimals() external view returns (uint8);
28 | }
29 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetFixedSupply.sol)
3 | pragma solidity ^0.8.0;
4 |
5 | import "../extensions/ERC20Burnable.sol";
6 |
7 | /**
8 | * @dev {ERC20} token, including:
9 | *
10 | * - Preminted initial supply
11 | * - Ability for holders to burn (destroy) their tokens
12 | * - No access control mechanism (for minting/pausing) and hence no governance
13 | *
14 | * This contract uses {ERC20Burnable} to include burn capabilities - head to
15 | * its documentation for details.
16 | *
17 | * _Available since v3.4._
18 | *
19 | * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
20 | */
21 | contract ERC20PresetFixedSupply is ERC20Burnable {
22 | /**
23 | * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
24 | *
25 | * See {ERC20-constructor}.
26 | */
27 | constructor(
28 | string memory name,
29 | string memory symbol,
30 | uint256 initialSupply,
31 | address owner
32 | ) ERC20(name, symbol) {
33 | _mint(owner, initialSupply);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @title ERC721 token receiver interface
8 | * @dev Interface for any contract that wants to support safeTransfers
9 | * from ERC721 asset contracts.
10 | */
11 | interface IERC721Receiver {
12 | /**
13 | * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
14 | * by `operator` from `from`, this function is called.
15 | *
16 | * It must return its Solidity selector to confirm the token transfer.
17 | * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
18 | *
19 | * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
20 | */
21 | function onERC721Received(
22 | address operator,
23 | address from,
24 | uint256 tokenId,
25 | bytes calldata data
26 | ) external returns (bytes4);
27 | }
28 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC721.sol";
7 | import "../../../utils/Context.sol";
8 |
9 | /**
10 | * @title ERC721 Burnable Token
11 | * @dev ERC721 Token that can be irreversibly burned (destroyed).
12 | */
13 | abstract contract ERC721Burnable is Context, ERC721 {
14 | /**
15 | * @dev Burns `tokenId`. See {ERC721-_burn}.
16 | *
17 | * Requirements:
18 | *
19 | * - The caller must own `tokenId` or be an approved operator.
20 | */
21 | function burn(uint256 tokenId) public virtual {
22 | //solhint-disable-next-line max-line-length
23 | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
24 | _burn(tokenId);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC721.sol";
7 | import "../../../security/Pausable.sol";
8 |
9 | /**
10 | * @dev ERC721 token with pausable token transfers, minting and burning.
11 | *
12 | * Useful for scenarios such as preventing trades until the end of an evaluation
13 | * period, or having an emergency switch for freezing all token transfers in the
14 | * event of a large bug.
15 | */
16 | abstract contract ERC721Pausable is ERC721, Pausable {
17 | /**
18 | * @dev See {ERC721-_beforeTokenTransfer}.
19 | *
20 | * Requirements:
21 | *
22 | * - the contract must not be paused.
23 | */
24 | function _beforeTokenTransfer(
25 | address from,
26 | address to,
27 | uint256 tokenId
28 | ) internal virtual override {
29 | super._beforeTokenTransfer(from, to, tokenId);
30 |
31 | require(!paused(), "ERC721Pausable: token transfer while paused");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/ERC721Royalty.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC721.sol";
7 | import "../../common/ERC2981.sol";
8 | import "../../../utils/introspection/ERC165.sol";
9 |
10 | /**
11 | * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment
12 | * information.
13 | *
14 | * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
15 | * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
16 | *
17 | * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
18 | * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
19 | * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
20 | *
21 | * _Available since v4.5._
22 | */
23 | abstract contract ERC721Royalty is ERC2981, ERC721 {
24 | /**
25 | * @dev See {IERC165-supportsInterface}.
26 | */
27 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
28 | return super.supportsInterface(interfaceId);
29 | }
30 |
31 | /**
32 | * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token.
33 | */
34 | function _burn(uint256 tokenId) internal virtual override {
35 | super._burn(tokenId);
36 | _resetTokenRoyalty(tokenId);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IERC721.sol";
7 |
8 | /**
9 | * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
10 | * @dev See https://eips.ethereum.org/EIPS/eip-721
11 | */
12 | interface IERC721Enumerable is IERC721 {
13 | /**
14 | * @dev Returns the total amount of tokens stored by the contract.
15 | */
16 | function totalSupply() external view returns (uint256);
17 |
18 | /**
19 | * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
20 | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
21 | */
22 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
23 |
24 | /**
25 | * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
26 | * Use along with {totalSupply} to enumerate all tokens.
27 | */
28 | function tokenByIndex(uint256 index) external view returns (uint256);
29 | }
30 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IERC721.sol";
7 |
8 | /**
9 | * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
10 | * @dev See https://eips.ethereum.org/EIPS/eip-721
11 | */
12 | interface IERC721Metadata is IERC721 {
13 | /**
14 | * @dev Returns the token collection name.
15 | */
16 | function name() external view returns (string memory);
17 |
18 | /**
19 | * @dev Returns the token collection symbol.
20 | */
21 | function symbol() external view returns (string memory);
22 |
23 | /**
24 | * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
25 | */
26 | function tokenURI(uint256 tokenId) external view returns (string memory);
27 | }
28 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/extensions/draft-ERC721Votes.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/extensions/draft-ERC721Votes.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC721.sol";
7 | import "../../../governance/utils/Votes.sol";
8 |
9 | /**
10 | * @dev Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts
11 | * as 1 vote unit.
12 | *
13 | * Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost
14 | * on every transfer. Token holders can either delegate to a trusted representative who will decide how to make use of
15 | * the votes in governance decisions, or they can delegate to themselves to be their own representative.
16 | *
17 | * _Available since v4.5._
18 | */
19 | abstract contract ERC721Votes is ERC721, Votes {
20 | /**
21 | * @dev Adjusts votes when tokens are transferred.
22 | *
23 | * Emits a {Votes-DelegateVotesChanged} event.
24 | */
25 | function _afterTokenTransfer(
26 | address from,
27 | address to,
28 | uint256 tokenId
29 | ) internal virtual override {
30 | _transferVotingUnits(from, to, 1);
31 | super._afterTokenTransfer(from, to, tokenId);
32 | }
33 |
34 | /**
35 | * @dev Returns the balance of `account`.
36 | */
37 | function _getVotingUnits(address account) internal view virtual override returns (uint256) {
38 | return balanceOf(account);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../IERC721Receiver.sol";
7 |
8 | /**
9 | * @dev Implementation of the {IERC721Receiver} interface.
10 | *
11 | * Accepts all token transfers.
12 | * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
13 | */
14 | contract ERC721Holder is IERC721Receiver {
15 | /**
16 | * @dev See {IERC721Receiver-onERC721Received}.
17 | *
18 | * Always returns `IERC721Receiver.onERC721Received.selector`.
19 | */
20 | function onERC721Received(
21 | address,
22 | address,
23 | uint256,
24 | bytes memory
25 | ) public virtual override returns (bytes4) {
26 | return this.onERC721Received.selector;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.
8 | *
9 | * Accounts can be notified of {IERC777} tokens being sent to them by having a
10 | * contract implement this interface (contract holders can be their own
11 | * implementer) and registering it on the
12 | * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
13 | *
14 | * See {IERC1820Registry} and {ERC1820Implementer}.
15 | */
16 | interface IERC777Recipient {
17 | /**
18 | * @dev Called by an {IERC777} token contract whenever tokens are being
19 | * moved or created into a registered account (`to`). The type of operation
20 | * is conveyed by `from` being the zero address or not.
21 | *
22 | * This call occurs _after_ the token contract's state is updated, so
23 | * {IERC777-balanceOf}, etc., can be used to query the post-operation state.
24 | *
25 | * This function may revert to prevent the operation from being executed.
26 | */
27 | function tokensReceived(
28 | address operator,
29 | address from,
30 | address to,
31 | uint256 amount,
32 | bytes calldata userData,
33 | bytes calldata operatorData
34 | ) external;
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC777/IERC777Sender.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Interface of the ERC777TokensSender standard as defined in the EIP.
8 | *
9 | * {IERC777} Token holders can be notified of operations performed on their
10 | * tokens by having a contract implement this interface (contract holders can be
11 | * their own implementer) and registering it on the
12 | * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
13 | *
14 | * See {IERC1820Registry} and {ERC1820Implementer}.
15 | */
16 | interface IERC777Sender {
17 | /**
18 | * @dev Called by an {IERC777} token contract whenever a registered holder's
19 | * (`from`) tokens are about to be moved or destroyed. The type of operation
20 | * is conveyed by `to` being the zero address or not.
21 | *
22 | * This call occurs _before_ the token contract's state is updated, so
23 | * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.
24 | *
25 | * This function may revert to prevent the operation from being executed.
26 | */
27 | function tokensToSend(
28 | address operator,
29 | address from,
30 | address to,
31 | uint256 amount,
32 | bytes calldata userData,
33 | bytes calldata operatorData
34 | ) external;
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC777/presets/ERC777PresetFixedSupply.sol)
3 | pragma solidity ^0.8.0;
4 |
5 | import "../ERC777.sol";
6 |
7 | /**
8 | * @dev {ERC777} token, including:
9 | *
10 | * - Preminted initial supply
11 | * - No access control mechanism (for minting/pausing) and hence no governance
12 | *
13 | * _Available since v3.4._
14 | */
15 | contract ERC777PresetFixedSupply is ERC777 {
16 | /**
17 | * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
18 | *
19 | * See {ERC777-constructor}.
20 | */
21 | constructor(
22 | string memory name,
23 | string memory symbol,
24 | address[] memory defaultOperators,
25 | uint256 initialSupply,
26 | address owner
27 | ) ERC777(name, symbol, defaultOperators) {
28 | _mint(owner, initialSupply, "", "");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/Arrays.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./math/Math.sol";
7 |
8 | /**
9 | * @dev Collection of functions related to array types.
10 | */
11 | library Arrays {
12 | /**
13 | * @dev Searches a sorted `array` and returns the first index that contains
14 | * a value greater or equal to `element`. If no such index exists (i.e. all
15 | * values in the array are strictly less than `element`), the array length is
16 | * returned. Time complexity O(log n).
17 | *
18 | * `array` is expected to be sorted in ascending order, and to contain no
19 | * repeated elements.
20 | */
21 | function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
22 | if (array.length == 0) {
23 | return 0;
24 | }
25 |
26 | uint256 low = 0;
27 | uint256 high = array.length;
28 |
29 | while (low < high) {
30 | uint256 mid = Math.average(low, high);
31 |
32 | // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
33 | // because Math.average rounds down (it does integer division with truncation).
34 | if (array[mid] > element) {
35 | high = mid;
36 | } else {
37 | low = mid + 1;
38 | }
39 | }
40 |
41 | // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
42 | if (low > 0 && array[low - 1] == element) {
43 | return low - 1;
44 | } else {
45 | return low;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/Context.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Provides information about the current execution context, including the
8 | * sender of the transaction and its data. While these are generally available
9 | * via msg.sender and msg.data, they should not be accessed in such a direct
10 | * manner, since when dealing with meta-transactions the account sending and
11 | * paying for execution may not be the actual sender (as far as an application
12 | * is concerned).
13 | *
14 | * This contract is only required for intermediate, library-like contracts.
15 | */
16 | abstract contract Context {
17 | function _msgSender() internal view virtual returns (address) {
18 | return msg.sender;
19 | }
20 |
21 | function _msgData() internal view virtual returns (bytes calldata) {
22 | return msg.data;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/Counters.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @title Counters
8 | * @author Matt Condon (@shrugs)
9 | * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
10 | * of elements in a mapping, issuing ERC721 ids, or counting request ids.
11 | *
12 | * Include with `using Counters for Counters.Counter;`
13 | */
14 | library Counters {
15 | struct Counter {
16 | // This variable should never be directly accessed by users of the library: interactions must be restricted to
17 | // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
18 | // this feature: see https://github.com/ethereum/solidity/issues/4637
19 | uint256 _value; // default: 0
20 | }
21 |
22 | function current(Counter storage counter) internal view returns (uint256) {
23 | return counter._value;
24 | }
25 |
26 | function increment(Counter storage counter) internal {
27 | unchecked {
28 | counter._value += 1;
29 | }
30 | }
31 |
32 | function decrement(Counter storage counter) internal {
33 | uint256 value = counter._value;
34 | require(value > 0, "Counter: decrement overflow");
35 | unchecked {
36 | counter._value = value - 1;
37 | }
38 | }
39 |
40 | function reset(Counter storage counter) internal {
41 | counter._value = 0;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/Multicall.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./Address.sol";
7 |
8 | /**
9 | * @dev Provides a function to batch together multiple calls in a single external call.
10 | *
11 | * _Available since v4.1._
12 | */
13 | abstract contract Multicall {
14 | /**
15 | * @dev Receives and executes a batch of function calls on this contract.
16 | */
17 | function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
18 | results = new bytes[](data.length);
19 | for (uint256 i = 0; i < data.length; i++) {
20 | results[i] = Address.functionDelegateCall(address(this), data[i]);
21 | }
22 | return results;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./ECDSA.sol";
7 | import "../Address.sol";
8 | import "../../interfaces/IERC1271.sol";
9 |
10 | /**
11 | * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
12 | * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
13 | * Argent and Gnosis Safe.
14 | *
15 | * _Available since v4.1._
16 | */
17 | library SignatureChecker {
18 | /**
19 | * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
20 | * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
21 | *
22 | * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
23 | * change through time. It could return true at block N and false at block N+1 (or the opposite).
24 | */
25 | function isValidSignatureNow(
26 | address signer,
27 | bytes32 hash,
28 | bytes memory signature
29 | ) internal view returns (bool) {
30 | (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
31 | if (error == ECDSA.RecoverError.NoError && recovered == signer) {
32 | return true;
33 | }
34 |
35 | (bool success, bytes memory result) = signer.staticcall(
36 | abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
37 | );
38 | return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/escrow/ConditionalEscrow.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/escrow/ConditionalEscrow.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./Escrow.sol";
7 |
8 | /**
9 | * @title ConditionalEscrow
10 | * @dev Base abstract escrow to only allow withdrawal if a condition is met.
11 | * @dev Intended usage: See {Escrow}. Same usage guidelines apply here.
12 | */
13 | abstract contract ConditionalEscrow is Escrow {
14 | /**
15 | * @dev Returns whether an address is allowed to withdraw their funds. To be
16 | * implemented by derived contracts.
17 | * @param payee The destination address of the funds.
18 | */
19 | function withdrawalAllowed(address payee) public view virtual returns (bool);
20 |
21 | function withdraw(address payable payee) public virtual override {
22 | require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
23 | super.withdraw(payee);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/introspection/ERC165.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./IERC165.sol";
7 |
8 | /**
9 | * @dev Implementation of the {IERC165} interface.
10 | *
11 | * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
12 | * for the additional interface id that will be supported. For example:
13 | *
14 | * ```solidity
15 | * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
16 | * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
17 | * }
18 | * ```
19 | *
20 | * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
21 | */
22 | abstract contract ERC165 is IERC165 {
23 | /**
24 | * @dev See {IERC165-supportsInterface}.
25 | */
26 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
27 | return interfaceId == type(IERC165).interfaceId;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/introspection/ERC165Storage.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./ERC165.sol";
7 |
8 | /**
9 | * @dev Storage based implementation of the {IERC165} interface.
10 | *
11 | * Contracts may inherit from this and call {_registerInterface} to declare
12 | * their support of an interface.
13 | */
14 | abstract contract ERC165Storage is ERC165 {
15 | /**
16 | * @dev Mapping of interface ids to whether or not it's supported.
17 | */
18 | mapping(bytes4 => bool) private _supportedInterfaces;
19 |
20 | /**
21 | * @dev See {IERC165-supportsInterface}.
22 | */
23 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
24 | return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
25 | }
26 |
27 | /**
28 | * @dev Registers the contract as an implementer of the interface defined by
29 | * `interfaceId`. Support of the actual ERC165 interface is automatic and
30 | * registering its interface id is not required.
31 | *
32 | * See {IERC165-supportsInterface}.
33 | *
34 | * Requirements:
35 | *
36 | * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
37 | */
38 | function _registerInterface(bytes4 interfaceId) internal virtual {
39 | require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
40 | _supportedInterfaces[interfaceId] = true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/introspection/ERC1820Implementer.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC1820Implementer.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "./IERC1820Implementer.sol";
7 |
8 | /**
9 | * @dev Implementation of the {IERC1820Implementer} interface.
10 | *
11 | * Contracts may inherit from this and call {_registerInterfaceForAddress} to
12 | * declare their willingness to be implementers.
13 | * {IERC1820Registry-setInterfaceImplementer} should then be called for the
14 | * registration to be complete.
15 | */
16 | contract ERC1820Implementer is IERC1820Implementer {
17 | bytes32 private constant _ERC1820_ACCEPT_MAGIC = keccak256("ERC1820_ACCEPT_MAGIC");
18 |
19 | mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
20 |
21 | /**
22 | * @dev See {IERC1820Implementer-canImplementInterfaceForAddress}.
23 | */
24 | function canImplementInterfaceForAddress(bytes32 interfaceHash, address account)
25 | public
26 | view
27 | virtual
28 | override
29 | returns (bytes32)
30 | {
31 | return _supportedInterfaces[interfaceHash][account] ? _ERC1820_ACCEPT_MAGIC : bytes32(0x00);
32 | }
33 |
34 | /**
35 | * @dev Declares the contract as willing to be an implementer of
36 | * `interfaceHash` for `account`.
37 | *
38 | * See {IERC1820Registry-setInterfaceImplementer} and
39 | * {IERC1820Registry-interfaceHash}.
40 | */
41 | function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual {
42 | _supportedInterfaces[interfaceHash][account] = true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/introspection/IERC165.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Interface of the ERC165 standard, as defined in the
8 | * https://eips.ethereum.org/EIPS/eip-165[EIP].
9 | *
10 | * Implementers can declare support of contract interfaces, which can then be
11 | * queried by others ({ERC165Checker}).
12 | *
13 | * For an implementation, see {ERC165}.
14 | */
15 | interface IERC165 {
16 | /**
17 | * @dev Returns true if this contract implements the interface defined by
18 | * `interfaceId`. See the corresponding
19 | * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
20 | * to learn more about how these ids are created.
21 | *
22 | * This function call must use less than 30 000 gas.
23 | */
24 | function supportsInterface(bytes4 interfaceId) external view returns (bool);
25 | }
26 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/introspection/IERC1820Implementer.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC1820Implementer.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Interface for an ERC1820 implementer, as defined in the
8 | * https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP].
9 | * Used by contracts that will be registered as implementers in the
10 | * {IERC1820Registry}.
11 | */
12 | interface IERC1820Implementer {
13 | /**
14 | * @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract
15 | * implements `interfaceHash` for `account`.
16 | *
17 | * See {IERC1820Registry-setInterfaceImplementer}.
18 | */
19 | function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32);
20 | }
21 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/math/Math.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Standard math utilities missing in the Solidity language.
8 | */
9 | library Math {
10 | /**
11 | * @dev Returns the largest of two numbers.
12 | */
13 | function max(uint256 a, uint256 b) internal pure returns (uint256) {
14 | return a >= b ? a : b;
15 | }
16 |
17 | /**
18 | * @dev Returns the smallest of two numbers.
19 | */
20 | function min(uint256 a, uint256 b) internal pure returns (uint256) {
21 | return a < b ? a : b;
22 | }
23 |
24 | /**
25 | * @dev Returns the average of two numbers. The result is rounded towards
26 | * zero.
27 | */
28 | function average(uint256 a, uint256 b) internal pure returns (uint256) {
29 | // (a + b) / 2 can overflow.
30 | return (a & b) + (a ^ b) / 2;
31 | }
32 |
33 | /**
34 | * @dev Returns the ceiling of the division of two numbers.
35 | *
36 | * This differs from standard division with `/` in that it rounds up instead
37 | * of rounding down.
38 | */
39 | function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
40 | // (a + b - 1) / b can overflow on addition, so we distribute.
41 | return a / b + (a % b == 0 ? 0 : 1);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/math/SignedMath.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (utils/math/SignedMath.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | /**
7 | * @dev Standard signed math utilities missing in the Solidity language.
8 | */
9 | library SignedMath {
10 | /**
11 | * @dev Returns the largest of two signed numbers.
12 | */
13 | function max(int256 a, int256 b) internal pure returns (int256) {
14 | return a >= b ? a : b;
15 | }
16 |
17 | /**
18 | * @dev Returns the smallest of two signed numbers.
19 | */
20 | function min(int256 a, int256 b) internal pure returns (int256) {
21 | return a < b ? a : b;
22 | }
23 |
24 | /**
25 | * @dev Returns the average of two signed numbers without overflow.
26 | * The result is rounded towards zero.
27 | */
28 | function average(int256 a, int256 b) internal pure returns (int256) {
29 | // Formula from the book "Hacker's Delight"
30 | int256 x = (a & b) + ((a ^ b) >> 1);
31 | return x + (int256(uint256(x) >> 255) & (a ^ b));
32 | }
33 |
34 | /**
35 | * @dev Returns the absolute unsigned value of a signed value.
36 | */
37 | function abs(int256 n) internal pure returns (uint256) {
38 | unchecked {
39 | // must be unchecked in order to support `n = type(int256).min`
40 | return uint256(n >= 0 ? n : -n);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/utils/structs/BitMaps.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol)
3 | pragma solidity ^0.8.0;
4 |
5 | /**
6 | * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
7 | * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
8 | */
9 | library BitMaps {
10 | struct BitMap {
11 | mapping(uint256 => uint256) _data;
12 | }
13 |
14 | /**
15 | * @dev Returns whether the bit at `index` is set.
16 | */
17 | function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
18 | uint256 bucket = index >> 8;
19 | uint256 mask = 1 << (index & 0xff);
20 | return bitmap._data[bucket] & mask != 0;
21 | }
22 |
23 | /**
24 | * @dev Sets the bit at `index` to the boolean `value`.
25 | */
26 | function setTo(
27 | BitMap storage bitmap,
28 | uint256 index,
29 | bool value
30 | ) internal {
31 | if (value) {
32 | set(bitmap, index);
33 | } else {
34 | unset(bitmap, index);
35 | }
36 | }
37 |
38 | /**
39 | * @dev Sets the bit at `index`.
40 | */
41 | function set(BitMap storage bitmap, uint256 index) internal {
42 | uint256 bucket = index >> 8;
43 | uint256 mask = 1 << (index & 0xff);
44 | bitmap._data[bucket] |= mask;
45 | }
46 |
47 | /**
48 | * @dev Unsets the bit at `index`.
49 | */
50 | function unset(BitMap storage bitmap, uint256 index) internal {
51 | uint256 bucket = index >> 8;
52 | uint256 mask = 1 << (index & 0xff);
53 | bitmap._data[bucket] &= ~mask;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/vendor/amb/IAMB.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/amb/IAMB.sol)
3 | pragma solidity ^0.8.0;
4 |
5 | interface IAMB {
6 | event UserRequestForAffirmation(bytes32 indexed messageId, bytes encodedData);
7 | event UserRequestForSignature(bytes32 indexed messageId, bytes encodedData);
8 | event AffirmationCompleted(
9 | address indexed sender,
10 | address indexed executor,
11 | bytes32 indexed messageId,
12 | bool status
13 | );
14 | event RelayedMessage(address indexed sender, address indexed executor, bytes32 indexed messageId, bool status);
15 |
16 | function messageSender() external view returns (address);
17 |
18 | function maxGasPerTx() external view returns (uint256);
19 |
20 | function transactionHash() external view returns (bytes32);
21 |
22 | function messageId() external view returns (bytes32);
23 |
24 | function messageSourceChainId() external view returns (bytes32);
25 |
26 | function messageCallStatus(bytes32 _messageId) external view returns (bool);
27 |
28 | function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32);
29 |
30 | function failedMessageReceiver(bytes32 _messageId) external view returns (address);
31 |
32 | function failedMessageSender(bytes32 _messageId) external view returns (address);
33 |
34 | function requireToPassMessage(
35 | address _contract,
36 | bytes calldata _data,
37 | uint256 _gas
38 | ) external returns (bytes32);
39 |
40 | function requireToConfirmMessage(
41 | address _contract,
42 | bytes calldata _data,
43 | uint256 _gas
44 | ) external returns (bytes32);
45 |
46 | function sourceChainId() external view returns (uint256);
47 |
48 | function destinationChainId() external view returns (uint256);
49 | }
50 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/vendor/arbitrum/IMessageProvider.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/arbitrum/IMessageProvider.sol)
3 |
4 | /*
5 | * Copyright 2021, Offchain Labs, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | pragma solidity ^0.8.0;
21 |
22 | interface IMessageProvider {
23 | event InboxMessageDelivered(uint256 indexed messageNum, bytes data);
24 |
25 | event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);
26 | }
27 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/vendor/arbitrum/IOutbox.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/arbitrum/IOutbox.sol)
3 |
4 | /*
5 | * Copyright 2021, Offchain Labs, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | pragma solidity ^0.8.0;
21 |
22 | interface IOutbox {
23 | event OutboxEntryCreated(
24 | uint256 indexed batchNum,
25 | uint256 outboxEntryIndex,
26 | bytes32 outputRoot,
27 | uint256 numInBatch
28 | );
29 | event OutBoxTransactionExecuted(
30 | address indexed destAddr,
31 | address indexed l2Sender,
32 | uint256 indexed outboxEntryIndex,
33 | uint256 transactionIndex
34 | );
35 |
36 | function l2ToL1Sender() external view returns (address);
37 |
38 | function l2ToL1Block() external view returns (uint256);
39 |
40 | function l2ToL1EthBlock() external view returns (uint256);
41 |
42 | function l2ToL1Timestamp() external view returns (uint256);
43 |
44 | function l2ToL1BatchNum() external view returns (uint256);
45 |
46 | function l2ToL1OutputId() external view returns (bytes32);
47 |
48 | function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths) external;
49 |
50 | function outboxEntryExists(uint256 batchNum) external view returns (bool);
51 | }
52 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/vendor/optimism/ICrossDomainMessenger.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/optimism/ICrossDomainMessenger.sol)
3 | pragma solidity >0.5.0 <0.9.0;
4 |
5 | /**
6 | * @title ICrossDomainMessenger
7 | */
8 | interface ICrossDomainMessenger {
9 | /**********
10 | * Events *
11 | **********/
12 |
13 | event SentMessage(address indexed target, address sender, bytes message, uint256 messageNonce, uint256 gasLimit);
14 | event RelayedMessage(bytes32 indexed msgHash);
15 | event FailedRelayedMessage(bytes32 indexed msgHash);
16 |
17 | /*************
18 | * Variables *
19 | *************/
20 |
21 | function xDomainMessageSender() external view returns (address);
22 |
23 | /********************
24 | * Public Functions *
25 | ********************/
26 |
27 | /**
28 | * Sends a cross domain message to the target messenger.
29 | * @param _target Target contract address.
30 | * @param _message Message to send to the target.
31 | * @param _gasLimit Gas limit for the provided message.
32 | */
33 | function sendMessage(
34 | address _target,
35 | bytes calldata _message,
36 | uint32 _gasLimit
37 | ) external;
38 | }
39 |
--------------------------------------------------------------------------------
/utils/imports/@openzeppelin/contracts/vendor/polygon/IFxMessageProcessor.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/polygon/IFxMessageProcessor.sol)
3 | pragma solidity ^0.8.0;
4 |
5 | interface IFxMessageProcessor {
6 | function processMessageFromRoot(
7 | uint256 stateId,
8 | address rootMessageSender,
9 | bytes calldata data
10 | ) external;
11 | }
12 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/agreements/AgreementBase.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { UUPSProxiable } from "../upgradability/UUPSProxiable.sol";
5 | import { ISuperAgreement } from "../interfaces/superfluid/ISuperAgreement.sol";
6 |
7 |
8 | /**
9 | * @title Superfluid agreement base boilerplate contract
10 | * @author Superfluid
11 | */
12 | abstract contract AgreementBase is
13 | UUPSProxiable,
14 | ISuperAgreement
15 | {
16 | address immutable internal _host;
17 |
18 | constructor(address host)
19 | {
20 | _host = host;
21 | }
22 |
23 | function proxiableUUID()
24 | public view override
25 | returns (bytes32)
26 | {
27 | return ISuperAgreement(this).agreementType();
28 | }
29 |
30 | function updateCode(address newAddress)
31 | external override
32 | {
33 | require(msg.sender == _host, "only host can update code");
34 | return _updateCodeAddress(newAddress);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/CustomSuperTokenBase.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | import {
5 | ISuperToken
6 | } from "../../interfaces/superfluid/ISuperToken.sol";
7 |
8 | /**
9 | * @title Custom super token base contract
10 | * @author Superfluid
11 | * NOTE:
12 | * - Because of how solidity lays out its storage variables and how custom
13 | * super tokens inherit the SuperToken standard implementation, it is
14 | * required that the custom token proxy pads its implementation
15 | * with reserved storage used by the Super Token implementation.
16 | * - You will need to append your own proxy implementation after the base
17 | * - Refer to SETH.sol for an example how it is used.
18 | */
19 | abstract contract CustomSuperTokenBase {
20 | // This (32) is the hard-coded number of storage slots used by the super token
21 | uint256[32] internal _storagePaddings;
22 | }
23 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | import { ISuperfluidToken } from "./ISuperfluidToken.sol";
5 |
6 | /**
7 | * @title Super agreement interface
8 | * @author Superfluid
9 | */
10 | interface ISuperAgreement {
11 |
12 | /**
13 | * @dev Get the type of the agreement class
14 | */
15 | function agreementType() external view returns (bytes32);
16 |
17 | /**
18 | * @dev Calculate the real-time balance for the account of this agreement class
19 | * @param account Account the state belongs to
20 | * @param time Time used for the calculation
21 | * @return dynamicBalance Dynamic balance portion of real-time balance of this agreement
22 | * @return deposit Account deposit amount of this agreement
23 | * @return owedDeposit Account owed deposit amount of this agreement
24 | */
25 | function realtimeBalanceOf(
26 | ISuperfluidToken token,
27 | address account,
28 | uint256 time
29 | )
30 | external
31 | view
32 | returns (
33 | int256 dynamicBalance,
34 | uint256 deposit,
35 | uint256 owedDeposit
36 | );
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5 | import { TokenInfo } from "./TokenInfo.sol";
6 |
7 | /**
8 | * @title ERC20 token with token info interface
9 | * @author Superfluid
10 | * @dev Using abstract contract instead of interfaces because old solidity
11 | * does not support interface inheriting other interfaces
12 | * solhint-disable-next-line no-empty-blocks
13 | *
14 | */
15 | // solhint-disable-next-line no-empty-blocks
16 | abstract contract ERC20WithTokenInfo is IERC20, TokenInfo {}
17 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/IMaticBridgedNativeSuperToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | import { ISuperToken } from "../superfluid/ISuperToken.sol";
5 |
6 | /**
7 | * @title Matic Bridged Native SuperToken Custom interface
8 | * @author Superfluid
9 | * @dev Functionality specific for Matic Bridged Native Super Tokens
10 | */
11 | interface IMaticBridgedNativeSuperTokenCustom {
12 | /// @dev triggers minting of tokens to the given user, called by the child chain manager
13 | function deposit(address user, bytes calldata depositData) external;
14 |
15 | /// @dev triggers burning of tokens on the child chain and unlocking on L1
16 | function withdraw(uint256 amount) external;
17 |
18 | /// @dev governance can change the child chain manager
19 | function updateChildChainManager(address newChildChainManager) external;
20 |
21 | /// @dev emitted when the child chain manager changes
22 | event ChildChainManagerChanged(address newAddress);
23 | }
24 |
25 | /**
26 | * @dev Matic Bridged Native SuperToken full interface
27 | * @author Superfluid
28 | */
29 | interface IMaticBridgedNativeSuperToken is IMaticBridgedNativeSuperTokenCustom, ISuperToken {}
30 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/IPureSuperToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | import { ISuperToken } from "../superfluid/ISuperToken.sol";
5 |
6 | /**
7 | * @title Pure Super Token custom interface
8 | * @author Superfluid
9 | */
10 | interface IPureSuperTokenCustom {
11 | function initialize(string calldata name, string calldata symbol, uint256 initialSupply) external;
12 | }
13 |
14 | /**
15 | * @title Pure Super Token interface
16 | * @author Superfluid
17 | */
18 | interface IPureSuperToken is IPureSuperTokenCustom, ISuperToken {}
19 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ISETH.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | import { ISuperToken } from "../superfluid/ISuperToken.sol";
5 |
6 |
7 | /**
8 | * @title Super ETH (SETH) custom token interface
9 | * @author Superfluid
10 | */
11 | interface ISETHCustom {
12 | // using native token
13 | function upgradeByETH() external payable;
14 | function upgradeByETHTo(address to) external payable;
15 | function downgradeToETH(uint wad) external;
16 | }
17 |
18 | /**
19 | * @title Super ETH (SETH) full interface
20 | * @author Superfluid
21 | */
22 | // solhint-disable-next-line no-empty-blocks
23 | interface ISETH is ISETHCustom, ISuperToken {}
24 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | /**
5 | * @title ERC20 token info interface
6 | * @author Superfluid
7 | * @dev ERC20 standard interface does not specify these functions, but
8 | * often the token implementations have them.
9 | */
10 | interface TokenInfo {
11 | /**
12 | * @dev Returns the name of the token.
13 | */
14 | function name() external view returns (string memory);
15 |
16 | /**
17 | * @dev Returns the symbol of the token, usually a shorter version of the
18 | * name.
19 | */
20 | function symbol() external view returns (string memory);
21 |
22 | /**
23 | * @dev Returns the number of decimals used to get its user representation.
24 | * For example, if `decimals` equals `2`, a balance of `505` tokens should
25 | * be displayed to a user as `5,05` (`505 / 10 ** 2`).
26 | *
27 | * Tokens usually opt for a value of 18, imitating the relationship between
28 | * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
29 | * called.
30 | *
31 | * NOTE: This information is only used for _display_ purposes: it in
32 | * no way affects any of the arithmetic of the contract, including
33 | * {IERC20-balanceOf} and {IERC20-transfer}.
34 | */
35 | function decimals() external view returns (uint8);
36 | }
37 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/utils/IMultiSigWallet.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: UNLICENSED
2 |
3 | pragma solidity >= 0.8.0;
4 | /**
5 | * @title Multisig wallet interface
6 | * @author Superfluid
7 | */
8 | interface IMultiSigWallet {
9 | function submitTransaction(address destination, uint value, bytes calldata data)
10 | external
11 | returns (uint transactionId);
12 | }
13 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/utils/IRelayRecipient.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | // MODIFIED FROM: https://github.com/opengsn/forwarder/blob/master/contracts/interfaces/IRelayRecipient.sol
5 |
6 | /**
7 | * @title Relay recipient interface
8 | * @author Superfluid
9 | * @dev A contract must implement this interface in order to support relayed transactions
10 | * @dev It is better to inherit the BaseRelayRecipient as its implementation
11 | */
12 | interface IRelayRecipient {
13 |
14 | /**
15 | * @notice Returns if the forwarder is trusted to forward relayed transactions to us.
16 | * @dev the forwarder is required to verify the sender's signature, and verify
17 | * the call is not a replay.
18 | */
19 | function isTrustedForwarder(address forwarder) external view returns(bool);
20 |
21 | /**
22 | * @dev EIP 2771 version
23 | *
24 | * NOTE:
25 | * - It is not clear if it is actually from the EIP 2771....
26 | * - https://docs.biconomy.io/guides/enable-gasless-transactions/eip-2771
27 | */
28 | function versionRecipient() external view returns (string memory);
29 | }
30 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/interfaces/utils/IResolver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity >= 0.8.0;
3 |
4 | /**
5 | * @title Abstraction for an address resolver contract
6 | * @author Superfluid
7 | */
8 | interface IResolver {
9 |
10 | event Set(string indexed name, address target);
11 |
12 | /**
13 | * @dev Set resolver address name
14 | */
15 | function set(string calldata name, address target) external;
16 |
17 | /**
18 | * @dev Get address by name
19 | */
20 | function get(string calldata name) external view returns (address);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/libs/BaseRelayRecipient.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import "../interfaces/utils/IRelayRecipient.sol";
5 |
6 |
7 | /**
8 | * @title Base relay recipient contract
9 | * @author Superfluid
10 | * @dev A base contract to be inherited by any contract that want to receive relayed transactions
11 | * A subclass must use "_msgSender()" instead of "msg.sender"
12 | * MODIFIED FROM: https://github.com/opengsn/forwarder/blob/master/contracts/BaseRelayRecipient.sol
13 | */
14 | abstract contract BaseRelayRecipient is IRelayRecipient {
15 |
16 | /**
17 | * @dev Check if the forwarder is trusted
18 | */
19 | function isTrustedForwarder(address forwarder) public view virtual override returns(bool);
20 |
21 | /**
22 | * @dev Return the transaction signer of this call
23 | *
24 | * if the call came through our trusted forwarder, return the original sender.
25 | * otherwise, return `msg.sender`.
26 | * should be used in the contract anywhere instead of msg.sender
27 | */
28 | function _getTransactionSigner() internal virtual view returns (address payable ret) {
29 | require(msg.data.length >= 24 && isTrustedForwarder(msg.sender), "Not trusted forwarder");
30 | // At this point we know that the sender is a trusted forwarder,
31 | // so we trust that the last bytes of msg.data are the verified sender address.
32 | // extract sender address from the end of msg.data
33 | assembly {
34 | ret := shr(96,calldataload(sub(calldatasize(),20)))
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/libs/UInt128SafeMath.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 |
5 | /**
6 | * @dev Wrappers over Solidity's arithmetic operations with added overflow
7 | * checks.
8 | *
9 | * Arithmetic operations in Solidity wrap on overflow. This can easily result
10 | * in bugs, because programmers usually assume that an overflow raises an
11 | * error, which is the standard behavior in high level programming languages.
12 | * `UInt128SafeMath` restores this intuition by reverting the transaction when an
13 | * operation overflows.
14 | *
15 | * Using this library instead of the unchecked operations eliminates an entire
16 | * class of bugs, so it's recommended to use it always.
17 | */
18 | library UInt128SafeMath {
19 | /**
20 | * @dev Returns the addition of two unsigned integers, reverting on
21 | * overflow.
22 | *
23 | * Counterpart to Solidity's `+` operator.
24 | *
25 | * Requirements:
26 | *
27 | * - Addition cannot overflow.
28 | */
29 | function add(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
30 | uint128 c;
31 |
32 | unchecked {
33 | c = a + b;
34 | }
35 |
36 | require(c >= a, errorMessage);
37 |
38 | return c;
39 | }
40 |
41 | /**
42 | * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
43 | * overflow (when the result is negative).
44 | *
45 | * Counterpart to Solidity's `-` operator.
46 | *
47 | * Requirements:
48 | *
49 | * - Subtraction cannot overflow.
50 | */
51 | function sub(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
52 | require(b <= a, errorMessage);
53 | uint128 c = a - b;
54 |
55 | return c;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/CallUtilsTester.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { CallUtils } from "../libs/CallUtils.sol";
5 |
6 | contract CallUtilsTester {
7 | function testIsValidAbiEncodedBytes() external pure {
8 | require(!CallUtils.isValidAbiEncodedBytes(abi.encode(1, 2, 3)), "bad data");
9 | require(CallUtils.isValidAbiEncodedBytes(abi.encode(new bytes(0))), "0");
10 | require(CallUtils.isValidAbiEncodedBytes(abi.encode(new bytes(1))), "1");
11 | require(CallUtils.isValidAbiEncodedBytes(abi.encode(new bytes(32))), "32");
12 | require(CallUtils.isValidAbiEncodedBytes(abi.encode(new bytes(33))), "33");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/FakeSuperfluidMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { CallUtils } from "../libs/CallUtils.sol";
5 |
6 | contract FakeSuperfluidMock {
7 |
8 | function callAgreement(
9 | address agreement,
10 | bytes calldata callData
11 | )
12 | external
13 | {
14 | bool success;
15 | bytes memory returnedData;
16 | // solhint-disable-next-line avoid-low-level-calls
17 | (success, returnedData) = agreement.call(callData);
18 | assert(!success);
19 | CallUtils.revertFromReturnedData(returnedData);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/ForwarderMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { CallUtils } from "../libs/CallUtils.sol";
5 | import { IRelayRecipient } from "../interfaces/utils/IRelayRecipient.sol";
6 |
7 | /**
8 | * @dev A test forwarder that can impersonate any account needed.
9 | *
10 | * It is obviously not secure for any production use.
11 | */
12 | contract ForwarderMock {
13 |
14 | // mocked forward request, we don't emulate the signature flow here
15 | struct ForwardRequest {
16 | address from;
17 | address to;
18 | uint256 value;
19 | uint256 gas;
20 | bytes data;
21 | }
22 |
23 | function execute(
24 | ForwardRequest memory req
25 | )
26 | external payable
27 | {
28 | bool success;
29 | bytes memory ret;
30 | require(
31 | keccak256(abi.encodePacked(IRelayRecipient(req.to).versionRecipient())) ==
32 | keccak256("v1"),
33 | "unknown IRelayRecipient.versionRecipient");
34 | // solhint-disable-next-line avoid-low-level-calls
35 | (success, ret) = req.to.call{gas : req.gas, value : req.value}(abi.encodePacked(req.data, req.from));
36 | if (!success) CallUtils.revertFromReturnedData(ret);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/MockSmartWallet.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { ISuperToken, IERC20 } from "../superfluid/Superfluid.sol";
5 |
6 | contract MockSmartWallet {
7 |
8 | function approveTest(IERC20 token, address spender, uint256 amount) external {
9 | token.approve(spender, amount);
10 | }
11 |
12 | function upgradeToTest(ISuperToken superToken, address to, uint256 amount, bytes calldata data) external {
13 | superToken.upgradeTo(to, amount, data);
14 | }
15 | }
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/SuperfluidDestructorMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | // solhint-disable
3 | pragma solidity 0.8.13;
4 |
5 | contract SuperfluidDestructorMock {
6 |
7 | bool immutable public NON_UPGRADABLE_DEPLOYMENT = false;
8 |
9 | fallback() external {
10 | // this == impl in this call
11 | selfdestruct(payable(0));
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/SuperfluidGovernanceIIMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { ISuperfluid } from "../interfaces/superfluid/ISuperfluid.sol";
5 | import { SuperfluidGovernanceII } from "../gov/SuperfluidGovernanceII.sol";
6 |
7 | contract SuperfluidGovernanceIIUpgradabilityTester is SuperfluidGovernanceII {
8 | // @dev Make sure the storage layout never changes over the course of the development
9 | function validateStorageLayout() external pure {
10 | uint256 slot;
11 | uint256 offset;
12 |
13 | // Initializable _initialized and _initialized
14 |
15 | // SuperfluidToken storages
16 |
17 | assembly { slot:= _configs.slot offset := _configs.offset }
18 | require (slot == 1 && offset == 0, "_configs changed location");
19 | // slot 0 offset 0-19: Ownable, offset 20-22: Initializable
20 | // _configs aligned to slot 1
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/mocks/UUPSProxiableMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { UUPSProxiable } from "../upgradability/UUPSProxiable.sol";
5 |
6 |
7 | contract UUPSProxiableMock is UUPSProxiable {
8 |
9 | bytes32 private immutable _uuid;
10 | uint256 public immutable waterMark;
11 |
12 | constructor(bytes32 uuid, uint256 w) {
13 | _uuid = uuid;
14 | waterMark = w;
15 | }
16 |
17 | function proxiableUUID() public view override returns (bytes32)
18 | {
19 | return _uuid;
20 | }
21 |
22 | function updateCode(address newAddress) external override
23 | {
24 | _updateCodeAddress(newAddress);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/superfluid/FullUpgradableSuperTokenProxy.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { ISuperTokenFactory } from "../interfaces/superfluid/ISuperTokenFactory.sol";
5 | import { Proxy } from "@openzeppelin/contracts/proxy/Proxy.sol";
6 |
7 |
8 | /**
9 | * @title Full upgradable super token proxy contract
10 | * @author Superfluid
11 | */
12 | contract FullUpgradableSuperTokenProxy is Proxy {
13 |
14 | // web3.utils.keccak256("org.superfluid-finance.FullUpgradableSuperTokenWrapper.factory_slot")
15 | bytes32 internal constant _FACTORY_SLOT = 0xb8fcd5719b3ddf8626f3664705a89b7fc476129a58c1aa5eda57c600cc1821a0;
16 |
17 | function initialize() external
18 | {
19 | address factory;
20 | assembly { // solium-disable-line
21 | factory := sload(_FACTORY_SLOT)
22 | }
23 | require(address(factory) == address(0), "Already initialized");
24 | factory = msg.sender;
25 | assembly { // solium-disable-line
26 | sstore(_FACTORY_SLOT, factory)
27 | }
28 | }
29 |
30 | function _implementation() internal override view returns (address impl) {
31 | ISuperTokenFactory factory;
32 | assembly { // solium-disable-line
33 | factory := sload(_FACTORY_SLOT)
34 | }
35 | require(address(factory) != address(0), "Not initialized");
36 | return address(factory.getSuperTokenLogic());
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/tokens/PureSuperToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import {
5 | ISuperToken,
6 | CustomSuperTokenBase
7 | }
8 | from "../interfaces/superfluid/CustomSuperTokenBase.sol";
9 | import { IPureSuperTokenCustom } from "../interfaces/tokens/IPureSuperToken.sol";
10 | import { UUPSProxy } from "../upgradability/UUPSProxy.sol";
11 | import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
12 |
13 |
14 | /**
15 | * @title Native SuperToken custom super token implementation
16 | * @author Superfluid
17 | * @dev This is a simple implementation where the supply is pre-minted.
18 | */
19 | contract PureSuperToken is IPureSuperTokenCustom, CustomSuperTokenBase, UUPSProxy {
20 | function initialize(string calldata name, string calldata symbol, uint256 initialSupply)
21 | external override
22 | {
23 | ISuperToken(address(this)).initialize(
24 | // NOTE this is the verbose intention
25 | IERC20(0x0000000000000000000000000000000000000000), // no underlying/wrapped token
26 | 18, // shouldn't matter if there's no wrapped token
27 | name,
28 | symbol
29 | );
30 | ISuperToken(address(this)).selfMint(msg.sender, initialSupply, new bytes(0));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/tokens/SETH.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import {
5 | ISuperToken,
6 | CustomSuperTokenBase
7 | }
8 | from "../interfaces/superfluid/CustomSuperTokenBase.sol";
9 | import { ISETHCustom } from "../interfaces/tokens/ISETH.sol";
10 | import { UUPSProxy } from "../upgradability/UUPSProxy.sol";
11 |
12 | /**
13 | * @dev Super ETH (SETH) custom super token implementation
14 | * @author Superfluid
15 | *
16 | * It is also called a Native-Asset Super Token.
17 | */
18 | contract SETHProxy is ISETHCustom, CustomSuperTokenBase, UUPSProxy {
19 | event TokenUpgraded(address indexed account, uint256 amount);
20 | event TokenDowngraded(address indexed account, uint256 amount);
21 |
22 | // fallback function which mints Super Tokens for received ETH
23 | receive() external payable override {
24 | ISuperToken(address(this)).selfMint(msg.sender, msg.value, new bytes(0));
25 | emit TokenUpgraded(msg.sender, msg.value);
26 | }
27 |
28 | function upgradeByETH() external override payable {
29 | ISuperToken(address(this)).selfMint(msg.sender, msg.value, new bytes(0));
30 | emit TokenUpgraded(msg.sender, msg.value);
31 | }
32 |
33 | function upgradeByETHTo(address to) external override payable {
34 | ISuperToken(address(this)).selfMint(to, msg.value, new bytes(0));
35 | emit TokenUpgraded(to, msg.value);
36 | }
37 |
38 | function downgradeToETH(uint wad) external override {
39 | ISuperToken(address(this)).selfBurn(msg.sender, wad, new bytes(0));
40 | payable(msg.sender).transfer(wad);
41 | emit TokenDowngraded(msg.sender, wad);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/upgradability/UUPSProxiable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { UUPSUtils } from "./UUPSUtils.sol";
5 | import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
6 |
7 | /**
8 | * @title UUPS (Universal Upgradeable Proxy Standard) Proxiable contract.
9 | */
10 | abstract contract UUPSProxiable is Initializable {
11 |
12 | /**
13 | * @dev Get current implementation code address.
14 | */
15 | function getCodeAddress() public view returns (address codeAddress)
16 | {
17 | return UUPSUtils.implementation();
18 | }
19 |
20 | function updateCode(address newAddress) external virtual;
21 |
22 | /**
23 | * @dev Proxiable UUID marker function, this would help to avoid wrong logic
24 | * contract to be used for upgrading.
25 | *
26 | * NOTE: The semantics of the UUID deviates from the actual UUPS standard,
27 | * where it is equivalent of _IMPLEMENTATION_SLOT.
28 | */
29 | function proxiableUUID() public view virtual returns (bytes32);
30 |
31 | /**
32 | * @dev Update code address function.
33 | * It is internal, so the derived contract could setup its own permission logic.
34 | */
35 | function _updateCodeAddress(address newAddress) internal
36 | {
37 | // require UUPSProxy.initializeProxy first
38 | require(UUPSUtils.implementation() != address(0), "UUPSProxiable: not upgradable");
39 | require(
40 | proxiableUUID() == UUPSProxiable(newAddress).proxiableUUID(),
41 | "UUPSProxiable: not compatible logic"
42 | );
43 | require(
44 | address(this) != newAddress,
45 | "UUPSProxiable: proxy loop"
46 | );
47 | UUPSUtils.setImplementation(newAddress);
48 | emit CodeUpdated(proxiableUUID(), newAddress);
49 | }
50 |
51 | event CodeUpdated(bytes32 uuid, address codeAddress);
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/upgradability/UUPSProxy.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { UUPSUtils } from "./UUPSUtils.sol";
5 | import { Proxy } from "@openzeppelin/contracts/proxy/Proxy.sol";
6 |
7 |
8 | /**
9 | * @title UUPS (Universal Upgradeable Proxy Standard) Proxy
10 | *
11 | * NOTE:
12 | * - Compliant with [Universal Upgradeable Proxy Standard](https://eips.ethereum.org/EIPS/eip-1822)
13 | * - Compiiant with [Standard Proxy Storage Slots](https://eips.ethereum.org/EIPS/eip-1967)
14 | * - Implements delegation of calls to other contracts, with proper forwarding of
15 | * return values and bubbling of failures.
16 | * - It defines a fallback function that delegates all calls to the implementation.
17 | */
18 | contract UUPSProxy is Proxy {
19 |
20 | /**
21 | * @dev Proxy initialization function.
22 | * This should only be called once and it is permission-less.
23 | * @param initialAddress Initial logic contract code address to be used.
24 | */
25 | function initializeProxy(address initialAddress) external {
26 | require(initialAddress != address(0), "UUPSProxy: zero address");
27 | require(UUPSUtils.implementation() == address(0), "UUPSProxy: already initialized");
28 | UUPSUtils.setImplementation(initialAddress);
29 | }
30 |
31 | /// @dev Proxy._implementation implementation
32 | function _implementation() internal virtual override view returns (address)
33 | {
34 | return UUPSUtils.implementation();
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/upgradability/UUPSUtils.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | /**
5 | * @title UUPS (Universal Upgradeable Proxy Standard) Shared Library
6 | */
7 | library UUPSUtils {
8 |
9 | /**
10 | * @dev Implementation slot constant.
11 | * Using https://eips.ethereum.org/EIPS/eip-1967 standard
12 | * Storage slot 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc
13 | * (obtained as bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).
14 | */
15 | bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
16 |
17 | /// @dev Get implementation address.
18 | function implementation() internal view returns (address impl) {
19 | assembly { // solium-disable-line
20 | impl := sload(_IMPLEMENTATION_SLOT)
21 | }
22 | }
23 |
24 | /// @dev Set new implementation address.
25 | function setImplementation(address codeAddress) internal {
26 | assembly {
27 | // solium-disable-line
28 | sstore(
29 | _IMPLEMENTATION_SLOT,
30 | codeAddress
31 | )
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/utils/Resolver.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
5 | import { IResolver } from "../interfaces/utils/IResolver.sol";
6 |
7 |
8 | /**
9 | * @title Resolver contract
10 | * @author Superfluid
11 | * @dev A simple implementation of IResolver using OZ AccessControl
12 | *
13 | * NOTE:
14 | * Relevant events for indexing:
15 | * - OZ Access Control events `RoleGranted`/`RoleRevoked`: admin add/remove
16 | * - IResolver event `Set`: resolver name updates
17 | */
18 | contract Resolver is IResolver, AccessControlEnumerable {
19 |
20 | mapping(string => address) private _registry;
21 |
22 | constructor() {
23 | _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
24 | }
25 |
26 | function set(string calldata name, address target) external override {
27 | require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Caller is not an admin");
28 | _registry[name] = target;
29 | emit Set(name, target);
30 | }
31 |
32 | function get(string calldata name) external view override returns (address) {
33 | return _registry[name];
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/utils/TestGovernance.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import {
5 | ISuperfluid,
6 | ISuperfluidToken
7 | } from "../interfaces/superfluid/ISuperfluid.sol";
8 | import { SuperfluidGovernanceBase } from "../gov/SuperfluidGovernanceBase.sol";
9 |
10 | import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
11 |
12 |
13 | /**
14 | * @title Test governance contract
15 | * @author Superfluid
16 | * @dev A initializable version of the governance for testing purpose
17 | */
18 | contract TestGovernance is
19 | Ownable,
20 | SuperfluidGovernanceBase
21 | {
22 | ISuperfluid private _host;
23 |
24 | function initialize(
25 | ISuperfluid host,
26 | address rewardAddress,
27 | uint256 liquidationPeriod,
28 | uint256 patricianPeriod,
29 | address[] memory trustedForwarders
30 | )
31 | external
32 | {
33 | // can initialize only once
34 | assert(address(host) != address(0));
35 | assert(address(_host) == address(0));
36 |
37 | _host = host;
38 |
39 | setRewardAddress(_host, ISuperfluidToken(address(0)), rewardAddress);
40 |
41 | setPPPConfig(host, ISuperfluidToken(address(0)), liquidationPeriod, patricianPeriod);
42 |
43 | for (uint i = 0; i < trustedForwarders.length; ++i) {
44 | enableTrustedForwarder(_host, ISuperfluidToken(address(0)), trustedForwarders[i]);
45 | }
46 | }
47 |
48 | function _requireAuthorised(ISuperfluid host)
49 | internal view override
50 | {
51 | assert(host == _host);
52 | assert(owner() == _msgSender());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/utils/imports/@superfluid-finance/ethereum-contracts/contracts/utils/TestToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity 0.8.13;
3 |
4 | import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5 |
6 | /**
7 | * @title Test token contract
8 | * @author Superfluid
9 | * @dev Test ERC20 token that allows any one mint new tokens.
10 | */
11 | contract TestToken is ERC20 {
12 |
13 | uint256 public constant MINT_LIMIT = 1e12 ether;
14 | uint8 private _decimals;
15 |
16 | constructor(string memory name, string memory symbol, uint8 initDecimals)
17 | ERC20(name, symbol)
18 | {
19 | _decimals = initDecimals;
20 | }
21 |
22 | /**
23 | * @dev See {ERC20-_mint}.
24 | */
25 | function mint(address account, uint256 amount) public returns (bool) {
26 | require(amount <= MINT_LIMIT, "Don't mint too many");
27 | ERC20._mint(account, amount);
28 | return true;
29 | }
30 |
31 | function decimals() public view override returns (uint8) {
32 | return _decimals;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/utils/imports/SuperTokenStorage.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity ^0.8.0;
3 |
4 | /// @title Abstract Storage Contract to pad the first 32 slots of storage
5 | /// @author Superfluid
6 | /// @dev MUST be the FIRST contract inherited to pad the first 32 slots. The slots are padded to
7 | /// ensure the implementation contract (SuperToken.sol) does not override any auxillary state
8 | /// variables. For more info see `./docs/StorageLayout.md`.
9 | abstract contract SuperTokenStorage {
10 | uint256[32] internal _storagePaddings;
11 | }
12 |
--------------------------------------------------------------------------------
/utils/imports/UUPSProxy.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: AGPLv3
2 | pragma solidity ^0.8.0;
3 |
4 | import {Proxy} from "@openzeppelin/contracts/proxy/Proxy.sol";
5 |
6 | /// @title UUPS Proxy implementation contract
7 | /// @author jtriley.eth
8 | /// @notice Stores the logic contract's address at the _IMPLEMENTATION_SLOT
9 | /// @dev `initializeProxy(address)` is called by the Super Token Factory
10 | /// The call to the factory should be in the same transaction to avoid being
11 | /// front run
12 | contract UUPSProxy is Proxy {
13 | /// @notice Thrown when the logic contract address is zero
14 | error ZeroAddress();
15 |
16 | /// @notice Thrown when the logic contract has been set
17 | error Initialized();
18 |
19 | /// @notice Precomputed from the following for gas savings
20 | /// bytes32(uint256(keccak256("eip1967.proxy.implementation") - 1));
21 | bytes32 internal constant _IMPLEMENTATION_SLOT =
22 | 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
23 |
24 | /// @notice Stores the logic contract address only once.
25 | /// @dev Called by the SuperTokenFactory contract on upgrade
26 | /// @param initialAddress logic contract address
27 | function initializeProxy(address initialAddress) external {
28 | if (initialAddress == address(0)) revert ZeroAddress();
29 | if (_implementation() != address(0)) revert Initialized();
30 | assembly {
31 | sstore(_IMPLEMENTATION_SLOT, initialAddress)
32 | }
33 | }
34 |
35 | /// @notice Reads logic contract from precomputed slot
36 | /// @return impl Logic contract address
37 | function _implementation()
38 | internal
39 | view
40 | virtual
41 | override
42 | returns (address impl)
43 | {
44 | assembly {
45 | impl := sload(_IMPLEMENTATION_SLOT)
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/utils/nft/getNftImage.ts:
--------------------------------------------------------------------------------
1 | import axios from 'axios';
2 | import path from 'path';
3 | import { getIPFSUrl } from '../getIPFSUrl';
4 | import { NFT } from '../types';
5 | import { tokenAsNFT } from '../type_functions';
6 |
7 | export default async function getNFT({
8 | chainId,
9 | contractAddress,
10 | tokenId,
11 | }: {
12 | tokenId: string;
13 | contractAddress: string;
14 | chainId: string;
15 | }): Promise {
16 | let imageLink: string | void = '';
17 | const metadataApiUrl =
18 | new URL(
19 | path.join('v1', chainId, 'tokens', contractAddress, 'nft_metadata', tokenId),
20 | process.env.NEXT_PUBLIC_COVALENT_BASEURL,
21 | ).toString() + '/';
22 |
23 | const metadataRes = await axios.get(metadataApiUrl, {
24 | params: {
25 | key: process.env.NEXT_PUBLIC_COVALENT_API_KEY,
26 | },
27 | });
28 | const nft = await tokenAsNFT(metadataRes.data.data.items[0]);
29 | // if (nft.nft_data[0].token_url) {
30 | // const tempLink = await getIPFSImageURl(nft.nft_data[0].token_url);
31 | // tempLink && tempLink.length > 0 && (imageLink = tempLink);
32 | // }
33 | // return imageLink;
34 | return nft;
35 | }
36 |
37 | // function that returns IPFS url
38 | export async function getIPFSImageURl(tokenURL: string): Promise {
39 | let imageLink = '';
40 | const tokenIPFSlink = await getIPFSUrl(tokenURL);
41 | const tokenIPFSresponse = await fetch(tokenIPFSlink, {
42 | method: 'GET',
43 | headers: {
44 | Accept: 'application/json',
45 | },
46 | });
47 | const tokenIPFSdata = await tokenIPFSresponse.json();
48 | if (tokenIPFSdata && tokenIPFSdata.image) {
49 | imageLink = await getIPFSUrl(tokenIPFSdata.image);
50 | }
51 | return imageLink;
52 | }
53 |
--------------------------------------------------------------------------------
/utils/nft/tranformNftData.ts:
--------------------------------------------------------------------------------
1 | import axios from 'axios';
2 | import { NftDataProps } from '../../components/ui/nftPage';
3 | import CustomNftMetadataProps from '../../components/ui/nftPage/CustomNftMetadataProps';
4 | import { getIPFSUrl } from '../getIPFSUrl';
5 |
6 | export default async function tranformNftData(data: NftDataProps): Promise {
7 | let nftImage = await getIPFSUrl(data.nft_data[0].token_url);
8 |
9 | nftImage = await axios.get(JSON.parse(nftImage).image);
10 |
11 | let newData: CustomNftMetadataProps = {
12 | nft_data: {
13 | image: nftImage,
14 | },
15 | } as CustomNftMetadataProps;
16 |
17 | console.log('aaaaaaaaaa');
18 | console.log(newData);
19 |
20 | return newData;
21 | }
22 |
--------------------------------------------------------------------------------
/utils/nft/uploadIpfsData.ts:
--------------------------------------------------------------------------------
1 | import { NFTStorage } from 'nft.storage';
2 |
3 | export default async function uploadIpfsData(data: any) {
4 | const client = new NFTStorage({ token: process.env.NEXT_PUBLIC_NFT_STORAGE_API_KEY + '' });
5 | let metadata = null;
6 | try {
7 | metadata = await client.store(data);
8 | } catch (e) {
9 | console.log(e);
10 | }
11 | return metadata;
12 | }
13 |
--------------------------------------------------------------------------------
/utils/nft_collection.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @author - rG
3 | * @resources -
4 | *
5 | */
6 |
7 | import compile from './contract_compiler';
8 | import { readFileSync } from 'fs';
9 | import { formatContractName, stringFormat } from './string_formatter';
10 |
11 | // type for user provided data for NFTCollection contract
12 | export type NFTCollectionData = {
13 | name: string;
14 | symbol: string;
15 | securityContact?: string;
16 | license?: string;
17 | };
18 |
19 | // generate NFTCollection contract using OpenZeppelin wizard solidity API
20 | // then pass it to compile method to generate ABI and bytecode
21 | export function nftCollection(
22 | opts: NFTCollectionData,
23 | cb: any,
24 | ): { abi: any; bytecode: any; contract: string; metadata: any } | void {
25 | opts.name = formatContractName(opts.name);
26 | let file: string = readFileSync(`${process.cwd()}/utils/contracts/NFTCollection.sol`, { encoding: 'utf-8' });
27 | file = stringFormat(file, opts.name, opts.symbol, opts.securityContact, opts.license);
28 | compile(file, opts.name, cb);
29 | }
30 |
--------------------------------------------------------------------------------
/utils/single_nft.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @author - rG
3 | * @resources -
4 | *
5 | */
6 |
7 | import compile from './contract_compiler';
8 | import { readFileSync } from 'fs';
9 | import { formatContractName, stringFormat } from './string_formatter';
10 |
11 | // type for user provided data for SingleNFT contract
12 | export type SingleNFTData = {
13 | name: string;
14 | symbol: string;
15 | tokenId: number;
16 | uri: string;
17 | securityContact?: string;
18 | license?: string;
19 | };
20 |
21 | // generate SingleNFT contract using OpenZeppelin wizard solidity API
22 | // then pass it to compile method to generate ABI and bytecode
23 | export function singleNft(
24 | opts: SingleNFTData,
25 | cb: any,
26 | ): { abi: any; bytecode: any; contract: string; metadata: any } | void {
27 | opts.name = formatContractName(opts.name);
28 | let file: string = readFileSync(`${process.cwd()}/utils/contracts/SingleNFT.sol`, { encoding: 'utf-8' });
29 | file = stringFormat(file, opts.name, opts.symbol, opts.tokenId, opts.uri, opts.securityContact, opts.license);
30 | compile(file, opts.name, cb);
31 | }
32 |
--------------------------------------------------------------------------------
/utils/string_formatter.ts:
--------------------------------------------------------------------------------
1 | // special characters -> https://stackoverflow.com/questions/6555182/remove-all-special-characters-except-space-from-a-string-using-javascript
2 | // white spaces ->https://stackoverflow.com/questions/6623231/remove-all-white-spaces-from-text
3 | export function formatContractName(str: string): string {
4 | // convert everything into lowercase
5 | str = str.replace(/[&\/\\#,+()$~%.@'":*?<>{}]/g, '');
6 | // str = str.replace(/[^a-z0-9]*([a-z0-9])([a-z0-9]*)/gi, (m, u, l) => u.toUpperCase() + l.toLowerCase() + ' ');
7 | str = str.replaceAll(/\s/g, '');
8 | return str;
9 | }
10 |
11 | // https://stackoverflow.com/questions/59934393/typescript-string-format-does-not-exist
12 | export function stringFormat(template: string, ...args: any[]) {
13 | return template.replace(/{(\d+)}/g, function (match, number) {
14 | return typeof args[number] != 'undefined' ? args[number] : match;
15 | });
16 | }
17 |
--------------------------------------------------------------------------------