diff --git a/.gitignore b/.gitignore index c630a2a..3d2621f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ artifacts *diamond.json metadata -types \ No newline at end of file +types +gen \ No newline at end of file diff --git a/contracts/_diamond/Diamond.sol b/contracts/_diamond/Diamond.sol index 42b552b..7fc671f 100644 --- a/contracts/_diamond/Diamond.sol +++ b/contracts/_diamond/Diamond.sol @@ -12,7 +12,8 @@ import { LibDiamond } from "./libraries/LibDiamond.sol"; import { IDiamondCut } from "./interfaces/IDiamondCut.sol"; import { IDiamondLoupe } from "./interfaces/IDiamondLoupe.sol"; -contract Diamond { +contract Diamond { + uint private _counter; constructor(address _contractOwner, address _diamondCutFacet, address _diamondLoupeFacet, address _facetsRepository) payable { LibDiamond.setContractOwner(_contractOwner); @@ -44,6 +45,22 @@ contract Diamond { LibDiamond.diamondCut(cut, address(0), ""); } + function exampleFunction(uint num) public pure returns (uint) { + return num; + } + + function incrementCounter() public { + _counter++; + } + + function increaseCounter(uint num) public { + _counter += num; + } + + function getCounter() public view returns (uint) { + return _counter; + } + // Find facet for function that is called and execute the // function if a facet is found and return any value. fallback() external payable { diff --git a/package.json b/package.json index a6fb89b..f6c5c07 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,15 @@ "start": "next start", "lint": "next lint", "start:node": "hardhat node", - "generate:typechain": "typechain --target=ethers-v5 metadata/*.json ", + "generate:typechain": "typechain --target=ethers-v5 artifacts/contracts/_diamond/Diamond.sol/Diamond.json ", + "generate:usedapp": "USEDAPP_OUT_DIR=./gen/hooks USEDAPP_TYPES_DIR=./types/ethers-contracts yarn usedapp-generate-hooks", + "generate": "yarn generate:typechain && yarn generate:usedapp", "diamond:add": "hardhat diamond:add --remote --save-metadata --address ", "diamond:init": "hardhat diamond:init && yarn generate:typechain" }, "dependencies": { "@solidstate/contracts": "^0.0.35", - "@usedapp/core": "^1.0.15", + "@usedapp/core": "1.1.3", "hardhat-gemcutter": "https://github.com/marcocastignoli/hardhat-gemcutter", "next": "12.1.6", "react": "18.2.0", diff --git a/yarn.lock b/yarn.lock index dcc1831..33468e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1415,10 +1415,10 @@ resolved "https://registry.yarnpkg.com/@uniswap/token-lists/-/token-lists-1.0.0-beta.30.tgz#2103ca23b8007c59ec71718d34cdc97861c409e5" integrity sha512-HwY2VvkQ8lNR6ks5NqQfAtg+4IZqz3KV1T8d2DlI8emIn9uMmaoFbIOg0nzjqAVKKnZSbMTRRtUoAh6mmjRvog== -"@usedapp/core@^1.0.15": - version "1.0.15" - resolved "https://registry.yarnpkg.com/@usedapp/core/-/core-1.0.15.tgz#66c982c13cf9aeb061b74fa6ad1f8ef6f7cd4fd2" - integrity sha512-dvjLiYVyutM25BiwiFlPjyhPVlLQA4Dg/WnN0Q8XPnWtyasM0mytxerGQMl0Um1WCtqQynV2R8SU5iQY723cCA== +"@usedapp/core@1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@usedapp/core/-/core-1.1.3.tgz#04f087edd96b5a5ec9726ba7fa278a6e68f5b937" + integrity sha512-2hWzZ9oCsfgzN8Ewu3of2JuWuiFfBUtSY4b+dz3YygZcx1D48IxjyUO3+VjxVbE5eQAYSjfnA6WVMDIBZ+K5zQ== dependencies: "@metamask/detect-provider" "^1.2.0" "@uniswap/token-lists" "^1.0.0-beta.27"