├── .env.example ├── .eslintrc ├── .github ├── ISSUE_TEMPLATE │ ├── bounty-ticket.md │ ├── bug_report.md │ └── feature_request.md ├── pull_request_template.md └── workflows │ ├── ci.yml │ ├── coveralls.yml │ ├── linter.yml │ └── slither.yml ├── .gitignore ├── .npmignore ├── .nvmrc ├── .openzeppelin ├── goerli.json ├── optimism.json ├── unknown-11155111.json ├── unknown-11155420.json └── unknown-420.json ├── .prettierrc ├── .solcover.js ├── .solhint.json ├── LICENSE-APACHE ├── LICENSE.md ├── README.md ├── abi ├── @solidstate │ └── contracts │ │ ├── access │ │ └── ownable │ │ │ ├── IOwnable.sol │ │ │ └── IOwnable.json │ │ │ ├── IOwnableInternal.sol │ │ │ └── IOwnableInternal.json │ │ │ ├── ISafeOwnable.sol │ │ │ └── ISafeOwnable.json │ │ │ ├── ISafeOwnableInternal.sol │ │ │ └── ISafeOwnableInternal.json │ │ │ ├── Ownable.sol │ │ │ └── Ownable.json │ │ │ ├── OwnableInternal.sol │ │ │ └── OwnableInternal.json │ │ │ ├── SafeOwnable.sol │ │ │ └── SafeOwnable.json │ │ │ └── SafeOwnableInternal.sol │ │ │ └── SafeOwnableInternal.json │ │ ├── interfaces │ │ ├── IERC165.sol │ │ │ └── IERC165.json │ │ ├── IERC173.sol │ │ │ └── IERC173.json │ │ ├── IERC173Internal.sol │ │ │ └── IERC173Internal.json │ │ ├── IERC721.sol │ │ │ └── IERC721.json │ │ ├── IERC721Internal.sol │ │ │ └── IERC721Internal.json │ │ └── IERC721Receiver.sol │ │ │ └── IERC721Receiver.json │ │ ├── introspection │ │ └── ERC165.sol │ │ │ └── ERC165.json │ │ ├── proxy │ │ ├── IProxy.sol │ │ │ └── IProxy.json │ │ ├── Proxy.sol │ │ │ └── Proxy.json │ │ └── diamond │ │ │ ├── ISolidStateDiamond.sol │ │ │ └── ISolidStateDiamond.json │ │ │ ├── SolidStateDiamond.sol │ │ │ └── SolidStateDiamond.json │ │ │ ├── base │ │ │ ├── DiamondBase.sol │ │ │ │ └── DiamondBase.json │ │ │ ├── DiamondBaseStorage.sol │ │ │ │ └── DiamondBaseStorage.json │ │ │ └── IDiamondBase.sol │ │ │ │ └── IDiamondBase.json │ │ │ ├── readable │ │ │ ├── DiamondReadable.sol │ │ │ │ └── DiamondReadable.json │ │ │ └── IDiamondReadable.sol │ │ │ │ └── IDiamondReadable.json │ │ │ └── writable │ │ │ ├── DiamondWritable.sol │ │ │ └── DiamondWritable.json │ │ │ └── IDiamondWritable.sol │ │ │ └── IDiamondWritable.json │ │ └── token │ │ └── ERC721 │ │ ├── base │ │ ├── ERC721Base.sol │ │ │ └── ERC721Base.json │ │ ├── ERC721BaseInternal.sol │ │ │ └── ERC721BaseInternal.json │ │ └── IERC721Base.sol │ │ │ └── IERC721Base.json │ │ └── metadata │ │ ├── ERC721Metadata.sol │ │ └── ERC721Metadata.json │ │ ├── ERC721MetadataInternal.sol │ │ └── ERC721MetadataInternal.json │ │ └── IERC721Metadata.sol │ │ └── IERC721Metadata.json ├── @superfluid-finance │ └── ethereum-contracts │ │ └── contracts │ │ ├── apps │ │ └── SuperAppBase.sol │ │ │ └── SuperAppBase.json │ │ └── interfaces │ │ ├── agreements │ │ ├── IConstantFlowAgreementV1.sol │ │ │ └── IConstantFlowAgreementV1.json │ │ ├── IInstantDistributionAgreementV1.sol │ │ │ └── IInstantDistributionAgreementV1.json │ │ └── gdav1 │ │ │ ├── IGeneralDistributionAgreementV1.sol │ │ │ └── IGeneralDistributionAgreementV1.json │ │ │ ├── IPoolAdminNFT.sol │ │ │ └── IPoolAdminNFT.json │ │ │ ├── IPoolMemberNFT.sol │ │ │ └── IPoolMemberNFT.json │ │ │ ├── IPoolNFTBase.sol │ │ │ └── IPoolNFTBase.json │ │ │ └── ISuperfluidPool.sol │ │ │ └── ISuperfluidPool.json │ │ ├── superfluid │ │ ├── IConstantInflowNFT.sol │ │ │ └── IConstantInflowNFT.json │ │ ├── IConstantOutflowNFT.sol │ │ │ └── IConstantOutflowNFT.json │ │ ├── IFlowNFTBase.sol │ │ │ └── IFlowNFTBase.json │ │ ├── ISuperAgreement.sol │ │ │ └── ISuperAgreement.json │ │ ├── ISuperApp.sol │ │ │ └── ISuperApp.json │ │ ├── ISuperToken.sol │ │ │ └── ISuperToken.json │ │ ├── ISuperTokenFactory.sol │ │ │ └── ISuperTokenFactory.json │ │ ├── ISuperfluid.sol │ │ │ └── ISuperfluid.json │ │ ├── ISuperfluidGovernance.sol │ │ │ └── ISuperfluidGovernance.json │ │ └── ISuperfluidToken.sol │ │ │ └── ISuperfluidToken.json │ │ └── tokens │ │ └── ISETH.sol │ │ ├── ISETH.json │ │ └── ISETHCustom.json └── contracts │ ├── beacon-diamond │ └── BeaconDiamond.sol │ │ └── BeaconDiamond.json │ ├── beneficiary │ ├── BeneficiarySuperApp.sol │ │ └── BeneficiarySuperApp.json │ ├── interfaces │ │ └── ICFABeneficiary.sol │ │ │ └── ICFABeneficiary.json │ └── test │ │ └── BeneficiarySuperApp.test.sol │ │ ├── FuzzyBeneficiarySuperApp.json │ │ └── MockParamsStore.json │ ├── pco-license │ ├── PCOLicenseDiamond.sol │ │ └── PCOLicenseDiamond.json │ ├── facets │ │ ├── CFABasePCOFacet.sol │ │ │ └── CFABasePCOFacet.json │ │ ├── CFAPenaltyBidFacet.sol │ │ │ └── CFAPenaltyBidFacet.json │ │ ├── CFAReclaimerFacet.sol │ │ │ └── CFAReclaimerFacet.json │ │ └── test │ │ │ └── CFABasePCOFacet.test.sol │ │ │ └── TestableCFABasePCOFacet.json │ ├── interfaces │ │ ├── ICFABasePCO.sol │ │ │ └── ICFABasePCO.json │ │ ├── ICFAPenaltyBid.sol │ │ │ └── ICFAPenaltyBid.json │ │ ├── ICFAReclaimer.sol │ │ │ └── ICFAReclaimer.json │ │ └── IPCOLicenseDiamond.sol │ │ │ └── IPCOLicenseDiamond.json │ └── libraries │ │ ├── LibCFABasePCO.sol │ │ └── LibCFABasePCO.json │ │ └── LibCFAPenaltyBid.sol │ │ └── LibCFAPenaltyBid.json │ └── registry │ ├── RegistryDiamond.sol │ └── RegistryDiamond.json │ ├── facets │ ├── GeoWebParcelFacet.sol │ │ ├── GeoWebParcelFacetV1.json │ │ └── GeoWebParcelFacetV2.json │ ├── PCOERC721Facet.sol │ │ └── PCOERC721Facet.json │ ├── PCOLicenseClaimerFacet.sol │ │ ├── PCOLicenseClaimerFacetV1.json │ │ └── PCOLicenseClaimerFacetV2.json │ ├── PCOLicenseParamsFacet.sol │ │ └── PCOLicenseParamsFacet.json │ └── test │ │ ├── GeoWebParcelFacet.test.sol │ │ ├── FuzzyGeoWebParcelFacetV1.json │ │ ├── FuzzyGeoWebParcelFacetV2.json │ │ ├── TestableGeoWebParcelFacetV1.json │ │ └── TestableGeoWebParcelFacetV2.json │ │ ├── PCOERC721Facet.test.sol │ │ └── FuzzyPCOERC721Facet.json │ │ ├── PCOLicenseClaimerFacet.test.sol │ │ ├── FuzzyPCOLicenseClaimerFacetV1.json │ │ └── FuzzyPCOLicenseClaimerFacetV2.json │ │ └── PCOLicenseParamsFacet.test.sol │ │ └── FuzzyPCOLicenseParamsFacet.json │ ├── interfaces │ ├── IGeoWebParcel.sol │ │ ├── IGeoWebParcel.json │ │ ├── IGeoWebParcelV1.json │ │ └── IGeoWebParcelV2.json │ ├── IPCOERC721.sol │ │ └── IPCOERC721.json │ ├── IPCOLicenseClaimer.sol │ │ ├── IPCOLicenseClaimer.json │ │ ├── IPCOLicenseClaimerV1.json │ │ └── IPCOLicenseClaimerV2.json │ ├── IPCOLicenseParamsStore.sol │ │ └── IPCOLicenseParamsStore.json │ └── IRegistryDiamond.sol │ │ └── IRegistryDiamond.json │ └── libraries │ ├── LibGeoWebCoordinate.sol │ └── LibGeoWebCoordinate.json │ ├── LibGeoWebParcel.sol │ └── LibGeoWebParcel.json │ └── test │ └── LibGeoWebCoordinate.test.sol │ ├── LibGeoWebCoordinatePathTest.json │ └── LibGeoWebCoordinateTest.json ├── contracts ├── beacon-diamond │ ├── BeaconDiamond.sol │ └── libraries │ │ └── LibBeaconDiamond.sol ├── beneficiary │ ├── BeneficiarySuperApp.sol │ ├── interfaces │ │ └── ICFABeneficiary.sol │ └── test │ │ └── BeneficiarySuperApp.test.sol ├── pco-license │ ├── PCOLicenseDiamond.sol │ ├── facets │ │ ├── CFABasePCOFacet.sol │ │ ├── CFAPenaltyBidFacet.sol │ │ ├── CFAReclaimerFacet.sol │ │ └── test │ │ │ └── CFABasePCOFacet.test.sol │ ├── interfaces │ │ ├── ICFABasePCO.sol │ │ ├── ICFAPenaltyBid.sol │ │ ├── ICFAReclaimer.sol │ │ └── IPCOLicenseDiamond.sol │ └── libraries │ │ ├── LibCFABasePCO.sol │ │ └── LibCFAPenaltyBid.sol └── registry │ ├── RegistryDiamond.sol │ ├── facets │ ├── GeoWebParcelFacet.sol │ ├── PCOERC721Facet.sol │ ├── PCOLicenseClaimerFacet.sol │ ├── PCOLicenseParamsFacet.sol │ └── test │ │ ├── GeoWebParcelFacet.test.sol │ │ ├── PCOERC721Facet.test.sol │ │ ├── PCOLicenseClaimerFacet.test.sol │ │ └── PCOLicenseParamsFacet.test.sol │ ├── interfaces │ ├── IGeoWebParcel.sol │ ├── IPCOERC721.sol │ ├── IPCOLicenseClaimer.sol │ ├── IPCOLicenseParamsStore.sol │ └── IRegistryDiamond.sol │ └── libraries │ ├── LibGeoWebCoordinate.sol │ ├── LibGeoWebParcel.sol │ ├── LibGeoWebParcelV2.sol │ ├── LibPCOLicenseClaimer.sol │ ├── LibPCOLicenseParams.sol │ └── test │ └── LibGeoWebCoordinate.test.sol ├── docs ├── .gitkeep ├── actions.png ├── architecture.png └── index.md ├── echidna-config.yaml ├── flake.lock ├── flake.nix ├── hardhat.config.ts ├── mythril-solc.json ├── package.json ├── scripts ├── deploy.ts └── libraries │ └── diamond.js ├── slither.config.json ├── src └── index.ts ├── tasks ├── bid-example.ts ├── claim_example.ts ├── estimate_minting_gas.ts ├── initialize-defender.ts ├── initialize-eoa.ts ├── upgrade-beneficiary.ts └── upgrades │ ├── 4_1_0.ts │ ├── 4_1_1.ts │ ├── 4_1_5.ts │ ├── 4_2_0.optimism.ts │ ├── 4_2_0.ts │ └── 4_3_0.ts ├── test ├── .gitkeep ├── beneficiary │ └── BeneficiarySuperApp.ts ├── pco-license │ ├── .DS_Store │ ├── CFABasePCO.fixture.ts │ ├── CFABasePCOFacet.ts │ ├── CFAPenaltyBid.fixture.ts │ ├── CFAPenaltyBidFacet.ts │ └── CFAReclaimerFacet.ts ├── registry │ ├── GeoWebParcelFacet.ts │ ├── GeoWebParcelFacetV2.ts │ ├── LibGeoWebCoordinate.ts │ ├── PCOERC721Facet.ts │ ├── PCOLicenseClaimer.fixture.ts │ ├── PCOLicenseClaimerFacet.ts │ ├── PCOLicenseClaimerFacetV2.ts │ ├── PCOLicenseClaimerV2.fixture.ts │ └── PCOLicenseParamsFacet.ts ├── shared.ts └── upgrades │ └── 4_1_0.ts ├── tsconfig.build.json ├── tsconfig.json ├── typechain-types ├── IERC721.ts ├── ISuperfluid.ts ├── PCOLicenseParamsFacet.ts └── factories │ ├── CFABasePCOFacet__factory.ts │ ├── CFAPenaltyBidFacet__factory.ts │ ├── PCOLicenseDiamond__factory.ts │ ├── PCOLicenseParamsFacet__factory.ts │ └── RegistryDiamond__factory.ts └── yarn.lock /.env.example: -------------------------------------------------------------------------------- 1 | DEV_PRIVATE_KEY="" 2 | INFURA_KEY="" 3 | ETHERSCAN_API_KEY="" 4 | OPTIMISTIC_ETHERSCAN_API_KEY= 5 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "es2021": true, 5 | "mocha": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/recommended", 10 | "prettier" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint", 19 | "mocha", 20 | "prettier" 21 | ], 22 | "rules": { 23 | "prettier/prettier": "error", 24 | "mocha/no-exclusive-tests": "error", 25 | "mocha/no-pending-tests": "error", 26 | "@typescript-eslint/no-var-requires": "warn" 27 | } 28 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bounty-ticket.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bounty Ticket 3 | about: Template for open bounties. 4 | title: "[OPEN BOUNTY]" 5 | labels: bounty 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Description (Open Bounty) 11 | 12 | **Business Requirements** 13 | 14 | **Technical Spec** 15 | 16 | **Bounty Overview** 17 | Size = 18 | Reason = 19 | Payment = 20 | Assignee = 21 | 22 | **Bounty Submission** 23 | When work is complete, please create PR with your work and request review from both @codynhat & @gravenp. @gravenp will handle logistics of payment with you privately. 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Please provide a detailed description of what was done in this PR 4 | 5 | # Issue 6 | 7 | fixes #ISSUE 8 | 9 | # Checklist: 10 | 11 | - [ ] My commit message follows the Conventional Commits specification 12 | - [ ] I have performed a self-review of my own code 13 | - [ ] I have commented my code, particularly in hard-to-understand areas 14 | - [ ] I have tested my code 15 | - [ ] My changes generate no new warnings 16 | - [ ] My PR is rebased off the most recent `main` or appropriate feature branch 17 | - [ ] My PR is opened against the `main` or appropriate feature branch 18 | 19 | # Additional comments 20 | 21 | Please post additional comments in this section if you have them, otherwise delete it 22 | 23 | # Alert Reviewers 24 | 25 | @codynhat @gravenp 26 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: "CI" 2 | on: 3 | push: 4 | branches: [main, develop] 5 | pull_request: 6 | branches: [main, develop] 7 | jobs: 8 | tests: 9 | name: "Tests" 10 | runs-on: ubuntu-latest 11 | needs: [] 12 | steps: 13 | - name: "Checkout Repo" 14 | uses: actions/checkout@master 15 | - name: "Install Node" 16 | uses: actions/setup-node@v2 17 | with: 18 | node-version: "14" 19 | cache: "yarn" 20 | - name: "Install JS Dependencies" 21 | run: "yarn install --frozen-lockfile --dev" 22 | - name: "Build" 23 | run: "yarn build" 24 | - name: "Run tests" 25 | run: "yarn tests:run" 26 | -------------------------------------------------------------------------------- /.github/workflows/coveralls.yml: -------------------------------------------------------------------------------- 1 | name: Test Coveralls 2 | on: 3 | push: 4 | branches: [main, develop] 5 | pull_request: 6 | branches: [main, develop] 7 | jobs: 8 | build: 9 | name: Build 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: "Checkout Repo" 13 | uses: actions/checkout@master 14 | - name: "Install Node" 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: "14" 18 | cache: "yarn" 19 | - name: "Install JS Dependencies" 20 | run: "yarn install --frozen-lockfile --dev" 21 | - name: "Build" 22 | run: "yarn build" 23 | - name: "Run solidity coverage" 24 | run: "yarn hardhat coverage" 25 | - name: Coveralls 26 | uses: coverallsapp/github-action@master 27 | with: 28 | github-token: ${{ secrets.GITHUB_TOKEN }} 29 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: "Linter" 2 | on: 3 | push: 4 | branches: [main, develop] 5 | pull_request: 6 | branches: [main, develop] 7 | jobs: 8 | tests: 9 | name: "Lint" 10 | runs-on: ubuntu-latest 11 | needs: [] 12 | steps: 13 | - name: "Checkout Repo" 14 | uses: actions/checkout@master 15 | - name: "Install Node" 16 | uses: actions/setup-node@v2 17 | with: 18 | node-version: "14" 19 | cache: "yarn" 20 | - name: "Install JS Dependencies" 21 | run: "yarn install --frozen-lockfile --dev" 22 | - name: "Build" 23 | run: "yarn build" 24 | - name: "Lint" 25 | run: "yarn lint" 26 | -------------------------------------------------------------------------------- /.github/workflows/slither.yml: -------------------------------------------------------------------------------- 1 | name: Slither Analysis 2 | 3 | on: 4 | push: 5 | branches: [main, develop] 6 | pull_request: 7 | branches: [main, develop] 8 | 9 | jobs: 10 | analyze: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | contents: read 14 | security-events: write 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v3 18 | 19 | - name: Run Slither 20 | uses: crytic/slither-action@v0.1.1 21 | continue-on-error: true 22 | id: slither 23 | with: 24 | node-version: 16 25 | sarif: results.sarif 26 | 27 | - name: Upload SARIF file 28 | uses: github/codeql-action/upload-sarif@v2 29 | with: 30 | sarif_file: ${{ steps.slither.outputs.sarif }} 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .envrc 3 | migrations 4 | dist/ 5 | 6 | # hardhat 7 | artifacts/ 8 | cache/ 9 | cache-ovm/ 10 | build/ 11 | 12 | # dotenv 13 | .env 14 | 15 | # typechain 16 | typechain-types/*.js 17 | typechain-types/*.ts 18 | typechain-types/factories/* 19 | !typechain-types/factories/RegistryDiamond__factory.ts 20 | !typechain-types/factories/PCOLicenseDiamond__factory.ts 21 | 22 | # tests-typechain 23 | !typechain-types/IERC721.ts 24 | !typechain-types/PCOLicenseClaimerFacet.ts 25 | !typechain-types/IDiamondLoupe.ts 26 | !typechain-types/PCOLicenseParamsFacet.ts 27 | !typechain-types/ISuperfluid.ts 28 | 29 | # solidity-coverage 30 | coverage/ 31 | 32 | # abi exporter 33 | abi/@openzeppelin 34 | abi/contracts/mock 35 | 36 | # solidity-coverage 37 | coverage.json 38 | coverage/ 39 | 40 | .direnv 41 | 42 | .openzeppelin/unknown-31337.json 43 | 44 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | !dist/** 3 | !package.json 4 | !README.md 5 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 14.18.1 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "overrides": [ 5 | { 6 | "files": "*.sol", 7 | "options": { 8 | "printWidth": 80, 9 | "tabWidth": 4, 10 | "useTabs": false, 11 | "singleQuote": false, 12 | "bracketSpacing": false, 13 | "explicitTypes": "always" 14 | } 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /.solcover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mocha: { 3 | grep: "@skip-on-coverage", // Find everything with this tag 4 | invert: true, // Run the grep's inverse set. 5 | enableTimeouts: false, 6 | }, 7 | configureYulOptimizer: true, 8 | skipFiles: [ 9 | "registry/facets/test/GeoWebParcelFacet.test.sol", 10 | "registry/facets/test/GeoWebParcelFacetV2.test.sol", 11 | "registry/facets/test/PCOERC721Facet.test.sol", 12 | "registry/facets/test/PCOLicenseClaimerFacet.test.sol", 13 | "registry/facets/test/PCOLicenseClaimerFacetV2.test.sol", 14 | "registry/facets/test/PCOLicenseParamsFacet.test.sol", 15 | "pco-license/facets/test/CFABasePCOFacet.test.sol", 16 | "beneficiary/test/BeneficiarySuperApp.test.sol", 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:recommended", 3 | "rules": { 4 | "compiler-version": ["error", "^0.8.16"], 5 | "not-rely-on-time": "off", 6 | "reason-string": ["warn", { "maxLength": 100 }], 7 | "func-visibility": ["warn", { "ignoreConstructors": true }] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021-2022 Geo Web Network, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/IOwnable.sol/IOwnable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "owner", 24 | "outputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "", 28 | "type": "address" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "account", 39 | "type": "address" 40 | } 41 | ], 42 | "name": "transferOwnership", 43 | "outputs": [], 44 | "stateMutability": "nonpayable", 45 | "type": "function" 46 | } 47 | ] 48 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/IOwnableInternal.sol/IOwnableInternal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/ISafeOwnable.sol/ISafeOwnable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "acceptOwnership", 24 | "outputs": [], 25 | "stateMutability": "nonpayable", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "nomineeOwner", 31 | "outputs": [ 32 | { 33 | "internalType": "address", 34 | "name": "", 35 | "type": "address" 36 | } 37 | ], 38 | "stateMutability": "view", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [], 43 | "name": "owner", 44 | "outputs": [ 45 | { 46 | "internalType": "address", 47 | "name": "", 48 | "type": "address" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | }, 54 | { 55 | "inputs": [ 56 | { 57 | "internalType": "address", 58 | "name": "account", 59 | "type": "address" 60 | } 61 | ], 62 | "name": "transferOwnership", 63 | "outputs": [], 64 | "stateMutability": "nonpayable", 65 | "type": "function" 66 | } 67 | ] 68 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/ISafeOwnableInternal.sol/ISafeOwnableInternal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/Ownable.sol/Ownable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "owner", 24 | "outputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "", 28 | "type": "address" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "account", 39 | "type": "address" 40 | } 41 | ], 42 | "name": "transferOwnership", 43 | "outputs": [], 44 | "stateMutability": "nonpayable", 45 | "type": "function" 46 | } 47 | ] 48 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/OwnableInternal.sol/OwnableInternal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/SafeOwnable.sol/SafeOwnable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "acceptOwnership", 24 | "outputs": [], 25 | "stateMutability": "nonpayable", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "nomineeOwner", 31 | "outputs": [ 32 | { 33 | "internalType": "address", 34 | "name": "", 35 | "type": "address" 36 | } 37 | ], 38 | "stateMutability": "view", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [], 43 | "name": "owner", 44 | "outputs": [ 45 | { 46 | "internalType": "address", 47 | "name": "", 48 | "type": "address" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | }, 54 | { 55 | "inputs": [ 56 | { 57 | "internalType": "address", 58 | "name": "account", 59 | "type": "address" 60 | } 61 | ], 62 | "name": "transferOwnership", 63 | "outputs": [], 64 | "stateMutability": "nonpayable", 65 | "type": "function" 66 | } 67 | ] 68 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/access/ownable/SafeOwnableInternal.sol/SafeOwnableInternal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/interfaces/IERC165.sol/IERC165.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes4", 6 | "name": "interfaceId", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "supportsInterface", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "", 15 | "type": "bool" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/interfaces/IERC173.sol/IERC173.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "owner", 24 | "outputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "", 28 | "type": "address" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "account", 39 | "type": "address" 40 | } 41 | ], 42 | "name": "transferOwnership", 43 | "outputs": [], 44 | "stateMutability": "nonpayable", 45 | "type": "function" 46 | } 47 | ] 48 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/interfaces/IERC173Internal.sol/IERC173Internal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/interfaces/IERC721Internal.sol/IERC721Internal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "operator", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "uint256", 20 | "name": "tokenId", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "operator", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "bool", 45 | "name": "approved", 46 | "type": "bool" 47 | } 48 | ], 49 | "name": "ApprovalForAll", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "from", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "to", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "uint256", 70 | "name": "tokenId", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "Transfer", 75 | "type": "event" 76 | } 77 | ] 78 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/interfaces/IERC721Receiver.sol/IERC721Receiver.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "operator", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "from", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "tokenId", 17 | "type": "uint256" 18 | }, 19 | { 20 | "internalType": "bytes", 21 | "name": "data", 22 | "type": "bytes" 23 | } 24 | ], 25 | "name": "onERC721Received", 26 | "outputs": [ 27 | { 28 | "internalType": "bytes4", 29 | "name": "", 30 | "type": "bytes4" 31 | } 32 | ], 33 | "stateMutability": "nonpayable", 34 | "type": "function" 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/introspection/ERC165.sol/ERC165.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes4", 6 | "name": "interfaceId", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "supportsInterface", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "", 15 | "type": "bool" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/IProxy.sol/IProxy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "stateMutability": "payable", 4 | "type": "fallback" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/Proxy.sol/Proxy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "stateMutability": "payable", 4 | "type": "fallback" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/base/DiamondBase.sol/DiamondBase.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "stateMutability": "payable", 4 | "type": "fallback" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/base/DiamondBaseStorage.sol/DiamondBaseStorage.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "components": [ 7 | { 8 | "internalType": "address", 9 | "name": "target", 10 | "type": "address" 11 | }, 12 | { 13 | "internalType": "enum IDiamondWritable.FacetCutAction", 14 | "name": "action", 15 | "type": "uint8" 16 | }, 17 | { 18 | "internalType": "bytes4[]", 19 | "name": "selectors", 20 | "type": "bytes4[]" 21 | } 22 | ], 23 | "indexed": false, 24 | "internalType": "struct IDiamondWritable.FacetCut[]", 25 | "name": "facetCuts", 26 | "type": "tuple[]" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "address", 31 | "name": "target", 32 | "type": "address" 33 | }, 34 | { 35 | "indexed": false, 36 | "internalType": "bytes", 37 | "name": "data", 38 | "type": "bytes" 39 | } 40 | ], 41 | "name": "DiamondCut", 42 | "type": "event" 43 | } 44 | ] 45 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/base/IDiamondBase.sol/IDiamondBase.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "stateMutability": "payable", 4 | "type": "fallback" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/readable/DiamondReadable.sol/DiamondReadable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes4", 6 | "name": "selector", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "facetAddress", 11 | "outputs": [ 12 | { 13 | "internalType": "address", 14 | "name": "facet", 15 | "type": "address" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "facetAddresses", 24 | "outputs": [ 25 | { 26 | "internalType": "address[]", 27 | "name": "addresses", 28 | "type": "address[]" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "facet", 39 | "type": "address" 40 | } 41 | ], 42 | "name": "facetFunctionSelectors", 43 | "outputs": [ 44 | { 45 | "internalType": "bytes4[]", 46 | "name": "selectors", 47 | "type": "bytes4[]" 48 | } 49 | ], 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "facets", 56 | "outputs": [ 57 | { 58 | "components": [ 59 | { 60 | "internalType": "address", 61 | "name": "target", 62 | "type": "address" 63 | }, 64 | { 65 | "internalType": "bytes4[]", 66 | "name": "selectors", 67 | "type": "bytes4[]" 68 | } 69 | ], 70 | "internalType": "struct IDiamondReadable.Facet[]", 71 | "name": "diamondFacets", 72 | "type": "tuple[]" 73 | } 74 | ], 75 | "stateMutability": "view", 76 | "type": "function" 77 | } 78 | ] 79 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/readable/IDiamondReadable.sol/IDiamondReadable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes4", 6 | "name": "selector", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "facetAddress", 11 | "outputs": [ 12 | { 13 | "internalType": "address", 14 | "name": "facet", 15 | "type": "address" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "facetAddresses", 24 | "outputs": [ 25 | { 26 | "internalType": "address[]", 27 | "name": "addresses", 28 | "type": "address[]" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "facet", 39 | "type": "address" 40 | } 41 | ], 42 | "name": "facetFunctionSelectors", 43 | "outputs": [ 44 | { 45 | "internalType": "bytes4[]", 46 | "name": "selectors", 47 | "type": "bytes4[]" 48 | } 49 | ], 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "facets", 56 | "outputs": [ 57 | { 58 | "components": [ 59 | { 60 | "internalType": "address", 61 | "name": "target", 62 | "type": "address" 63 | }, 64 | { 65 | "internalType": "bytes4[]", 66 | "name": "selectors", 67 | "type": "bytes4[]" 68 | } 69 | ], 70 | "internalType": "struct IDiamondReadable.Facet[]", 71 | "name": "diamondFacets", 72 | "type": "tuple[]" 73 | } 74 | ], 75 | "stateMutability": "view", 76 | "type": "function" 77 | } 78 | ] 79 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/writable/DiamondWritable.sol/DiamondWritable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "components": [ 7 | { 8 | "internalType": "address", 9 | "name": "target", 10 | "type": "address" 11 | }, 12 | { 13 | "internalType": "enum IDiamondWritable.FacetCutAction", 14 | "name": "action", 15 | "type": "uint8" 16 | }, 17 | { 18 | "internalType": "bytes4[]", 19 | "name": "selectors", 20 | "type": "bytes4[]" 21 | } 22 | ], 23 | "indexed": false, 24 | "internalType": "struct IDiamondWritable.FacetCut[]", 25 | "name": "facetCuts", 26 | "type": "tuple[]" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "address", 31 | "name": "target", 32 | "type": "address" 33 | }, 34 | { 35 | "indexed": false, 36 | "internalType": "bytes", 37 | "name": "data", 38 | "type": "bytes" 39 | } 40 | ], 41 | "name": "DiamondCut", 42 | "type": "event" 43 | }, 44 | { 45 | "anonymous": false, 46 | "inputs": [ 47 | { 48 | "indexed": true, 49 | "internalType": "address", 50 | "name": "previousOwner", 51 | "type": "address" 52 | }, 53 | { 54 | "indexed": true, 55 | "internalType": "address", 56 | "name": "newOwner", 57 | "type": "address" 58 | } 59 | ], 60 | "name": "OwnershipTransferred", 61 | "type": "event" 62 | }, 63 | { 64 | "inputs": [ 65 | { 66 | "components": [ 67 | { 68 | "internalType": "address", 69 | "name": "target", 70 | "type": "address" 71 | }, 72 | { 73 | "internalType": "enum IDiamondWritable.FacetCutAction", 74 | "name": "action", 75 | "type": "uint8" 76 | }, 77 | { 78 | "internalType": "bytes4[]", 79 | "name": "selectors", 80 | "type": "bytes4[]" 81 | } 82 | ], 83 | "internalType": "struct IDiamondWritable.FacetCut[]", 84 | "name": "facetCuts", 85 | "type": "tuple[]" 86 | }, 87 | { 88 | "internalType": "address", 89 | "name": "target", 90 | "type": "address" 91 | }, 92 | { 93 | "internalType": "bytes", 94 | "name": "data", 95 | "type": "bytes" 96 | } 97 | ], 98 | "name": "diamondCut", 99 | "outputs": [], 100 | "stateMutability": "nonpayable", 101 | "type": "function" 102 | } 103 | ] 104 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/proxy/diamond/writable/IDiamondWritable.sol/IDiamondWritable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "components": [ 7 | { 8 | "internalType": "address", 9 | "name": "target", 10 | "type": "address" 11 | }, 12 | { 13 | "internalType": "enum IDiamondWritable.FacetCutAction", 14 | "name": "action", 15 | "type": "uint8" 16 | }, 17 | { 18 | "internalType": "bytes4[]", 19 | "name": "selectors", 20 | "type": "bytes4[]" 21 | } 22 | ], 23 | "indexed": false, 24 | "internalType": "struct IDiamondWritable.FacetCut[]", 25 | "name": "facetCuts", 26 | "type": "tuple[]" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "address", 31 | "name": "target", 32 | "type": "address" 33 | }, 34 | { 35 | "indexed": false, 36 | "internalType": "bytes", 37 | "name": "data", 38 | "type": "bytes" 39 | } 40 | ], 41 | "name": "DiamondCut", 42 | "type": "event" 43 | }, 44 | { 45 | "inputs": [ 46 | { 47 | "components": [ 48 | { 49 | "internalType": "address", 50 | "name": "target", 51 | "type": "address" 52 | }, 53 | { 54 | "internalType": "enum IDiamondWritable.FacetCutAction", 55 | "name": "action", 56 | "type": "uint8" 57 | }, 58 | { 59 | "internalType": "bytes4[]", 60 | "name": "selectors", 61 | "type": "bytes4[]" 62 | } 63 | ], 64 | "internalType": "struct IDiamondWritable.FacetCut[]", 65 | "name": "facetCuts", 66 | "type": "tuple[]" 67 | }, 68 | { 69 | "internalType": "address", 70 | "name": "target", 71 | "type": "address" 72 | }, 73 | { 74 | "internalType": "bytes", 75 | "name": "data", 76 | "type": "bytes" 77 | } 78 | ], 79 | "name": "diamondCut", 80 | "outputs": [], 81 | "stateMutability": "nonpayable", 82 | "type": "function" 83 | } 84 | ] 85 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/token/ERC721/base/ERC721BaseInternal.sol/ERC721BaseInternal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "operator", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "uint256", 20 | "name": "tokenId", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "operator", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "bool", 45 | "name": "approved", 46 | "type": "bool" 47 | } 48 | ], 49 | "name": "ApprovalForAll", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "from", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "to", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "uint256", 70 | "name": "tokenId", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "Transfer", 75 | "type": "event" 76 | } 77 | ] 78 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/token/ERC721/metadata/ERC721Metadata.sol/ERC721Metadata.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "operator", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "uint256", 20 | "name": "tokenId", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "operator", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "bool", 45 | "name": "approved", 46 | "type": "bool" 47 | } 48 | ], 49 | "name": "ApprovalForAll", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "from", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "to", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "uint256", 70 | "name": "tokenId", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "Transfer", 75 | "type": "event" 76 | }, 77 | { 78 | "inputs": [], 79 | "name": "name", 80 | "outputs": [ 81 | { 82 | "internalType": "string", 83 | "name": "", 84 | "type": "string" 85 | } 86 | ], 87 | "stateMutability": "view", 88 | "type": "function" 89 | }, 90 | { 91 | "inputs": [], 92 | "name": "symbol", 93 | "outputs": [ 94 | { 95 | "internalType": "string", 96 | "name": "", 97 | "type": "string" 98 | } 99 | ], 100 | "stateMutability": "view", 101 | "type": "function" 102 | }, 103 | { 104 | "inputs": [ 105 | { 106 | "internalType": "uint256", 107 | "name": "tokenId", 108 | "type": "uint256" 109 | } 110 | ], 111 | "name": "tokenURI", 112 | "outputs": [ 113 | { 114 | "internalType": "string", 115 | "name": "", 116 | "type": "string" 117 | } 118 | ], 119 | "stateMutability": "view", 120 | "type": "function" 121 | } 122 | ] 123 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/token/ERC721/metadata/ERC721MetadataInternal.sol/ERC721MetadataInternal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "operator", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "uint256", 20 | "name": "tokenId", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "operator", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "bool", 45 | "name": "approved", 46 | "type": "bool" 47 | } 48 | ], 49 | "name": "ApprovalForAll", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "from", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "to", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "uint256", 70 | "name": "tokenId", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "Transfer", 75 | "type": "event" 76 | } 77 | ] 78 | -------------------------------------------------------------------------------- /abi/@solidstate/contracts/token/ERC721/metadata/IERC721Metadata.sol/IERC721Metadata.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "operator", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "uint256", 20 | "name": "tokenId", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "operator", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "bool", 45 | "name": "approved", 46 | "type": "bool" 47 | } 48 | ], 49 | "name": "ApprovalForAll", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "from", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "to", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "uint256", 70 | "name": "tokenId", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "Transfer", 75 | "type": "event" 76 | }, 77 | { 78 | "inputs": [], 79 | "name": "name", 80 | "outputs": [ 81 | { 82 | "internalType": "string", 83 | "name": "", 84 | "type": "string" 85 | } 86 | ], 87 | "stateMutability": "view", 88 | "type": "function" 89 | }, 90 | { 91 | "inputs": [], 92 | "name": "symbol", 93 | "outputs": [ 94 | { 95 | "internalType": "string", 96 | "name": "", 97 | "type": "string" 98 | } 99 | ], 100 | "stateMutability": "view", 101 | "type": "function" 102 | }, 103 | { 104 | "inputs": [ 105 | { 106 | "internalType": "uint256", 107 | "name": "tokenId", 108 | "type": "uint256" 109 | } 110 | ], 111 | "name": "tokenURI", 112 | "outputs": [ 113 | { 114 | "internalType": "string", 115 | "name": "", 116 | "type": "string" 117 | } 118 | ], 119 | "stateMutability": "view", 120 | "type": "function" 121 | } 122 | ] 123 | -------------------------------------------------------------------------------- /abi/@superfluid-finance/ethereum-contracts/contracts/apps/SuperAppBase.sol/SuperAppBase.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract ISuperToken", 6 | "name": "", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "bytes32", 16 | "name": "", 17 | "type": "bytes32" 18 | }, 19 | { 20 | "internalType": "bytes", 21 | "name": "", 22 | "type": "bytes" 23 | }, 24 | { 25 | "internalType": "bytes", 26 | "name": "", 27 | "type": "bytes" 28 | }, 29 | { 30 | "internalType": "bytes", 31 | "name": "", 32 | "type": "bytes" 33 | } 34 | ], 35 | "name": "afterAgreementCreated", 36 | "outputs": [ 37 | { 38 | "internalType": "bytes", 39 | "name": "", 40 | "type": "bytes" 41 | } 42 | ], 43 | "stateMutability": "nonpayable", 44 | "type": "function" 45 | }, 46 | { 47 | "inputs": [ 48 | { 49 | "internalType": "contract ISuperToken", 50 | "name": "", 51 | "type": "address" 52 | }, 53 | { 54 | "internalType": "address", 55 | "name": "", 56 | "type": "address" 57 | }, 58 | { 59 | "internalType": "bytes32", 60 | "name": "", 61 | "type": "bytes32" 62 | }, 63 | { 64 | "internalType": "bytes", 65 | "name": "", 66 | "type": "bytes" 67 | }, 68 | { 69 | "internalType": "bytes", 70 | "name": "", 71 | "type": "bytes" 72 | }, 73 | { 74 | "internalType": "bytes", 75 | "name": "", 76 | "type": "bytes" 77 | } 78 | ], 79 | "name": "afterAgreementTerminated", 80 | "outputs": [ 81 | { 82 | "internalType": "bytes", 83 | "name": "", 84 | "type": "bytes" 85 | } 86 | ], 87 | "stateMutability": "nonpayable", 88 | "type": "function" 89 | }, 90 | { 91 | "inputs": [ 92 | { 93 | "internalType": "contract ISuperToken", 94 | "name": "", 95 | "type": "address" 96 | }, 97 | { 98 | "internalType": "address", 99 | "name": "", 100 | "type": "address" 101 | }, 102 | { 103 | "internalType": "bytes32", 104 | "name": "", 105 | "type": "bytes32" 106 | }, 107 | { 108 | "internalType": "bytes", 109 | "name": "", 110 | "type": "bytes" 111 | }, 112 | { 113 | "internalType": "bytes", 114 | "name": "", 115 | "type": "bytes" 116 | }, 117 | { 118 | "internalType": "bytes", 119 | "name": "", 120 | "type": "bytes" 121 | } 122 | ], 123 | "name": "afterAgreementUpdated", 124 | "outputs": [ 125 | { 126 | "internalType": "bytes", 127 | "name": "", 128 | "type": "bytes" 129 | } 130 | ], 131 | "stateMutability": "nonpayable", 132 | "type": "function" 133 | }, 134 | { 135 | "inputs": [ 136 | { 137 | "internalType": "contract ISuperToken", 138 | "name": "", 139 | "type": "address" 140 | }, 141 | { 142 | "internalType": "address", 143 | "name": "", 144 | "type": "address" 145 | }, 146 | { 147 | "internalType": "bytes32", 148 | "name": "", 149 | "type": "bytes32" 150 | }, 151 | { 152 | "internalType": "bytes", 153 | "name": "", 154 | "type": "bytes" 155 | }, 156 | { 157 | "internalType": "bytes", 158 | "name": "", 159 | "type": "bytes" 160 | } 161 | ], 162 | "name": "beforeAgreementCreated", 163 | "outputs": [ 164 | { 165 | "internalType": "bytes", 166 | "name": "", 167 | "type": "bytes" 168 | } 169 | ], 170 | "stateMutability": "view", 171 | "type": "function" 172 | }, 173 | { 174 | "inputs": [ 175 | { 176 | "internalType": "contract ISuperToken", 177 | "name": "", 178 | "type": "address" 179 | }, 180 | { 181 | "internalType": "address", 182 | "name": "", 183 | "type": "address" 184 | }, 185 | { 186 | "internalType": "bytes32", 187 | "name": "", 188 | "type": "bytes32" 189 | }, 190 | { 191 | "internalType": "bytes", 192 | "name": "", 193 | "type": "bytes" 194 | }, 195 | { 196 | "internalType": "bytes", 197 | "name": "", 198 | "type": "bytes" 199 | } 200 | ], 201 | "name": "beforeAgreementTerminated", 202 | "outputs": [ 203 | { 204 | "internalType": "bytes", 205 | "name": "", 206 | "type": "bytes" 207 | } 208 | ], 209 | "stateMutability": "view", 210 | "type": "function" 211 | }, 212 | { 213 | "inputs": [ 214 | { 215 | "internalType": "contract ISuperToken", 216 | "name": "", 217 | "type": "address" 218 | }, 219 | { 220 | "internalType": "address", 221 | "name": "", 222 | "type": "address" 223 | }, 224 | { 225 | "internalType": "bytes32", 226 | "name": "", 227 | "type": "bytes32" 228 | }, 229 | { 230 | "internalType": "bytes", 231 | "name": "", 232 | "type": "bytes" 233 | }, 234 | { 235 | "internalType": "bytes", 236 | "name": "", 237 | "type": "bytes" 238 | } 239 | ], 240 | "name": "beforeAgreementUpdated", 241 | "outputs": [ 242 | { 243 | "internalType": "bytes", 244 | "name": "", 245 | "type": "bytes" 246 | } 247 | ], 248 | "stateMutability": "view", 249 | "type": "function" 250 | } 251 | ] 252 | -------------------------------------------------------------------------------- /abi/@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol/ISuperAgreement.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "agreementType", 5 | "outputs": [ 6 | { 7 | "internalType": "bytes32", 8 | "name": "", 9 | "type": "bytes32" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [ 17 | { 18 | "internalType": "contract ISuperfluidToken", 19 | "name": "token", 20 | "type": "address" 21 | }, 22 | { 23 | "internalType": "address", 24 | "name": "account", 25 | "type": "address" 26 | }, 27 | { 28 | "internalType": "uint256", 29 | "name": "time", 30 | "type": "uint256" 31 | } 32 | ], 33 | "name": "realtimeBalanceOf", 34 | "outputs": [ 35 | { 36 | "internalType": "int256", 37 | "name": "dynamicBalance", 38 | "type": "int256" 39 | }, 40 | { 41 | "internalType": "uint256", 42 | "name": "deposit", 43 | "type": "uint256" 44 | }, 45 | { 46 | "internalType": "uint256", 47 | "name": "owedDeposit", 48 | "type": "uint256" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /abi/@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol/ISuperApp.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract ISuperToken", 6 | "name": "superToken", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "agreementClass", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "bytes32", 16 | "name": "agreementId", 17 | "type": "bytes32" 18 | }, 19 | { 20 | "internalType": "bytes", 21 | "name": "agreementData", 22 | "type": "bytes" 23 | }, 24 | { 25 | "internalType": "bytes", 26 | "name": "cbdata", 27 | "type": "bytes" 28 | }, 29 | { 30 | "internalType": "bytes", 31 | "name": "ctx", 32 | "type": "bytes" 33 | } 34 | ], 35 | "name": "afterAgreementCreated", 36 | "outputs": [ 37 | { 38 | "internalType": "bytes", 39 | "name": "newCtx", 40 | "type": "bytes" 41 | } 42 | ], 43 | "stateMutability": "nonpayable", 44 | "type": "function" 45 | }, 46 | { 47 | "inputs": [ 48 | { 49 | "internalType": "contract ISuperToken", 50 | "name": "superToken", 51 | "type": "address" 52 | }, 53 | { 54 | "internalType": "address", 55 | "name": "agreementClass", 56 | "type": "address" 57 | }, 58 | { 59 | "internalType": "bytes32", 60 | "name": "agreementId", 61 | "type": "bytes32" 62 | }, 63 | { 64 | "internalType": "bytes", 65 | "name": "agreementData", 66 | "type": "bytes" 67 | }, 68 | { 69 | "internalType": "bytes", 70 | "name": "cbdata", 71 | "type": "bytes" 72 | }, 73 | { 74 | "internalType": "bytes", 75 | "name": "ctx", 76 | "type": "bytes" 77 | } 78 | ], 79 | "name": "afterAgreementTerminated", 80 | "outputs": [ 81 | { 82 | "internalType": "bytes", 83 | "name": "newCtx", 84 | "type": "bytes" 85 | } 86 | ], 87 | "stateMutability": "nonpayable", 88 | "type": "function" 89 | }, 90 | { 91 | "inputs": [ 92 | { 93 | "internalType": "contract ISuperToken", 94 | "name": "superToken", 95 | "type": "address" 96 | }, 97 | { 98 | "internalType": "address", 99 | "name": "agreementClass", 100 | "type": "address" 101 | }, 102 | { 103 | "internalType": "bytes32", 104 | "name": "agreementId", 105 | "type": "bytes32" 106 | }, 107 | { 108 | "internalType": "bytes", 109 | "name": "agreementData", 110 | "type": "bytes" 111 | }, 112 | { 113 | "internalType": "bytes", 114 | "name": "cbdata", 115 | "type": "bytes" 116 | }, 117 | { 118 | "internalType": "bytes", 119 | "name": "ctx", 120 | "type": "bytes" 121 | } 122 | ], 123 | "name": "afterAgreementUpdated", 124 | "outputs": [ 125 | { 126 | "internalType": "bytes", 127 | "name": "newCtx", 128 | "type": "bytes" 129 | } 130 | ], 131 | "stateMutability": "nonpayable", 132 | "type": "function" 133 | }, 134 | { 135 | "inputs": [ 136 | { 137 | "internalType": "contract ISuperToken", 138 | "name": "superToken", 139 | "type": "address" 140 | }, 141 | { 142 | "internalType": "address", 143 | "name": "agreementClass", 144 | "type": "address" 145 | }, 146 | { 147 | "internalType": "bytes32", 148 | "name": "agreementId", 149 | "type": "bytes32" 150 | }, 151 | { 152 | "internalType": "bytes", 153 | "name": "agreementData", 154 | "type": "bytes" 155 | }, 156 | { 157 | "internalType": "bytes", 158 | "name": "ctx", 159 | "type": "bytes" 160 | } 161 | ], 162 | "name": "beforeAgreementCreated", 163 | "outputs": [ 164 | { 165 | "internalType": "bytes", 166 | "name": "cbdata", 167 | "type": "bytes" 168 | } 169 | ], 170 | "stateMutability": "view", 171 | "type": "function" 172 | }, 173 | { 174 | "inputs": [ 175 | { 176 | "internalType": "contract ISuperToken", 177 | "name": "superToken", 178 | "type": "address" 179 | }, 180 | { 181 | "internalType": "address", 182 | "name": "agreementClass", 183 | "type": "address" 184 | }, 185 | { 186 | "internalType": "bytes32", 187 | "name": "agreementId", 188 | "type": "bytes32" 189 | }, 190 | { 191 | "internalType": "bytes", 192 | "name": "agreementData", 193 | "type": "bytes" 194 | }, 195 | { 196 | "internalType": "bytes", 197 | "name": "ctx", 198 | "type": "bytes" 199 | } 200 | ], 201 | "name": "beforeAgreementTerminated", 202 | "outputs": [ 203 | { 204 | "internalType": "bytes", 205 | "name": "cbdata", 206 | "type": "bytes" 207 | } 208 | ], 209 | "stateMutability": "view", 210 | "type": "function" 211 | }, 212 | { 213 | "inputs": [ 214 | { 215 | "internalType": "contract ISuperToken", 216 | "name": "superToken", 217 | "type": "address" 218 | }, 219 | { 220 | "internalType": "address", 221 | "name": "agreementClass", 222 | "type": "address" 223 | }, 224 | { 225 | "internalType": "bytes32", 226 | "name": "agreementId", 227 | "type": "bytes32" 228 | }, 229 | { 230 | "internalType": "bytes", 231 | "name": "agreementData", 232 | "type": "bytes" 233 | }, 234 | { 235 | "internalType": "bytes", 236 | "name": "ctx", 237 | "type": "bytes" 238 | } 239 | ], 240 | "name": "beforeAgreementUpdated", 241 | "outputs": [ 242 | { 243 | "internalType": "bytes", 244 | "name": "cbdata", 245 | "type": "bytes" 246 | } 247 | ], 248 | "stateMutability": "view", 249 | "type": "function" 250 | } 251 | ] 252 | -------------------------------------------------------------------------------- /abi/@superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/ISETH.sol/ISETHCustom.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "wad", 7 | "type": "uint256" 8 | } 9 | ], 10 | "name": "downgradeToETH", 11 | "outputs": [], 12 | "stateMutability": "nonpayable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "upgradeByETH", 18 | "outputs": [], 19 | "stateMutability": "payable", 20 | "type": "function" 21 | }, 22 | { 23 | "inputs": [ 24 | { 25 | "internalType": "address", 26 | "name": "to", 27 | "type": "address" 28 | } 29 | ], 30 | "name": "upgradeByETHTo", 31 | "outputs": [], 32 | "stateMutability": "payable", 33 | "type": "function" 34 | } 35 | ] 36 | -------------------------------------------------------------------------------- /abi/contracts/beacon-diamond/BeaconDiamond.sol/BeaconDiamond.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_contractOwner", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract IDiamondReadable", 11 | "name": "_beacon", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "payable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "inputs": [], 20 | "name": "BeaconDiamond__NoFacetForSignature", 21 | "type": "error" 22 | }, 23 | { 24 | "anonymous": false, 25 | "inputs": [ 26 | { 27 | "indexed": true, 28 | "internalType": "address", 29 | "name": "previousOwner", 30 | "type": "address" 31 | }, 32 | { 33 | "indexed": true, 34 | "internalType": "address", 35 | "name": "newOwner", 36 | "type": "address" 37 | } 38 | ], 39 | "name": "OwnershipTransferred", 40 | "type": "event" 41 | }, 42 | { 43 | "stateMutability": "payable", 44 | "type": "fallback" 45 | }, 46 | { 47 | "inputs": [], 48 | "name": "acceptOwnership", 49 | "outputs": [], 50 | "stateMutability": "nonpayable", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "nomineeOwner", 56 | "outputs": [ 57 | { 58 | "internalType": "address", 59 | "name": "", 60 | "type": "address" 61 | } 62 | ], 63 | "stateMutability": "view", 64 | "type": "function" 65 | }, 66 | { 67 | "inputs": [], 68 | "name": "owner", 69 | "outputs": [ 70 | { 71 | "internalType": "address", 72 | "name": "", 73 | "type": "address" 74 | } 75 | ], 76 | "stateMutability": "view", 77 | "type": "function" 78 | }, 79 | { 80 | "inputs": [ 81 | { 82 | "internalType": "address", 83 | "name": "account", 84 | "type": "address" 85 | } 86 | ], 87 | "name": "transferOwnership", 88 | "outputs": [], 89 | "stateMutability": "nonpayable", 90 | "type": "function" 91 | } 92 | ] 93 | -------------------------------------------------------------------------------- /abi/contracts/beneficiary/interfaces/ICFABeneficiary.sol/ICFABeneficiary.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "sender", 7 | "type": "address" 8 | } 9 | ], 10 | "name": "getLastDeletion", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /abi/contracts/pco-license/facets/CFAReclaimerFacet.sol/CFAReclaimerFacet.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "to", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "price", 15 | "type": "uint256" 16 | } 17 | ], 18 | "name": "LicenseReclaimed", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "uint256", 25 | "name": "maxClaimPrice", 26 | "type": "uint256" 27 | }, 28 | { 29 | "internalType": "int96", 30 | "name": "newContributionRate", 31 | "type": "int96" 32 | }, 33 | { 34 | "internalType": "uint256", 35 | "name": "newForSalePrice", 36 | "type": "uint256" 37 | } 38 | ], 39 | "name": "reclaim", 40 | "outputs": [], 41 | "stateMutability": "nonpayable", 42 | "type": "function" 43 | }, 44 | { 45 | "inputs": [ 46 | { 47 | "internalType": "uint256", 48 | "name": "maxClaimPrice", 49 | "type": "uint256" 50 | }, 51 | { 52 | "internalType": "int96", 53 | "name": "newContributionRate", 54 | "type": "int96" 55 | }, 56 | { 57 | "internalType": "uint256", 58 | "name": "newForSalePrice", 59 | "type": "uint256" 60 | }, 61 | { 62 | "internalType": "bytes", 63 | "name": "contentHash", 64 | "type": "bytes" 65 | } 66 | ], 67 | "name": "reclaim", 68 | "outputs": [], 69 | "stateMutability": "nonpayable", 70 | "type": "function" 71 | }, 72 | { 73 | "inputs": [], 74 | "name": "reclaimPrice", 75 | "outputs": [ 76 | { 77 | "internalType": "uint256", 78 | "name": "", 79 | "type": "uint256" 80 | } 81 | ], 82 | "stateMutability": "view", 83 | "type": "function" 84 | } 85 | ] 86 | -------------------------------------------------------------------------------- /abi/contracts/pco-license/facets/test/CFABasePCOFacet.test.sol/TestableCFABasePCOFacet.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "to", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "int96", 11 | "name": "flowRate", 12 | "type": "int96" 13 | } 14 | ], 15 | "name": "manualCreateFlow", 16 | "outputs": [], 17 | "stateMutability": "nonpayable", 18 | "type": "function" 19 | }, 20 | { 21 | "inputs": [ 22 | { 23 | "internalType": "address", 24 | "name": "to", 25 | "type": "address" 26 | } 27 | ], 28 | "name": "manualDeleteFlow", 29 | "outputs": [], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "to", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "uint256", 42 | "name": "amount", 43 | "type": "uint256" 44 | } 45 | ], 46 | "name": "manualTransfer", 47 | "outputs": [], 48 | "stateMutability": "nonpayable", 49 | "type": "function" 50 | } 51 | ] 52 | -------------------------------------------------------------------------------- /abi/contracts/pco-license/interfaces/ICFAReclaimer.sol/ICFAReclaimer.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "to", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "price", 15 | "type": "uint256" 16 | } 17 | ], 18 | "name": "LicenseReclaimed", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "uint256", 25 | "name": "maxClaimPrice", 26 | "type": "uint256" 27 | }, 28 | { 29 | "internalType": "int96", 30 | "name": "newContributionRate", 31 | "type": "int96" 32 | }, 33 | { 34 | "internalType": "uint256", 35 | "name": "newForSalePrice", 36 | "type": "uint256" 37 | } 38 | ], 39 | "name": "reclaim", 40 | "outputs": [], 41 | "stateMutability": "nonpayable", 42 | "type": "function" 43 | }, 44 | { 45 | "inputs": [ 46 | { 47 | "internalType": "uint256", 48 | "name": "maxClaimPrice", 49 | "type": "uint256" 50 | }, 51 | { 52 | "internalType": "int96", 53 | "name": "newContributionRate", 54 | "type": "int96" 55 | }, 56 | { 57 | "internalType": "uint256", 58 | "name": "newForSalePrice", 59 | "type": "uint256" 60 | }, 61 | { 62 | "internalType": "bytes", 63 | "name": "contentHash", 64 | "type": "bytes" 65 | } 66 | ], 67 | "name": "reclaim", 68 | "outputs": [], 69 | "stateMutability": "nonpayable", 70 | "type": "function" 71 | }, 72 | { 73 | "inputs": [], 74 | "name": "reclaimPrice", 75 | "outputs": [ 76 | { 77 | "internalType": "uint256", 78 | "name": "", 79 | "type": "uint256" 80 | } 81 | ], 82 | "stateMutability": "view", 83 | "type": "function" 84 | } 85 | ] 86 | -------------------------------------------------------------------------------- /abi/contracts/pco-license/libraries/LibCFABasePCO.sol/LibCFABasePCO.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "_payer", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "bytes", 14 | "name": "contentHash", 15 | "type": "bytes" 16 | } 17 | ], 18 | "name": "PayerContentHashUpdated", 19 | "type": "event" 20 | }, 21 | { 22 | "anonymous": false, 23 | "inputs": [ 24 | { 25 | "indexed": true, 26 | "internalType": "address", 27 | "name": "_payer", 28 | "type": "address" 29 | }, 30 | { 31 | "indexed": false, 32 | "internalType": "int96", 33 | "name": "contributionRate", 34 | "type": "int96" 35 | } 36 | ], 37 | "name": "PayerContributionRateUpdated", 38 | "type": "event" 39 | }, 40 | { 41 | "anonymous": false, 42 | "inputs": [ 43 | { 44 | "indexed": true, 45 | "internalType": "address", 46 | "name": "_payer", 47 | "type": "address" 48 | }, 49 | { 50 | "indexed": false, 51 | "internalType": "uint256", 52 | "name": "forSalePrice", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "PayerForSalePriceUpdated", 57 | "type": "event" 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /abi/contracts/pco-license/libraries/LibCFAPenaltyBid.sol/LibCFAPenaltyBid.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "_bidder", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "int96", 14 | "name": "contributionRate", 15 | "type": "int96" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "forSalePrice", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "BidPlaced", 25 | "type": "event" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /abi/contracts/registry/facets/GeoWebParcelFacet.sol/GeoWebParcelFacetV1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "uint256", 30 | "name": "id", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "getLandParcel", 35 | "outputs": [ 36 | { 37 | "internalType": "uint64", 38 | "name": "baseCoordinate", 39 | "type": "uint64" 40 | }, 41 | { 42 | "internalType": "uint256[]", 43 | "name": "path", 44 | "type": "uint256[]" 45 | } 46 | ], 47 | "stateMutability": "view", 48 | "type": "function" 49 | } 50 | ] 51 | -------------------------------------------------------------------------------- /abi/contracts/registry/facets/GeoWebParcelFacet.sol/GeoWebParcelFacetV2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "uint256", 30 | "name": "id", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "getLandParcel", 35 | "outputs": [ 36 | { 37 | "internalType": "uint64", 38 | "name": "baseCoordinate", 39 | "type": "uint64" 40 | }, 41 | { 42 | "internalType": "uint256[]", 43 | "name": "path", 44 | "type": "uint256[]" 45 | } 46 | ], 47 | "stateMutability": "view", 48 | "type": "function" 49 | }, 50 | { 51 | "inputs": [ 52 | { 53 | "internalType": "uint256", 54 | "name": "id", 55 | "type": "uint256" 56 | } 57 | ], 58 | "name": "getLandParcelV2", 59 | "outputs": [ 60 | { 61 | "internalType": "uint64", 62 | "name": "swCoordinate", 63 | "type": "uint64" 64 | }, 65 | { 66 | "internalType": "uint256", 67 | "name": "latDim", 68 | "type": "uint256" 69 | }, 70 | { 71 | "internalType": "uint256", 72 | "name": "lngDim", 73 | "type": "uint256" 74 | } 75 | ], 76 | "stateMutability": "view", 77 | "type": "function" 78 | } 79 | ] 80 | -------------------------------------------------------------------------------- /abi/contracts/registry/facets/test/GeoWebParcelFacet.test.sol/FuzzyGeoWebParcelFacetV1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "inputs": [ 9 | { 10 | "internalType": "uint256", 11 | "name": "x", 12 | "type": "uint256" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "y", 17 | "type": "uint256" 18 | } 19 | ], 20 | "name": "availabilityIndex", 21 | "outputs": [ 22 | { 23 | "internalType": "uint256", 24 | "name": "", 25 | "type": "uint256" 26 | } 27 | ], 28 | "stateMutability": "view", 29 | "type": "function" 30 | }, 31 | { 32 | "inputs": [ 33 | { 34 | "internalType": "uint64", 35 | "name": "baseCoordinate", 36 | "type": "uint64" 37 | }, 38 | { 39 | "internalType": "uint256[]", 40 | "name": "path", 41 | "type": "uint256[]" 42 | } 43 | ], 44 | "name": "build", 45 | "outputs": [], 46 | "stateMutability": "nonpayable", 47 | "type": "function" 48 | }, 49 | { 50 | "inputs": [], 51 | "name": "echidna_coordinate_never_changes_parcel", 52 | "outputs": [ 53 | { 54 | "internalType": "bool", 55 | "name": "", 56 | "type": "bool" 57 | } 58 | ], 59 | "stateMutability": "view", 60 | "type": "function" 61 | }, 62 | { 63 | "inputs": [], 64 | "name": "echidna_coordinate_never_is_available", 65 | "outputs": [ 66 | { 67 | "internalType": "bool", 68 | "name": "", 69 | "type": "bool" 70 | } 71 | ], 72 | "stateMutability": "view", 73 | "type": "function" 74 | }, 75 | { 76 | "inputs": [], 77 | "name": "echidna_next_id_never_repeats", 78 | "outputs": [ 79 | { 80 | "internalType": "bool", 81 | "name": "", 82 | "type": "bool" 83 | } 84 | ], 85 | "stateMutability": "view", 86 | "type": "function" 87 | }, 88 | { 89 | "inputs": [ 90 | { 91 | "internalType": "uint256", 92 | "name": "id", 93 | "type": "uint256" 94 | } 95 | ], 96 | "name": "getLandParcel", 97 | "outputs": [ 98 | { 99 | "internalType": "uint64", 100 | "name": "baseCoordinate", 101 | "type": "uint64" 102 | }, 103 | { 104 | "internalType": "uint256[]", 105 | "name": "path", 106 | "type": "uint256[]" 107 | } 108 | ], 109 | "stateMutability": "view", 110 | "type": "function" 111 | } 112 | ] 113 | -------------------------------------------------------------------------------- /abi/contracts/registry/facets/test/GeoWebParcelFacet.test.sol/FuzzyGeoWebParcelFacetV2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "inputs": [ 9 | { 10 | "internalType": "uint256", 11 | "name": "x", 12 | "type": "uint256" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "y", 17 | "type": "uint256" 18 | } 19 | ], 20 | "name": "availabilityIndex", 21 | "outputs": [ 22 | { 23 | "internalType": "uint256", 24 | "name": "", 25 | "type": "uint256" 26 | } 27 | ], 28 | "stateMutability": "view", 29 | "type": "function" 30 | }, 31 | { 32 | "inputs": [ 33 | { 34 | "components": [ 35 | { 36 | "internalType": "uint64", 37 | "name": "swCoordinate", 38 | "type": "uint64" 39 | }, 40 | { 41 | "internalType": "uint256", 42 | "name": "lngDim", 43 | "type": "uint256" 44 | }, 45 | { 46 | "internalType": "uint256", 47 | "name": "latDim", 48 | "type": "uint256" 49 | } 50 | ], 51 | "internalType": "struct LibGeoWebParcelV2.LandParcel", 52 | "name": "parcel", 53 | "type": "tuple" 54 | } 55 | ], 56 | "name": "build", 57 | "outputs": [], 58 | "stateMutability": "nonpayable", 59 | "type": "function" 60 | }, 61 | { 62 | "inputs": [], 63 | "name": "echidna_coordinate_never_changes_parcel", 64 | "outputs": [ 65 | { 66 | "internalType": "bool", 67 | "name": "", 68 | "type": "bool" 69 | } 70 | ], 71 | "stateMutability": "view", 72 | "type": "function" 73 | }, 74 | { 75 | "inputs": [], 76 | "name": "echidna_coordinate_never_is_available", 77 | "outputs": [ 78 | { 79 | "internalType": "bool", 80 | "name": "", 81 | "type": "bool" 82 | } 83 | ], 84 | "stateMutability": "view", 85 | "type": "function" 86 | }, 87 | { 88 | "inputs": [], 89 | "name": "echidna_next_id_never_repeats", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "view", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "uint256", 104 | "name": "id", 105 | "type": "uint256" 106 | } 107 | ], 108 | "name": "getLandParcel", 109 | "outputs": [ 110 | { 111 | "internalType": "uint64", 112 | "name": "baseCoordinate", 113 | "type": "uint64" 114 | }, 115 | { 116 | "internalType": "uint256[]", 117 | "name": "path", 118 | "type": "uint256[]" 119 | } 120 | ], 121 | "stateMutability": "view", 122 | "type": "function" 123 | }, 124 | { 125 | "inputs": [ 126 | { 127 | "internalType": "uint256", 128 | "name": "id", 129 | "type": "uint256" 130 | } 131 | ], 132 | "name": "getLandParcelV2", 133 | "outputs": [ 134 | { 135 | "internalType": "uint64", 136 | "name": "swCoordinate", 137 | "type": "uint64" 138 | }, 139 | { 140 | "internalType": "uint256", 141 | "name": "latDim", 142 | "type": "uint256" 143 | }, 144 | { 145 | "internalType": "uint256", 146 | "name": "lngDim", 147 | "type": "uint256" 148 | } 149 | ], 150 | "stateMutability": "view", 151 | "type": "function" 152 | } 153 | ] 154 | -------------------------------------------------------------------------------- /abi/contracts/registry/facets/test/GeoWebParcelFacet.test.sol/TestableGeoWebParcelFacetV1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "uint64", 30 | "name": "baseCoordinate", 31 | "type": "uint64" 32 | }, 33 | { 34 | "internalType": "uint256[]", 35 | "name": "path", 36 | "type": "uint256[]" 37 | } 38 | ], 39 | "name": "build", 40 | "outputs": [], 41 | "stateMutability": "nonpayable", 42 | "type": "function" 43 | }, 44 | { 45 | "inputs": [ 46 | { 47 | "internalType": "uint64", 48 | "name": "id", 49 | "type": "uint64" 50 | } 51 | ], 52 | "name": "destroy", 53 | "outputs": [], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [ 59 | { 60 | "internalType": "uint256", 61 | "name": "id", 62 | "type": "uint256" 63 | } 64 | ], 65 | "name": "getLandParcel", 66 | "outputs": [ 67 | { 68 | "internalType": "uint64", 69 | "name": "baseCoordinate", 70 | "type": "uint64" 71 | }, 72 | { 73 | "internalType": "uint256[]", 74 | "name": "path", 75 | "type": "uint256[]" 76 | } 77 | ], 78 | "stateMutability": "view", 79 | "type": "function" 80 | } 81 | ] 82 | -------------------------------------------------------------------------------- /abi/contracts/registry/facets/test/GeoWebParcelFacet.test.sol/TestableGeoWebParcelFacetV2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "components": [ 30 | { 31 | "internalType": "uint64", 32 | "name": "swCoordinate", 33 | "type": "uint64" 34 | }, 35 | { 36 | "internalType": "uint256", 37 | "name": "lngDim", 38 | "type": "uint256" 39 | }, 40 | { 41 | "internalType": "uint256", 42 | "name": "latDim", 43 | "type": "uint256" 44 | } 45 | ], 46 | "internalType": "struct LibGeoWebParcelV2.LandParcel", 47 | "name": "parcel", 48 | "type": "tuple" 49 | } 50 | ], 51 | "name": "build", 52 | "outputs": [], 53 | "stateMutability": "nonpayable", 54 | "type": "function" 55 | }, 56 | { 57 | "inputs": [ 58 | { 59 | "internalType": "uint256", 60 | "name": "id", 61 | "type": "uint256" 62 | } 63 | ], 64 | "name": "getLandParcel", 65 | "outputs": [ 66 | { 67 | "internalType": "uint64", 68 | "name": "baseCoordinate", 69 | "type": "uint64" 70 | }, 71 | { 72 | "internalType": "uint256[]", 73 | "name": "path", 74 | "type": "uint256[]" 75 | } 76 | ], 77 | "stateMutability": "view", 78 | "type": "function" 79 | }, 80 | { 81 | "inputs": [ 82 | { 83 | "internalType": "uint256", 84 | "name": "id", 85 | "type": "uint256" 86 | } 87 | ], 88 | "name": "getLandParcelV2", 89 | "outputs": [ 90 | { 91 | "internalType": "uint64", 92 | "name": "swCoordinate", 93 | "type": "uint64" 94 | }, 95 | { 96 | "internalType": "uint256", 97 | "name": "latDim", 98 | "type": "uint256" 99 | }, 100 | { 101 | "internalType": "uint256", 102 | "name": "lngDim", 103 | "type": "uint256" 104 | } 105 | ], 106 | "stateMutability": "view", 107 | "type": "function" 108 | } 109 | ] 110 | -------------------------------------------------------------------------------- /abi/contracts/registry/interfaces/IGeoWebParcel.sol/IGeoWebParcel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "uint256", 30 | "name": "id", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "getLandParcel", 35 | "outputs": [ 36 | { 37 | "internalType": "uint64", 38 | "name": "baseCoordinate", 39 | "type": "uint64" 40 | }, 41 | { 42 | "internalType": "uint256[]", 43 | "name": "path", 44 | "type": "uint256[]" 45 | } 46 | ], 47 | "stateMutability": "view", 48 | "type": "function" 49 | }, 50 | { 51 | "inputs": [ 52 | { 53 | "internalType": "uint256", 54 | "name": "id", 55 | "type": "uint256" 56 | } 57 | ], 58 | "name": "getLandParcelV2", 59 | "outputs": [ 60 | { 61 | "internalType": "uint64", 62 | "name": "swCoordinate", 63 | "type": "uint64" 64 | }, 65 | { 66 | "internalType": "uint256", 67 | "name": "latDim", 68 | "type": "uint256" 69 | }, 70 | { 71 | "internalType": "uint256", 72 | "name": "lngDim", 73 | "type": "uint256" 74 | } 75 | ], 76 | "stateMutability": "view", 77 | "type": "function" 78 | } 79 | ] 80 | -------------------------------------------------------------------------------- /abi/contracts/registry/interfaces/IGeoWebParcel.sol/IGeoWebParcelV1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "uint256", 30 | "name": "id", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "getLandParcel", 35 | "outputs": [ 36 | { 37 | "internalType": "uint64", 38 | "name": "baseCoordinate", 39 | "type": "uint64" 40 | }, 41 | { 42 | "internalType": "uint256[]", 43 | "name": "path", 44 | "type": "uint256[]" 45 | } 46 | ], 47 | "stateMutability": "view", 48 | "type": "function" 49 | } 50 | ] 51 | -------------------------------------------------------------------------------- /abi/contracts/registry/interfaces/IGeoWebParcel.sol/IGeoWebParcelV2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "x", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "y", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "availabilityIndex", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "uint256", 30 | "name": "id", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "getLandParcel", 35 | "outputs": [ 36 | { 37 | "internalType": "uint64", 38 | "name": "baseCoordinate", 39 | "type": "uint64" 40 | }, 41 | { 42 | "internalType": "uint256[]", 43 | "name": "path", 44 | "type": "uint256[]" 45 | } 46 | ], 47 | "stateMutability": "view", 48 | "type": "function" 49 | }, 50 | { 51 | "inputs": [ 52 | { 53 | "internalType": "uint256", 54 | "name": "id", 55 | "type": "uint256" 56 | } 57 | ], 58 | "name": "getLandParcelV2", 59 | "outputs": [ 60 | { 61 | "internalType": "uint64", 62 | "name": "swCoordinate", 63 | "type": "uint64" 64 | }, 65 | { 66 | "internalType": "uint256", 67 | "name": "latDim", 68 | "type": "uint256" 69 | }, 70 | { 71 | "internalType": "uint256", 72 | "name": "lngDim", 73 | "type": "uint256" 74 | } 75 | ], 76 | "stateMutability": "view", 77 | "type": "function" 78 | } 79 | ] 80 | -------------------------------------------------------------------------------- /abi/contracts/registry/interfaces/IPCOLicenseClaimer.sol/IPCOLicenseClaimerV1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "uint256", 8 | "name": "_licenseId", 9 | "type": "uint256" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "_payer", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "ParcelClaimed", 19 | "type": "event" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "int96", 25 | "name": "initialContributionRate", 26 | "type": "int96" 27 | }, 28 | { 29 | "internalType": "uint256", 30 | "name": "initialForSalePrice", 31 | "type": "uint256" 32 | }, 33 | { 34 | "internalType": "uint64", 35 | "name": "baseCoordinate", 36 | "type": "uint64" 37 | }, 38 | { 39 | "internalType": "uint256[]", 40 | "name": "path", 41 | "type": "uint256[]" 42 | } 43 | ], 44 | "name": "claim", 45 | "outputs": [], 46 | "stateMutability": "nonpayable", 47 | "type": "function" 48 | }, 49 | { 50 | "inputs": [], 51 | "name": "getAuctionEnd", 52 | "outputs": [ 53 | { 54 | "internalType": "uint256", 55 | "name": "", 56 | "type": "uint256" 57 | } 58 | ], 59 | "stateMutability": "view", 60 | "type": "function" 61 | }, 62 | { 63 | "inputs": [], 64 | "name": "getAuctionStart", 65 | "outputs": [ 66 | { 67 | "internalType": "uint256", 68 | "name": "", 69 | "type": "uint256" 70 | } 71 | ], 72 | "stateMutability": "view", 73 | "type": "function" 74 | }, 75 | { 76 | "inputs": [], 77 | "name": "getBeacon", 78 | "outputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "", 82 | "type": "address" 83 | } 84 | ], 85 | "stateMutability": "view", 86 | "type": "function" 87 | }, 88 | { 89 | "inputs": [ 90 | { 91 | "internalType": "uint256", 92 | "name": "licenseId", 93 | "type": "uint256" 94 | } 95 | ], 96 | "name": "getBeaconProxy", 97 | "outputs": [ 98 | { 99 | "internalType": "address", 100 | "name": "", 101 | "type": "address" 102 | } 103 | ], 104 | "stateMutability": "view", 105 | "type": "function" 106 | }, 107 | { 108 | "inputs": [], 109 | "name": "getEndingBid", 110 | "outputs": [ 111 | { 112 | "internalType": "uint256", 113 | "name": "", 114 | "type": "uint256" 115 | } 116 | ], 117 | "stateMutability": "view", 118 | "type": "function" 119 | }, 120 | { 121 | "inputs": [ 122 | { 123 | "internalType": "address", 124 | "name": "user", 125 | "type": "address" 126 | } 127 | ], 128 | "name": "getNextProxyAddress", 129 | "outputs": [ 130 | { 131 | "internalType": "address", 132 | "name": "", 133 | "type": "address" 134 | } 135 | ], 136 | "stateMutability": "view", 137 | "type": "function" 138 | }, 139 | { 140 | "inputs": [], 141 | "name": "getStartingBid", 142 | "outputs": [ 143 | { 144 | "internalType": "uint256", 145 | "name": "", 146 | "type": "uint256" 147 | } 148 | ], 149 | "stateMutability": "view", 150 | "type": "function" 151 | }, 152 | { 153 | "inputs": [ 154 | { 155 | "internalType": "uint256", 156 | "name": "auctionStart", 157 | "type": "uint256" 158 | }, 159 | { 160 | "internalType": "uint256", 161 | "name": "auctionEnd", 162 | "type": "uint256" 163 | }, 164 | { 165 | "internalType": "uint256", 166 | "name": "startingBid", 167 | "type": "uint256" 168 | }, 169 | { 170 | "internalType": "uint256", 171 | "name": "endingBid", 172 | "type": "uint256" 173 | }, 174 | { 175 | "internalType": "address", 176 | "name": "beacon", 177 | "type": "address" 178 | } 179 | ], 180 | "name": "initializeClaimer", 181 | "outputs": [], 182 | "stateMutability": "nonpayable", 183 | "type": "function" 184 | }, 185 | { 186 | "inputs": [], 187 | "name": "requiredBid", 188 | "outputs": [ 189 | { 190 | "internalType": "uint256", 191 | "name": "", 192 | "type": "uint256" 193 | } 194 | ], 195 | "stateMutability": "view", 196 | "type": "function" 197 | }, 198 | { 199 | "inputs": [ 200 | { 201 | "internalType": "uint256", 202 | "name": "auctionEnd", 203 | "type": "uint256" 204 | } 205 | ], 206 | "name": "setAuctionEnd", 207 | "outputs": [], 208 | "stateMutability": "nonpayable", 209 | "type": "function" 210 | }, 211 | { 212 | "inputs": [ 213 | { 214 | "internalType": "uint256", 215 | "name": "auctionStart", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "setAuctionStart", 220 | "outputs": [], 221 | "stateMutability": "nonpayable", 222 | "type": "function" 223 | }, 224 | { 225 | "inputs": [ 226 | { 227 | "internalType": "address", 228 | "name": "beacon", 229 | "type": "address" 230 | } 231 | ], 232 | "name": "setBeacon", 233 | "outputs": [], 234 | "stateMutability": "nonpayable", 235 | "type": "function" 236 | }, 237 | { 238 | "inputs": [ 239 | { 240 | "internalType": "uint256", 241 | "name": "endingBid", 242 | "type": "uint256" 243 | } 244 | ], 245 | "name": "setEndingBid", 246 | "outputs": [], 247 | "stateMutability": "nonpayable", 248 | "type": "function" 249 | }, 250 | { 251 | "inputs": [ 252 | { 253 | "internalType": "uint256", 254 | "name": "startingBid", 255 | "type": "uint256" 256 | } 257 | ], 258 | "name": "setStartingBid", 259 | "outputs": [], 260 | "stateMutability": "nonpayable", 261 | "type": "function" 262 | } 263 | ] 264 | -------------------------------------------------------------------------------- /abi/contracts/registry/libraries/LibGeoWebCoordinate.sol/LibGeoWebCoordinate.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "MAX_X", 5 | "outputs": [ 6 | { 7 | "internalType": "uint64", 8 | "name": "", 9 | "type": "uint64" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "MAX_Y", 18 | "outputs": [ 19 | { 20 | "internalType": "uint64", 21 | "name": "", 22 | "type": "uint64" 23 | } 24 | ], 25 | "stateMutability": "view", 26 | "type": "function" 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /abi/contracts/registry/libraries/LibGeoWebParcel.sol/LibGeoWebParcel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "uint256", 8 | "name": "_id", 9 | "type": "uint256" 10 | } 11 | ], 12 | "name": "ParcelBuilt", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": true, 20 | "internalType": "uint256", 21 | "name": "_id", 22 | "type": "uint256" 23 | } 24 | ], 25 | "name": "ParcelDestroyed", 26 | "type": "event" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "uint256", 34 | "name": "_id", 35 | "type": "uint256" 36 | } 37 | ], 38 | "name": "ParcelModified", 39 | "type": "event" 40 | } 41 | ] 42 | -------------------------------------------------------------------------------- /abi/contracts/registry/libraries/test/LibGeoWebCoordinate.test.sol/LibGeoWebCoordinatePathTest.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "path", 7 | "type": "uint256" 8 | } 9 | ], 10 | "name": "nextDirection", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "hasNext", 15 | "type": "bool" 16 | }, 17 | { 18 | "internalType": "uint256", 19 | "name": "direction", 20 | "type": "uint256" 21 | }, 22 | { 23 | "internalType": "uint256", 24 | "name": "nextPath", 25 | "type": "uint256" 26 | } 27 | ], 28 | "stateMutability": "pure", 29 | "type": "function" 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /abi/contracts/registry/libraries/test/LibGeoWebCoordinate.test.sol/LibGeoWebCoordinateTest.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "MAX_X", 5 | "outputs": [ 6 | { 7 | "internalType": "uint64", 8 | "name": "", 9 | "type": "uint64" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "MAX_Y", 18 | "outputs": [ 19 | { 20 | "internalType": "uint64", 21 | "name": "", 22 | "type": "uint64" 23 | } 24 | ], 25 | "stateMutability": "view", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "uint64", 32 | "name": "coord", 33 | "type": "uint64" 34 | } 35 | ], 36 | "name": "toWordIndex", 37 | "outputs": [ 38 | { 39 | "internalType": "uint256", 40 | "name": "iX", 41 | "type": "uint256" 42 | }, 43 | { 44 | "internalType": "uint256", 45 | "name": "iY", 46 | "type": "uint256" 47 | }, 48 | { 49 | "internalType": "uint256", 50 | "name": "i", 51 | "type": "uint256" 52 | } 53 | ], 54 | "stateMutability": "pure", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [ 59 | { 60 | "internalType": "uint64", 61 | "name": "origin", 62 | "type": "uint64" 63 | }, 64 | { 65 | "internalType": "uint256", 66 | "name": "direction", 67 | "type": "uint256" 68 | }, 69 | { 70 | "internalType": "uint256", 71 | "name": "iX", 72 | "type": "uint256" 73 | }, 74 | { 75 | "internalType": "uint256", 76 | "name": "iY", 77 | "type": "uint256" 78 | }, 79 | { 80 | "internalType": "uint256", 81 | "name": "i", 82 | "type": "uint256" 83 | } 84 | ], 85 | "name": "traverse", 86 | "outputs": [ 87 | { 88 | "internalType": "uint64", 89 | "name": "", 90 | "type": "uint64" 91 | }, 92 | { 93 | "internalType": "uint256", 94 | "name": "", 95 | "type": "uint256" 96 | }, 97 | { 98 | "internalType": "uint256", 99 | "name": "", 100 | "type": "uint256" 101 | }, 102 | { 103 | "internalType": "uint256", 104 | "name": "", 105 | "type": "uint256" 106 | } 107 | ], 108 | "stateMutability": "pure", 109 | "type": "function" 110 | } 111 | ] 112 | -------------------------------------------------------------------------------- /contracts/beacon-diamond/BeaconDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | /******************************************************************************\ 5 | * EIP-2535 Diamonds implementation that uses an external IDiamondLoupe to store facet addresses. 6 | * Can be used to store a single set of facet addresses for many diamonds 7 | /******************************************************************************/ 8 | 9 | import {LibBeaconDiamond} from "./libraries/LibBeaconDiamond.sol"; 10 | import {OwnableStorage} from "@solidstate/contracts/access/ownable/OwnableStorage.sol"; 11 | import {IDiamondReadable} from "@solidstate/contracts/proxy/diamond/readable/IDiamondReadable.sol"; 12 | import {Proxy} from "@solidstate/contracts/proxy/Proxy.sol"; 13 | import {SafeOwnable} from "@solidstate/contracts/access/ownable/SafeOwnable.sol"; 14 | 15 | contract BeaconDiamond is Proxy, SafeOwnable { 16 | using OwnableStorage for OwnableStorage.Layout; 17 | 18 | error BeaconDiamond__NoFacetForSignature(); 19 | 20 | constructor(address _contractOwner, IDiamondReadable _beacon) payable { 21 | OwnableStorage.layout().setOwner(_contractOwner); 22 | LibBeaconDiamond.setBeacon(_beacon); 23 | } 24 | 25 | function _getImplementation() internal view override returns (address) { 26 | LibBeaconDiamond.DiamondStorage storage ds = LibBeaconDiamond 27 | .diamondStorage(); 28 | 29 | address implementation = ds.beacon.facetAddress(msg.sig); 30 | 31 | if (implementation == address(0)) { 32 | revert BeaconDiamond__NoFacetForSignature(); 33 | } 34 | 35 | return implementation; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /contracts/beacon-diamond/libraries/LibBeaconDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {IDiamondReadable} from "@solidstate/contracts/proxy/diamond/readable/IDiamondReadable.sol"; 5 | 6 | library LibBeaconDiamond { 7 | bytes32 private constant STORAGE_POSITION = 8 | keccak256("diamond.standard.diamond.storage.LibBeaconDiamond"); 9 | 10 | struct DiamondStorage { 11 | /// @notice Beacon that stores facet addresses 12 | IDiamondReadable beacon; 13 | } 14 | 15 | function diamondStorage() 16 | internal 17 | pure 18 | returns (DiamondStorage storage ds) 19 | { 20 | bytes32 position = STORAGE_POSITION; 21 | 22 | // solhint-disable-next-line no-inline-assembly 23 | assembly { 24 | ds.slot := position 25 | } 26 | } 27 | 28 | function setBeacon(IDiamondReadable beacon) internal { 29 | DiamondStorage storage ds = diamondStorage(); 30 | ds.beacon = beacon; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contracts/beneficiary/interfaces/ICFABeneficiary.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | interface ICFABeneficiary { 5 | /// @notice Get last deletion for sender 6 | function getLastDeletion(address sender) external view returns (uint256); 7 | } 8 | -------------------------------------------------------------------------------- /contracts/beneficiary/test/BeneficiarySuperApp.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../BeneficiarySuperApp.sol"; 5 | import "../../registry/interfaces/IPCOLicenseParamsStore.sol"; 6 | import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; 7 | import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol"; 8 | import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; 9 | 10 | contract MockParamsStore is IPCOLicenseParamsStore { 11 | ERC20Upgradeable private mockERC20; 12 | 13 | constructor(ERC20Upgradeable mockERC20_) { 14 | mockERC20 = mockERC20_; 15 | } 16 | 17 | /// @notice Payment token 18 | function getPaymentToken() external view returns (ISuperToken) { 19 | return ISuperToken(address(mockERC20)); 20 | } 21 | 22 | /// @notice Superfluid Host 23 | function getHost() external pure returns (ISuperfluid) { 24 | return ISuperfluid(address(0x1)); 25 | } 26 | 27 | /// @notice Beneficiary 28 | function getBeneficiary() external pure returns (ICFABeneficiary) { 29 | return ICFABeneficiary(address(0x1)); 30 | } 31 | 32 | /// @notice The numerator of the network-wide per second contribution fee. 33 | function getPerSecondFeeNumerator() external pure returns (uint256) { 34 | return 1; 35 | } 36 | 37 | /// @notice The denominator of the network-wide per second contribution fee. 38 | function getPerSecondFeeDenominator() external pure returns (uint256) { 39 | return 2; 40 | } 41 | 42 | /// @notice The numerator of the penalty rate. 43 | function getPenaltyNumerator() external pure returns (uint256) { 44 | return 3; 45 | } 46 | 47 | /// @notice The denominator of the penalty rate. 48 | function getPenaltyDenominator() external pure returns (uint256) { 49 | return 4; 50 | } 51 | 52 | /// @notice when the required bid amount reaches its minimum value. 53 | function getReclaimAuctionLength() external pure returns (uint256) { 54 | return 5; 55 | } 56 | 57 | /// @notice Bid period length in seconds 58 | function getBidPeriodLengthInSeconds() external pure returns (uint256) { 59 | return 6; 60 | } 61 | 62 | /// @notice Minimum for sale price 63 | function getMinForSalePrice() external pure returns (uint256) { 64 | return 7; 65 | } 66 | 67 | function initializeParams( 68 | ICFABeneficiary, 69 | ISuperToken, 70 | ISuperfluid, 71 | uint256, 72 | uint256, 73 | uint256, 74 | uint256, 75 | uint256, 76 | uint256, 77 | uint256 78 | ) external pure override { 79 | revert("Not Implemented"); 80 | } 81 | 82 | /// @notice Set Superfluid Host 83 | function setHost(ISuperfluid) external pure override { 84 | revert("Not Implemented"); 85 | } 86 | 87 | /// @notice Set Payment Token 88 | function setPaymentToken(ISuperToken) external pure override { 89 | revert("Not Implemented"); 90 | } 91 | 92 | /// @notice Set Beneficiary 93 | function setBeneficiary(ICFABeneficiary) external pure override { 94 | revert("Not Implemented"); 95 | } 96 | 97 | /// @notice Set Per Second Fee Numerator 98 | function setPerSecondFeeNumerator(uint256) external pure override { 99 | revert("Not Implemented"); 100 | } 101 | 102 | /// @notice Set Per Second Fee Denominator 103 | function setPerSecondFeeDenominator(uint256) external pure override { 104 | revert("Not Implemented"); 105 | } 106 | 107 | /// @notice Set Penalty Numerator 108 | function setPenaltyNumerator(uint256) external pure override { 109 | revert("Not Implemented"); 110 | } 111 | 112 | /// @notice Set Penalty Denominator 113 | function setPenaltyDenominator(uint256) external pure override { 114 | revert("Not Implemented"); 115 | } 116 | 117 | /// @notice Set Reclaim Auction Length 118 | function setReclaimAuctionLength(uint256) external pure override { 119 | revert("Not Implemented"); 120 | } 121 | 122 | /// @notice Set Bid Period Length in seconds 123 | function setBidPeriodLengthInSeconds(uint256) external pure override { 124 | revert("Not Implemented"); 125 | } 126 | 127 | /// @notice Set minimum for sale price 128 | function setMinForSalePrice(uint256) external pure override { 129 | revert("Not Implemented"); 130 | } 131 | } 132 | 133 | contract FuzzyBeneficiarySuperApp is BeneficiarySuperApp, ERC20Upgradeable { 134 | MockParamsStore private mockParamsStore; 135 | 136 | constructor() { 137 | _mint(address(this), 1000); 138 | mockParamsStore = new MockParamsStore(this); 139 | paramsStore = mockParamsStore; 140 | beneficiary = address(0x2); 141 | } 142 | 143 | // solhint-disable-next-line func-name-mixedcase 144 | function echidna_beneficiary_never_changes() public view returns (bool) { 145 | return beneficiary == address(0x2); 146 | } 147 | 148 | // solhint-disable-next-line func-name-mixedcase 149 | function echidna_params_store_never_changes() public view returns (bool) { 150 | return address(paramsStore) == address(mockParamsStore); 151 | } 152 | 153 | // solhint-disable-next-line func-name-mixedcase 154 | function echidna_balance_never_decreases() public view returns (bool) { 155 | return balanceOf(address(this)) >= 1000; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /contracts/pco-license/PCOLicenseDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {SolidStateDiamond} from "@solidstate/contracts/proxy/diamond/SolidStateDiamond.sol"; 5 | 6 | // solhint-disable-next-line no-empty-blocks 7 | contract PCOLicenseDiamond is SolidStateDiamond { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /contracts/pco-license/facets/test/CFABasePCOFacet.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../../libraries/LibCFABasePCO.sol"; 5 | import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol"; 6 | import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; 7 | import {CFAv1Library} from "@superfluid-finance/ethereum-contracts/contracts/apps/CFAv1Library.sol"; 8 | 9 | contract TestableCFABasePCOFacet { 10 | using CFAv1Library for CFAv1Library.InitData; 11 | using SafeERC20 for ISuperToken; 12 | 13 | function manualTransfer(address to, uint256 amount) external { 14 | LibCFABasePCO.DiamondStorage storage ds = LibCFABasePCO 15 | .diamondStorage(); 16 | ISuperToken paymentToken = ds.paramsStore.getPaymentToken(); 17 | 18 | paymentToken.safeTransfer(to, amount); 19 | } 20 | 21 | function manualCreateFlow(address to, int96 flowRate) external { 22 | LibCFABasePCO.DiamondStorage storage ds = LibCFABasePCO 23 | .diamondStorage(); 24 | LibCFABasePCO.DiamondCFAStorage storage cs = LibCFABasePCO.cfaStorage(); 25 | ISuperToken paymentToken = ds.paramsStore.getPaymentToken(); 26 | 27 | cs.cfaV1.createFlow(to, paymentToken, flowRate); 28 | } 29 | 30 | function manualDeleteFlow(address to) external { 31 | LibCFABasePCO.DiamondStorage storage ds = LibCFABasePCO 32 | .diamondStorage(); 33 | LibCFABasePCO.DiamondCFAStorage storage cs = LibCFABasePCO.cfaStorage(); 34 | ISuperToken paymentToken = ds.paramsStore.getPaymentToken(); 35 | 36 | cs.cfaV1.deleteFlow(address(this), to, paymentToken); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /contracts/pco-license/interfaces/ICFABasePCO.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {IERC721} from "@solidstate/contracts/interfaces/IERC721.sol"; 5 | import "../libraries/LibCFABasePCO.sol"; 6 | import "../../registry/interfaces/IPCOLicenseParamsStore.sol"; 7 | import "../../beneficiary/interfaces/ICFABeneficiary.sol"; 8 | 9 | interface ICFABasePCO { 10 | /// @notice Emitted when an owner bid is updated 11 | event PayerContributionRateUpdated( 12 | address indexed _payer, 13 | int96 contributionRate 14 | ); 15 | 16 | /// @notice Emitted when for sale price is updated 17 | event PayerForSalePriceUpdated( 18 | address indexed _payer, 19 | uint256 forSalePrice 20 | ); 21 | 22 | /// @notice Emitted when content hash is updated 23 | event PayerContentHashUpdated(address indexed _payer, bytes contentHash); 24 | 25 | /** 26 | * @notice Initialize bid. 27 | * - Must be the contract owner 28 | * - Must have payment token buffer deposited 29 | * - Must have permissions to create flow for bidder 30 | * @param paramsStore Global store for parameters 31 | * @param initLicense Underlying ERC721 license 32 | * @param initLicenseId Token ID of license 33 | * @param bidder Initial bidder 34 | * @param newContributionRate New contribution rate for bid 35 | * @param newForSalePrice Intented new for sale price. Must be within rounding bounds of newContributionRate 36 | */ 37 | function initializeBid( 38 | ICFABeneficiary beneficiary, 39 | IPCOLicenseParamsStore paramsStore, 40 | IERC721 initLicense, 41 | uint256 initLicenseId, 42 | address bidder, 43 | int96 newContributionRate, 44 | uint256 newForSalePrice 45 | ) external; 46 | 47 | /** 48 | * @notice Initialize bid with a content hash. 49 | * - Must be the contract owner 50 | * - Must have payment token buffer deposited 51 | * - Must have permissions to create flow for bidder 52 | * @param paramsStore Global store for parameters 53 | * @param initLicense Underlying ERC721 license 54 | * @param initLicenseId Token ID of license 55 | * @param bidder Initial bidder 56 | * @param newContributionRate New contribution rate for bid 57 | * @param newForSalePrice Intended new for sale price. Must be within rounding bounds of newContributionRate 58 | * @param contentHash Content hash for parcel content 59 | */ 60 | function initializeBid( 61 | ICFABeneficiary beneficiary, 62 | IPCOLicenseParamsStore paramsStore, 63 | IERC721 initLicense, 64 | uint256 initLicenseId, 65 | address bidder, 66 | int96 newContributionRate, 67 | uint256 newForSalePrice, 68 | bytes calldata contentHash 69 | ) external; 70 | 71 | /** 72 | * @notice Current payer of license 73 | */ 74 | function payer() external view returns (address); 75 | 76 | /** 77 | * @notice Current contribution rate of payer 78 | */ 79 | function contributionRate() external view returns (int96); 80 | 81 | /** 82 | * @notice Current price needed to purchase license 83 | */ 84 | function forSalePrice() external view returns (uint256); 85 | 86 | /** 87 | * @notice License Id 88 | */ 89 | function licenseId() external view returns (uint256); 90 | 91 | /** 92 | * @notice License 93 | */ 94 | function license() external view returns (IERC721); 95 | 96 | /** 97 | * @notice Is current bid actively being paid 98 | */ 99 | function isPayerBidActive() external view returns (bool); 100 | 101 | /** 102 | * @notice Get current bid 103 | */ 104 | function currentBid() external pure returns (LibCFABasePCO.Bid memory); 105 | 106 | /** 107 | * @notice Get content hash 108 | */ 109 | function contentHash() external view returns (bytes memory); 110 | } 111 | -------------------------------------------------------------------------------- /contracts/pco-license/interfaces/ICFAPenaltyBid.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../libraries/LibCFAPenaltyBid.sol"; 5 | 6 | interface ICFAPenaltyBid { 7 | /// @notice Emitted when for sale price is updated 8 | event BidPlaced( 9 | address indexed _bidder, 10 | int96 contributionRate, 11 | uint256 forSalePrice 12 | ); 13 | 14 | /// @notice Emitted when a bid is accepted 15 | event BidAccepted( 16 | address indexed _payer, 17 | address indexed _bidder, 18 | uint256 forSalePrice 19 | ); 20 | 21 | /// @notice Emitted when a bid is rejected 22 | event BidRejected( 23 | address indexed _payer, 24 | address indexed _bidder, 25 | uint256 forSalePrice 26 | ); 27 | 28 | /// @notice Emitted when a transfer is triggered 29 | event TransferTriggered( 30 | address indexed _sender, 31 | address indexed _payer, 32 | address indexed _bidder, 33 | uint256 forSalePrice 34 | ); 35 | 36 | /** 37 | * @notice Should bid period end early 38 | */ 39 | function shouldBidPeriodEndEarly() external view returns (bool); 40 | 41 | /** 42 | * @notice Get pending bid 43 | */ 44 | function pendingBid() external pure returns (LibCFAPenaltyBid.Bid memory); 45 | 46 | /** 47 | * @notice Checks if there is a pending bid 48 | */ 49 | function hasPendingBid() external view returns (bool); 50 | 51 | /** 52 | * @notice Get penalty payment 53 | */ 54 | function calculatePenalty() external view returns (uint256); 55 | 56 | /** 57 | * @notice Edit bid 58 | * @param newContributionRate New contribution rate for bid 59 | * @param newForSalePrice Intented new for sale price. Must be within rounding bounds of newContributionRate 60 | */ 61 | function editBid(int96 newContributionRate, uint256 newForSalePrice) 62 | external; 63 | 64 | /** 65 | * @notice Place a bid to purchase license as msg.sender 66 | * @param newContributionRate New contribution rate for bid 67 | * @param newForSalePrice Intented new for sale price. Must be within rounding bounds of newContributionRate 68 | */ 69 | function placeBid(int96 newContributionRate, uint256 newForSalePrice) 70 | external; 71 | 72 | /** 73 | * @notice Accept a pending bid as the current payer 74 | */ 75 | function acceptBid() external; 76 | 77 | /** 78 | * @notice Reject a pending bid as the current payer 79 | * @param newContributionRate New contribution rate for bid 80 | * @param newForSalePrice Intented new for sale price. Must be within rounding bounds of newContributionRate 81 | */ 82 | function rejectBid(int96 newContributionRate, uint256 newForSalePrice) 83 | external; 84 | 85 | /** 86 | * @notice Trigger a transfer after bidding period has elapsed 87 | */ 88 | function triggerTransfer() external; 89 | 90 | /** 91 | * @notice Edit bid with a content hash 92 | * @param newContributionRate New contribution rate for bid 93 | * @param newForSalePrice Intended new for sale price. Must be within rounding bounds of newContributionRate 94 | * @param contentHash Content hash for parcel content 95 | */ 96 | function editBid( 97 | int96 newContributionRate, 98 | uint256 newForSalePrice, 99 | bytes calldata contentHash 100 | ) external; 101 | 102 | /** 103 | * @notice Place a bid with a content hash 104 | * @param newContributionRate New contribution rate for bid 105 | * @param newForSalePrice Intended new for sale price. Must be within rounding bounds of newContributionRate 106 | * @param contentHash Content hash for parcel content 107 | */ 108 | function placeBid( 109 | int96 newContributionRate, 110 | uint256 newForSalePrice, 111 | bytes calldata contentHash 112 | ) external; 113 | 114 | /** 115 | * @notice Edit content hash 116 | * - Must be the current payer 117 | * - Must have permissions to update flow for payer 118 | * @param contentHash Content hash for parcel content 119 | */ 120 | function editContentHash(bytes calldata contentHash) external; 121 | } 122 | -------------------------------------------------------------------------------- /contracts/pco-license/interfaces/ICFAReclaimer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | /// @notice Handles reclaiming of licenses that are no longer active 5 | interface ICFAReclaimer { 6 | /// @notice Emitted when a license is reclaimed 7 | event LicenseReclaimed(address indexed to, uint256 price); 8 | 9 | /** 10 | * @notice Current price to reclaim 11 | */ 12 | function reclaimPrice() external view returns (uint256); 13 | 14 | /** 15 | * @notice Reclaim an inactive license as msg.sender 16 | * @param maxClaimPrice Max price willing to pay for claim. Prevents front-running 17 | * @param newContributionRate New contribution rate for license 18 | * @param newForSalePrice Intended new for sale price. Must be within rounding bounds of newContributionRate 19 | */ 20 | function reclaim( 21 | uint256 maxClaimPrice, 22 | int96 newContributionRate, 23 | uint256 newForSalePrice 24 | ) external; 25 | 26 | /** 27 | * @notice Reclaim an inactive license as msg.sender 28 | * @param maxClaimPrice Max price willing to pay for claim. Prevents front-running 29 | * @param newContributionRate New contribution rate for license 30 | * @param newForSalePrice Intended new for sale price. Must be within rounding bounds of newContributionRate 31 | * @param contentHash Content hash for parcel content 32 | */ 33 | function reclaim( 34 | uint256 maxClaimPrice, 35 | int96 newContributionRate, 36 | uint256 newForSalePrice, 37 | bytes calldata contentHash 38 | ) external; 39 | } 40 | -------------------------------------------------------------------------------- /contracts/pco-license/interfaces/IPCOLicenseDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "./ICFABasePCO.sol"; 5 | import "./ICFAPenaltyBid.sol"; 6 | import "./ICFAReclaimer.sol"; 7 | import {IDiamondReadable} from "@solidstate/contracts/proxy/diamond/readable/IDiamondReadable.sol"; 8 | import {IDiamondWritable} from "@solidstate/contracts/proxy/diamond/writable/IDiamondWritable.sol"; 9 | 10 | // solhint-disable-next-line no-empty-blocks 11 | interface IPCOLicenseDiamond is 12 | ICFABasePCO, 13 | ICFAPenaltyBid, 14 | ICFAReclaimer, 15 | IDiamondReadable, 16 | IDiamondWritable 17 | { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /contracts/registry/RegistryDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {SolidStateDiamond} from "@solidstate/contracts/proxy/diamond/SolidStateDiamond.sol"; 5 | 6 | // solhint-disable-next-line no-empty-blocks 7 | contract RegistryDiamond is SolidStateDiamond { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /contracts/registry/facets/GeoWebParcelFacet.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../libraries/LibGeoWebParcel.sol"; 5 | import "../libraries/LibGeoWebParcelV2.sol"; 6 | import {IGeoWebParcelV1, IGeoWebParcelV2} from "../interfaces/IGeoWebParcel.sol"; 7 | 8 | /// @title Public access to parcel data 9 | contract GeoWebParcelFacetV1 is IGeoWebParcelV1 { 10 | /** 11 | * @notice Get availability index for coordinates 12 | * @param x X coordinate 13 | * @param y Y coordinate 14 | */ 15 | function availabilityIndex(uint256 x, uint256 y) 16 | external 17 | view 18 | returns (uint256) 19 | { 20 | LibGeoWebParcel.DiamondStorage storage ds = LibGeoWebParcel 21 | .diamondStorage(); 22 | 23 | return ds.availabilityIndex[x][y]; 24 | } 25 | 26 | /** 27 | * @notice Get a land parcel 28 | * @param id ID of land parcel 29 | */ 30 | function getLandParcel(uint256 id) 31 | external 32 | view 33 | virtual 34 | returns (uint64 baseCoordinate, uint256[] memory path) 35 | { 36 | LibGeoWebParcel.DiamondStorage storage ds = LibGeoWebParcel 37 | .diamondStorage(); 38 | 39 | LibGeoWebParcel.LandParcel storage p = ds.landParcels[id]; 40 | return (p.baseCoordinate, p.path); 41 | } 42 | } 43 | 44 | /// @title Public access to parcel data 45 | contract GeoWebParcelFacetV2 is GeoWebParcelFacetV1, IGeoWebParcelV2 { 46 | /** 47 | * @notice Get a V2 land parcel 48 | * @param id ID of land parcel 49 | */ 50 | function getLandParcelV2(uint256 id) 51 | external 52 | view 53 | returns ( 54 | uint64 swCoordinate, 55 | uint256 latDim, 56 | uint256 lngDim 57 | ) 58 | { 59 | LibGeoWebParcelV2.DiamondStorage storage ds = LibGeoWebParcelV2 60 | .diamondStorage(); 61 | 62 | LibGeoWebParcelV2.LandParcel storage p = ds.landParcels[id]; 63 | return (p.swCoordinate, p.latDim, p.lngDim); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /contracts/registry/facets/PCOERC721Facet.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../libraries/LibPCOLicenseClaimer.sol"; 5 | import "../interfaces/IPCOERC721.sol"; 6 | import {ERC721Base, ERC721BaseInternal} from "@solidstate/contracts/token/ERC721/base/ERC721Base.sol"; 7 | import {ERC721Metadata} from "@solidstate/contracts/token/ERC721/metadata/ERC721Metadata.sol"; 8 | import {ERC721MetadataStorage} from "@solidstate/contracts/token/ERC721/metadata/ERC721MetadataStorage.sol"; 9 | import {ERC165} from "@solidstate/contracts/introspection/ERC165.sol"; 10 | import {IERC165} from "@solidstate/contracts/interfaces/IERC165.sol"; 11 | import {IERC721} from "@solidstate/contracts/interfaces/IERC721.sol"; 12 | import {ERC165Storage} from "@solidstate/contracts/introspection/ERC165Storage.sol"; 13 | import {OwnableStorage} from "@solidstate/contracts/access/ownable/OwnableStorage.sol"; 14 | 15 | contract PCOERC721Facet is IPCOERC721, ERC721Base, ERC721Metadata, ERC165 { 16 | using ERC165Storage for ERC165Storage.Layout; 17 | using OwnableStorage for OwnableStorage.Layout; 18 | 19 | modifier onlyOwner() { 20 | require( 21 | msg.sender == OwnableStorage.layout().owner, 22 | "Ownable: sender must be owner" 23 | ); 24 | _; 25 | } 26 | 27 | function initializeERC721( 28 | string memory name, 29 | string memory symbol, 30 | string memory baseURI 31 | ) external onlyOwner { 32 | ERC721MetadataStorage.Layout storage ls = ERC721MetadataStorage 33 | .layout(); 34 | ls.name = name; 35 | ls.symbol = symbol; 36 | ls.baseURI = baseURI; 37 | 38 | ERC165Storage.layout().setSupportedInterface( 39 | type(IERC721).interfaceId, 40 | true 41 | ); 42 | } 43 | 44 | function updateTokenURI(uint256 tokenId, string calldata uri) external { 45 | require( 46 | _isApprovedOrOwner(msg.sender, tokenId), 47 | "ERC721: caller is not owner or approved" 48 | ); 49 | 50 | emit TokenURIUpdated(tokenId, uri); 51 | 52 | ERC721MetadataStorage.Layout storage ls = ERC721MetadataStorage 53 | .layout(); 54 | ls.tokenURIs[tokenId] = uri; 55 | } 56 | 57 | /// @dev Override _isApprovedOrOwner to include corresponding beacon proxy 58 | function _isApprovedOrOwner(address spender, uint256 tokenId) 59 | internal 60 | view 61 | virtual 62 | override 63 | returns (bool) 64 | { 65 | LibPCOLicenseClaimer.DiamondStorage storage cs = LibPCOLicenseClaimer 66 | .diamondStorage(); 67 | 68 | return 69 | super._isApprovedOrOwner(spender, tokenId) || 70 | spender == cs.beaconProxies[tokenId]; 71 | } 72 | 73 | /** 74 | * Override to only allow transfers from corresponding beacon proxy 75 | */ 76 | function _beforeTokenTransfer( 77 | address from, 78 | address to, 79 | uint256 tokenId 80 | ) internal virtual override(ERC721BaseInternal, ERC721Metadata) { 81 | if (from != address(0) && to != address(0)) { 82 | LibPCOLicenseClaimer.DiamondStorage 83 | storage cs = LibPCOLicenseClaimer.diamondStorage(); 84 | 85 | require( 86 | msg.sender == cs.beaconProxies[tokenId], 87 | "Only beacon proxy can transfer" 88 | ); 89 | } 90 | super._beforeTokenTransfer(from, to, tokenId); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /contracts/registry/facets/test/GeoWebParcelFacet.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../../libraries/LibGeoWebParcel.sol"; 5 | import "../../libraries/LibGeoWebParcelV2.sol"; 6 | import "../GeoWebParcelFacet.sol"; 7 | 8 | contract TestableGeoWebParcelFacetV1 is GeoWebParcelFacetV1 { 9 | function build(uint64 baseCoordinate, uint256[] memory path) external { 10 | LibGeoWebParcel.build(baseCoordinate, path); 11 | } 12 | 13 | function destroy(uint64 id) external { 14 | return LibGeoWebParcel.destroy(id); 15 | } 16 | } 17 | 18 | contract FuzzyGeoWebParcelFacetV1 is GeoWebParcelFacetV1 { 19 | using LibGeoWebCoordinate for uint64; 20 | 21 | constructor() { 22 | // Build a single parcel 23 | uint256[] memory path = new uint256[](1); 24 | path[0] = 0; 25 | LibGeoWebParcel.build(17179869217, path); 26 | } 27 | 28 | function build(uint64 baseCoordinate, uint256[] memory path) external { 29 | LibGeoWebParcel.build(baseCoordinate, path); 30 | } 31 | 32 | // solhint-disable-next-line func-name-mixedcase 33 | function echidna_coordinate_never_changes_parcel() 34 | public 35 | view 36 | returns (bool) 37 | { 38 | LibGeoWebParcel.DiamondStorage storage ds = LibGeoWebParcel 39 | .diamondStorage(); 40 | 41 | LibGeoWebParcel.LandParcel storage p = ds.landParcels[0]; 42 | 43 | return p.baseCoordinate == 17179869217; 44 | } 45 | 46 | // solhint-disable-next-line func-name-mixedcase 47 | function echidna_coordinate_never_is_available() 48 | public 49 | view 50 | returns (bool) 51 | { 52 | LibGeoWebParcel.DiamondStorage storage ds = LibGeoWebParcel 53 | .diamondStorage(); 54 | 55 | uint64 baseCoordinate = 17179869217; 56 | (uint256 iX, uint256 iY, uint256 i) = baseCoordinate.toWordIndex(); 57 | uint256 word = ds.availabilityIndex[iX][iY]; 58 | 59 | return (word & (2**i) != 0); 60 | } 61 | 62 | // solhint-disable-next-line func-name-mixedcase 63 | function echidna_next_id_never_repeats() public view returns (bool) { 64 | return LibGeoWebParcel.nextId() != 0; 65 | } 66 | } 67 | 68 | contract TestableGeoWebParcelFacetV2 is GeoWebParcelFacetV2 { 69 | function build(LibGeoWebParcelV2.LandParcel memory parcel) external { 70 | LibGeoWebParcelV2.build(parcel); 71 | } 72 | } 73 | 74 | contract FuzzyGeoWebParcelFacetV2 is GeoWebParcelFacetV2 { 75 | using LibGeoWebCoordinate for uint64; 76 | 77 | constructor() { 78 | // Build a single parcel 79 | LibGeoWebParcelV2.LandParcel memory p; 80 | p.swCoordinate = 17179869217; 81 | p.lngDim = 1; 82 | p.latDim = 1; 83 | LibGeoWebParcelV2.build(p); 84 | } 85 | 86 | function build(LibGeoWebParcelV2.LandParcel memory parcel) external { 87 | LibGeoWebParcelV2.build(parcel); 88 | } 89 | 90 | // solhint-disable-next-line func-name-mixedcase 91 | function echidna_coordinate_never_changes_parcel() 92 | public 93 | view 94 | returns (bool) 95 | { 96 | LibGeoWebParcelV2.DiamondStorage storage ds = LibGeoWebParcelV2 97 | .diamondStorage(); 98 | 99 | LibGeoWebParcelV2.LandParcel storage p = ds.landParcels[0]; 100 | 101 | return p.swCoordinate == 17179869217 && p.lngDim == 1 && p.latDim == 1; 102 | } 103 | 104 | // solhint-disable-next-line func-name-mixedcase 105 | function echidna_coordinate_never_is_available() 106 | public 107 | view 108 | returns (bool) 109 | { 110 | LibGeoWebParcel.DiamondStorage storage ds = LibGeoWebParcel 111 | .diamondStorage(); 112 | 113 | uint64 swCoordinate = 17179869217; 114 | (uint256 iX, uint256 iY, uint256 i) = swCoordinate.toWordIndex(); 115 | uint256 word = ds.availabilityIndex[iX][iY]; 116 | 117 | return (word & (2**i) != 0); 118 | } 119 | 120 | // solhint-disable-next-line func-name-mixedcase 121 | function echidna_next_id_never_repeats() public view returns (bool) { 122 | return LibGeoWebParcel.nextId() != 0; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /contracts/registry/facets/test/PCOERC721Facet.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "./../PCOERC721Facet.sol"; 5 | import "../../libraries/LibPCOLicenseClaimer.sol"; 6 | 7 | contract FuzzyPCOERC721Facet is PCOERC721Facet { 8 | address private echidnaCaller = msg.sender; 9 | 10 | constructor() { 11 | LibPCOLicenseClaimer.DiamondStorage storage cs = LibPCOLicenseClaimer 12 | .diamondStorage(); 13 | 14 | _safeMint(echidnaCaller, 1); 15 | cs.beaconProxies[1] = address(this); 16 | } 17 | 18 | // solhint-disable-next-line func-name-mixedcase 19 | function echidna_operator_always_approved() public view returns (bool) { 20 | return _isApprovedOrOwner(address(this), 1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/registry/facets/test/PCOLicenseClaimerFacet.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../../libraries/LibPCOLicenseClaimer.sol"; 5 | import "../PCOLicenseClaimerFacet.sol"; 6 | 7 | contract FuzzyPCOLicenseClaimerFacetV1 is PCOLicenseClaimerFacetV1 { 8 | constructor() { 9 | // Initialize params 10 | LibPCOLicenseClaimer.DiamondStorage storage ds = LibPCOLicenseClaimer 11 | .diamondStorage(); 12 | ds.auctionStart = 0; 13 | ds.auctionEnd = 1; 14 | ds.startingBid = 2; 15 | ds.endingBid = 3; 16 | ds.beacon = address(0x1); 17 | } 18 | 19 | // solhint-disable-next-line func-name-mixedcase 20 | function echidna_params_never_change() public view returns (bool) { 21 | LibPCOLicenseClaimer.DiamondStorage storage ds = LibPCOLicenseClaimer 22 | .diamondStorage(); 23 | 24 | return 25 | ds.auctionStart == 0 && 26 | ds.auctionEnd == 1 && 27 | ds.startingBid == 2 && 28 | ds.endingBid == 3 && 29 | ds.beacon == address(0x1); 30 | } 31 | 32 | // solhint-disable-next-line func-name-mixedcase 33 | function echidna_no_repeat_next_address() public returns (bool) { 34 | LibPCOLicenseClaimer.DiamondStorage storage ds = LibPCOLicenseClaimer 35 | .diamondStorage(); 36 | 37 | address nextAddress = getNextProxyAddress(msg.sender); 38 | BeaconDiamond proxy = new BeaconDiamond{ 39 | salt: keccak256( 40 | abi.encodePacked(msg.sender, ds.userSalts[msg.sender]) 41 | ) 42 | }(address(this), IDiamondReadable(ds.beacon)); 43 | 44 | return nextAddress == address(proxy); 45 | } 46 | } 47 | 48 | contract FuzzyPCOLicenseClaimerFacetV2 is PCOLicenseClaimerFacetV2 { 49 | constructor() { 50 | // Initialize params 51 | LibPCOLicenseClaimer.DiamondStorage storage ds = LibPCOLicenseClaimer 52 | .diamondStorage(); 53 | ds.auctionStart = 0; 54 | ds.auctionEnd = 1; 55 | ds.startingBid = 2; 56 | ds.endingBid = 3; 57 | ds.beacon = address(0x1); 58 | } 59 | 60 | // solhint-disable-next-line func-name-mixedcase 61 | function echidna_params_never_change() public view returns (bool) { 62 | LibPCOLicenseClaimer.DiamondStorage storage ds = LibPCOLicenseClaimer 63 | .diamondStorage(); 64 | 65 | return 66 | ds.auctionStart == 0 && 67 | ds.auctionEnd == 1 && 68 | ds.startingBid == 2 && 69 | ds.endingBid == 3 && 70 | ds.beacon == address(0x1); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /contracts/registry/facets/test/PCOLicenseParamsFacet.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../../libraries/LibPCOLicenseParams.sol"; 5 | import "./../PCOLicenseParamsFacet.sol"; 6 | import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; 7 | import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol"; 8 | import "../../../beneficiary/interfaces/ICFABeneficiary.sol"; 9 | 10 | contract FuzzyPCOLicenseParamsFacet is PCOLicenseParamsFacet { 11 | constructor() { 12 | // Initialize params 13 | LibPCOLicenseParams.DiamondStorage storage ps = LibPCOLicenseParams 14 | .diamondStorage(); 15 | ps.beneficiary = ICFABeneficiary(address(0x1)); 16 | ps.paymentToken = ISuperToken(address(0x2)); 17 | ps.host = ISuperfluid(address(0x3)); 18 | ps.perSecondFeeNumerator = 10; 19 | ps.perSecondFeeDenominator = 3153600000; 20 | ps.penaltyNumerator = 1; 21 | ps.penaltyDenominator = 10; 22 | ps.bidPeriodLengthInSeconds = 60 * 60 * 24 * 7; 23 | ps.reclaimAuctionLength = 60 * 60 * 24 * 14; 24 | ps.minForSalePrice = 5000000000000000; 25 | } 26 | 27 | // solhint-disable-next-line func-name-mixedcase 28 | function echidna_params_never_change() public view returns (bool) { 29 | LibPCOLicenseParams.DiamondStorage storage ps = LibPCOLicenseParams 30 | .diamondStorage(); 31 | 32 | return 33 | ps.beneficiary == ICFABeneficiary(address(0x1)) && 34 | ps.paymentToken == ISuperToken(address(0x2)) && 35 | ps.host == ISuperfluid(address(0x3)) && 36 | ps.perSecondFeeNumerator == 10 && 37 | ps.perSecondFeeDenominator == 3153600000 && 38 | ps.penaltyNumerator == 1 && 39 | ps.penaltyDenominator == 10 && 40 | ps.bidPeriodLengthInSeconds == 60 * 60 * 24 * 7 && 41 | ps.reclaimAuctionLength == 60 * 60 * 24 * 14 && 42 | ps.minForSalePrice == 5000000000000000; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /contracts/registry/interfaces/IGeoWebParcel.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | /// @title Latest version of IGeoWebParcel 5 | interface IGeoWebParcel { 6 | /** 7 | * @notice Get availability index for coordinates 8 | * @param x X coordinate 9 | * @param y Y coordinate 10 | */ 11 | function availabilityIndex(uint256 x, uint256 y) 12 | external 13 | view 14 | returns (uint256); 15 | 16 | /** 17 | * @notice Get a land parcel 18 | * @param id ID of land parcel 19 | */ 20 | function getLandParcel(uint256 id) 21 | external 22 | view 23 | returns (uint64 baseCoordinate, uint256[] memory path); 24 | 25 | /** 26 | * @notice Get a V2 land parcel 27 | * @param id ID of land parcel 28 | */ 29 | function getLandParcelV2(uint256 id) 30 | external 31 | view 32 | returns ( 33 | uint64 swCoordinate, 34 | uint256 latDim, 35 | uint256 lngDim 36 | ); 37 | } 38 | 39 | /// @title IGeoWebParcelV1 external functions 40 | interface IGeoWebParcelV1 { 41 | /** 42 | * @notice Get availability index for coordinates 43 | * @param x X coordinate 44 | * @param y Y coordinate 45 | */ 46 | function availabilityIndex(uint256 x, uint256 y) 47 | external 48 | view 49 | returns (uint256); 50 | 51 | /** 52 | * @notice Get a land parcel 53 | * @param id ID of land parcel 54 | */ 55 | function getLandParcel(uint256 id) 56 | external 57 | view 58 | returns (uint64 baseCoordinate, uint256[] memory path); 59 | } 60 | 61 | /// @title IGeoWebParcelV2 defines new external functions 62 | interface IGeoWebParcelV2 is IGeoWebParcelV1 { 63 | /** 64 | * @notice Get a V2 land parcel 65 | * @param id ID of land parcel 66 | */ 67 | function getLandParcelV2(uint256 id) 68 | external 69 | view 70 | returns ( 71 | uint64 swCoordinate, 72 | uint256 latDim, 73 | uint256 lngDim 74 | ); 75 | } 76 | -------------------------------------------------------------------------------- /contracts/registry/interfaces/IPCOERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {IERC721} from "@solidstate/contracts/interfaces/IERC721.sol"; 5 | import {IERC721Metadata} from "@solidstate/contracts/token/ERC721/metadata/IERC721Metadata.sol"; 6 | 7 | interface IPCOERC721 is IERC721, IERC721Metadata { 8 | event TokenURIUpdated(uint256 indexed tokenId, string uri); 9 | 10 | function initializeERC721( 11 | string memory name, 12 | string memory symbol, 13 | string memory baseURI 14 | ) external; 15 | 16 | function updateTokenURI(uint256 tokenId, string calldata uri) external; 17 | } 18 | -------------------------------------------------------------------------------- /contracts/registry/interfaces/IPCOLicenseParamsStore.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; 5 | import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol"; 6 | import "../../beneficiary/interfaces/ICFABeneficiary.sol"; 7 | 8 | interface IPCOLicenseParamsStore { 9 | /** 10 | * @notice Initialize. 11 | * - Must be the contract owner 12 | * @param beneficiary Beneficiary of funds. 13 | * @param paymentToken Payment token. 14 | * @param host Superfluid host 15 | * @param perSecondFeeNumerator The numerator of the network-wide per second contribution fee. 16 | * @param perSecondFeeDenominator The denominator of the network-wide per second contribution fee. 17 | * @param penaltyNumerator The numerator of the penalty to pay to reject a bid. 18 | * @param penaltyDenominator The denominator of the penalty to pay to reject a bid. 19 | * @param bidPeriodLengthInSeconds Bid period length in seconds 20 | * @param reclaimAuctionLength when the required bid amount reaches its minimum value. 21 | */ 22 | function initializeParams( 23 | ICFABeneficiary beneficiary, 24 | ISuperToken paymentToken, 25 | ISuperfluid host, 26 | uint256 perSecondFeeNumerator, 27 | uint256 perSecondFeeDenominator, 28 | uint256 penaltyNumerator, 29 | uint256 penaltyDenominator, 30 | uint256 bidPeriodLengthInSeconds, 31 | uint256 reclaimAuctionLength, 32 | uint256 minForSalePrice 33 | ) external; 34 | 35 | /// @notice Superfluid Host 36 | function getHost() external view returns (ISuperfluid); 37 | 38 | /// @notice Set Superfluid Host 39 | function setHost(ISuperfluid host) external; 40 | 41 | /// @notice Payment token 42 | function getPaymentToken() external view returns (ISuperToken); 43 | 44 | /// @notice Set Payment Token 45 | function setPaymentToken(ISuperToken paymentToken) external; 46 | 47 | /// @notice Beneficiary 48 | function getBeneficiary() external view returns (ICFABeneficiary); 49 | 50 | /// @notice Set Beneficiary 51 | function setBeneficiary(ICFABeneficiary beneficiary) external; 52 | 53 | /// @notice The numerator of the network-wide per second contribution fee. 54 | function getPerSecondFeeNumerator() external view returns (uint256); 55 | 56 | /// @notice Set Per Second Fee Numerator 57 | function setPerSecondFeeNumerator(uint256 perSecondFeeNumerator) external; 58 | 59 | /// @notice The denominator of the network-wide per second contribution fee. 60 | function getPerSecondFeeDenominator() external view returns (uint256); 61 | 62 | /// @notice Set Per Second Fee Denominator 63 | function setPerSecondFeeDenominator(uint256 perSecondFeeDenominator) 64 | external; 65 | 66 | /// @notice The numerator of the penalty rate. 67 | function getPenaltyNumerator() external view returns (uint256); 68 | 69 | /// @notice Set Penalty Numerator 70 | function setPenaltyNumerator(uint256 penaltyNumerator) external; 71 | 72 | /// @notice The denominator of the penalty rate. 73 | function getPenaltyDenominator() external view returns (uint256); 74 | 75 | /// @notice Set Penalty Denominator 76 | function setPenaltyDenominator(uint256 penaltyDenominator) external; 77 | 78 | /// @notice the final/minimum required bid reached and maintained at the end of the auction. 79 | function getReclaimAuctionLength() external view returns (uint256); 80 | 81 | /// @notice Set Reclaim Auction Length 82 | function setReclaimAuctionLength(uint256 reclaimAuctionLength) external; 83 | 84 | /// @notice Bid period length in seconds 85 | function getBidPeriodLengthInSeconds() external view returns (uint256); 86 | 87 | /// @notice Set Bid Period Length in seconds 88 | function setBidPeriodLengthInSeconds(uint256 bidPeriodLengthInSeconds) 89 | external; 90 | 91 | /// @notice Minimum for sale price 92 | function getMinForSalePrice() external view returns (uint256); 93 | 94 | /// @notice Set minimum for sale price 95 | function setMinForSalePrice(uint256 minForSalePrice) external; 96 | } 97 | -------------------------------------------------------------------------------- /contracts/registry/interfaces/IRegistryDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "./IGeoWebParcel.sol"; 5 | import "./IPCOLicenseClaimer.sol"; 6 | import "./IPCOERC721.sol"; 7 | import "./IPCOLicenseParamsStore.sol"; 8 | import {IDiamondReadable} from "@solidstate/contracts/proxy/diamond/readable/IDiamondReadable.sol"; 9 | import {IDiamondWritable} from "@solidstate/contracts/proxy/diamond/writable/IDiamondWritable.sol"; 10 | 11 | // solhint-disable-next-line no-empty-blocks 12 | interface IRegistryDiamond is 13 | IGeoWebParcel, 14 | IPCOLicenseClaimer, 15 | IPCOERC721, 16 | IPCOLicenseParamsStore, 17 | IDiamondReadable, 18 | IDiamondWritable 19 | { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /contracts/registry/libraries/LibGeoWebCoordinate.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | /// @title LibGeoWebCoordinate is an unsigned 64-bit integer that contains x and y coordinates in the upper and lower 32 bits, respectively 5 | library LibGeoWebCoordinate { 6 | // Fixed grid size is 2^23 longitude by 2^22 latitude 7 | uint64 public constant MAX_X = ((2**23) - 1); 8 | uint64 public constant MAX_Y = ((2**22) - 1); 9 | 10 | /// @dev Enum for different directions 11 | enum Direction { 12 | North, 13 | South, 14 | East, 15 | West 16 | } 17 | 18 | /// @notice Traverse a single direction 19 | /// @param origin The origin coordinate to start from 20 | /// @param direction The direction to take 21 | /// @return destination The destination coordinate 22 | function traverse( 23 | uint64 origin, 24 | Direction direction, 25 | uint256 iX, 26 | uint256 iY, 27 | uint256 i 28 | ) 29 | internal 30 | pure 31 | returns ( 32 | uint64, 33 | uint256, 34 | uint256, 35 | uint256 36 | ) 37 | { 38 | uint64 originX = _getX(origin); 39 | uint64 originY = _getY(origin); 40 | 41 | if (direction == Direction.North) { 42 | originY += 1; 43 | require(originY <= MAX_Y, "Direction went too far north!"); 44 | 45 | if (originY % 16 == 0) { 46 | iY += 1; 47 | i -= 240; 48 | } else { 49 | i += 16; 50 | } 51 | } else if (direction == Direction.South) { 52 | require(originY > 0, "Direction went too far south!"); 53 | originY -= 1; 54 | 55 | if (originY % 16 == 15) { 56 | iY -= 1; 57 | i += 240; 58 | } else { 59 | i -= 16; 60 | } 61 | } else if (direction == Direction.East) { 62 | if (originX >= MAX_X) { 63 | // Wrap to west 64 | originX = 0; 65 | iX = 0; 66 | i -= 15; 67 | } else { 68 | originX += 1; 69 | if (originX % 16 == 0) { 70 | iX += 1; 71 | i -= 15; 72 | } else { 73 | i += 1; 74 | } 75 | } 76 | } else if (direction == Direction.West) { 77 | if (originX == 0) { 78 | // Wrap to east 79 | originX = MAX_X; 80 | iX = MAX_X / 16; 81 | i += 15; 82 | } else { 83 | originX -= 1; 84 | if (originX % 16 == 15) { 85 | iX -= 1; 86 | i += 15; 87 | } else { 88 | i -= 1; 89 | } 90 | } 91 | } 92 | 93 | uint64 destination = (originY | (originX << 32)); 94 | 95 | return (destination, iX, iY, i); 96 | } 97 | 98 | /// @notice Get the X coordinate 99 | function _getX(uint64 coord) internal pure returns (uint64 coordX) { 100 | coordX = (coord >> 32); // Take first 32 bits 101 | require(coordX <= MAX_X, "X coordinate is out of bounds"); 102 | } 103 | 104 | /// @notice Get the Y coordinate 105 | function _getY(uint64 coord) internal pure returns (uint64 coordY) { 106 | coordY = (coord & ((2**32) - 1)); // Take last 32 bits 107 | require(coordY <= MAX_Y, "Y coordinate is out of bounds"); 108 | } 109 | 110 | /// @notice Convert coordinate to word index 111 | function toWordIndex(uint64 coord) 112 | internal 113 | pure 114 | returns ( 115 | uint256 iX, 116 | uint256 iY, 117 | uint256 i 118 | ) 119 | { 120 | uint256 coordX = uint256(_getX(coord)); 121 | uint256 coordY = uint256(_getY(coord)); 122 | 123 | iX = coordX / 16; 124 | iY = coordY / 16; 125 | 126 | uint256 lX = coordX % 16; 127 | uint256 lY = coordY % 16; 128 | 129 | i = lY * 16 + lX; 130 | } 131 | } 132 | 133 | /// @notice LibGeoWebCoordinatePath stores a path of directions in a uint256. The most significant 8 bits encodes the length of the path 134 | library LibGeoWebCoordinatePath { 135 | uint256 private constant INNER_PATH_MASK = (2**(256 - 8)) - 1; 136 | uint256 private constant PATH_SEGMENT_MASK = (2**2) - 1; 137 | 138 | /// @notice Get next direction from path 139 | /// @param path The path to get the direction from 140 | /// @return hasNext If the path has a next direction 141 | /// @return direction The next direction taken from path 142 | /// @return nextPath The next path with the direction popped from it 143 | function nextDirection(uint256 path) 144 | internal 145 | pure 146 | returns ( 147 | bool hasNext, 148 | LibGeoWebCoordinate.Direction direction, 149 | uint256 nextPath 150 | ) 151 | { 152 | uint256 length = (path >> (256 - 8)); // Take most significant 8 bits 153 | hasNext = (length > 0); 154 | if (!hasNext) { 155 | return (hasNext, LibGeoWebCoordinate.Direction.North, 0); 156 | } 157 | uint256 _path = (path & INNER_PATH_MASK); 158 | 159 | direction = LibGeoWebCoordinate.Direction(_path & PATH_SEGMENT_MASK); // Take least significant 2 bits of path 160 | nextPath = (_path >> 2) | ((length - 1) << (256 - 8)); // Trim direction from path 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /contracts/registry/libraries/LibGeoWebParcel.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "./LibGeoWebCoordinate.sol"; 5 | 6 | library LibGeoWebParcel { 7 | using LibGeoWebCoordinate for uint64; 8 | using LibGeoWebCoordinatePath for uint256; 9 | 10 | bytes32 private constant STORAGE_POSITION = 11 | keccak256("diamond.standard.diamond.storage.LibGeoWebParcel"); 12 | 13 | /// @dev Structure of a land parcel 14 | struct LandParcel { 15 | uint64 baseCoordinate; 16 | uint256[] path; 17 | } 18 | 19 | /// @dev Enum for different actions 20 | enum Action { 21 | Build, 22 | Destroy, 23 | Check 24 | } 25 | 26 | /// @dev Maxmium uint256 stored as a constant to use for masking 27 | uint256 private constant MAX_INT = 2**256 - 1; 28 | 29 | /// @notice Emitted when a parcel is built 30 | event ParcelBuilt(uint256 indexed _id); 31 | 32 | /// @notice Emitted when a parcel is destroyed 33 | event ParcelDestroyed(uint256 indexed _id); 34 | 35 | /// @notice Emitted when a parcel is modified 36 | event ParcelModified(uint256 indexed _id); 37 | 38 | struct DiamondStorage { 39 | /// @notice Stores which coordinates are available 40 | mapping(uint256 => mapping(uint256 => uint256)) availabilityIndex; 41 | /// @notice Stores which coordinates belong to a parcel 42 | mapping(uint256 => LandParcel) landParcels; 43 | /// @dev The next ID to assign to a parcel 44 | uint256 nextId; 45 | } 46 | 47 | function diamondStorage() 48 | internal 49 | pure 50 | returns (DiamondStorage storage ds) 51 | { 52 | bytes32 position = STORAGE_POSITION; 53 | // solhint-disable-next-line no-inline-assembly 54 | assembly { 55 | ds.slot := position 56 | } 57 | } 58 | 59 | /** 60 | * @notice Build a new parcel. All coordinates along the path must be available. All coordinates are marked unavailable after creation. 61 | * @param baseCoordinate Base coordinate of new parcel 62 | * @param path Path of new parcel 63 | */ 64 | function build(uint64 baseCoordinate, uint256[] memory path) internal { 65 | require( 66 | path.length > 0, 67 | "LibGeoWebParcel: Path must have at least one component" 68 | ); 69 | 70 | DiamondStorage storage ds = diamondStorage(); 71 | 72 | // Mark everything as available 73 | _updateAvailabilityIndex(Action.Build, baseCoordinate, path); 74 | 75 | LandParcel storage p = ds.landParcels[ds.nextId]; 76 | p.baseCoordinate = baseCoordinate; 77 | p.path = path; 78 | 79 | emit ParcelBuilt(ds.nextId); 80 | 81 | ds.nextId += 1; 82 | } 83 | 84 | /** 85 | * @notice Destroy an existing parcel. All coordinates along the path are marked as available. 86 | * @param id ID of land parcel 87 | */ 88 | function destroy(uint256 id) internal { 89 | DiamondStorage storage ds = diamondStorage(); 90 | 91 | LandParcel storage p = ds.landParcels[id]; 92 | 93 | _updateAvailabilityIndex(Action.Destroy, p.baseCoordinate, p.path); 94 | 95 | delete ds.landParcels[id]; 96 | 97 | emit ParcelDestroyed(id); 98 | } 99 | 100 | /** 101 | * @notice The next ID to assign to a parcel 102 | */ 103 | function nextId() internal view returns (uint256) { 104 | DiamondStorage storage ds = diamondStorage(); 105 | return ds.nextId; 106 | } 107 | 108 | /// @dev Update availability index by traversing a path and marking everything as available or unavailable 109 | function _updateAvailabilityIndex( 110 | Action action, 111 | uint64 baseCoordinate, 112 | uint256[] memory path 113 | ) private { 114 | DiamondStorage storage ds = diamondStorage(); 115 | 116 | uint64 currentCoord = baseCoordinate; 117 | 118 | uint256 pI = 0; 119 | uint256 currentPath = path[pI]; 120 | 121 | (uint256 iX, uint256 iY, uint256 i) = currentCoord.toWordIndex(); 122 | uint256 word = ds.availabilityIndex[iX][iY]; 123 | 124 | do { 125 | if (action == Action.Build) { 126 | // Check if coordinate is available 127 | require( 128 | (word & (2**i) == 0), 129 | "LibGeoWebParcel: Coordinate is not available" 130 | ); 131 | 132 | // Mark coordinate as unavailable in memory 133 | word = word | (2**i); 134 | } else if (action == Action.Destroy) { 135 | // Mark coordinate as available in memory 136 | word = word & ((2**i) ^ MAX_INT); 137 | } 138 | 139 | // Get next direction 140 | bool hasNext; 141 | LibGeoWebCoordinate.Direction direction; 142 | (hasNext, direction, currentPath) = currentPath.nextDirection(); 143 | 144 | if (!hasNext) { 145 | // Try next path 146 | pI += 1; 147 | if (pI >= path.length) { 148 | break; 149 | } 150 | currentPath = path[pI]; 151 | (hasNext, direction, currentPath) = currentPath.nextDirection(); 152 | } 153 | 154 | // Traverse to next coordinate 155 | uint256 newIX; 156 | uint256 newIY; 157 | (currentCoord, newIX, newIY, i) = currentCoord.traverse( 158 | direction, 159 | iX, 160 | iY, 161 | i 162 | ); 163 | 164 | // If new coordinate is in new word 165 | if (newIX != iX || newIY != iY) { 166 | // Update word in storage 167 | ds.availabilityIndex[iX][iY] = word; 168 | 169 | // Advance to next word 170 | word = ds.availabilityIndex[newIX][newIY]; 171 | } 172 | 173 | iX = newIX; 174 | iY = newIY; 175 | } while (true); 176 | 177 | // Update last word in storage 178 | ds.availabilityIndex[iX][iY] = word; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /contracts/registry/libraries/LibGeoWebParcelV2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "./LibGeoWebParcel.sol"; 5 | import "./LibGeoWebCoordinate.sol"; 6 | 7 | uint256 constant MAX_PARCEL_DIM = 200; 8 | 9 | library LibGeoWebParcelV2 { 10 | using LibGeoWebCoordinate for uint64; 11 | 12 | bytes32 private constant STORAGE_POSITION = 13 | keccak256("diamond.standard.diamond.storage.LibGeoWebParcelV2"); 14 | 15 | /// @dev Structure of a land parcel 16 | struct LandParcel { 17 | uint64 swCoordinate; 18 | uint256 lngDim; 19 | uint256 latDim; 20 | } 21 | 22 | struct DiamondStorage { 23 | /// @notice Stores which coordinates belong to a parcel 24 | mapping(uint256 => LandParcel) landParcels; 25 | } 26 | 27 | function diamondStorage() 28 | internal 29 | pure 30 | returns (DiamondStorage storage ds) 31 | { 32 | bytes32 position = STORAGE_POSITION; 33 | // solhint-disable-next-line no-inline-assembly 34 | assembly { 35 | ds.slot := position 36 | } 37 | } 38 | 39 | /** 40 | * @notice Build a new parcel. All coordinates along the path must be available. All coordinates are marked unavailable after creation. 41 | * @param parcel New parcel 42 | */ 43 | function build(LandParcel memory parcel) internal { 44 | require( 45 | parcel.latDim <= MAX_PARCEL_DIM && parcel.latDim > 0, 46 | "LibGeoWebParcel: Latitude dimension out of bounds" 47 | ); 48 | require( 49 | parcel.lngDim <= MAX_PARCEL_DIM && parcel.lngDim > 0, 50 | "LibGeoWebParcel: Longitude dimension out of bounds" 51 | ); 52 | 53 | LibGeoWebParcel.DiamondStorage storage dsV1 = LibGeoWebParcel 54 | .diamondStorage(); 55 | DiamondStorage storage dsV2 = diamondStorage(); 56 | 57 | // Mark everything as available 58 | _updateAvailabilityIndex(parcel); 59 | 60 | dsV2.landParcels[dsV1.nextId] = parcel; 61 | 62 | emit LibGeoWebParcel.ParcelBuilt(dsV1.nextId); 63 | 64 | dsV1.nextId += 1; 65 | } 66 | 67 | /// @dev Update availability index by traversing a path and marking everything as available or unavailable 68 | function _updateAvailabilityIndex(LandParcel memory parcel) private { 69 | LibGeoWebParcel.DiamondStorage storage dsV1 = LibGeoWebParcel 70 | .diamondStorage(); 71 | 72 | uint64 currentCoord = parcel.swCoordinate; 73 | 74 | (uint256 iX, uint256 iY, uint256 i) = currentCoord.toWordIndex(); 75 | uint256 word = dsV1.availabilityIndex[iX][iY]; 76 | 77 | LibGeoWebCoordinate.Direction lngDir = LibGeoWebCoordinate 78 | .Direction 79 | .East; 80 | 81 | for (uint256 lat = 0; lat < parcel.latDim; lat++) { 82 | for (uint256 lng = 0; lng < parcel.lngDim; lng++) { 83 | // Check if coordinate is available 84 | require( 85 | (word & (2**i) == 0), 86 | "LibGeoWebParcel: Coordinate is not available" 87 | ); 88 | 89 | // Mark coordinate as unavailable in memory 90 | word = word | (2**i); 91 | 92 | // Get next direction 93 | LibGeoWebCoordinate.Direction direction; 94 | if (lng < parcel.lngDim - 1) { 95 | direction = lngDir; 96 | } else if (lat < parcel.latDim - 1) { 97 | direction = LibGeoWebCoordinate.Direction.North; 98 | if (lngDir == LibGeoWebCoordinate.Direction.East) { 99 | lngDir = LibGeoWebCoordinate.Direction.West; 100 | } else { 101 | lngDir = LibGeoWebCoordinate.Direction.East; 102 | } 103 | } else { 104 | break; 105 | } 106 | 107 | // Traverse to next coordinate 108 | uint256 newIX; 109 | uint256 newIY; 110 | (currentCoord, newIX, newIY, i) = currentCoord.traverse( 111 | direction, 112 | iX, 113 | iY, 114 | i 115 | ); 116 | 117 | // If new coordinate is in new word 118 | if (newIX != iX || newIY != iY) { 119 | // Update word in storage 120 | dsV1.availabilityIndex[iX][iY] = word; 121 | 122 | // Advance to next word 123 | word = dsV1.availabilityIndex[newIX][newIY]; 124 | } 125 | 126 | iX = newIX; 127 | iY = newIY; 128 | } 129 | } 130 | 131 | // Update last word in storage 132 | dsV1.availabilityIndex[iX][iY] = word; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /contracts/registry/libraries/LibPCOLicenseClaimer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | library LibPCOLicenseClaimer { 5 | bytes32 private constant STORAGE_POSITION = 6 | keccak256("diamond.standard.diamond.storage.LibPCOLicenseClaimer"); 7 | 8 | struct DiamondStorage { 9 | /// @notice start time of the genesis land parcel auction. 10 | uint256 auctionStart; 11 | /// @notice when the required bid amount reaches its minimum value. 12 | uint256 auctionEnd; 13 | /// @notice start price of the genesis land auction. Decreases to endingBid between auctionStart and auctionEnd. 14 | uint256 startingBid; 15 | /// @notice the final/minimum required bid reached and maintained at the end of the auction. 16 | uint256 endingBid; 17 | /// @notice The beacon contract for PCO licenses 18 | address beacon; 19 | /// @notice Beacon proxies for each license 20 | mapping(uint256 => address) beaconProxies; 21 | /// @notice User salts for deterministic proxy addresses 22 | mapping(address => uint256) userSalts; 23 | } 24 | 25 | function diamondStorage() 26 | internal 27 | pure 28 | returns (DiamondStorage storage ds) 29 | { 30 | bytes32 position = STORAGE_POSITION; 31 | // solhint-disable-next-line no-inline-assembly 32 | assembly { 33 | ds.slot := position 34 | } 35 | } 36 | 37 | /** 38 | * @notice the current dutch auction price of a parcel. 39 | */ 40 | function _requiredBid() internal view returns (uint256) { 41 | DiamondStorage storage ds = diamondStorage(); 42 | if (block.timestamp > ds.auctionEnd) { 43 | return ds.endingBid; 44 | } 45 | 46 | uint256 timeElapsed = block.timestamp - ds.auctionStart; 47 | uint256 auctionDuration = ds.auctionEnd - ds.auctionStart; 48 | uint256 priceDecrease = ((ds.startingBid - ds.endingBid) * 49 | timeElapsed) / auctionDuration; 50 | return ds.startingBid - priceDecrease; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /contracts/registry/libraries/LibPCOLicenseParams.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; 5 | import {CFAv1Library} from "@superfluid-finance/ethereum-contracts/contracts/apps/CFAv1Library.sol"; 6 | import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol"; 7 | import "../../beneficiary/interfaces/ICFABeneficiary.sol"; 8 | 9 | library LibPCOLicenseParams { 10 | bytes32 private constant STORAGE_POSITION = 11 | keccak256("diamond.standard.diamond.storage.LibPCOLicenseParams"); 12 | 13 | struct DiamondStorage { 14 | /// @notice Beneficiary of funds. 15 | ICFABeneficiary beneficiary; 16 | /// @notice Payment token. 17 | ISuperToken paymentToken; 18 | /// @notice Superfluid host 19 | ISuperfluid host; 20 | /// @notice The numerator of the network-wide per second contribution fee. 21 | uint256 perSecondFeeNumerator; 22 | /// @notice The denominator of the network-wide per second contribution fee. 23 | uint256 perSecondFeeDenominator; 24 | /// @notice The numerator of the penalty to pay to reject a bid. 25 | uint256 penaltyNumerator; 26 | /// @notice The denominator of the penalty to pay to reject a bid. 27 | uint256 penaltyDenominator; 28 | /// @notice Bid period length in seconds 29 | uint256 bidPeriodLengthInSeconds; 30 | /// @notice when the required bid amount reaches its minimum value. 31 | uint256 reclaimAuctionLength; 32 | /// @notice Minimum for sale price 33 | uint256 minForSalePrice; 34 | } 35 | 36 | function diamondStorage() 37 | internal 38 | pure 39 | returns (DiamondStorage storage ds) 40 | { 41 | bytes32 position = STORAGE_POSITION; 42 | // solhint-disable-next-line no-inline-assembly 43 | assembly { 44 | ds.slot := position 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /contracts/registry/libraries/test/LibGeoWebCoordinate.test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.16; 3 | 4 | import "../LibGeoWebCoordinate.sol"; 5 | 6 | library LibGeoWebCoordinateTest { 7 | uint64 public constant MAX_X = ((2**23) - 1); 8 | uint64 public constant MAX_Y = ((2**22) - 1); 9 | 10 | function traverse( 11 | uint64 origin, 12 | uint256 direction, 13 | uint256 iX, 14 | uint256 iY, 15 | uint256 i 16 | ) 17 | external 18 | pure 19 | returns ( 20 | uint64, 21 | uint256, 22 | uint256, 23 | uint256 24 | ) 25 | { 26 | return 27 | LibGeoWebCoordinate.traverse( 28 | origin, 29 | LibGeoWebCoordinate.Direction(direction), 30 | iX, 31 | iY, 32 | i 33 | ); 34 | } 35 | 36 | function toWordIndex(uint64 coord) 37 | external 38 | pure 39 | returns ( 40 | uint256 iX, 41 | uint256 iY, 42 | uint256 i 43 | ) 44 | { 45 | return LibGeoWebCoordinate.toWordIndex(coord); 46 | } 47 | } 48 | 49 | /// @notice LibGeoWebCoordinatePath stores a path of directions in a uint256. The most significant 8 bits encodes the length of the path 50 | library LibGeoWebCoordinatePathTest { 51 | function nextDirection(uint256 path) 52 | external 53 | pure 54 | returns ( 55 | bool hasNext, 56 | uint256 direction, 57 | uint256 nextPath 58 | ) 59 | { 60 | LibGeoWebCoordinate.Direction directionT; 61 | (hasNext, directionT, nextPath) = LibGeoWebCoordinatePath.nextDirection( 62 | path 63 | ); 64 | direction = uint256(directionT); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /docs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Geo-Web-Project/core-contracts/8d5c461982d33775f5ec610063847c21218f3c8f/docs/.gitkeep -------------------------------------------------------------------------------- /docs/actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Geo-Web-Project/core-contracts/8d5c461982d33775f5ec610063847c21218f3c8f/docs/actions.png -------------------------------------------------------------------------------- /docs/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Geo-Web-Project/core-contracts/8d5c461982d33775f5ec610063847c21218f3c8f/docs/architecture.png -------------------------------------------------------------------------------- /echidna-config.yaml: -------------------------------------------------------------------------------- 1 | cryticArgs: ["--solc-remaps", "@=node_modules/@"] 2 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "locked": { 5 | "lastModified": 1667395993, 6 | "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", 7 | "owner": "numtide", 8 | "repo": "flake-utils", 9 | "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "numtide", 14 | "repo": "flake-utils", 15 | "type": "github" 16 | } 17 | }, 18 | "nixpkgs": { 19 | "locked": { 20 | "lastModified": 1697206931, 21 | "narHash": "sha256-TBska1WiZ3nvX6Je+C4zh5zDhGRm0yHy8DEu1lE8GBE=", 22 | "owner": "NixOS", 23 | "repo": "nixpkgs", 24 | "rev": "9b795d9d4a0114d7aa4bba5fcc17c29b043a5c78", 25 | "type": "github" 26 | }, 27 | "original": { 28 | "owner": "NixOS", 29 | "ref": "nixpkgs-23.05-darwin", 30 | "repo": "nixpkgs", 31 | "type": "github" 32 | } 33 | }, 34 | "root": { 35 | "inputs": { 36 | "flake-utils": "flake-utils", 37 | "nixpkgs": "nixpkgs" 38 | } 39 | } 40 | }, 41 | "root": "root", 42 | "version": 7 43 | } 44 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A basic flake with a shell"; 3 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin"; 4 | inputs.flake-utils.url = "github:numtide/flake-utils"; 5 | 6 | outputs = { self, nixpkgs, flake-utils }: 7 | flake-utils.lib.eachDefaultSystem (system: 8 | let pkgs = import nixpkgs { 9 | overlays = [ (final: prev: { 10 | nodejs = prev.nodejs-16_x; 11 | }) ]; 12 | inherit system; 13 | }; 14 | in { 15 | devShells.default = pkgs.mkShell { 16 | nativeBuildInputs = [ pkgs.yarn pkgs.nodejs-16_x pkgs.python310Packages.crytic-compile pkgs.solc-select pkgs.slither-analyzer ]; 17 | buildInputs = [ ]; 18 | }; 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /hardhat.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @type import('hardhat/config').HardhatUserConfig 3 | */ 4 | 5 | import * as dotenv from "dotenv"; 6 | 7 | if (process.env.NODE_ENV !== "production") { 8 | dotenv.config(); 9 | } 10 | 11 | import "@nomiclabs/hardhat-ethers"; 12 | import "@nomiclabs/hardhat-web3"; 13 | import "@nomiclabs/hardhat-waffle"; 14 | import "hardhat-deploy"; 15 | import "@openzeppelin/hardhat-upgrades"; 16 | import "@typechain/hardhat"; 17 | import "hardhat-abi-exporter"; 18 | import "solidity-coverage"; 19 | import "./tasks/estimate_minting_gas"; 20 | import "./tasks/initialize-defender"; 21 | import "./tasks/initialize-eoa"; 22 | import "./tasks/upgrade-beneficiary"; 23 | import "./tasks/upgrades/4_1_0"; 24 | import "./tasks/upgrades/4_1_1"; 25 | import "./tasks/upgrades/4_1_5"; 26 | import "./tasks/upgrades/4_2_0"; 27 | import "./tasks/upgrades/4_3_0"; 28 | import "hardhat-gas-reporter"; 29 | import "@nomiclabs/hardhat-etherscan"; 30 | import "solidity-docgen"; 31 | 32 | const networks: any = { 33 | local: { 34 | url: `http://localhost:1248`, 35 | }, 36 | }; 37 | 38 | if (process.env.INFURA_KEY) { 39 | if (process.env.DEV_PRIVATE_KEY) { 40 | networks["goerli"] = { 41 | url: `https://goerli.infura.io/v3/${process.env.INFURA_KEY}`, 42 | chainId: 5, 43 | accounts: [process.env.DEV_PRIVATE_KEY], 44 | }; 45 | networks["op-goerli"] = { 46 | url: `https://optimism-goerli.infura.io/v3/${process.env.INFURA_KEY}`, 47 | chainId: 420, 48 | accounts: [process.env.DEV_PRIVATE_KEY], 49 | }; 50 | networks["sepolia"] = { 51 | url: `https://endpoints.omniatech.io/v1/eth/sepolia/public`, 52 | chainId: 11155111, 53 | accounts: [process.env.DEV_PRIVATE_KEY], 54 | }; 55 | networks["op-sepolia"] = { 56 | url: `https://opt-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_TESTNET_KEY}`, 57 | chainId: 11155420, 58 | accounts: [process.env.DEV_PRIVATE_KEY], 59 | gasPrice: 1000000000, 60 | }; 61 | } else { 62 | console.warn("Missing env.DEV_PRIVATE_KEY"); 63 | } 64 | } else { 65 | console.warn("Missing env.INFURA_KEY"); 66 | } 67 | 68 | module.exports = { 69 | networks, 70 | solidity: { 71 | version: "0.8.16", 72 | settings: { 73 | optimizer: { 74 | enabled: true, 75 | }, 76 | }, 77 | }, 78 | abiExporter: { 79 | path: "./abi", 80 | clear: true, 81 | }, 82 | gasReporter: { 83 | enabled: process.env.REPORT_GAS ? true : false, 84 | outputFile: "./gas-report.out", 85 | }, 86 | etherscan: { 87 | apiKey: process.env.ETHERSCAN_API_KEY, 88 | customChains: [ 89 | { 90 | network: "op-sepolia", 91 | chainId: 11155420, 92 | urls: { 93 | apiURL: "https://api-sepolia-optimism.etherscan.io/api", 94 | browserURL: "https://sepolia-optimism.etherscan.io", 95 | }, 96 | }, 97 | ], 98 | }, 99 | namedAccounts: { 100 | diamondAdmin: { 101 | default: 0, 102 | 5: "0x9c2516a3700B2A5D3a8E72f5dBf4aFDa268D0316", 103 | 10: "0x8FC4308da9310479dF48ef77142Eef05c363e099", 104 | 420: "0xfF5Be16460704eFd0263dB1444Eaa216b77477c5", 105 | 11155420: "0xfF5Be16460704eFd0263dB1444Eaa216b77477c5", 106 | 11155111: 0, 107 | }, 108 | user: { 109 | default: 1, 110 | }, 111 | bidder: { 112 | default: 2, 113 | }, 114 | other: { 115 | default: 3, 116 | }, 117 | treasury: { 118 | 5: "0x9c2516a3700B2A5D3a8E72f5dBf4aFDa268D0316", 119 | 10: "0x8FC4308da9310479dF48ef77142Eef05c363e099", 120 | 420: "0xfF5Be16460704eFd0263dB1444Eaa216b77477c5", 121 | 11155111: 0, 122 | 11155420: "0xfF5Be16460704eFd0263dB1444Eaa216b77477c5", 123 | 31337: 0, 124 | }, 125 | deployer: { 126 | default: 0, 127 | }, 128 | }, 129 | }; 130 | -------------------------------------------------------------------------------- /mythril-solc.json: -------------------------------------------------------------------------------- 1 | { 2 | "remappings": [ 3 | "@superfluid-finance/=/tmp/node_modules/@superfluid-finance/", 4 | "@openzeppelin/=/tmp/node_modules/@openzeppelin/", 5 | "@solidstate/=/tmp/node_modules/@solidstate/" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@geo-web/contracts", 3 | "license": "MIT", 4 | "version": "4.3.1", 5 | "description": "GeoWeb solidity contracts, artifacts, & types", 6 | "author": "GeoWebCore", 7 | "homepage": "https://www.geoweb.network/", 8 | "main": "dist/src/index.js", 9 | "types": "dist/src/index.d.ts", 10 | "scripts": { 11 | "lint": "yarn lint:ts && yarn lint:sol", 12 | "lint:fix": "yarn lint:ts:fix && yarn lint:sol:fix", 13 | "lint:ts": "eslint --ext ts --ignore-path .gitignore .", 14 | "lint:ts:fix": "eslint --ext ts --ignore-path .gitignore . --fix", 15 | "lint:sol": "solhint 'contracts/**/*.sol' && prettier -c 'contracts/**/*.sol'", 16 | "lint:sol:fix": "prettier --write \"contracts/**/*.sol\"", 17 | "build": "yarn build:sol && yarn build:abi && yarn build:ts", 18 | "build:ts": "npx tsc --build tsconfig.build.json", 19 | "build:abi": "npx hardhat export-abi", 20 | "build:sol": "npx hardhat compile", 21 | "tests:run": "npx hardhat test", 22 | "tests:coverage": "npx hardhat coverage" 23 | }, 24 | "dependencies": { 25 | "@openzeppelin/contracts": "^4.7.0", 26 | "@superfluid-finance/ethereum-contracts": "1.9.0", 27 | "@truffle/hdwallet-provider": "^1.1.1", 28 | "bn.js": "^5.1.3", 29 | "date-fns": "^2.28.0", 30 | "remixd": "^0.2.4-alpha.0" 31 | }, 32 | "devDependencies": { 33 | "@defi-wonderland/smock": "^2.0.7", 34 | "@gnosis.pm/safe-core-sdk": "^3.1.1", 35 | "@gnosis.pm/safe-ethers-adapters": "^0.1.0-alpha.11", 36 | "@gnosis.pm/safe-ethers-lib": "^1.6.1", 37 | "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers", 38 | "@nomiclabs/hardhat-etherscan": "^3.1.1", 39 | "@nomiclabs/hardhat-waffle": "^2.0.3", 40 | "@nomiclabs/hardhat-web3": "^2.0.0", 41 | "@openzeppelin/contracts-upgradeable": "^4.7.0", 42 | "@openzeppelin/hardhat-upgrades": "^1.9.0", 43 | "@openzeppelin/test-helpers": "^0.5.15", 44 | "@openzeppelin/truffle-upgrades": "^1.3.1", 45 | "@solidstate/contracts": "^0.0.42", 46 | "@superfluid-finance/sdk-core": "^0.5.6", 47 | "@typechain/ethers-v5": "^9.0.0", 48 | "@typechain/hardhat": "^4.0.0", 49 | "@types/chai": "^4.3.0", 50 | "@types/chai-as-promised": "^7.1.5", 51 | "@types/mocha": "^9.1.0", 52 | "@types/node": "^17.0.13", 53 | "@typescript-eslint/eslint-plugin": "^5.36.2", 54 | "@typescript-eslint/parser": "^5.36.2", 55 | "chai": "^4.3.4", 56 | "chai-as-promised": "^7.1.1", 57 | "coveralls": "^3.1.1", 58 | "defender-admin-client": "^1.33.0", 59 | "diamond-diff": "^1.0.11", 60 | "dotenv": "^14.3.2", 61 | "eslint": "^8.23.0", 62 | "eslint-config-prettier": "^8.5.0", 63 | "eslint-plugin-mocha": "^10.1.0", 64 | "eslint-plugin-prettier": "^4.2.1", 65 | "ethereum-waffle": "^3.4.0", 66 | "ethers": "^5.6.9", 67 | "graphql": "^16.3.0", 68 | "hardhat": "^2.9.2", 69 | "hardhat-abi-exporter": "^2.8.0", 70 | "hardhat-deploy": "^0.11.11", 71 | "hardhat-gas-reporter": "^1.0.9", 72 | "js-geo-web-coordinate": "^0.2.0", 73 | "prettier": "^2.7.1", 74 | "prettier-plugin-solidity": "^1.0.0-dev.23", 75 | "shx": "^0.3.4", 76 | "solhint": "^3.3.7", 77 | "solhint-plugin-prettier": "^0.0.5", 78 | "solidity-coverage": "^0.7.17", 79 | "solidity-docgen": "^0.6.0-beta.29", 80 | "ts-node": "^10.4.0", 81 | "typechain": "^7.0.0", 82 | "typescript": "^4.5.4", 83 | "web3": "^1.7.0" 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /scripts/deploy.ts: -------------------------------------------------------------------------------- 1 | const hre = require("hardhat"); 2 | import { Contract, Signer } from "ethers"; 3 | import { ethers } from "hardhat"; 4 | import { DiamondWritable } from "../typechain-types/DiamondWritable"; 5 | import { Ownable } from "../typechain-types/Ownable"; 6 | const { getSelectors, FacetCutAction } = require("./libraries/diamond.js"); 7 | 8 | export async function deployDiamond( 9 | name: string, 10 | { 11 | facets, 12 | from, 13 | owner, 14 | }: { facets: string[]; from: string | Signer; owner: string } 15 | ) { 16 | from = typeof from === "string" ? await ethers.getSigner(from) : from; 17 | 18 | const DiamondInit = await ethers.getContractFactory(name); 19 | const diamondInit = await DiamondInit.connect(from).deploy(); 20 | await diamondInit.deployed(); 21 | console.log(`${name} deployed:`, diamondInit.address); 22 | 23 | // Deploy facets and set the `facetCuts` variable 24 | console.log(""); 25 | console.log("Deploying facets"); 26 | // The `facetCuts` variable is the FacetCut[] that contains the functions to add during diamond deployment 27 | const facetCuts = []; 28 | for (const FacetName of facets) { 29 | const Facet = await ethers.getContractFactory(FacetName); 30 | const facet = await Facet.connect(from).deploy(); 31 | await facet.deployed(); 32 | console.log(`${FacetName} deployed: ${facet.address}`); 33 | facetCuts.push({ 34 | target: facet.address, 35 | action: FacetCutAction.Add, 36 | selectors: getSelectors(facet), 37 | }); 38 | } 39 | 40 | const target = ethers.constants.AddressZero; 41 | const data = "0x"; 42 | 43 | // Cut diamond 44 | await (diamondInit as DiamondWritable) 45 | .connect(from) 46 | .diamondCut(facetCuts, target, data); 47 | console.log(); 48 | console.log("Diamond deployed:", diamondInit.address); 49 | 50 | // Set owner 51 | if ((await from.getAddress()) !== owner) { 52 | await (diamondInit as Ownable).connect(from).transferOwnership(owner); 53 | } 54 | 55 | return await ethers.getContractAt(`I${name}`, diamondInit.address); 56 | } 57 | 58 | async function deployBeaconDiamond() { 59 | const { diamondAdmin, deployer } = await hre.getNamedAccounts(); 60 | 61 | console.log(); 62 | console.log("Deploying PCOLicenseDiamond"); 63 | const beaconDiamond = await deployDiamond("PCOLicenseDiamond", { 64 | facets: ["CFABasePCOFacet", "CFAPenaltyBidFacet", "CFAReclaimerFacet"], 65 | owner: diamondAdmin, 66 | from: deployer, 67 | }); 68 | 69 | console.log("PCOLicenseDiamond deployed: ", beaconDiamond.address); 70 | return beaconDiamond; 71 | } 72 | 73 | async function deployRegistryDiamond() { 74 | // await hre.network.provider.request({ 75 | // method: "wallet_switchEthereumChain", 76 | // params: [{ chainId: 11155420 }], 77 | // }); 78 | 79 | const { diamondAdmin, deployer } = await hre.getNamedAccounts(); 80 | 81 | await deployBeaconDiamond(); 82 | 83 | console.log(); 84 | console.log("Deploying RegistryDiamond"); 85 | const registryDiamond = await deployDiamond("RegistryDiamond", { 86 | facets: [ 87 | "PCOLicenseClaimerFacetV2", 88 | "GeoWebParcelFacetV2", 89 | "PCOLicenseParamsFacet", 90 | "PCOERC721Facet", 91 | ], 92 | owner: diamondAdmin, 93 | from: deployer, 94 | }); 95 | console.log("RegistryDiamond deployed: ", registryDiamond.address); 96 | } 97 | 98 | async function deploy() { 99 | await deployRegistryDiamond(); 100 | } 101 | 102 | if (require.main === module) { 103 | deploy() 104 | .then(() => process.exit(0)) 105 | .catch((error) => { 106 | console.error(error); 107 | process.exit(1); 108 | }); 109 | } 110 | -------------------------------------------------------------------------------- /scripts/libraries/diamond.js: -------------------------------------------------------------------------------- 1 | /* global ethers */ 2 | 3 | const FacetCutAction = { Add: 0, Replace: 1, Remove: 2 }; 4 | 5 | async function checkSelectorCount(contract, expected) { 6 | const actual = await getSelectorCount(contract); 7 | console.assert(actual === expected, "Incorrect selector count"); 8 | } 9 | 10 | async function getSelectorCount(contract) { 11 | const facets = await contract.facets(); 12 | return facets.reduce((p, c) => { 13 | return p + c.selectors.length; 14 | }, 0); 15 | } 16 | 17 | // get function selectors from ABI 18 | function getSelectors(contract, erc165 = false) { 19 | const signatures = Object.keys(contract.interface.functions); 20 | const selectors = signatures.reduce((acc, val) => { 21 | if (val !== "init(bytes)" && (erc165 || val !== "supportsInterface(bytes4)")) { 22 | acc.push(contract.interface.getSighash(val)); 23 | } 24 | return acc;z 25 | }, []); 26 | return selectors; 27 | } 28 | 29 | // get function selector from function signature 30 | function getSelector(func) { 31 | const abiInterface = new ethers.utils.Interface([func]); 32 | return abiInterface.getSighash(ethers.utils.Fragment.from(func)); 33 | } 34 | 35 | // used with getSelectors to remove selectors from an array of selectors 36 | // functionNames argument is an array of function signatures 37 | function remove(functionNames) { 38 | const selectors = this.filter((v) => { 39 | for (const functionName of functionNames) { 40 | if (v === this.contract.interface.getSighash(functionName)) { 41 | return false; 42 | } 43 | } 44 | return true; 45 | }); 46 | selectors.contract = this.contract; 47 | selectors.remove = this.remove; 48 | selectors.get = this.get; 49 | return selectors; 50 | } 51 | 52 | // used with getSelectors to get selectors from an array of selectors 53 | // functionNames argument is an array of function signatures 54 | function get(functionNames) { 55 | const selectors = this.filter((v) => { 56 | for (const functionName of functionNames) { 57 | if (v === this.contract.interface.getSighash(functionName)) { 58 | return true; 59 | } 60 | } 61 | return false; 62 | }); 63 | selectors.contract = this.contract; 64 | selectors.remove = this.remove; 65 | selectors.get = this.get; 66 | return selectors; 67 | } 68 | 69 | // remove selectors using an array of signatures 70 | function removeSelectors(selectors, signatures) { 71 | const iface = new ethers.utils.Interface( 72 | signatures.map((v) => "function " + v) 73 | ); 74 | const removeSelectors = signatures.map((v) => iface.getSighash(v)); 75 | selectors = selectors.filter((v) => !removeSelectors.includes(v)); 76 | return selectors; 77 | } 78 | 79 | // find a particular address position in the return value of diamondLoupeFacet.facets() 80 | function findAddressPositionInFacets(facetAddress, facets) { 81 | for (let i = 0; i < facets.length; i++) { 82 | if (facets[i].facetAddress === facetAddress) { 83 | return i; 84 | } 85 | } 86 | } 87 | 88 | exports.checkSelectorCount = checkSelectorCount; 89 | exports.getSelectorCount = getSelectorCount; 90 | exports.getSelectors = getSelectors; 91 | exports.getSelector = getSelector; 92 | exports.FacetCutAction = FacetCutAction; 93 | exports.remove = remove; 94 | exports.removeSelectors = removeSelectors; 95 | exports.findAddressPositionInFacets = findAddressPositionInFacets; 96 | -------------------------------------------------------------------------------- /slither.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "filter_paths": "(node_modules/|.*\\.test\\.sol)", 3 | "solc_remaps": [ 4 | "@superfluid-finance/=node_modules/@superfluid-finance/", 5 | "@openzeppelin/=node_modules/@openzeppelin/", 6 | "@solidstate/=node_modules/@solidstate/" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { default as IRegistryDiamondABI } from "../abi/contracts/registry/interfaces/IRegistryDiamond.sol/IRegistryDiamond.json"; 2 | export { default as IPCOLicenseDiamondABI } from "../abi/contracts/pco-license/interfaces/IPCOLicenseDiamond.sol/IPCOLicenseDiamond.json"; 3 | 4 | export { IRegistryDiamond__factory as RegistryDiamondFactory } from "../typechain-types/factories/IRegistryDiamond__factory"; 5 | export { IPCOLicenseDiamond__factory as PCOLicenseDiamondFactory } from "../typechain-types/factories/IPCOLicenseDiamond__factory"; 6 | -------------------------------------------------------------------------------- /tasks/bid-example.ts: -------------------------------------------------------------------------------- 1 | import { Framework } from "@superfluid-finance/sdk-core"; 2 | import { BigNumber, ethers } from "ethers"; 3 | import { task } from "hardhat/config"; 4 | 5 | enum Action { 6 | CLAIM, 7 | BID, 8 | } 9 | 10 | task("example:bid") 11 | .addParam("superAppAddress", "AuctionSuperApp contract address") 12 | .addParam("licenseId", "License ID") 13 | .addParam("newForSalePrice", "New for sale price in ETH") 14 | .setAction( 15 | async ( 16 | { 17 | superAppAddress, 18 | licenseId, 19 | newForSalePrice, 20 | }: { 21 | superAppAddress: string; 22 | licenseId: string; 23 | newForSalePrice: string; 24 | }, 25 | hre 26 | ) => { 27 | const sf = await Framework.create({ 28 | networkName: hre.network.name, 29 | provider: hre.ethers.provider, 30 | }); 31 | const ethx = await sf.loadSuperToken("ETHx"); 32 | const newForSalePriceWei = ethers.utils.parseEther(newForSalePrice); 33 | 34 | const [admin] = await hre.ethers.getSigners(); 35 | 36 | const superApp = await hre.ethers.getContractAt( 37 | "AuctionSuperApp", 38 | superAppAddress 39 | ); 40 | 41 | const perSecondFeeNumerator = await superApp.perSecondFeeNumerator(); 42 | const perSecondFeeDenominator = await superApp.perSecondFeeDenominator(); 43 | 44 | const newContributionRate = newForSalePriceWei 45 | .mul(perSecondFeeNumerator) 46 | .div(perSecondFeeDenominator); 47 | 48 | // Approve ETHx amount above purchase price 49 | const approveOp = ethx.approve({ 50 | receiver: superApp.address, 51 | amount: newForSalePriceWei.toString(), 52 | }); 53 | 54 | const bidData = ethers.utils.defaultAbiCoder.encode( 55 | ["uint256"], 56 | [licenseId] 57 | ); 58 | const actionData = ethers.utils.defaultAbiCoder.encode( 59 | ["uint256", "bytes"], 60 | [newForSalePriceWei, bidData] 61 | ); 62 | const userData = ethers.utils.defaultAbiCoder.encode( 63 | ["uint8", "bytes"], 64 | [Action.BID, actionData] 65 | ); 66 | 67 | const existingFlow = await sf.cfaV1.getFlow({ 68 | sender: admin.address, 69 | receiver: superApp.address, 70 | superToken: ethx.address, 71 | providerOrSigner: admin, 72 | }); 73 | 74 | let op; 75 | if (BigNumber.from(existingFlow.flowRate).gt(0)) { 76 | op = await sf.cfaV1.updateFlow({ 77 | sender: admin.address, 78 | receiver: superApp.address, 79 | flowRate: BigNumber.from(existingFlow.flowRate) 80 | .add(newContributionRate) 81 | .toString(), 82 | superToken: ethx.address, 83 | userData: userData, 84 | }); 85 | } else { 86 | op = await sf.cfaV1.createFlow({ 87 | sender: admin.address, 88 | receiver: superApp.address, 89 | flowRate: newContributionRate.toString(), 90 | superToken: ethx.address, 91 | userData: userData, 92 | }); 93 | } 94 | 95 | // Perform these in a single batch call 96 | const batchCall = sf.batchCall([approveOp, op]); 97 | const txn = await batchCall.exec(admin); 98 | await txn.wait(); 99 | } 100 | ); 101 | -------------------------------------------------------------------------------- /tasks/claim_example.ts: -------------------------------------------------------------------------------- 1 | import BN from "bn.js"; 2 | import { BigNumber, ethers } from "ethers"; 3 | import { task, types } from "hardhat/config"; 4 | const GeoWebCoordinate = require("js-geo-web-coordinate"); 5 | 6 | function toBN(value: BigNumber): BN { 7 | const hex = BigNumber.from(value).toHexString(); 8 | if (hex[0] === "-") { 9 | return new BN("-" + hex.substring(3), 16); 10 | } 11 | return new BN(hex.substring(2), 16); 12 | } 13 | 14 | async function mintSquare(dim: number, GW: ethers.Contract) { 15 | // Global(160000, 17) -> Index(100000, 1), Local(0, 1) 16 | const coord1 = BigNumber.from(0).shl(32).or(BigNumber.from(0)); 17 | const coord2 = BigNumber.from(0 + dim) 18 | .shl(32) 19 | .or(BigNumber.from(dim)); 20 | 21 | const paths = GeoWebCoordinate.make_rect_path(toBN(coord1), toBN(coord2)).map( 22 | (v: BN) => { 23 | return BigNumber.from(v.toString(10)); 24 | } 25 | ); 26 | 27 | const response = await GW.build(coord1, paths); 28 | const receipt = await response.wait(); 29 | 30 | console.log( 31 | `Transaction of ${dim}x${dim} (${ 32 | dim * dim 33 | }) coordinates: https://kovan-optimistic.etherscan.io/tx/${ 34 | receipt.transactionHash 35 | }` 36 | ); 37 | } 38 | 39 | // task("example:claim") 40 | // .addParam("geoWebCoordinate", "GeoWebCoordinate contract address") 41 | // .addParam("geoWebCoordinatePath", "GeoWebCoordinatePath contract address") 42 | // .addParam("geoWebParcel", "GeoWebParcel contract address") 43 | // .setAction( 44 | // async ( 45 | // { 46 | // geoWebCoordinate, 47 | // geoWebCoordinatePath, 48 | // geoWebParcel, 49 | // }: { 50 | // geoWebCoordinate: string; 51 | // geoWebCoordinatePath: string; 52 | // geoWebParcel: string; 53 | // }, 54 | // hre 55 | // ) => { 56 | // const [admin] = await hre.ethers.getSigners(); 57 | 58 | // const gwCoor = await hre.ethers.getContractAt( 59 | // "GeoWebCoordinate", 60 | // geoWebCoordinate 61 | // ); 62 | // const gwCoorPath = await hre.ethers.getContractAt( 63 | // "GeoWebCoordinatePath", 64 | // geoWebCoordinatePath 65 | // ); 66 | // const GW = await hre.ethers.getContractAt("GeoWebParcel", geoWebParcel); 67 | 68 | // const buildRole = await GW.BUILD_ROLE(); 69 | 70 | // const result = await GW.grantRole(buildRole, admin.address); 71 | // await result.wait(); 72 | 73 | // await mintSquare(64, GW); 74 | // } 75 | // ); 76 | -------------------------------------------------------------------------------- /tasks/upgrade-beneficiary.ts: -------------------------------------------------------------------------------- 1 | import { ContractAddressOrInstance } from "@openzeppelin/hardhat-upgrades/dist/utils"; 2 | import { task } from "hardhat/config"; 3 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 4 | 5 | async function upgradeBeneficiarySuperApp( 6 | hre: HardhatRuntimeEnvironment, 7 | beneficiaryContractAddress: ContractAddressOrInstance 8 | ) { 9 | const { treasury, diamondAdmin, deployer } = await hre.getNamedAccounts(); 10 | 11 | console.log("Upgrading BeneficiarySuperApp"); 12 | const BeneficiarySuperApp = await hre.ethers.getContractFactory( 13 | "BeneficiarySuperApp" 14 | ); 15 | const beneSuperApp = await hre.upgrades.upgradeProxy( 16 | beneficiaryContractAddress, 17 | BeneficiarySuperApp 18 | ); 19 | console.log("BeneficiarySuperApp upgraded: ", beneSuperApp.address); 20 | } 21 | 22 | task("upgrade:eoa:beneficiarySuperApp") 23 | .addParam("beneficiaryContractAddress", "BeneficiarySuperApp address") 24 | .setAction( 25 | async ( 26 | { 27 | beneficiaryContractAddress, 28 | }: { 29 | beneficiaryContractAddress: string; 30 | }, 31 | hre 32 | ) => { 33 | // Switch network 34 | await hre.network.provider.request({ 35 | method: "wallet_switchEthereumChain", 36 | params: [{ chainId: 10 }], 37 | }); 38 | 39 | // await upgradeBeneficiarySuperApp(hre, beneficiaryContractAddress); 40 | 41 | await hre.upgrades.admin.changeProxyAdmin( 42 | "0x5aD276439E3772FDb6696B6cB61401902D4e8b72", 43 | "0x8FC4308da9310479dF48ef77142Eef05c363e099" 44 | ); 45 | } 46 | ); 47 | -------------------------------------------------------------------------------- /tasks/upgrades/4_1_5.ts: -------------------------------------------------------------------------------- 1 | /* 2 | v4.1.5 Upgrade 3 | 4 | RegistryDiamond 5 | =============== 6 | 7 | Facets to deploy: 8 | - PCOLicenseClaimerFacetV2 9 | 10 | Function selectors to REPLACE: 11 | - All of IPCOLicenseClaimerFacet -> PCOLicenseClaimerFacetV2 12 | 13 | =============== 14 | */ 15 | 16 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 17 | import { Contract } from "ethers"; 18 | const { 19 | FacetCutAction, 20 | getSelectors, 21 | } = require("../../scripts/libraries/diamond.js"); 22 | import { task } from "hardhat/config"; 23 | import { AdminClient } from "defender-admin-client"; 24 | 25 | async function deployFacets( 26 | hre: HardhatRuntimeEnvironment, 27 | registryDiamond: Contract, 28 | pcoLicenseClaimerV2?: Contract 29 | ) { 30 | const facetCuts = []; 31 | 32 | const PCOLicenseClaimerFacetV2 = await hre.ethers.getContractFactory( 33 | "PCOLicenseClaimerFacetV2" 34 | ); 35 | const pcoLicenseClaimerFacetV2 = 36 | pcoLicenseClaimerV2 ?? (await PCOLicenseClaimerFacetV2.deploy()); 37 | await pcoLicenseClaimerFacetV2.deployed(); 38 | console.log( 39 | `PCOLicenseClaimerFacetV2 deployed: ${pcoLicenseClaimerFacetV2.address}` 40 | ); 41 | 42 | const pcoLicenseClaimer = await hre.ethers.getContractAt( 43 | "IPCOLicenseClaimer", 44 | pcoLicenseClaimerFacetV2.address 45 | ); 46 | 47 | facetCuts.push({ 48 | target: pcoLicenseClaimerFacetV2.address, 49 | action: FacetCutAction.Replace, 50 | selectors: getSelectors(pcoLicenseClaimer), 51 | }); 52 | 53 | return facetCuts; 54 | } 55 | 56 | export async function upgrade( 57 | hre: HardhatRuntimeEnvironment, 58 | registryDiamond: Contract 59 | ) { 60 | const facetCuts = await deployFacets(hre, registryDiamond); 61 | 62 | const target = hre.ethers.constants.AddressZero; 63 | const data = "0x"; 64 | 65 | // Cut diamond 66 | const diamond = await hre.ethers.getContractAt( 67 | `IRegistryDiamond`, 68 | registryDiamond.address 69 | ); 70 | await diamond.diamondCut(facetCuts, target, data); 71 | console.log(`Diamond cut: ${diamond.address}`); 72 | } 73 | 74 | task("upgrade:4.1.5") 75 | .addParam("registryDiamondAddress", "RegistryDiamond address") 76 | .addOptionalParam("pcoLicenseClaimerV2Address", "PCOLicenseClaimerV2 address") 77 | .setAction( 78 | async ( 79 | { 80 | registryDiamondAddress, 81 | pcoLicenseClaimerV2Address, 82 | }: { 83 | registryDiamondAddress: string; 84 | pcoLicenseClaimerV2Address?: string; 85 | }, 86 | hre 87 | ) => { 88 | const { diamondAdmin } = await hre.getNamedAccounts(); 89 | 90 | // Create Defender client 91 | // const adminClient = new AdminClient({ 92 | // apiKey: process.env.DEFENDER_API_KEY!, 93 | // apiSecret: process.env.DEFENDER_API_SECRET!, 94 | // }); 95 | 96 | const registryDiamond = await hre.ethers.getContractAt( 97 | "IRegistryDiamond", 98 | registryDiamondAddress 99 | ); 100 | 101 | const pcoLicenseClaimerFacetV2 = pcoLicenseClaimerV2Address 102 | ? await hre.ethers.getContractAt( 103 | "IPCOLicenseClaimer", 104 | pcoLicenseClaimerV2Address 105 | ) 106 | : undefined; 107 | 108 | const facetCuts = await deployFacets( 109 | hre, 110 | registryDiamond, 111 | pcoLicenseClaimerFacetV2 112 | ); 113 | 114 | const target = hre.ethers.constants.AddressZero; 115 | const data = "0x"; 116 | 117 | console.log(facetCuts, target, data); 118 | 119 | // Cut diamond 120 | // await adminClient.createProposal({ 121 | // contract: { 122 | // address: registryDiamond.address, 123 | // network: NETWORKS[hre.network.config.chainId!] as any, 124 | // }, // Target contract 125 | // title: "Upgrade RegistryDiamond v4.1.0", // Title of the proposal 126 | // description: "Cut RegistryDiamond to upgrade to v4.1.0", // Description of the proposal 127 | // type: "custom", // Use 'custom' for custom admin actions 128 | // functionInterface: { 129 | // name: "diamondCut", 130 | // inputs: [ 131 | // { 132 | // components: [ 133 | // { 134 | // internalType: "address", 135 | // name: "target", 136 | // type: "address", 137 | // }, 138 | // { 139 | // internalType: "enum IDiamondWritable.FacetCutAction", 140 | // name: "action", 141 | // type: "uint8", 142 | // }, 143 | // { 144 | // internalType: "bytes4[]", 145 | // name: "selectors", 146 | // type: "bytes4[]", 147 | // }, 148 | // ], 149 | // internalType: "struct IDiamondWritable.FacetCut[]", 150 | // name: "facetCuts", 151 | // type: "tuple[]", 152 | // }, 153 | // { 154 | // internalType: "address", 155 | // name: "target", 156 | // type: "address", 157 | // }, 158 | // { 159 | // internalType: "bytes", 160 | // name: "data", 161 | // type: "bytes", 162 | // }, 163 | // ], 164 | // }, // Function ABI 165 | // functionInputs: [encodedFacetCuts, target, data], // Arguments to the function 166 | // via: diamondAdmin, // Address to execute proposal 167 | // viaType: "Gnosis Safe", // 'Gnosis Safe', 'Gnosis Multisig', or 'EOA' 168 | // }); 169 | } 170 | ); 171 | -------------------------------------------------------------------------------- /test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Geo-Web-Project/core-contracts/8d5c461982d33775f5ec610063847c21218f3c8f/test/.gitkeep -------------------------------------------------------------------------------- /test/pco-license/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Geo-Web-Project/core-contracts/8d5c461982d33775f5ec610063847c21218f3c8f/test/pco-license/.DS_Store -------------------------------------------------------------------------------- /test/registry/PCOERC721Facet.ts: -------------------------------------------------------------------------------- 1 | import chaiAsPromised from "chai-as-promised"; 2 | import { expect, use } from "chai"; 3 | import { ethers, getNamedAccounts, deployments, network } from "hardhat"; 4 | import { solidity } from "ethereum-waffle"; 5 | import { smock } from "@defi-wonderland/smock"; 6 | import { BigNumber } from "ethers"; 7 | import { rateToPurchasePrice } from "../shared"; 8 | import Fixtures from "../pco-license/CFABasePCO.fixture"; 9 | import { addDays, getUnixTime, startOfToday } from "date-fns"; 10 | 11 | use(solidity); 12 | use(chaiAsPromised); 13 | use(smock.matchers); 14 | 15 | describe("PCOERC721Facet", async function () { 16 | describe("updateTokenURI", async () => { 17 | it("should update tokenURI if current owner", async () => { 18 | const { erc721License } = await Fixtures.initializedWithRealLicense(); 19 | const { user } = await getNamedAccounts(); 20 | 21 | const txn = await erc721License 22 | .connect(await ethers.getSigner(user)) 23 | .updateTokenURI(0, "ipfs://test"); 24 | 25 | await txn.wait(); 26 | 27 | await expect(txn) 28 | .to.emit(erc721License, "TokenURIUpdated") 29 | .withArgs(0, "ipfs://test"); 30 | expect(await erc721License.tokenURI(0)).to.equal("ipfs://test"); 31 | }); 32 | 33 | it("should fail to update tokenURI if not current owner", async () => { 34 | const { erc721License } = await Fixtures.initializedWithRealLicense(); 35 | const { other } = await getNamedAccounts(); 36 | 37 | const txn = erc721License 38 | .connect(await ethers.getSigner(other)) 39 | .updateTokenURI(0, "ipfs://test"); 40 | 41 | await expect(txn).to.be.revertedWith( 42 | "ERC721: caller is not owner or approved" 43 | ); 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /test/registry/PCOLicenseClaimer.fixture.ts: -------------------------------------------------------------------------------- 1 | import { smock } from "@defi-wonderland/smock"; 2 | import { deployments, ethers } from "hardhat"; 3 | import { 4 | IDiamondReadable, 5 | IPCOLicenseParamsStore, 6 | } from "../../typechain-types"; 7 | import { perYearToPerSecondRate, setupSf } from "../shared"; 8 | import { addDays, getUnixTime, startOfToday } from "date-fns"; 9 | import { deployDiamond } from "../../scripts/deploy"; 10 | 11 | const setup = deployments.createFixture( 12 | async ({ getNamedAccounts, ethers }) => { 13 | const res = await setupSf(); 14 | const { ethx_erc20, sf } = res; 15 | 16 | const { diamondAdmin } = await getNamedAccounts(); 17 | const diamond = await deployDiamond("RegistryDiamond", { 18 | from: diamondAdmin, 19 | owner: diamondAdmin, 20 | facets: [ 21 | "PCOLicenseClaimerFacetV1", 22 | "GeoWebParcelFacetV1", 23 | "PCOLicenseParamsFacet", 24 | ], 25 | }); 26 | 27 | const pcoLicenseClaimer = await ethers.getContractAt( 28 | `IPCOLicenseClaimerV1`, 29 | diamond.address 30 | ); 31 | 32 | const { numerator, denominator } = perYearToPerSecondRate(0.1); 33 | 34 | await (diamond as IPCOLicenseParamsStore).initializeParams( 35 | diamondAdmin, 36 | ethx_erc20.address, 37 | sf.host.address, 38 | numerator, 39 | denominator, 40 | numerator, 41 | denominator, 42 | 60 * 60 * 24, 43 | 60 * 60 * 24, 44 | 0 45 | ); 46 | 47 | return { 48 | pcoLicenseClaimer, 49 | pcoLicenseParams: diamond as IPCOLicenseParamsStore, 50 | ...res, 51 | }; 52 | } 53 | ); 54 | 55 | const initialized = deployments.createFixture(async () => { 56 | const res = await setup(); 57 | const { pcoLicenseClaimer } = res; 58 | 59 | const mockFacet = await smock.fake("CFABasePCOFacet"); 60 | const mockBeacon = await smock.fake("IDiamondReadable"); 61 | 62 | mockBeacon.facetAddress.returns(mockFacet.address); 63 | 64 | await pcoLicenseClaimer.initializeClaimer(0, 0, 0, 0, mockBeacon.address); 65 | 66 | return res; 67 | }); 68 | 69 | const initializedWithAuction = deployments.createFixture(async () => { 70 | const res = await setup(); 71 | const { pcoLicenseClaimer } = res; 72 | 73 | const mockFacet = await smock.fake("CFABasePCOFacet"); 74 | const mockBeacon = await smock.fake("IDiamondReadable"); 75 | 76 | mockBeacon.facetAddress.returns(mockFacet.address); 77 | 78 | const today = getUnixTime(startOfToday()); 79 | const tenDaysFromNow = getUnixTime(addDays(startOfToday(), 10)); 80 | 81 | const startBid = ethers.utils.parseEther("10"); 82 | const endingBid = ethers.utils.parseEther("0"); 83 | 84 | await pcoLicenseClaimer.initializeClaimer( 85 | today, 86 | tenDaysFromNow, 87 | startBid, 88 | endingBid, 89 | mockBeacon.address 90 | ); 91 | 92 | return { ...res, today, tenDaysFromNow, startBid, endingBid }; 93 | }); 94 | 95 | export default { 96 | setup, 97 | initialized, 98 | initializedWithAuction, 99 | }; 100 | -------------------------------------------------------------------------------- /test/registry/PCOLicenseClaimerV2.fixture.ts: -------------------------------------------------------------------------------- 1 | import { smock } from "@defi-wonderland/smock"; 2 | import { deployments, ethers } from "hardhat"; 3 | import { 4 | IDiamondReadable, 5 | PCOLicenseParamsFacet, 6 | IPCOLicenseClaimerV1, 7 | IPCOLicenseClaimerV2, 8 | IPCOERC721, 9 | } from "../../typechain-types"; 10 | import { perYearToPerSecondRate, setupSf } from "../shared"; 11 | import { addDays, getUnixTime, startOfToday } from "date-fns"; 12 | import { deployDiamond } from "../../scripts/deploy"; 13 | 14 | const setup = deployments.createFixture(async ({ getNamedAccounts }) => { 15 | const res = await setupSf(); 16 | const { ethx_erc20, sf } = res; 17 | 18 | const { diamondAdmin } = await getNamedAccounts(); 19 | const diamond = await deployDiamond("RegistryDiamond", { 20 | from: diamondAdmin, 21 | owner: diamondAdmin, 22 | facets: [ 23 | "PCOLicenseClaimerFacetV2", 24 | "GeoWebParcelFacetV2", 25 | "PCOLicenseParamsFacet", 26 | ], 27 | }); 28 | 29 | const pcoLicenseClaimerV1 = await ethers.getContractAt( 30 | `IPCOLicenseClaimerV1`, 31 | diamond.address 32 | ); 33 | 34 | const pcoLicenseClaimerV2 = await ethers.getContractAt( 35 | `IPCOLicenseClaimerV2`, 36 | diamond.address 37 | ); 38 | 39 | const { numerator, denominator } = perYearToPerSecondRate(0.1); 40 | 41 | await diamond.initializeParams( 42 | diamondAdmin, 43 | ethx_erc20.address, 44 | sf.host.address, 45 | numerator, 46 | denominator, 47 | numerator, 48 | denominator, 49 | 60 * 60 * 24, 50 | 60 * 60 * 24, 51 | 0 52 | ); 53 | 54 | return { 55 | pcoLicenseClaimer: pcoLicenseClaimerV1 as IPCOLicenseClaimerV1, 56 | pcoLicenseClaimerV2: pcoLicenseClaimerV2 as IPCOLicenseClaimerV2, 57 | pcoLicenseParams: diamond as PCOLicenseParamsFacet, 58 | pcoERC721: diamond as IPCOERC721, 59 | ...res, 60 | }; 61 | }); 62 | 63 | const initialized = deployments.createFixture(async () => { 64 | const res = await setup(); 65 | const { pcoLicenseClaimer } = res; 66 | 67 | const mockFacet = await smock.fake("CFABasePCOFacet"); 68 | const mockBeacon = await smock.fake("IDiamondReadable"); 69 | 70 | mockBeacon.facetAddress.returns(mockFacet.address); 71 | 72 | await pcoLicenseClaimer.initializeClaimer(0, 0, 0, 0, mockBeacon.address); 73 | 74 | return res; 75 | }); 76 | 77 | const initializedWithAuction = deployments.createFixture(async () => { 78 | const res = await setup(); 79 | const { pcoLicenseClaimer } = res; 80 | 81 | const mockFacet = await smock.fake("CFABasePCOFacet"); 82 | const mockBeacon = await smock.fake("IDiamondReadable"); 83 | 84 | mockBeacon.facetAddress.returns(mockFacet.address); 85 | 86 | const today = getUnixTime(startOfToday()); 87 | const tenDaysFromNow = getUnixTime(addDays(startOfToday(), 10)); 88 | 89 | const startBid = ethers.utils.parseEther("10"); 90 | const endingBid = ethers.utils.parseEther("0"); 91 | 92 | await pcoLicenseClaimer.initializeClaimer( 93 | today, 94 | tenDaysFromNow, 95 | startBid, 96 | endingBid, 97 | mockBeacon.address 98 | ); 99 | 100 | return { ...res, today, tenDaysFromNow, startBid, endingBid }; 101 | }); 102 | 103 | export default { 104 | setup, 105 | initialized, 106 | initializedWithAuction, 107 | }; 108 | -------------------------------------------------------------------------------- /test/shared.ts: -------------------------------------------------------------------------------- 1 | import { web3 } from "hardhat"; 2 | import { Framework } from "@superfluid-finance/sdk-core"; 3 | import { BigNumber } from "ethers"; 4 | const SuperfluidSDK = require("@superfluid-finance/js-sdk"); 5 | const deployFramework = require("@superfluid-finance/ethereum-contracts/scripts/deploy-framework"); 6 | const deploySuperToken = require("@superfluid-finance/ethereum-contracts/scripts/deploy-super-token"); 7 | const deployTestToken = require("@superfluid-finance/ethereum-contracts/scripts/deploy-test-token"); 8 | import { deployments, getUnnamedAccounts } from "hardhat"; 9 | import { ISuperfluid } from "../typechain-types"; 10 | 11 | export const errorHandler = (err: any) => { 12 | if (err) throw err; 13 | }; 14 | 15 | export async function rateToPurchasePrice(paramsStore: any, rate: BigNumber) { 16 | const perSecondFeeNumerator = await paramsStore.getPerSecondFeeNumerator(); 17 | const perSecondFeeDenominator = 18 | await paramsStore.getPerSecondFeeDenominator(); 19 | 20 | return rate.mul(perSecondFeeDenominator).div(perSecondFeeNumerator); 21 | } 22 | 23 | export async function fromValueToRate(paramsStore: any, value: BigNumber) { 24 | const perSecondFeeNumerator = await paramsStore.getPerSecondFeeNumerator(); 25 | const perSecondFeeDenominator = 26 | await paramsStore.getPerSecondFeeDenominator(); 27 | 28 | return value.mul(perSecondFeeNumerator).div(perSecondFeeDenominator); 29 | } 30 | 31 | export function perYearToPerSecondRate(annualRate: number) { 32 | return { 33 | numerator: annualRate * 100, 34 | denominator: 60 * 60 * 24 * 365 * 100, 35 | }; 36 | } 37 | 38 | export const setupSf = deployments.createFixture( 39 | async ({ deployments, ethers }) => { 40 | await deployments.fixture("setupSf"); 41 | 42 | const accounts = await ethers.getSigners(); 43 | 44 | const [admin, user, bidder] = accounts; 45 | const uAccounts = await getUnnamedAccounts(); 46 | 47 | await deployFramework(errorHandler, { 48 | web3, 49 | from: admin.address, 50 | }); 51 | 52 | await deploySuperToken(errorHandler, [":", "ETH"], { 53 | web3, 54 | from: admin.address, 55 | }); 56 | 57 | await deployTestToken(errorHandler, [":", "fDAI"], { 58 | web3, 59 | from: admin.address, 60 | }); 61 | 62 | await deploySuperToken(errorHandler, [":", "fDAI"], { 63 | web3, 64 | from: admin.address, 65 | }); 66 | 67 | const sf = new SuperfluidSDK.Framework({ 68 | web3, 69 | version: "test", 70 | tokens: ["ETH", "fDAI"], 71 | }); 72 | await sf.initialize(); 73 | 74 | const ethersProvider = admin.provider!; 75 | const ethersjsSf: Framework = await Framework.create({ 76 | chainId: 31337, 77 | resolverAddress: sf.resolver.address, 78 | protocolReleaseVersion: "test", 79 | provider: ethersProvider, 80 | }); 81 | 82 | const ethx = await ethersjsSf.loadSuperToken(sf.tokens.ETHx.address); 83 | const ethx_erc20 = await ethers.getContractAt( 84 | "IERC20", 85 | sf.tokens.ETHx.address 86 | ); 87 | const hostContract: ISuperfluid = await ethers.getContractAt( 88 | "ISuperfluid", 89 | sf.host.address 90 | ); 91 | 92 | await sf.tokens.ETHx.upgradeByETH({ 93 | from: user.address, 94 | value: ethers.utils.parseEther("10"), 95 | }); 96 | 97 | await sf.tokens.ETHx.upgradeByETH({ 98 | from: bidder.address, 99 | value: ethers.utils.parseEther("10"), 100 | }); 101 | 102 | await sf.tokens.ETHx.upgradeByETH({ 103 | from: uAccounts[3], 104 | value: ethers.utils.parseEther("10"), 105 | }); 106 | 107 | return { 108 | paymentToken: ethx, 109 | ethx_erc20, 110 | ethersjsSf, 111 | sf, 112 | hostContract, 113 | }; 114 | } 115 | ); 116 | -------------------------------------------------------------------------------- /test/upgrades/4_1_0.ts: -------------------------------------------------------------------------------- 1 | import { use, expect } from "chai"; 2 | import { solidity } from "ethereum-waffle"; 3 | import { BigNumber } from "ethers"; 4 | import { upgrade } from "../../tasks/upgrades/4_1_0"; 5 | import Fixtures from "../registry/PCOLicenseClaimer.fixture"; 6 | import { rateToPurchasePrice } from "../shared"; 7 | import { ethers, getNamedAccounts, deployments } from "hardhat"; 8 | 9 | use(solidity); 10 | 11 | describe("Migration v4.1.0", async () => { 12 | const setupTest = deployments.createFixture(async (hre) => { 13 | const { getNamedAccounts, ethers } = hre; 14 | const res = await Fixtures.initialized(); 15 | const { pcoLicenseClaimer, pcoLicenseParams, ethersjsSf, paymentToken } = 16 | res; 17 | const { user } = await getNamedAccounts(); 18 | 19 | const coord = BigNumber.from(4).shl(32).or(BigNumber.from(33)); 20 | const contributionRate = ethers.utils 21 | .parseEther("9") 22 | .div(365 * 24 * 60 * 60 * 10); 23 | const forSalePrice = await rateToPurchasePrice( 24 | pcoLicenseParams, 25 | contributionRate 26 | ); 27 | 28 | // Approve payment token for buffer 29 | const requiredBuffer = await ethersjsSf.cfaV1.contract 30 | .connect(await ethers.getSigner(user)) 31 | .getDepositRequiredForFlowRate(paymentToken.address, contributionRate); 32 | const approveOp = paymentToken.approve({ 33 | receiver: pcoLicenseClaimer.address, 34 | amount: requiredBuffer.toString(), 35 | }); 36 | await approveOp.exec(await ethers.getSigner(user)); 37 | 38 | const txn = await pcoLicenseClaimer 39 | .connect(await ethers.getSigner(user)) 40 | .claim(contributionRate, forSalePrice, coord, [BigNumber.from(0)]); 41 | 42 | await txn.wait(); 43 | 44 | // Migrate 45 | const diamond = await ethers.getContractAt( 46 | `IRegistryDiamond`, 47 | pcoLicenseClaimer.address 48 | ); 49 | await upgrade(hre, diamond); 50 | 51 | const pcoLicenseClaimerV2 = await ethers.getContractAt( 52 | `IPCOLicenseClaimerV2`, 53 | diamond.address 54 | ); 55 | 56 | const geoWebParcelV1 = await ethers.getContractAt( 57 | `IGeoWebParcelV1`, 58 | diamond.address 59 | ); 60 | 61 | const geoWebParcelV2 = await ethers.getContractAt( 62 | `IGeoWebParcel`, 63 | diamond.address 64 | ); 65 | 66 | return { 67 | ...res, 68 | diamond, 69 | pcoLicenseClaimerV2, 70 | geoWebParcelV1, 71 | geoWebParcelV2, 72 | }; 73 | }); 74 | 75 | it("should fail to claim V1", async () => { 76 | const { pcoLicenseClaimer, pcoLicenseParams, ethersjsSf, paymentToken } = 77 | await setupTest(); 78 | const { user } = await getNamedAccounts(); 79 | 80 | const coord = BigNumber.from(5).shl(32).or(BigNumber.from(33)); 81 | const contributionRate = ethers.utils 82 | .parseEther("9") 83 | .div(365 * 24 * 60 * 60 * 10); 84 | const forSalePrice = await rateToPurchasePrice( 85 | pcoLicenseParams, 86 | contributionRate 87 | ); 88 | 89 | // Approve payment token for buffer 90 | const requiredBuffer = await ethersjsSf.cfaV1.contract 91 | .connect(await ethers.getSigner(user)) 92 | .getDepositRequiredForFlowRate(paymentToken.address, contributionRate); 93 | const approveOp = paymentToken.approve({ 94 | receiver: pcoLicenseClaimer.address, 95 | amount: requiredBuffer.toString(), 96 | }); 97 | await approveOp.exec(await ethers.getSigner(user)); 98 | 99 | const txn = pcoLicenseClaimer 100 | .connect(await ethers.getSigner(user)) 101 | .claim(contributionRate, forSalePrice, coord, [BigNumber.from(0)]); 102 | 103 | await expect(txn).to.be.revertedWith( 104 | "DiamondBase: no facet found for function signature" 105 | ); 106 | }); 107 | 108 | it("should read old parcel after migration", async () => { 109 | const { geoWebParcelV1 } = await setupTest(); 110 | 111 | const parcel = await geoWebParcelV1.getLandParcel(0); 112 | 113 | const coord = BigNumber.from(4).shl(32).or(BigNumber.from(33)); 114 | 115 | expect(parcel.baseCoordinate).to.equal(coord); 116 | }); 117 | 118 | it("should claim and read new parcel after migration", async () => { 119 | const { 120 | pcoLicenseClaimerV2, 121 | pcoLicenseClaimer, 122 | pcoLicenseParams, 123 | ethersjsSf, 124 | paymentToken, 125 | ethx_erc20, 126 | geoWebParcelV2, 127 | } = await setupTest(); 128 | const { user } = await getNamedAccounts(); 129 | 130 | const coord = BigNumber.from(5).shl(32).or(BigNumber.from(33)); 131 | const contributionRate = ethers.utils 132 | .parseEther("9") 133 | .div(365 * 24 * 60 * 60 * 10); 134 | const forSalePrice = await rateToPurchasePrice( 135 | pcoLicenseParams, 136 | contributionRate 137 | ); 138 | 139 | // Approve payment token for buffer 140 | const requiredBuffer = await ethersjsSf.cfaV1.contract 141 | .connect(await ethers.getSigner(user)) 142 | .getDepositRequiredForFlowRate(paymentToken.address, contributionRate); 143 | const approveOp = paymentToken.approve({ 144 | receiver: pcoLicenseClaimerV2.address, 145 | amount: requiredBuffer.toString(), 146 | }); 147 | await approveOp.exec(await ethers.getSigner(user)); 148 | 149 | const nextAddress = await pcoLicenseClaimer.getNextProxyAddress(user); 150 | 151 | const txn = await pcoLicenseClaimerV2 152 | .connect(await ethers.getSigner(user)) 153 | ["claim(int96,uint256,(uint64,uint256,uint256))"]( 154 | contributionRate, 155 | forSalePrice, 156 | [coord, 1, 1] 157 | ); 158 | 159 | await txn.wait(); 160 | 161 | await expect(txn) 162 | .to.emit(pcoLicenseClaimerV2, "ParcelClaimedV2") 163 | .withArgs(1, user); 164 | await expect(txn) 165 | .to.emit(ethx_erc20, "Transfer") 166 | .withArgs(user, nextAddress, requiredBuffer); 167 | 168 | const parcel = await geoWebParcelV2.getLandParcelV2(1); 169 | expect(parcel.swCoordinate).to.equal(coord); 170 | }); 171 | }); 172 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* 4 | * Uncomment for small accuracy reduction & vast build time reduction for 5 | * --watch mode 6 | */ 7 | // "assumeChangesOnlyAffectDirectDependencies": true, 8 | "allowSyntheticDefaultImports": true, 9 | "alwaysStrict": true, 10 | "declaration": true, 11 | "esModuleInterop": true, 12 | "resolveJsonModule": true, 13 | "forceConsistentCasingInFileNames": true, 14 | "incremental": true, 15 | "composite": true, 16 | "lib": ["esnext"], 17 | "module": "CommonJS", 18 | "moduleResolution": "node", 19 | "noImplicitThis":true, 20 | "outDir": "dist", 21 | "skipLibCheck": true, 22 | "strict": true, 23 | "strictNullChecks": true, 24 | "rootDirs": ["src", "typechain-types", "abi/**/*.json"], 25 | "target": "es6", 26 | }, 27 | "include": ["src", "typechain-types", "abi/**/*.json"], 28 | } 29 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["chai", "node"], 4 | "target": "es2018", 5 | "module": "commonjs", 6 | "strict": true, 7 | "resolveJsonModule": true, 8 | "esModuleInterop": true, 9 | "outDir": "dist", 10 | }, 11 | "include": [ 12 | "./deploy", 13 | "./test", 14 | "./tasks", 15 | "./src", 16 | "./typechain-types", 17 | "./abi/**/*.json" 18 | ], 19 | "files": [ 20 | "./hardhat.config.ts" 21 | ] 22 | } 23 | --------------------------------------------------------------------------------