├── deployments ├── bsc │ └── .chainId ├── goerli │ └── .chainId ├── base │ └── .chainId ├── bsctest │ └── .chainId ├── celo │ └── .chainId ├── ethereum │ └── .chainId ├── masa │ └── .chainId ├── mumbai │ └── .chainId ├── opbnb │ └── .chainId ├── polygon │ └── .chainId ├── scroll │ └── .chainId ├── alfajores │ └── .chainId ├── basegoerli │ └── .chainId ├── masatest │ └── .chainId ├── opbnbtest │ └── .chainId └── scrolltest │ └── .chainId ├── .gitattributes ├── .env.network.secret.example ├── .prettierignore ├── docs ├── reference │ ├── Strings.md │ ├── Address.md │ ├── Math.md │ ├── SignedMath.md │ ├── ECDSA.md │ ├── SafeMath.md │ ├── Counters.md │ ├── SafeERC20.md │ ├── Context.md │ ├── ReentrancyGuard.md │ ├── IERC165.md │ ├── IERC5267.md │ ├── ERC165.md │ ├── StorageSlot.md │ ├── ShortStrings.md │ ├── EIP712.md │ ├── ISBT.md │ ├── SBT.md │ ├── IUniswapRouter.md │ ├── SBTBurnable.md │ ├── ISoulName.md │ ├── ISBTMetadata.md │ ├── ILinkableSBT.md │ ├── IERC20Permit.md │ ├── ISBTEnumerable.md │ └── SBTEnumerable.md ├── elin │ └── contracts │ │ ├── utils │ │ ├── Strings.md │ │ ├── Address.md │ │ ├── math │ │ │ ├── Math.md │ │ │ ├── SignedMath.md │ │ │ └── SafeMath.md │ │ ├── cryptography │ │ │ ├── ECDSA.md │ │ │ └── EIP712.md │ │ ├── Counters.md │ │ ├── Context.md │ │ ├── introspection │ │ │ ├── IERC165.md │ │ │ └── ERC165.md │ │ ├── StorageSlot.md │ │ └── ShortStrings.md │ │ ├── token │ │ ├── ERC20 │ │ │ ├── utils │ │ │ │ └── SafeERC20.md │ │ │ └── extensions │ │ │ │ └── IERC20Permit.md │ │ └── ERC721 │ │ │ └── IERC721Receiver.md │ │ ├── security │ │ ├── ReentrancyGuard.md │ │ └── Pausable.md │ │ ├── interfaces │ │ └── IERC5267.md │ │ └── access │ │ └── Ownable.md ├── libraries │ └── Utils.md ├── tokens │ └── SBT │ │ ├── ISBT.md │ │ ├── SBT.md │ │ └── extensions │ │ ├── SBTBurnable.md │ │ ├── ISBTMetadata.md │ │ ├── ISBTEnumerable.md │ │ └── SBTEnumerable.md └── interfaces │ ├── dex │ └── IUniswapRouter.md │ ├── ISoulName.md │ └── ILinkableSBT.md ├── .deepsource.toml ├── .prettierrc ├── .solhint.json ├── metadata ├── Masa_OpenSea_Profile_Logo_400x400.png ├── Masa_OpenSea_Profile_Banner_1400x350.jpg ├── Masa_OpenSea_Profile_Banner_1400x350.png ├── Masa_OpenSea_Profile_Featured_600x400.jpg ├── Masa_OpenSea_Profile_Logo_400x400.txt ├── goerli │ ├── SoulName.json │ └── SoulName.txt ├── mainnet │ ├── SoulName.json │ └── SoulName.txt ├── Masa_OpenSea_Profile_Banner_1400x350.txt └── Masa_OpenSea_Profile_Featured_600x400.txt ├── .auto-changelog ├── .env.example ├── .github ├── CODEOWNERS ├── workflows │ ├── publish-npm.yml │ ├── test.yml │ └── publish-to-docs.yml ├── dependabot.yml └── ISSUE_TEMPLATE │ └── bug-bounty-report.md ├── .npmignore ├── contracts ├── interfaces │ ├── ILinkableSBT.sol │ ├── ISoulboundIdentity.sol │ ├── ISoulName.sol │ └── dex │ │ └── IUniswapRouter.sol ├── tokens │ ├── SBT │ │ ├── extensions │ │ │ ├── ISBTMetadata.sol │ │ │ ├── SBTBurnable.sol │ │ │ └── ISBTEnumerable.sol │ │ └── ISBT.sol │ └── MasaSBTAuthority.sol ├── libraries │ ├── Errors.sol │ └── Utils.sol └── reference │ └── ReferenceSBTSelfSovereign.sol ├── tsconfig.json ├── .env.network.example ├── LICENSE ├── src ├── addresses.ts ├── EnvParams.ts ├── deployDynamicSSSBT.ts ├── deploySSSBT.ts └── deployASBT.ts ├── .env.polygon ├── .env.base ├── .env.masa ├── .env.masatest ├── .env.mumbai ├── .env.opbnb ├── .env.opbnbtest ├── .env.scroll ├── .env.scrolltest ├── .env.basegoerli ├── .env.bsc ├── .env.ethereum ├── .env.bsctest ├── .env.celo ├── .env.alfajores ├── .env.hardhat ├── .env.sepolia ├── deploy ├── SoulboundIdentity.ts ├── SoulName.ts ├── SoulLinker.ts └── SoulboundGreen.ts ├── .gitignore ├── addresses.json ├── README.md └── package.json /deployments/bsc/.chainId: -------------------------------------------------------------------------------- 1 | 56 -------------------------------------------------------------------------------- /deployments/goerli/.chainId: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /deployments/base/.chainId: -------------------------------------------------------------------------------- 1 | 8453 -------------------------------------------------------------------------------- /deployments/bsctest/.chainId: -------------------------------------------------------------------------------- 1 | 97 -------------------------------------------------------------------------------- /deployments/celo/.chainId: -------------------------------------------------------------------------------- 1 | 42220 -------------------------------------------------------------------------------- /deployments/ethereum/.chainId: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /deployments/masa/.chainId: -------------------------------------------------------------------------------- 1 | 13396 -------------------------------------------------------------------------------- /deployments/mumbai/.chainId: -------------------------------------------------------------------------------- 1 | 80001 -------------------------------------------------------------------------------- /deployments/opbnb/.chainId: -------------------------------------------------------------------------------- 1 | 204 -------------------------------------------------------------------------------- /deployments/polygon/.chainId: -------------------------------------------------------------------------------- 1 | 137 -------------------------------------------------------------------------------- /deployments/scroll/.chainId: -------------------------------------------------------------------------------- 1 | 534352 -------------------------------------------------------------------------------- /deployments/alfajores/.chainId: -------------------------------------------------------------------------------- 1 | 44787 -------------------------------------------------------------------------------- /deployments/basegoerli/.chainId: -------------------------------------------------------------------------------- 1 | 84531 -------------------------------------------------------------------------------- /deployments/masatest/.chainId: -------------------------------------------------------------------------------- 1 | 103454 -------------------------------------------------------------------------------- /deployments/opbnbtest/.chainId: -------------------------------------------------------------------------------- 1 | 5611 -------------------------------------------------------------------------------- /deployments/scrolltest/.chainId: -------------------------------------------------------------------------------- 1 | 534351 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /.env.network.secret.example: -------------------------------------------------------------------------------- 1 | DEPLOYER_PRIVATE_KEY=XXX 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | package-lock.json 4 | coverage 5 | dist 6 | typechain 7 | -------------------------------------------------------------------------------- /docs/reference/Strings.md: -------------------------------------------------------------------------------- 1 | # Strings 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *String operations.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/Strings.md: -------------------------------------------------------------------------------- 1 | # Strings 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *String operations.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "javascript" 5 | 6 | [analyzers.meta] 7 | environment = ["nodejs"] 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/Address.md: -------------------------------------------------------------------------------- 1 | # Address 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Collection of functions related to the address type* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/reference/Math.md: -------------------------------------------------------------------------------- 1 | # Math 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Standard math utilities missing in the Solidity language.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "prettier-plugin-solidity" 4 | ], 5 | "semi": true, 6 | "singleQuote": false, 7 | "trailingComma": "none" 8 | } 9 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:default", 3 | "plugins": [ 4 | "prettier" 5 | ], 6 | "rules": { 7 | "prettier/prettier": "error" 8 | } 9 | } -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Logo_400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masa-finance/masa-contracts-identity/HEAD/metadata/Masa_OpenSea_Profile_Logo_400x400.png -------------------------------------------------------------------------------- /docs/elin/contracts/utils/Address.md: -------------------------------------------------------------------------------- 1 | # Address 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Collection of functions related to the address type* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Banner_1400x350.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masa-finance/masa-contracts-identity/HEAD/metadata/Masa_OpenSea_Profile_Banner_1400x350.jpg -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Banner_1400x350.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masa-finance/masa-contracts-identity/HEAD/metadata/Masa_OpenSea_Profile_Banner_1400x350.png -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Featured_600x400.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masa-finance/masa-contracts-identity/HEAD/metadata/Masa_OpenSea_Profile_Featured_600x400.jpg -------------------------------------------------------------------------------- /docs/elin/contracts/utils/math/Math.md: -------------------------------------------------------------------------------- 1 | # Math 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Standard math utilities missing in the Solidity language.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/reference/SignedMath.md: -------------------------------------------------------------------------------- 1 | # SignedMath 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Standard signed math utilities missing in the Solidity language.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/math/SignedMath.md: -------------------------------------------------------------------------------- 1 | # SignedMath 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Standard signed math utilities missing in the Solidity language.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.auto-changelog: -------------------------------------------------------------------------------- 1 | { 2 | "commitLimit": false, 3 | "ignoreCommitPattern": "^(build|Bump|chore|ci|docs|refactor|style|test|Initial.*|Merge.*)", 4 | "output": "CHANGELOG.md", 5 | "template": "compact", 6 | "unreleased": false 7 | } -------------------------------------------------------------------------------- /docs/libraries/Utils.md: -------------------------------------------------------------------------------- 1 | # Utils 2 | 3 | *Masa Finance* 4 | 5 | > Utilities library for Masa Contracts Identity repository 6 | 7 | Library of utilities for Masa Contracts Identity repository 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | COINMARKETCAP_API_KEY=XXX 2 | ANKR_API_KEY=XXX 3 | ETHERSCAN_API_KEY=XXX 4 | BSCSCAN_API_KEY=XXX 5 | POLYGONSCAN_API_KEY=XXX 6 | CELOSCAN_API_KEY=XXX 7 | OPBNB_API_KEY=XXX 8 | BASESCAN_API_KEY=XXX 9 | SCROLLSCAN_API_KEY=XXX 10 | GITHUB_TOKEN=XXX 11 | -------------------------------------------------------------------------------- /docs/reference/ECDSA.md: -------------------------------------------------------------------------------- 1 | # ECDSA 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holder of the private keys of a given address.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/reference/SafeMath.md: -------------------------------------------------------------------------------- 1 | # SafeMath 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Wrappers over Solidity's arithmetic operations. NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler now has built in overflow checking.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/math/SafeMath.md: -------------------------------------------------------------------------------- 1 | # SafeMath 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Wrappers over Solidity's arithmetic operations. NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler now has built in overflow checking.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/cryptography/ECDSA.md: -------------------------------------------------------------------------------- 1 | # ECDSA 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holder of the private keys of a given address.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Logo_400x400.txt: -------------------------------------------------------------------------------- 1 | #1: 2 | Hash: 2e407f943770f7fdcbcead6b1a1cd5bd3c4bbb4cd7ee0560cb76bc88a7917989 3 | 4 | https://arweave.app/tx/HPdpPIgOC_0GCSt63F4682bYEVIFhfkzeYKi7SgPxMU 5 | https://arweave.net/HPdpPIgOC_0GCSt63F4682bYEVIFhfkzeYKi7SgPxMU 6 | ar://HPdpPIgOC_0GCSt63F4682bYEVIFhfkzeYKi7SgPxMU 7 | -------------------------------------------------------------------------------- /docs/reference/Counters.md: -------------------------------------------------------------------------------- 1 | # Counters 2 | 3 | *Matt Condon (@shrugs)* 4 | 5 | > Counters 6 | 7 | 8 | 9 | *Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number of elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;`* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/Counters.md: -------------------------------------------------------------------------------- 1 | # Counters 2 | 3 | *Matt Condon (@shrugs)* 4 | 5 | > Counters 6 | 7 | 8 | 9 | *Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number of elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;`* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | # For details on acceptable file patterns, please refer to the [Github Documentation](https://help.github.com/articles/about-codeowners/) 4 | 5 | # default owners, overridden by package specific owners below 6 | * @masa-finance/smart-contracts 7 | 8 | # directory and file-level owners. Feel free to add to this! 9 | -------------------------------------------------------------------------------- /metadata/goerli/SoulName.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Masa Soul Name", 3 | "description": "Masa Soul Names are a domain name for your web3 soulbound identity. Your Soulbound Identity and Soul Name will serve as your passport to the world of web3.", 4 | "image": "ar://HPdpPIgOC_0GCSt63F4682bYEVIFhfkzeYKi7SgPxMU", 5 | "external_link": "https://app.masa.finance", 6 | "seller_fee_basis_points": 500, 7 | "fee_recipient": "0xA38dd237a3A8D50537B74a4B0D4E7E8A5359386F" 8 | } 9 | -------------------------------------------------------------------------------- /metadata/mainnet/SoulName.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Masa Soul Name", 3 | "description": "Masa Soul Names are a domain name for your web3 soulbound identity. Your Soulbound Identity and Soul Name will serve as your passport to the world of web3.", 4 | "image": "ar://HPdpPIgOC_0GCSt63F4682bYEVIFhfkzeYKi7SgPxMU", 5 | "external_link": "https://app.masa.finance", 6 | "seller_fee_basis_points": 500, 7 | "fee_recipient": "0xccfA6a842151F53e18a5D56eDfD0177fA8C8D7F5" 8 | } 9 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .github/ 2 | artifacts/ 3 | !artifacts/contracts/reference/ReferenceSBTAuthority.sol/ReferenceSBTAuthority.json 4 | !artifacts/contracts/reference/ReferenceSBTSelfSovereign.sol/ReferenceSBTSelfSovereign.json 5 | cache/ 6 | deploy/ 7 | deployments/ 8 | docs/ 9 | metadata/ 10 | node_modules/ 11 | src/ 12 | test/ 13 | .env.* 14 | .gitattributes 15 | .npmignore 16 | .prettierignore 17 | .prettierrc 18 | .solhint.json 19 | CHANGELOG.md 20 | **/solcInputs/ 21 | -------------------------------------------------------------------------------- /contracts/interfaces/ILinkableSBT.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "../tokens/SBT/ISBT.sol"; 5 | 6 | interface ILinkableSBT is ISBT { 7 | function addLinkPrice() external view returns (uint256); 8 | 9 | function addLinkPriceMASA() external view returns (uint256); 10 | 11 | function queryLinkPrice() external view returns (uint256); 12 | 13 | function queryLinkPriceMASA() external view returns (uint256); 14 | } 15 | -------------------------------------------------------------------------------- /docs/reference/SafeERC20.md: -------------------------------------------------------------------------------- 1 | # SafeERC20 2 | 3 | 4 | 5 | > SafeERC20 6 | 7 | 8 | 9 | *Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/token/ERC20/utils/SafeERC20.md: -------------------------------------------------------------------------------- 1 | # SafeERC20 2 | 3 | 4 | 5 | > SafeERC20 6 | 7 | 8 | 9 | *Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/reference/Context.md: -------------------------------------------------------------------------------- 1 | # Context 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/Context.md: -------------------------------------------------------------------------------- 1 | # Context 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metadata/mainnet/SoulName.txt: -------------------------------------------------------------------------------- 1 | #1: 2 | Hash: 88cc3348deb2cea8d92840f17e66462362cca241d9fe8a64cb24cac41295d788 3 | 4 | https://arweave.app/tx/xK3QKClL-U_p6WLH4SGDX-6Z9cHLqbkpPyoZ4a86D50 5 | https://arweave.net/xK3QKClL-U_p6WLH4SGDX-6Z9cHLqbkpPyoZ4a86D50 6 | ar://xK3QKClL-U_p6WLH4SGDX-6Z9cHLqbkpPyoZ4a86D50 7 | 8 | #2: 9 | Hash: e930ea8546f0f24a651c5e3a9ea6d9f8dce21985eaac53058dc0bac162d635fd 10 | 11 | https://arweave.app/tx/vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 12 | https://arweave.net/vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 13 | ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 14 | -------------------------------------------------------------------------------- /.github/workflows/publish-npm.yml: -------------------------------------------------------------------------------- 1 | name: Publish NPM package 2 | 3 | on: 4 | release: 5 | types: [ created ] 6 | 7 | jobs: 8 | publish-npm: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | - uses: actions/setup-node@v4 13 | with: 14 | cache: 'yarn' 15 | node-version: '18' 16 | registry-url: 'https://registry.npmjs.org' 17 | - run: yarn install --frozen-lockfile 18 | - run: yarn build 19 | - run: yarn publish --access public 20 | env: 21 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Banner_1400x350.txt: -------------------------------------------------------------------------------- 1 | #1: 2 | Hash: e6b6c52dbe49e247637d3fdcfcae29d66f7889330c0eaf74bc2992bdd9da8094 3 | 4 | https://arweave.app/tx/xXXfYW6gvjfItVw2ryfv95LI0DJpd6qUu1hvyzJ9XP8 5 | https://arweave.net/xXXfYW6gvjfItVw2ryfv95LI0DJpd6qUu1hvyzJ9XP8 6 | ar://xXXfYW6gvjfItVw2ryfv95LI0DJpd6qUu1hvyzJ9XP8 7 | 8 | #2: 9 | Hash: bc88e64e60b5f83c781fed2e1978fc9e4caf2d42ed7dff2f393706bc19d94aa0 10 | 11 | https://arweave.app/tx/RR_98oQnKRsee8Vfkg-4maJsi_Krxx-3KomP_FfLiFg 12 | https://arweave.net/RR_98oQnKRsee8Vfkg-4maJsi_Krxx-3KomP_FfLiFg 13 | ar://RR_98oQnKRsee8Vfkg-4maJsi_Krxx-3KomP_FfLiFg 14 | -------------------------------------------------------------------------------- /metadata/Masa_OpenSea_Profile_Featured_600x400.txt: -------------------------------------------------------------------------------- 1 | #1: 2 | Hash: be3b1af59eed6872c18d6021cd5b5049e947b925ccc7d69e2428d6f62f09f893 3 | 4 | https://arweave.app/tx/-rwt-1XOQsOm4YB8eIolQb9qhckbyqkMRV4Hm-iAaxc 5 | https://arweave.net/-rwt-1XOQsOm4YB8eIolQb9qhckbyqkMRV4Hm-iAaxc 6 | ar://-rwt-1XOQsOm4YB8eIolQb9qhckbyqkMRV4Hm-iAaxc 7 | 8 | #2: 9 | Hash: 099ee508007a735425ec1662bff7235e35b137a3cfd5e3433ef7d04efc032ef0 10 | 11 | https://arweave.app/tx/qO8n8EM75nbVRForuHUO8mKeihEvn8G64pruZaHGPi8 12 | https://arweave.net/qO8n8EM75nbVRForuHUO8mKeihEvn8G64pruZaHGPi8 13 | ar://qO8n8EM75nbVRForuHUO8mKeihEvn8G64pruZaHGPi8 14 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | tags: 8 | - '**' 9 | pull_request: 10 | branches: 11 | - '**' 12 | 13 | jobs: 14 | test: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: actions/setup-node@v4 21 | with: 22 | cache: 'yarn' 23 | node-version: '18' 24 | - run: yarn 25 | - run: yarn compile 26 | - run: sleep 10 27 | - run: yarn test 28 | env: 29 | ANKR_API_KEY: ${{ secrets.ANKR_API_KEY }} 30 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | reviewers: 13 | - "masa-finance/smart-contracts" 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "CommonJS", 5 | "outDir": "dist", 6 | "declaration": true, 7 | "strict": true, 8 | "resolveJsonModule": true, 9 | "esModuleInterop": true, 10 | "rootDirs": [ 11 | "./test" 12 | ], 13 | "skipLibCheck": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "useUnknownInCatchVariables": false, 16 | "noImplicitAny": false 17 | }, 18 | "include": [ 19 | "./typechain", 20 | "./src", 21 | "./test" 22 | ], 23 | "exclude": [ 24 | "./node_modules/*" 25 | ], 26 | "files": [ 27 | "./hardhat.config.ts" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /contracts/tokens/SBT/extensions/ISBTMetadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "../ISBT.sol"; 5 | 6 | /** 7 | * @title SBT Soulbound Token Standard, optional metadata extension 8 | */ 9 | interface ISBTMetadata is ISBT { 10 | /** 11 | * @dev Returns the token collection name. 12 | */ 13 | function name() external view returns (string memory); 14 | 15 | /** 16 | * @dev Returns the token collection symbol. 17 | */ 18 | function symbol() external view returns (string memory); 19 | 20 | /** 21 | * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. 22 | */ 23 | function tokenURI(uint256 tokenId) external view returns (string memory); 24 | } 25 | -------------------------------------------------------------------------------- /docs/reference/ReentrancyGuard.md: -------------------------------------------------------------------------------- 1 | # ReentrancyGuard 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/security/ReentrancyGuard.md: -------------------------------------------------------------------------------- 1 | # ReentrancyGuard 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /contracts/tokens/SBT/extensions/SBTBurnable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "@openzeppelin/contracts/utils/Context.sol"; 5 | 6 | import "../SBT.sol"; 7 | 8 | /** 9 | * @title SBT Burnable Token 10 | * @dev SBT Token that can be burned (destroyed). 11 | */ 12 | abstract contract SBTBurnable is Context, SBT { 13 | /** 14 | * @dev Burns `tokenId`. See {SBT-_burn}. 15 | * 16 | * Requirements: 17 | * 18 | * - The caller must own `tokenId` or be an approved operator. 19 | */ 20 | function burn(uint256 tokenId) public virtual { 21 | //solhint-disable-next-line max-line-length 22 | require( 23 | _isOwner(_msgSender(), tokenId), 24 | "SBT: caller is not token owner" 25 | ); 26 | _burn(tokenId); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metadata/goerli/SoulName.txt: -------------------------------------------------------------------------------- 1 | #1: 2 | Hash: d4cb1d6d627c5dd841dc6154e5e293ced99b1423757efc1c77f4c4c6692c7f83 3 | 4 | https://arweave.app/tx/0QKTgWhM7PDoRZabeJeguoYypaSolRlqhChkKSI3GHw 5 | https://arweave.net/0QKTgWhM7PDoRZabeJeguoYypaSolRlqhChkKSI3GHw 6 | ar://0QKTgWhM7PDoRZabeJeguoYypaSolRlqhChkKSI3GHw 7 | 8 | #2: 9 | Hash: 3c0ec46b626b04dcdfc63c494a1185ab27f1d55181137f85108e097e225a1d8a 10 | 11 | https://arweave.app/tx/M6CTrV07E0yffM-LAy7CQEp2JbhQTaadApTAtZw4llY 12 | https://arweave.net/M6CTrV07E0yffM-LAy7CQEp2JbhQTaadApTAtZw4llY 13 | ar://M6CTrV07E0yffM-LAy7CQEp2JbhQTaadApTAtZw4llY 14 | 15 | #3: 16 | Hash: 9d92253b2324964342fed5df35062cf352222492b8d106d33427e45e136b3354 17 | 18 | https://arweave.app/tx/bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 19 | https://arweave.net/bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 20 | ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 21 | -------------------------------------------------------------------------------- /.github/workflows/publish-to-docs.yml: -------------------------------------------------------------------------------- 1 | name: Publish to Docs 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | container: pandoc/latex 11 | steps: 12 | - uses: actions/checkout@v4 13 | - name: Copy Readme and Changelog 14 | run: | 15 | cp README.md docs 16 | cp CHANGELOG.md docs 17 | - name: Pushes to another repository 18 | uses: cpina/github-action-push-to-another-repository@main 19 | env: 20 | API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 21 | with: 22 | source-directory: 'docs' 23 | target-directory: 'docs/developers/identity-contracts' 24 | destination-github-username: 'masa-finance' 25 | destination-repository-name: 'docs' 26 | user-email: 13647606+H34D@users.noreply.github.com 27 | target-branch: main 28 | -------------------------------------------------------------------------------- /contracts/tokens/SBT/extensions/ISBTEnumerable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "../ISBT.sol"; 5 | 6 | /** 7 | * @title SBT Soulbound Token Standard, optional enumeration extension 8 | */ 9 | interface ISBTEnumerable is ISBT { 10 | /** 11 | * @dev Returns the total amount of tokens stored by the contract. 12 | */ 13 | function totalSupply() external view returns (uint256); 14 | 15 | /** 16 | * @dev Returns a token ID owned by `owner` at a given `index` of its token list. 17 | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. 18 | */ 19 | function tokenOfOwnerByIndex( 20 | address owner, 21 | uint256 index 22 | ) external view returns (uint256); 23 | 24 | /** 25 | * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. 26 | * Use along with {totalSupply} to enumerate all tokens. 27 | */ 28 | function tokenByIndex(uint256 index) external view returns (uint256); 29 | } 30 | -------------------------------------------------------------------------------- /docs/reference/IERC165.md: -------------------------------------------------------------------------------- 1 | # IERC165 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.* 10 | 11 | ## Methods 12 | 13 | ### supportsInterface 14 | 15 | ```solidity 16 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 17 | ``` 18 | 19 | 20 | 21 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | interfaceId | bytes4 | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | bool | undefined | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /contracts/interfaces/ISoulboundIdentity.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "../tokens/SBT/ISBT.sol"; 5 | import "./ISoulName.sol"; 6 | 7 | interface ISoulboundIdentity is ISBT { 8 | function mint(address to) external payable returns (uint256); 9 | 10 | function mint( 11 | address paymentMethod, 12 | address to 13 | ) external payable returns (uint256); 14 | 15 | function mintIdentityWithName( 16 | address to, 17 | string memory name, 18 | uint256 yearsPeriod, 19 | string memory _tokenURI 20 | ) external payable returns (uint256); 21 | 22 | function mintIdentityWithName( 23 | address paymentMethod, 24 | address to, 25 | string memory name, 26 | uint256 yearsPeriod, 27 | string memory _tokenURI 28 | ) external payable returns (uint256); 29 | 30 | function getSoulName() external view returns (ISoulName); 31 | 32 | function tokenOfOwner(address owner) external view returns (uint256); 33 | } 34 | -------------------------------------------------------------------------------- /docs/reference/IERC5267.md: -------------------------------------------------------------------------------- 1 | # IERC5267 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### eip712Domain 14 | 15 | ```solidity 16 | function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) 17 | ``` 18 | 19 | 20 | 21 | *returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | fields | bytes1 | undefined | 29 | | name | string | undefined | 30 | | version | string | undefined | 31 | | chainId | uint256 | undefined | 32 | | verifyingContract | address | undefined | 33 | | salt | bytes32 | undefined | 34 | | extensions | uint256[] | undefined | 35 | 36 | 37 | 38 | ## Events 39 | 40 | ### EIP712DomainChanged 41 | 42 | ```solidity 43 | event EIP712DomainChanged() 44 | ``` 45 | 46 | 47 | 48 | *MAY be emitted to signal that the domain could have changed.* 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/introspection/IERC165.md: -------------------------------------------------------------------------------- 1 | # IERC165 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.* 10 | 11 | ## Methods 12 | 13 | ### supportsInterface 14 | 15 | ```solidity 16 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 17 | ``` 18 | 19 | 20 | 21 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | interfaceId | bytes4 | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | bool | undefined | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/elin/contracts/interfaces/IERC5267.md: -------------------------------------------------------------------------------- 1 | # IERC5267 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### eip712Domain 14 | 15 | ```solidity 16 | function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) 17 | ``` 18 | 19 | 20 | 21 | *returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | fields | bytes1 | undefined | 29 | | name | string | undefined | 30 | | version | string | undefined | 31 | | chainId | uint256 | undefined | 32 | | verifyingContract | address | undefined | 33 | | salt | bytes32 | undefined | 34 | | extensions | uint256[] | undefined | 35 | 36 | 37 | 38 | ## Events 39 | 40 | ### EIP712DomainChanged 41 | 42 | ```solidity 43 | event EIP712DomainChanged() 44 | ``` 45 | 46 | 47 | 48 | *MAY be emitted to signal that the domain could have changed.* 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/reference/ERC165.md: -------------------------------------------------------------------------------- 1 | # ERC165 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ``` Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.* 10 | 11 | ## Methods 12 | 13 | ### supportsInterface 14 | 15 | ```solidity 16 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 17 | ``` 18 | 19 | 20 | 21 | *See {IERC165-supportsInterface}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | interfaceId | bytes4 | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | bool | undefined | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /.env.network.example: -------------------------------------------------------------------------------- 1 | ADMIN=XXX 2 | PROJECTFEE_RECEIVER=XXX 3 | PROTOCOLFEE_RECEIVER=XXX 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=XXX 8 | BASE_URI=XXX 9 | SOUL_NAME_CONTRACT_URI=XXX 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=XXX XXX XXX 11 | PAYMENT_METHODS_SOULBOUNDGREEN=XXX XXX XXX 12 | PAYMENT_METHODS_SOULLINKER=XXX XXX XXX 13 | PAYMENT_METHODS_SOULSTORE=XXX XXX XXX 14 | SWAP_ROUTER=XXX 15 | USDC_TOKEN=XXX 16 | MASA_TOKEN=XXX 17 | WETH_TOKEN=XXX 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=6250000000 30 | SOULNAME_PRICE_2LEN=1250000000 31 | SOULNAME_PRICE_3LEN=250000000 32 | SOULNAME_PRICE_4LEN=50000000 33 | SOULNAME_PRICE_5LEN=10000000 34 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/introspection/ERC165.md: -------------------------------------------------------------------------------- 1 | # ERC165 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ``` Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.* 10 | 11 | ## Methods 12 | 13 | ### supportsInterface 14 | 15 | ```solidity 16 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 17 | ``` 18 | 19 | 20 | 21 | *See {IERC165-supportsInterface}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | interfaceId | bytes4 | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | bool | undefined | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Masa Finance 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 | -------------------------------------------------------------------------------- /src/addresses.ts: -------------------------------------------------------------------------------- 1 | import * as fs from "fs"; 2 | 3 | const deploymentsFolder = "./deployments/"; 4 | const addressesFile = "./addresses.json"; 5 | 6 | /** 7 | * main function 8 | */ 9 | async function main() { 10 | // JSON to be written in ./addresses.json file 11 | let addresses = {}; 12 | 13 | fs.readdirSync(deploymentsFolder).forEach((network) => { 14 | // for each network 15 | addresses[network] = {}; 16 | const networkFolder = `${deploymentsFolder}${network}/`; 17 | 18 | fs.readdirSync(networkFolder) 19 | .filter((fn) => fn.endsWith(".json")) 20 | .forEach((file) => { 21 | // for each contract 22 | const contract = file.slice(0, -5); 23 | const jsonString = fs.readFileSync(`${networkFolder}${file}`, "utf-8"); 24 | const json = JSON.parse(jsonString); 25 | 26 | addresses[network][contract] = json.address; 27 | }); 28 | }); 29 | 30 | // Write addresses to /addresses.json file 31 | fs.writeFileSync(addressesFile, JSON.stringify(addresses, null, 2)); 32 | } 33 | 34 | main() 35 | .then(() => process.exit(0)) 36 | .catch((error) => { 37 | console.error(error); 38 | process.exit(1); 39 | }); 40 | -------------------------------------------------------------------------------- /docs/reference/StorageSlot.md: -------------------------------------------------------------------------------- 1 | # StorageSlot 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Library for reading and writing primitive types to specific storage slots. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. This library helps with reading and writing to such slots without the need for inline assembly. The functions in this library return Slot structs that contain a `value` member that can be used to read or write. Example usage to set ERC1967 implementation slot: ```solidity contract ERC1967 { bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } function _setImplementation(address newImplementation) internal { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } } ``` _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ _Available since v4.9 for `string`, `bytes`._* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/StorageSlot.md: -------------------------------------------------------------------------------- 1 | # StorageSlot 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Library for reading and writing primitive types to specific storage slots. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. This library helps with reading and writing to such slots without the need for inline assembly. The functions in this library return Slot structs that contain a `value` member that can be used to read or write. Example usage to set ERC1967 implementation slot: ```solidity contract ERC1967 { bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } function _setImplementation(address newImplementation) internal { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } } ``` _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ _Available since v4.9 for `string`, `bytes`._* 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/elin/contracts/token/ERC721/IERC721Receiver.md: -------------------------------------------------------------------------------- 1 | # IERC721Receiver 2 | 3 | 4 | 5 | > ERC721 token receiver interface 6 | 7 | 8 | 9 | *Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.* 10 | 11 | ## Methods 12 | 13 | ### onERC721Received 14 | 15 | ```solidity 16 | function onERC721Received(address operator, address from, uint256 tokenId, bytes data) external nonpayable returns (bytes4) 17 | ``` 18 | 19 | 20 | 21 | *Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | operator | address | undefined | 28 | | from | address | undefined | 29 | | tokenId | uint256 | undefined | 30 | | data | bytes | undefined | 31 | 32 | #### Returns 33 | 34 | | Name | Type | Description | 35 | |---|---|---| 36 | | _0 | bytes4 | undefined | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/reference/ShortStrings.md: -------------------------------------------------------------------------------- 1 | # ShortStrings 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *This library provides functions to convert short memory strings into a `ShortString` type that can be used as an immutable variable. Strings of arbitrary length can be optimized using this library if they are short enough (up to 31 bytes) by packing them with their length (1 byte) in a single EVM word (32 bytes). Additionally, a fallback mechanism can be used for every other case. Usage example: ```solidity contract Named { using ShortStrings for *; ShortString private immutable _name; string private _nameFallback; constructor(string memory contractName) { _name = contractName.toShortStringWithFallback(_nameFallback); } function name() external view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } } ```* 10 | 11 | 12 | 13 | ## Errors 14 | 15 | ### InvalidShortString 16 | 17 | ```solidity 18 | error InvalidShortString() 19 | ``` 20 | 21 | 22 | 23 | 24 | 25 | 26 | ### StringTooLong 27 | 28 | ```solidity 29 | error StringTooLong(string str) 30 | ``` 31 | 32 | 33 | 34 | 35 | 36 | #### Parameters 37 | 38 | | Name | Type | Description | 39 | |---|---|---| 40 | | str | string | undefined | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/ShortStrings.md: -------------------------------------------------------------------------------- 1 | # ShortStrings 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *This library provides functions to convert short memory strings into a `ShortString` type that can be used as an immutable variable. Strings of arbitrary length can be optimized using this library if they are short enough (up to 31 bytes) by packing them with their length (1 byte) in a single EVM word (32 bytes). Additionally, a fallback mechanism can be used for every other case. Usage example: ```solidity contract Named { using ShortStrings for *; ShortString private immutable _name; string private _nameFallback; constructor(string memory contractName) { _name = contractName.toShortStringWithFallback(_nameFallback); } function name() external view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } } ```* 10 | 11 | 12 | 13 | ## Errors 14 | 15 | ### InvalidShortString 16 | 17 | ```solidity 18 | error InvalidShortString() 19 | ``` 20 | 21 | 22 | 23 | 24 | 25 | 26 | ### StringTooLong 27 | 28 | ```solidity 29 | error StringTooLong(string str) 30 | ``` 31 | 32 | 33 | 34 | 35 | 36 | #### Parameters 37 | 38 | | Name | Type | Description | 39 | |---|---|---| 40 | | str | string | undefined | 41 | 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-bounty-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Bounty Report 3 | about: Create a report to qualify for the bug bounty 4 | title: "[BUG BOUNTY]" 5 | labels: bug 6 | assignees: aaronknott, H34D, hide-on-bush-x, im-khem, Luka-Loncar, miquelcabot, teslashibe 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 | **Video** 27 | If applicable, add a video to help explain your problem. 28 | 29 | **Desktop (please complete the following information):** 30 | - OS: [e.g. iOS] 31 | - Browser [e.g. chrome, safari] 32 | - Version [e.g. 22] 33 | 34 | **Smartphone (please complete the following information):** 35 | - Device: [e.g. iPhone6] 36 | - OS: [e.g. iOS8.1] 37 | - Browser [e.g. stock browser, safari] 38 | - Version [e.g. 22] 39 | 40 | **Additional context** 41 | Add any other context about the problem here. 42 | 43 | **Is this bug a Critical Vulnerability** 44 | Y/N 45 | -------------------------------------------------------------------------------- /contracts/tokens/SBT/ISBT.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; 5 | 6 | interface ISBT is IERC165 { 7 | /// @dev This emits when an SBT is newly minted. 8 | /// This event emits when SBTs are created 9 | event Mint(address indexed _owner, uint256 indexed _tokenId); 10 | 11 | /// @dev This emits when an SBT is burned 12 | /// This event emits when SBTs are destroyed 13 | event Burn(address indexed _owner, uint256 indexed _tokenId); 14 | 15 | /// @notice Count all SBTs assigned to an owner 16 | /// @dev SBTs assigned to the zero address are considered invalid, and this 17 | /// function throws for queries about the zero address. 18 | /// @param _owner An address for whom to query the balance 19 | /// @return The number of SBTs owned by `_owner`, possibly zero 20 | function balanceOf(address _owner) external view returns (uint256); 21 | 22 | /// @notice Find the owner of an SBT 23 | /// @dev SBTs assigned to zero address are considered invalid, and queries 24 | /// about them do throw. 25 | /// @param _tokenId The identifier for an SBT 26 | /// @return The address of the owner of the SBT 27 | function ownerOf(uint256 _tokenId) external view returns (address); 28 | } 29 | -------------------------------------------------------------------------------- /contracts/interfaces/ISoulName.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | interface ISoulName { 5 | function mint( 6 | address to, 7 | string memory name, 8 | uint256 yearsPeriod, 9 | string memory _tokenURI 10 | ) external returns (uint256); 11 | 12 | function getExtension() external view returns (string memory); 13 | 14 | function isAvailable( 15 | string memory name 16 | ) external view returns (bool available); 17 | 18 | function tokenData( 19 | uint256 tokenId 20 | ) external view returns (string memory name, uint256 expirationDate); 21 | 22 | function getTokenData( 23 | string memory name 24 | ) 25 | external 26 | view 27 | returns ( 28 | string memory sbtName, 29 | bool linked, 30 | uint256 identityId, 31 | uint256 tokenId, 32 | uint256 expirationDate, 33 | bool active 34 | ); 35 | 36 | function getTokenId(string memory name) external view returns (uint256); 37 | 38 | function getSoulNames( 39 | address owner 40 | ) external view returns (string[] memory sbtNames); 41 | 42 | function getSoulNames( 43 | uint256 identityId 44 | ) external view returns (string[] memory sbtNames); 45 | } 46 | -------------------------------------------------------------------------------- /docs/elin/contracts/security/Pausable.md: -------------------------------------------------------------------------------- 1 | # Pausable 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Contract module which allows children to implement an emergency stop mechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available the modifiers `whenNotPaused` and `whenPaused`, which can be applied to the functions of your contract. Note that they will not be pausable by simply including this module, only once the modifiers are put in place.* 10 | 11 | ## Methods 12 | 13 | ### paused 14 | 15 | ```solidity 16 | function paused() external view returns (bool) 17 | ``` 18 | 19 | 20 | 21 | *Returns true if the contract is paused, and false otherwise.* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | bool | undefined | 29 | 30 | 31 | 32 | ## Events 33 | 34 | ### Paused 35 | 36 | ```solidity 37 | event Paused(address account) 38 | ``` 39 | 40 | 41 | 42 | *Emitted when the pause is triggered by `account`.* 43 | 44 | #### Parameters 45 | 46 | | Name | Type | Description | 47 | |---|---|---| 48 | | account | address | undefined | 49 | 50 | ### Unpaused 51 | 52 | ```solidity 53 | event Unpaused(address account) 54 | ``` 55 | 56 | 57 | 58 | *Emitted when the pause is lifted by `account`.* 59 | 60 | #### Parameters 61 | 62 | | Name | Type | Description | 63 | |---|---|---| 64 | | account | address | undefined | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /.env.polygon: -------------------------------------------------------------------------------- 1 | ADMIN=0x47d640442215b49f22FC227488d2e840E10fff4D 2 | PROJECTFEE_RECEIVER=0x3CE0aa6b475E3B9B9Eb64c10e1409c0b3Ff37153 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=XXX 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506 15 | USDC_TOKEN=0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | 35 | -------------------------------------------------------------------------------- /.env.base: -------------------------------------------------------------------------------- 1 | ADMIN=0x84a74cc52048dd8421df4a9eb139d91bb7744b4e 2 | PROJECTFEE_RECEIVER=0x95e3B737EA33B45AcabC111569eF65e6D0b44312 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 7 | BASE_URI=https://metadata.masa.finance/v1.0 8 | SOUL_NAME_CONTRACT_URI=ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 9 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 10 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 13 | SWAP_ROUTER=0x0A64D8858061E1C5e2BC63f2C267Cb87b47DeA57 14 | USDC_TOKEN=0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA 15 | MASA_TOKEN=0x0000000000000000000000000000000000000000 16 | WETH_TOKEN=0x4200000000000000000000000000000000000006 17 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 18 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 19 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 20 | SOULBOUNDGREEN_NAME="Masa Green" 21 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 22 | SOULBOUNDGREEN_MINTING_PRICE=0 23 | SOULBOUNDIDENTITY_NAME="Base Identity" 24 | SOULBOUNDIDENTITY_SYMBOL="BID" 25 | SOULNAME_NAME="Base Domain Name" 26 | SOULNAME_SYMBOL="BDN" 27 | SOULNAME_EXTENSION=".base" 28 | SOULNAME_PRICE_1LEN=100000000 29 | SOULNAME_PRICE_2LEN=50000000 30 | SOULNAME_PRICE_3LEN=15000000 31 | SOULNAME_PRICE_4LEN=5000000 32 | SOULNAME_PRICE_5LEN=1000000 33 | -------------------------------------------------------------------------------- /.env.masa: -------------------------------------------------------------------------------- 1 | ADMIN=0x06168A0f16DFbe0cea6fa3E2807026617C96a2b8 2 | PROJECTFEE_RECEIVER=0x0000000000000000000000000000000000000000 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x0000000000000000000000000000000000000000 15 | USDC_TOKEN=0x0000000000000000000000000000000000000000 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0x0000000000000000000000000000000000000000 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=0 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | 35 | -------------------------------------------------------------------------------- /.env.masatest: -------------------------------------------------------------------------------- 1 | ADMIN=0x19B35C375BE865A902423590f68B8B5f0ec02574 2 | PROJECTFEE_RECEIVER=0x0000000000000000000000000000000000000000 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x0000000000000000000000000000000000000000 15 | USDC_TOKEN=0x0000000000000000000000000000000000000000 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0x0000000000000000000000000000000000000000 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=0 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | 35 | -------------------------------------------------------------------------------- /.env.mumbai: -------------------------------------------------------------------------------- 1 | ADMIN=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 2 | PROJECTFEE_RECEIVER=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 15 | USDC_TOKEN=0x742dfa5aa70a8212857966d491d67b09ce7d6ec7 16 | MASA_TOKEN=0xd393b1E02dA9831Ff419e22eA105aAe4c47E1253 17 | WETH_TOKEN=0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=0 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | 35 | -------------------------------------------------------------------------------- /.env.opbnb: -------------------------------------------------------------------------------- 1 | ADMIN=0x0E56328c0Ab5cb79aF9Df2F76C0479ba46155075 2 | PROJECTFEE_RECEIVER=0x63ad8499305975824f2d7982196c74bf9fb73415 3 | PROTOCOLFEE_RECEIVER=0x0E56328c0Ab5cb79aF9Df2F76C0479ba46155075 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=50 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb 15 | USDC_TOKEN=0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0x4200000000000000000000000000000000000006 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | -------------------------------------------------------------------------------- /.env.opbnbtest: -------------------------------------------------------------------------------- 1 | ADMIN=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 2 | PROJECTFEE_RECEIVER=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=50 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D 15 | USDC_TOKEN=0xD87Ba7A50B2E7E660f678A895E4B72E7CB4CCd9C 16 | MASA_TOKEN=0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 17 | WETH_TOKEN=0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=0 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | -------------------------------------------------------------------------------- /.env.scroll: -------------------------------------------------------------------------------- 1 | ADMIN=0x0E56328c0Ab5cb79aF9Df2F76C0479ba46155075 2 | PROJECTFEE_RECEIVER=0x0000000000000000000000000000000000000000 3 | PROTOCOLFEE_RECEIVER=0x0E56328c0Ab5cb79aF9Df2F76C0479ba46155075 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D 15 | USDC_TOKEN=0xD87Ba7A50B2E7E660f678A895E4B72E7CB4CCd9C 16 | MASA_TOKEN=0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 17 | WETH_TOKEN=0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | -------------------------------------------------------------------------------- /.env.scrolltest: -------------------------------------------------------------------------------- 1 | ADMIN=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 2 | PROJECTFEE_RECEIVER=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D 15 | USDC_TOKEN=0xD87Ba7A50B2E7E660f678A895E4B72E7CB4CCd9C 16 | MASA_TOKEN=0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 17 | WETH_TOKEN=0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=0 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | -------------------------------------------------------------------------------- /.env.basegoerli: -------------------------------------------------------------------------------- 1 | ADMIN=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 2 | PROJECTFEE_RECEIVER=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0xbdFa4a05372a10172EeEB75075c85FCbff521625 15 | USDC_TOKEN=0xD87Ba7A50B2E7E660f678A895E4B72E7CB4CCd9C 16 | MASA_TOKEN=0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 17 | WETH_TOKEN=0x44D627f900da8AdaC7561bD73aA745F132450798 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=0 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=0 24 | SOULBOUNDIDENTITY_NAME="Base Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="BID" 26 | SOULNAME_NAME="Base Domain Name" 27 | SOULNAME_SYMBOL="BDN" 28 | SOULNAME_EXTENSION=".base" 29 | SOULNAME_PRICE_1LEN=0 30 | SOULNAME_PRICE_2LEN=0 31 | SOULNAME_PRICE_3LEN=0 32 | SOULNAME_PRICE_4LEN=0 33 | SOULNAME_PRICE_5LEN=0 34 | 35 | -------------------------------------------------------------------------------- /contracts/interfaces/dex/IUniswapRouter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | /// @title Uniswap Router interface 5 | /// @author Masa Finance 6 | /// @notice Interface of the Uniswap Router contract 7 | /// @dev This interface is used to interact with the Uniswap Router contract, 8 | /// and gets the most important functions of the contract. It's based on 9 | /// https://github.com/Uniswap/v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol 10 | interface IUniswapRouter { 11 | function swapExactTokensForTokens( 12 | uint256 amountIn, 13 | uint256 amountOutMin, 14 | address[] calldata path, 15 | address to, 16 | uint256 deadline 17 | ) external returns (uint256[] memory amounts); 18 | 19 | function swapExactETHForTokens( 20 | uint256 amountOutMin, 21 | address[] calldata path, 22 | address to, 23 | uint256 deadline 24 | ) external payable returns (uint256[] memory amounts); 25 | 26 | function swapExactTokensForETH( 27 | uint256 amountIn, 28 | uint256 amountOutMin, 29 | address[] calldata path, 30 | address to, 31 | uint256 deadline 32 | ) external returns (uint256[] memory amounts); 33 | 34 | function getAmountsOut( 35 | uint256 amountIn, 36 | address[] calldata path 37 | ) external view returns (uint256[] memory amounts); 38 | 39 | function getAmountsIn( 40 | uint256 amountOut, 41 | address[] calldata path 42 | ) external view returns (uint256[] memory amounts); 43 | } 44 | -------------------------------------------------------------------------------- /.env.bsc: -------------------------------------------------------------------------------- 1 | ADMIN=0xD9f8D4359C034E1290d83b70e73e32fdd31a663B 2 | PROJECTFEE_RECEIVER=0x9024b41ebAA34f7b1999665ec7CF2145455E0557 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=XXX 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0x10ED43C718714eb63d5aA57B78B54704E256024E 15 | USDC_TOKEN=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000000000000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000000000000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=6250000000000000000000 30 | SOULNAME_PRICE_2LEN=1250000000000000000000 31 | SOULNAME_PRICE_3LEN=250000000000000000000 32 | SOULNAME_PRICE_4LEN=50000000000000000000 33 | SOULNAME_PRICE_5LEN=10000000000000000000 34 | -------------------------------------------------------------------------------- /.env.ethereum: -------------------------------------------------------------------------------- 1 | ADMIN=0xBb4125C48e8c69b0F06E0c635dfCd0Aa250fcbF9 2 | PROJECTFEE_RECEIVER=0xccfA6a842151F53e18a5D56eDfD0177fA8C8D7F5 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 14 | SWAP_ROUTER=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D 15 | USDC_TOKEN=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=6250000000 30 | SOULNAME_PRICE_2LEN=1250000000 31 | SOULNAME_PRICE_3LEN=250000000 32 | SOULNAME_PRICE_4LEN=50000000 33 | SOULNAME_PRICE_5LEN=10000000 34 | 35 | -------------------------------------------------------------------------------- /.env.bsctest: -------------------------------------------------------------------------------- 1 | ADMIN=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 2 | PROJECTFEE_RECEIVER=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 14 | SWAP_ROUTER=0xD99D1c33F9fC3444f8101754aBC46c52416550D1 15 | USDC_TOKEN=0x64544969ed7EBf5f083679233325356EbE738930 16 | MASA_TOKEN=0xEC5dCb5Dbf4B114C9d0F65BcCAb49EC54F6A0867 17 | WETH_TOKEN=0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000000000000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000000000000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=6250000000000000000000 30 | SOULNAME_PRICE_2LEN=1250000000000000000000 31 | SOULNAME_PRICE_3LEN=250000000000000000000 32 | SOULNAME_PRICE_4LEN=50000000000000000000 33 | SOULNAME_PRICE_5LEN=10000000000000000000 34 | -------------------------------------------------------------------------------- /.env.celo: -------------------------------------------------------------------------------- 1 | ADMIN=0x48E2042bF980E12b5C50eA78d38042517Df0d90C 2 | PROJECTFEE_RECEIVER=0x0a8C9AdAbCA7807737296b5F4E065A61DbeBD128 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x5b45dAA4645F79a419811dc0657FA1b2695c6Ab7 8 | BASE_URI=https://metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A 14 | SWAP_ROUTER=0xE3D8bd6Aed4F159bc8000a9cD47CffDb95F96121 15 | USDC_TOKEN=0x765de816845861e75a25fca122bb6898b8b1282a 16 | MASA_TOKEN=0x0000000000000000000000000000000000000000 17 | WETH_TOKEN=0x471EcE3750Da237f93B8E339c536989b8978a438 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000000000000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000000000000000 24 | SOULBOUNDIDENTITY_NAME="Celo Prosperity Passport" 25 | SOULBOUNDIDENTITY_SYMBOL="CPP" 26 | SOULNAME_NAME="Celo Domain Name" 27 | SOULNAME_SYMBOL="CDN" 28 | SOULNAME_EXTENSION=".celo" 29 | SOULNAME_PRICE_1LEN=100000000000000000000 30 | SOULNAME_PRICE_2LEN=25000000000000000000 31 | SOULNAME_PRICE_3LEN=5000000000000000000 32 | SOULNAME_PRICE_4LEN=1000000000000000000 33 | SOULNAME_PRICE_5LEN=0 34 | -------------------------------------------------------------------------------- /.env.alfajores: -------------------------------------------------------------------------------- 1 | ADMIN=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 2 | PROJECTFEE_RECEIVER=0x46c9cdA3F83C5c13C767A07b6E80aEd302E40B28 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1 14 | SWAP_ROUTER=0xE3D8bd6Aed4F159bc8000a9cD47CffDb95F96121 15 | USDC_TOKEN=0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1 16 | MASA_TOKEN=0x7d91E51C8F218f7140188A155f5C75388630B6a8 17 | WETH_TOKEN=0xf194afdf50b03e69bd7d057c1aa9e10c9954e4c9 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000000000000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000000000000000 24 | SOULBOUNDIDENTITY_NAME="Celo Prosperity Passport" 25 | SOULBOUNDIDENTITY_SYMBOL="CPP" 26 | SOULNAME_NAME="Celo Domain Name" 27 | SOULNAME_SYMBOL="CDN" 28 | SOULNAME_EXTENSION=".celo" 29 | SOULNAME_PRICE_1LEN=100000000000000000000 30 | SOULNAME_PRICE_2LEN=25000000000000000000 31 | SOULNAME_PRICE_3LEN=5000000000000000000 32 | SOULNAME_PRICE_4LEN=1000000000000000000 33 | SOULNAME_PRICE_5LEN=0 34 | -------------------------------------------------------------------------------- /.env.hardhat: -------------------------------------------------------------------------------- 1 | ADMIN= 2 | PROJECTFEE_RECEIVER= 3 | PROTOCOLFEE_RECEIVER= 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET= 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 14 | SWAP_ROUTER=0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008 15 | USDC_TOKEN=0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 16 | MASA_TOKEN=0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 17 | WETH_TOKEN=0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000000000000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000000000000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=6250000000 30 | SOULNAME_PRICE_2LEN=1250000000 31 | SOULNAME_PRICE_3LEN=250000000 32 | SOULNAME_PRICE_4LEN=50000000 33 | SOULNAME_PRICE_5LEN=10000000 34 | 35 | -------------------------------------------------------------------------------- /.env.sepolia: -------------------------------------------------------------------------------- 1 | ADMIN=0xA38dd237a3A8D50537B74a4B0D4E7E8A5359386F 2 | PROJECTFEE_RECEIVER=0xA38dd237a3A8D50537B74a4B0D4E7E8A5359386F 3 | PROTOCOLFEE_RECEIVER=0x0000000000000000000000000000000000000000 4 | PROTOCOLFEE_AMOUNT=0 5 | PROTOCOLFEE_PERCENT=0 6 | PROTOCOLFEE_PERCENT_SUB=0 7 | AUTHORITY_WALLET=0x3c8D9f130970358b7E8cbc1DbD0a1EbA6EBE368F 8 | BASE_URI=https://beta.metadata.masa.finance/v1.0 9 | SOUL_NAME_CONTRACT_URI=ar://bfG2m3VJU19fj6uGgyaxNY0QhK0G7RINYtw-GRVVqTM 10 | PAYMENT_METHODS_SOULBOUNDCREDITSCORE=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 11 | PAYMENT_METHODS_SOULBOUNDGREEN=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 12 | PAYMENT_METHODS_SOULLINKER=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 13 | PAYMENT_METHODS_SOULSTORE=0x0000000000000000000000000000000000000000 0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 14 | SWAP_ROUTER=0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008 15 | USDC_TOKEN=0xf8187B6F83790e533DFAB746cAE3B2507c1196Ae 16 | MASA_TOKEN=0x300fa0B0a9d373988394EEBFe66E03f90bb419E3 17 | WETH_TOKEN=0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9 18 | SOULBOUNDCREDITSCORE_NAME="Masa Credit Score" 19 | SOULBOUNDCREDITSCORE_SYMBOL="MCS" 20 | SOULBOUNDCREDITSCORE_MINTING_PRICE=1000000 21 | SOULBOUNDGREEN_NAME="Masa Green" 22 | SOULBOUNDGREEN_SYMBOL="MG-2FA" 23 | SOULBOUNDGREEN_MINTING_PRICE=1000000 24 | SOULBOUNDIDENTITY_NAME="Masa Identity" 25 | SOULBOUNDIDENTITY_SYMBOL="MID" 26 | SOULNAME_NAME="Masa Soul Name" 27 | SOULNAME_SYMBOL="MSN" 28 | SOULNAME_EXTENSION=".soul" 29 | SOULNAME_PRICE_1LEN=6250000000 30 | SOULNAME_PRICE_2LEN=1250000000 31 | SOULNAME_PRICE_3LEN=250000000 32 | SOULNAME_PRICE_4LEN=50000000 33 | SOULNAME_PRICE_5LEN=10000000 34 | 35 | -------------------------------------------------------------------------------- /contracts/libraries/Errors.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | error AddressDoesNotHaveIdentity(address to); 5 | error AlreadyAdded(); 6 | error AuthorityNotExists(address authority); 7 | error CallerNotOwner(address caller); 8 | error CallerNotReader(address caller); 9 | error IdentityOwnerIsReader(uint256 readerIdentityId); 10 | error InsufficientEthAmount(uint256 amount); 11 | error IdentityOwnerNotTokenOwner(uint256 tokenId, uint256 ownerIdentityId); 12 | error InvalidPaymentMethod(address paymentMethod); 13 | error InvalidSignature(); 14 | error InvalidSignatureDate(uint256 signatureDate); 15 | error InvalidState(string state); 16 | error InvalidToken(address token); 17 | error InvalidTokenURI(string tokenURI); 18 | error LinkAlreadyExists( 19 | address token, 20 | uint256 tokenId, 21 | uint256 readerIdentityId, 22 | uint256 signatureDate 23 | ); 24 | error LinkAlreadyRevoked(); 25 | error LinkDoesNotExist(); 26 | error MaxSBTMinted(address to, uint256 maximum); 27 | error NameAlreadyExists(string name); 28 | error NameNotFound(string name); 29 | error NameRegisteredByOtherAccount(string name, uint256 tokenId); 30 | error NotAllBeforeMintStatesSet(); 31 | error NotAuthorized(address signer); 32 | error NonExistingErc20Token(address erc20token); 33 | error NotLinkedToAnIdentitySBT(); 34 | error PaymentParamsNotSet(); 35 | error ProtocolFeeReceiverNotSet(); 36 | error RefundFailed(); 37 | error SameValue(); 38 | error SBTAlreadyLinked(address token); 39 | error SoulNameContractNotSet(); 40 | error SoulNameNotExist(); 41 | error SoulNameNotRegistered(address token); 42 | error StateNotSet(string state); 43 | error TokenNotFound(uint256 tokenId); 44 | error TransferFailed(); 45 | error URIAlreadyExists(string tokenURI); 46 | error UserMustHaveProtocolOrProjectAdminRole(); 47 | error ValidPeriodExpired(uint256 expirationDate); 48 | error WithoutBeforeMintStates(); 49 | error ZeroAddress(); 50 | error ZeroLengthName(string name); 51 | error ZeroYearsPeriod(uint256 yearsPeriod); 52 | -------------------------------------------------------------------------------- /docs/elin/contracts/access/Ownable.md: -------------------------------------------------------------------------------- 1 | # Ownable 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. By default, the owner account will be the one that deploys the contract. This can later be changed with {transferOwnership}. This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be applied to your functions to restrict their use to the owner.* 10 | 11 | ## Methods 12 | 13 | ### owner 14 | 15 | ```solidity 16 | function owner() external view returns (address) 17 | ``` 18 | 19 | 20 | 21 | *Returns the address of the current owner.* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | address | undefined | 29 | 30 | ### renounceOwnership 31 | 32 | ```solidity 33 | function renounceOwnership() external nonpayable 34 | ``` 35 | 36 | 37 | 38 | *Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.* 39 | 40 | 41 | ### transferOwnership 42 | 43 | ```solidity 44 | function transferOwnership(address newOwner) external nonpayable 45 | ``` 46 | 47 | 48 | 49 | *Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.* 50 | 51 | #### Parameters 52 | 53 | | Name | Type | Description | 54 | |---|---|---| 55 | | newOwner | address | undefined | 56 | 57 | 58 | 59 | ## Events 60 | 61 | ### OwnershipTransferred 62 | 63 | ```solidity 64 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) 65 | ``` 66 | 67 | 68 | 69 | 70 | 71 | #### Parameters 72 | 73 | | Name | Type | Description | 74 | |---|---|---| 75 | | previousOwner `indexed` | address | undefined | 76 | | newOwner `indexed` | address | undefined | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /contracts/libraries/Utils.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | /// @title Utilities library for Masa Contracts Identity repository 5 | /// @author Masa Finance 6 | /// @notice Library of utilities for Masa Contracts Identity repository 7 | library Utils { 8 | struct slice { 9 | uint256 _len; 10 | uint256 _ptr; 11 | } 12 | 13 | function toLowerCase( 14 | string memory _str 15 | ) internal pure returns (string memory) { 16 | bytes memory bStr = bytes(_str); 17 | bytes memory bLower = new bytes(bStr.length); 18 | 19 | for (uint256 i = 0; i < bStr.length; i++) { 20 | // Uppercase character... 21 | if ((bStr[i] >= 0x41) && (bStr[i] <= 0x5A)) { 22 | // So we add 0x20 to make it lowercase 23 | bLower[i] = bytes1(uint8(bStr[i]) + 0x20); 24 | } else { 25 | bLower[i] = bStr[i]; 26 | } 27 | } 28 | return string(bLower); 29 | } 30 | 31 | function toSlice(string memory self) private pure returns (slice memory) { 32 | uint256 ptr; 33 | assembly { 34 | ptr := add(self, 0x20) 35 | } 36 | return slice(bytes(self).length, ptr); 37 | } 38 | 39 | function startsWith( 40 | string memory str, 41 | string memory needle 42 | ) internal pure returns (bool) { 43 | slice memory s_str = toSlice(str); 44 | slice memory s_needle = toSlice(needle); 45 | 46 | if (s_str._len < s_needle._len) { 47 | return false; 48 | } 49 | 50 | if (s_str._ptr == s_needle._ptr) { 51 | return true; 52 | } 53 | 54 | bool equal; 55 | assembly { 56 | let length := mload(s_needle) 57 | let selfptr := mload(add(s_str, 0x20)) 58 | let needleptr := mload(add(s_needle, 0x20)) 59 | equal := eq( 60 | keccak256(selfptr, length), 61 | keccak256(needleptr, length) 62 | ) 63 | } 64 | return equal; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/EnvParams.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs-extra"; 2 | import fsx from "fs-extra"; 3 | import { parse } from "envfile"; 4 | 5 | export function getEnvParams(networkName: string | undefined) { 6 | if (!networkName) { 7 | networkName = "hardhat"; 8 | } 9 | 10 | const path = `.env.${networkName}`; 11 | 12 | if (!fs.existsSync(path)) { 13 | throw new Error(`The env file ${path} doesn't exists.`); 14 | } 15 | 16 | fsx.ensureFileSync(path); 17 | return parse(fs.readFileSync(path)); 18 | } 19 | 20 | export function getSecretParam( 21 | param: string, 22 | networkName?: string | undefined 23 | ) { 24 | const path = networkName ? `.env.${networkName}.secret` : `.env`; 25 | 26 | fsx.ensureFileSync(path); 27 | return parse(fs.readFileSync(path))[param]; 28 | } 29 | 30 | export function getPrivateKey(networkName: string | undefined) { 31 | const privateKey = 32 | process.env.DEPLOYER_PRIVATE_KEY || 33 | getSecretParam("DEPLOYER_PRIVATE_KEY", networkName); 34 | 35 | return privateKey 36 | ? privateKey 37 | : "0x0000000000000000000000000000000000000000000000000000000000000000"; 38 | } 39 | 40 | export function getAnkrApiKey() { 41 | return process.env.ANKR_API_KEY || getSecretParam("ANKR_API_KEY"); 42 | } 43 | 44 | export function getEtherscanApiKey() { 45 | return process.env.ETHERSCAN_API_KEY || getSecretParam("ETHERSCAN_API_KEY"); 46 | } 47 | 48 | export function getBscscanApiKey() { 49 | return process.env.BSCSCAN_API_KEY || getSecretParam("BSCSCAN_API_KEY"); 50 | } 51 | 52 | export function getPolygonscanApiKey() { 53 | return ( 54 | process.env.POLYGONSCAN_API_KEY || getSecretParam("POLYGONSCAN_API_KEY") 55 | ); 56 | } 57 | 58 | export function getCeloscanApiKey() { 59 | return process.env.CELOSCAN_API_KEY || getSecretParam("CELOSCAN_API_KEY"); 60 | } 61 | 62 | export function getBasescanApiKey() { 63 | return process.env.BASESCAN_API_KEY || getSecretParam("BASESCAN_API_KEY"); 64 | } 65 | 66 | export function getOpBnbApiKey() { 67 | return process.env.OPBNB_API_KEY || getSecretParam("OPBNB_API_KEY"); 68 | } 69 | 70 | export function getScrollscanApiKey() { 71 | return process.env.SCROLLSCAN_API_KEY || getSecretParam("SCROLLSCAN_API_KEY"); 72 | } 73 | 74 | export function getCoinMarketCapApiKey() { 75 | return ( 76 | process.env.COINMARKETCAP_API_KEY || getSecretParam("COINMARKETCAP_API_KEY") 77 | ); 78 | } 79 | -------------------------------------------------------------------------------- /deploy/SoulboundIdentity.ts: -------------------------------------------------------------------------------- 1 | import { run } from "hardhat"; 2 | import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; 3 | import { DeployFunction } from "hardhat-deploy/dist/types"; 4 | import { getEnvParams } from "../src/EnvParams"; 5 | 6 | let admin: SignerWithAddress; 7 | 8 | const func: DeployFunction = async ({ 9 | // @ts-ignore 10 | getNamedAccounts, 11 | // @ts-ignore 12 | deployments, 13 | // @ts-ignore 14 | ethers, 15 | network 16 | }) => { 17 | const { deploy } = deployments; 18 | const { deployer } = await getNamedAccounts(); 19 | 20 | // const currentNonce: number = await ethers.provider.getTransactionCount(deployer); 21 | // to solve REPLACEMENT_UNDERPRICED, when needed 22 | 23 | [, admin] = await ethers.getSigners(); 24 | const env = getEnvParams(network.name); 25 | const baseUri = `${env.BASE_URI}/identity/${network.name}/`; 26 | 27 | const constructorArguments = [ 28 | env.ADMIN || admin.address, 29 | env.SOULBOUNDIDENTITY_NAME, 30 | env.SOULBOUNDIDENTITY_SYMBOL, 31 | baseUri, 32 | [ 33 | env.SWAP_ROUTER, 34 | env.WETH_TOKEN, 35 | env.USDC_TOKEN, 36 | env.MASA_TOKEN, 37 | env.PROJECTFEE_RECEIVER || admin.address, 38 | env.PROTOCOLFEE_RECEIVER || ethers.constants.AddressZero, 39 | env.PROTOCOLFEE_AMOUNT || 0, 40 | env.PROTOCOLFEE_PERCENT || 0, 41 | env.PROTOCOLFEE_PERCENT_SUB || 0 42 | ] 43 | ]; 44 | 45 | const soulboundIdentityDeploymentResult = await deploy("SoulboundIdentity", { 46 | from: deployer, 47 | args: constructorArguments, 48 | log: true 49 | // nonce: currentNonce + 1 // to solve REPLACEMENT_UNDERPRICED, when needed 50 | }); 51 | 52 | // verify contract with etherscan, if its not a local network or celo 53 | if ( 54 | network.name !== "hardhat" && 55 | network.name !== "masa" && 56 | network.name !== "masatest" 57 | ) { 58 | try { 59 | await run("verify:verify", { 60 | address: soulboundIdentityDeploymentResult.address, 61 | constructorArguments 62 | }); 63 | } catch (error) { 64 | if ( 65 | !error.message.includes("Contract source code already verified") && 66 | !error.message.includes("Reason: Already Verified") 67 | ) { 68 | throw error; 69 | } 70 | } 71 | } 72 | }; 73 | 74 | func.tags = ["SoulboundIdentity"]; 75 | export default func; 76 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | # Smart contract deployment keys 107 | deployment_keys 108 | 109 | # API keys 110 | api_keys 111 | 112 | # Hot code 113 | hot_code 114 | 115 | # System 116 | .DS_Store 117 | 118 | cache 119 | artifacts 120 | 121 | .env.*.secret 122 | !.env.example 123 | !.env.network.secret.example 124 | 125 | coverage.json 126 | 127 | typechain/ -------------------------------------------------------------------------------- /docs/reference/EIP712.md: -------------------------------------------------------------------------------- 1 | # EIP712 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in their contracts using a combination of `abi.encode` and `keccak256`. This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA ({_hashTypedDataV4}). The implementation of the domain separator was designed to be as efficient as possible while still properly updating the chain id to protect against replay attacks on an eventual fork of the chain. NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the separator from the immutable values, which is cheaper than accessing a cached version in cold storage. _Available since v3.4._* 10 | 11 | ## Methods 12 | 13 | ### eip712Domain 14 | 15 | ```solidity 16 | function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) 17 | ``` 18 | 19 | 20 | 21 | *See {EIP-5267}. _Available since v4.9._* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | fields | bytes1 | undefined | 29 | | name | string | undefined | 30 | | version | string | undefined | 31 | | chainId | uint256 | undefined | 32 | | verifyingContract | address | undefined | 33 | | salt | bytes32 | undefined | 34 | | extensions | uint256[] | undefined | 35 | 36 | 37 | 38 | ## Events 39 | 40 | ### EIP712DomainChanged 41 | 42 | ```solidity 43 | event EIP712DomainChanged() 44 | ``` 45 | 46 | 47 | 48 | *MAY be emitted to signal that the domain could have changed.* 49 | 50 | 51 | 52 | 53 | ## Errors 54 | 55 | ### InvalidShortString 56 | 57 | ```solidity 58 | error InvalidShortString() 59 | ``` 60 | 61 | 62 | 63 | 64 | 65 | 66 | ### StringTooLong 67 | 68 | ```solidity 69 | error StringTooLong(string str) 70 | ``` 71 | 72 | 73 | 74 | 75 | 76 | #### Parameters 77 | 78 | | Name | Type | Description | 79 | |---|---|---| 80 | | str | string | undefined | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/elin/contracts/utils/cryptography/EIP712.md: -------------------------------------------------------------------------------- 1 | # EIP712 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in their contracts using a combination of `abi.encode` and `keccak256`. This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA ({_hashTypedDataV4}). The implementation of the domain separator was designed to be as efficient as possible while still properly updating the chain id to protect against replay attacks on an eventual fork of the chain. NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the separator from the immutable values, which is cheaper than accessing a cached version in cold storage. _Available since v3.4._* 10 | 11 | ## Methods 12 | 13 | ### eip712Domain 14 | 15 | ```solidity 16 | function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) 17 | ``` 18 | 19 | 20 | 21 | *See {EIP-5267}. _Available since v4.9._* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | fields | bytes1 | undefined | 29 | | name | string | undefined | 30 | | version | string | undefined | 31 | | chainId | uint256 | undefined | 32 | | verifyingContract | address | undefined | 33 | | salt | bytes32 | undefined | 34 | | extensions | uint256[] | undefined | 35 | 36 | 37 | 38 | ## Events 39 | 40 | ### EIP712DomainChanged 41 | 42 | ```solidity 43 | event EIP712DomainChanged() 44 | ``` 45 | 46 | 47 | 48 | *MAY be emitted to signal that the domain could have changed.* 49 | 50 | 51 | 52 | 53 | ## Errors 54 | 55 | ### InvalidShortString 56 | 57 | ```solidity 58 | error InvalidShortString() 59 | ``` 60 | 61 | 62 | 63 | 64 | 65 | 66 | ### StringTooLong 67 | 68 | ```solidity 69 | error StringTooLong(string str) 70 | ``` 71 | 72 | 73 | 74 | 75 | 76 | #### Parameters 77 | 78 | | Name | Type | Description | 79 | |---|---|---| 80 | | str | string | undefined | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/reference/ISBT.md: -------------------------------------------------------------------------------- 1 | # ISBT 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address _owner) external view returns (uint256) 17 | ``` 18 | 19 | Count all SBTs assigned to an owner 20 | 21 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | _owner | address | An address for whom to query the balance | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 34 | 35 | ### ownerOf 36 | 37 | ```solidity 38 | function ownerOf(uint256 _tokenId) external view returns (address) 39 | ``` 40 | 41 | Find the owner of an SBT 42 | 43 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 44 | 45 | #### Parameters 46 | 47 | | Name | Type | Description | 48 | |---|---|---| 49 | | _tokenId | uint256 | The identifier for an SBT | 50 | 51 | #### Returns 52 | 53 | | Name | Type | Description | 54 | |---|---|---| 55 | | _0 | address | The address of the owner of the SBT | 56 | 57 | ### supportsInterface 58 | 59 | ```solidity 60 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 61 | ``` 62 | 63 | 64 | 65 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 66 | 67 | #### Parameters 68 | 69 | | Name | Type | Description | 70 | |---|---|---| 71 | | interfaceId | bytes4 | undefined | 72 | 73 | #### Returns 74 | 75 | | Name | Type | Description | 76 | |---|---|---| 77 | | _0 | bool | undefined | 78 | 79 | 80 | 81 | ## Events 82 | 83 | ### Burn 84 | 85 | ```solidity 86 | event Burn(address indexed _owner, uint256 indexed _tokenId) 87 | ``` 88 | 89 | 90 | 91 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 92 | 93 | #### Parameters 94 | 95 | | Name | Type | Description | 96 | |---|---|---| 97 | | _owner `indexed` | address | undefined | 98 | | _tokenId `indexed` | uint256 | undefined | 99 | 100 | ### Mint 101 | 102 | ```solidity 103 | event Mint(address indexed _owner, uint256 indexed _tokenId) 104 | ``` 105 | 106 | 107 | 108 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 109 | 110 | #### Parameters 111 | 112 | | Name | Type | Description | 113 | |---|---|---| 114 | | _owner `indexed` | address | undefined | 115 | | _tokenId `indexed` | uint256 | undefined | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /docs/tokens/SBT/ISBT.md: -------------------------------------------------------------------------------- 1 | # ISBT 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address _owner) external view returns (uint256) 17 | ``` 18 | 19 | Count all SBTs assigned to an owner 20 | 21 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | _owner | address | An address for whom to query the balance | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 34 | 35 | ### ownerOf 36 | 37 | ```solidity 38 | function ownerOf(uint256 _tokenId) external view returns (address) 39 | ``` 40 | 41 | Find the owner of an SBT 42 | 43 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 44 | 45 | #### Parameters 46 | 47 | | Name | Type | Description | 48 | |---|---|---| 49 | | _tokenId | uint256 | The identifier for an SBT | 50 | 51 | #### Returns 52 | 53 | | Name | Type | Description | 54 | |---|---|---| 55 | | _0 | address | The address of the owner of the SBT | 56 | 57 | ### supportsInterface 58 | 59 | ```solidity 60 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 61 | ``` 62 | 63 | 64 | 65 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 66 | 67 | #### Parameters 68 | 69 | | Name | Type | Description | 70 | |---|---|---| 71 | | interfaceId | bytes4 | undefined | 72 | 73 | #### Returns 74 | 75 | | Name | Type | Description | 76 | |---|---|---| 77 | | _0 | bool | undefined | 78 | 79 | 80 | 81 | ## Events 82 | 83 | ### Burn 84 | 85 | ```solidity 86 | event Burn(address indexed _owner, uint256 indexed _tokenId) 87 | ``` 88 | 89 | 90 | 91 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 92 | 93 | #### Parameters 94 | 95 | | Name | Type | Description | 96 | |---|---|---| 97 | | _owner `indexed` | address | undefined | 98 | | _tokenId `indexed` | uint256 | undefined | 99 | 100 | ### Mint 101 | 102 | ```solidity 103 | event Mint(address indexed _owner, uint256 indexed _tokenId) 104 | ``` 105 | 106 | 107 | 108 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 109 | 110 | #### Parameters 111 | 112 | | Name | Type | Description | 113 | |---|---|---| 114 | | _owner `indexed` | address | undefined | 115 | | _tokenId `indexed` | uint256 | undefined | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /contracts/tokens/MasaSBTAuthority.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "./MasaSBT.sol"; 5 | 6 | /// @title MasaSBT 7 | /// @author Masa Finance 8 | /// @notice Soulbound token. Non-fungible token that is not transferable. 9 | /// @dev Implementation of https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4105763 Soulbound token. 10 | abstract contract MasaSBTAuthority is MasaSBT { 11 | /* ========== STATE VARIABLES =========================================== */ 12 | 13 | bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); 14 | 15 | /* ========== INITIALIZE ================================================ */ 16 | 17 | /// @notice Creates a new soulbound token 18 | /// @dev Creates a new soulbound token 19 | /// @param admin Administrator of the smart contract 20 | /// @param name Name of the token 21 | /// @param symbol Symbol of the token 22 | /// @param baseTokenURI Base URI of the token 23 | /// @param soulboundIdentity Address of the SoulboundIdentity contract 24 | /// @param paymentParams Payment gateway params 25 | /// @param maxSBTToMint Maximum number of SBT that can be minted 26 | constructor( 27 | address admin, 28 | string memory name, 29 | string memory symbol, 30 | string memory baseTokenURI, 31 | address soulboundIdentity, 32 | PaymentParams memory paymentParams, 33 | uint256 maxSBTToMint 34 | ) 35 | MasaSBT( 36 | admin, 37 | name, 38 | symbol, 39 | baseTokenURI, 40 | soulboundIdentity, 41 | paymentParams, 42 | maxSBTToMint 43 | ) 44 | { 45 | _grantRole(MINTER_ROLE, admin); 46 | } 47 | 48 | /* ========== RESTRICTED FUNCTIONS ====================================== */ 49 | 50 | /* ========== MUTATIVE FUNCTIONS ======================================== */ 51 | 52 | /* ========== VIEWS ===================================================== */ 53 | 54 | /* ========== PRIVATE FUNCTIONS ========================================= */ 55 | 56 | function _mintWithCounter( 57 | address paymentMethod, 58 | uint256 identityId 59 | ) internal virtual onlyRole(MINTER_ROLE) returns (uint256) { 60 | address to = soulboundIdentity.ownerOf(identityId); 61 | uint256 tokenId = MasaSBT._mintWithCounter(paymentMethod, to); 62 | emit MintedToIdentity(tokenId, identityId); 63 | 64 | return tokenId; 65 | } 66 | 67 | function _mintWithCounter( 68 | address paymentMethod, 69 | address to 70 | ) internal virtual override onlyRole(MINTER_ROLE) returns (uint256) { 71 | uint256 tokenId = MasaSBT._mintWithCounter(paymentMethod, to); 72 | emit MintedToAddress(tokenId, to); 73 | 74 | return tokenId; 75 | } 76 | 77 | /* ========== MODIFIERS ================================================= */ 78 | 79 | /* ========== EVENTS ==================================================== */ 80 | 81 | event MintedToIdentity(uint256 tokenId, uint256 identityId); 82 | 83 | event MintedToAddress(uint256 tokenId, address to); 84 | } 85 | -------------------------------------------------------------------------------- /docs/reference/SBT.md: -------------------------------------------------------------------------------- 1 | # SBT 2 | 3 | *Masa Finance* 4 | 5 | > SBT 6 | 7 | Soulbound token is an NFT token that is not transferable. 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address owner) external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | *See {ISBT-balanceOf}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | owner | address | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | undefined | 34 | 35 | ### name 36 | 37 | ```solidity 38 | function name() external view returns (string) 39 | ``` 40 | 41 | 42 | 43 | *See {ISBTMetadata-name}.* 44 | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | string | undefined | 51 | 52 | ### ownerOf 53 | 54 | ```solidity 55 | function ownerOf(uint256 tokenId) external view returns (address) 56 | ``` 57 | 58 | 59 | 60 | *See {ISBT-ownerOf}.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | tokenId | uint256 | undefined | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | _0 | address | undefined | 73 | 74 | ### supportsInterface 75 | 76 | ```solidity 77 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 78 | ``` 79 | 80 | 81 | 82 | *See {IERC165-supportsInterface}.* 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | interfaceId | bytes4 | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | _0 | bool | undefined | 95 | 96 | ### symbol 97 | 98 | ```solidity 99 | function symbol() external view returns (string) 100 | ``` 101 | 102 | 103 | 104 | *See {ISBTMetadata-symbol}.* 105 | 106 | 107 | #### Returns 108 | 109 | | Name | Type | Description | 110 | |---|---|---| 111 | | _0 | string | undefined | 112 | 113 | ### tokenURI 114 | 115 | ```solidity 116 | function tokenURI(uint256 tokenId) external view returns (string) 117 | ``` 118 | 119 | 120 | 121 | *See {ISBTMetadata-tokenURI}.* 122 | 123 | #### Parameters 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | tokenId | uint256 | undefined | 128 | 129 | #### Returns 130 | 131 | | Name | Type | Description | 132 | |---|---|---| 133 | | _0 | string | undefined | 134 | 135 | 136 | 137 | ## Events 138 | 139 | ### Burn 140 | 141 | ```solidity 142 | event Burn(address indexed _owner, uint256 indexed _tokenId) 143 | ``` 144 | 145 | 146 | 147 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 148 | 149 | #### Parameters 150 | 151 | | Name | Type | Description | 152 | |---|---|---| 153 | | _owner `indexed` | address | undefined | 154 | | _tokenId `indexed` | uint256 | undefined | 155 | 156 | ### Mint 157 | 158 | ```solidity 159 | event Mint(address indexed _owner, uint256 indexed _tokenId) 160 | ``` 161 | 162 | 163 | 164 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 165 | 166 | #### Parameters 167 | 168 | | Name | Type | Description | 169 | |---|---|---| 170 | | _owner `indexed` | address | undefined | 171 | | _tokenId `indexed` | uint256 | undefined | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/tokens/SBT/SBT.md: -------------------------------------------------------------------------------- 1 | # SBT 2 | 3 | *Masa Finance* 4 | 5 | > SBT 6 | 7 | Soulbound token is an NFT token that is not transferable. 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address owner) external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | *See {ISBT-balanceOf}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | owner | address | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | undefined | 34 | 35 | ### name 36 | 37 | ```solidity 38 | function name() external view returns (string) 39 | ``` 40 | 41 | 42 | 43 | *See {ISBTMetadata-name}.* 44 | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | string | undefined | 51 | 52 | ### ownerOf 53 | 54 | ```solidity 55 | function ownerOf(uint256 tokenId) external view returns (address) 56 | ``` 57 | 58 | 59 | 60 | *See {ISBT-ownerOf}.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | tokenId | uint256 | undefined | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | _0 | address | undefined | 73 | 74 | ### supportsInterface 75 | 76 | ```solidity 77 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 78 | ``` 79 | 80 | 81 | 82 | *See {IERC165-supportsInterface}.* 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | interfaceId | bytes4 | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | _0 | bool | undefined | 95 | 96 | ### symbol 97 | 98 | ```solidity 99 | function symbol() external view returns (string) 100 | ``` 101 | 102 | 103 | 104 | *See {ISBTMetadata-symbol}.* 105 | 106 | 107 | #### Returns 108 | 109 | | Name | Type | Description | 110 | |---|---|---| 111 | | _0 | string | undefined | 112 | 113 | ### tokenURI 114 | 115 | ```solidity 116 | function tokenURI(uint256 tokenId) external view returns (string) 117 | ``` 118 | 119 | 120 | 121 | *See {ISBTMetadata-tokenURI}.* 122 | 123 | #### Parameters 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | tokenId | uint256 | undefined | 128 | 129 | #### Returns 130 | 131 | | Name | Type | Description | 132 | |---|---|---| 133 | | _0 | string | undefined | 134 | 135 | 136 | 137 | ## Events 138 | 139 | ### Burn 140 | 141 | ```solidity 142 | event Burn(address indexed _owner, uint256 indexed _tokenId) 143 | ``` 144 | 145 | 146 | 147 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 148 | 149 | #### Parameters 150 | 151 | | Name | Type | Description | 152 | |---|---|---| 153 | | _owner `indexed` | address | undefined | 154 | | _tokenId `indexed` | uint256 | undefined | 155 | 156 | ### Mint 157 | 158 | ```solidity 159 | event Mint(address indexed _owner, uint256 indexed _tokenId) 160 | ``` 161 | 162 | 163 | 164 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 165 | 166 | #### Parameters 167 | 168 | | Name | Type | Description | 169 | |---|---|---| 170 | | _owner `indexed` | address | undefined | 171 | | _tokenId `indexed` | uint256 | undefined | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/reference/IUniswapRouter.md: -------------------------------------------------------------------------------- 1 | # IUniswapRouter 2 | 3 | *Masa Finance* 4 | 5 | > Uniswap Router interface 6 | 7 | Interface of the Uniswap Router contract 8 | 9 | *This interface is used to interact with the Uniswap Router contract, and gets the most important functions of the contract. It's based on https://github.com/Uniswap/v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol* 10 | 11 | ## Methods 12 | 13 | ### getAmountsIn 14 | 15 | ```solidity 16 | function getAmountsIn(uint256 amountOut, address[] path) external view returns (uint256[] amounts) 17 | ``` 18 | 19 | 20 | 21 | 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | amountOut | uint256 | undefined | 28 | | path | address[] | undefined | 29 | 30 | #### Returns 31 | 32 | | Name | Type | Description | 33 | |---|---|---| 34 | | amounts | uint256[] | undefined | 35 | 36 | ### getAmountsOut 37 | 38 | ```solidity 39 | function getAmountsOut(uint256 amountIn, address[] path) external view returns (uint256[] amounts) 40 | ``` 41 | 42 | 43 | 44 | 45 | 46 | #### Parameters 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | amountIn | uint256 | undefined | 51 | | path | address[] | undefined | 52 | 53 | #### Returns 54 | 55 | | Name | Type | Description | 56 | |---|---|---| 57 | | amounts | uint256[] | undefined | 58 | 59 | ### swapExactETHForTokens 60 | 61 | ```solidity 62 | function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) external payable returns (uint256[] amounts) 63 | ``` 64 | 65 | 66 | 67 | 68 | 69 | #### Parameters 70 | 71 | | Name | Type | Description | 72 | |---|---|---| 73 | | amountOutMin | uint256 | undefined | 74 | | path | address[] | undefined | 75 | | to | address | undefined | 76 | | deadline | uint256 | undefined | 77 | 78 | #### Returns 79 | 80 | | Name | Type | Description | 81 | |---|---|---| 82 | | amounts | uint256[] | undefined | 83 | 84 | ### swapExactTokensForETH 85 | 86 | ```solidity 87 | function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) external nonpayable returns (uint256[] amounts) 88 | ``` 89 | 90 | 91 | 92 | 93 | 94 | #### Parameters 95 | 96 | | Name | Type | Description | 97 | |---|---|---| 98 | | amountIn | uint256 | undefined | 99 | | amountOutMin | uint256 | undefined | 100 | | path | address[] | undefined | 101 | | to | address | undefined | 102 | | deadline | uint256 | undefined | 103 | 104 | #### Returns 105 | 106 | | Name | Type | Description | 107 | |---|---|---| 108 | | amounts | uint256[] | undefined | 109 | 110 | ### swapExactTokensForTokens 111 | 112 | ```solidity 113 | function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) external nonpayable returns (uint256[] amounts) 114 | ``` 115 | 116 | 117 | 118 | 119 | 120 | #### Parameters 121 | 122 | | Name | Type | Description | 123 | |---|---|---| 124 | | amountIn | uint256 | undefined | 125 | | amountOutMin | uint256 | undefined | 126 | | path | address[] | undefined | 127 | | to | address | undefined | 128 | | deadline | uint256 | undefined | 129 | 130 | #### Returns 131 | 132 | | Name | Type | Description | 133 | |---|---|---| 134 | | amounts | uint256[] | undefined | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /docs/interfaces/dex/IUniswapRouter.md: -------------------------------------------------------------------------------- 1 | # IUniswapRouter 2 | 3 | *Masa Finance* 4 | 5 | > Uniswap Router interface 6 | 7 | Interface of the Uniswap Router contract 8 | 9 | *This interface is used to interact with the Uniswap Router contract, and gets the most important functions of the contract. It's based on https://github.com/Uniswap/v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol* 10 | 11 | ## Methods 12 | 13 | ### getAmountsIn 14 | 15 | ```solidity 16 | function getAmountsIn(uint256 amountOut, address[] path) external view returns (uint256[] amounts) 17 | ``` 18 | 19 | 20 | 21 | 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | amountOut | uint256 | undefined | 28 | | path | address[] | undefined | 29 | 30 | #### Returns 31 | 32 | | Name | Type | Description | 33 | |---|---|---| 34 | | amounts | uint256[] | undefined | 35 | 36 | ### getAmountsOut 37 | 38 | ```solidity 39 | function getAmountsOut(uint256 amountIn, address[] path) external view returns (uint256[] amounts) 40 | ``` 41 | 42 | 43 | 44 | 45 | 46 | #### Parameters 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | amountIn | uint256 | undefined | 51 | | path | address[] | undefined | 52 | 53 | #### Returns 54 | 55 | | Name | Type | Description | 56 | |---|---|---| 57 | | amounts | uint256[] | undefined | 58 | 59 | ### swapExactETHForTokens 60 | 61 | ```solidity 62 | function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) external payable returns (uint256[] amounts) 63 | ``` 64 | 65 | 66 | 67 | 68 | 69 | #### Parameters 70 | 71 | | Name | Type | Description | 72 | |---|---|---| 73 | | amountOutMin | uint256 | undefined | 74 | | path | address[] | undefined | 75 | | to | address | undefined | 76 | | deadline | uint256 | undefined | 77 | 78 | #### Returns 79 | 80 | | Name | Type | Description | 81 | |---|---|---| 82 | | amounts | uint256[] | undefined | 83 | 84 | ### swapExactTokensForETH 85 | 86 | ```solidity 87 | function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) external nonpayable returns (uint256[] amounts) 88 | ``` 89 | 90 | 91 | 92 | 93 | 94 | #### Parameters 95 | 96 | | Name | Type | Description | 97 | |---|---|---| 98 | | amountIn | uint256 | undefined | 99 | | amountOutMin | uint256 | undefined | 100 | | path | address[] | undefined | 101 | | to | address | undefined | 102 | | deadline | uint256 | undefined | 103 | 104 | #### Returns 105 | 106 | | Name | Type | Description | 107 | |---|---|---| 108 | | amounts | uint256[] | undefined | 109 | 110 | ### swapExactTokensForTokens 111 | 112 | ```solidity 113 | function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) external nonpayable returns (uint256[] amounts) 114 | ``` 115 | 116 | 117 | 118 | 119 | 120 | #### Parameters 121 | 122 | | Name | Type | Description | 123 | |---|---|---| 124 | | amountIn | uint256 | undefined | 125 | | amountOutMin | uint256 | undefined | 126 | | path | address[] | undefined | 127 | | to | address | undefined | 128 | | deadline | uint256 | undefined | 129 | 130 | #### Returns 131 | 132 | | Name | Type | Description | 133 | |---|---|---| 134 | | amounts | uint256[] | undefined | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /deploy/SoulName.ts: -------------------------------------------------------------------------------- 1 | import { run } from "hardhat"; 2 | import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; 3 | import { DeployFunction } from "hardhat-deploy/dist/types"; 4 | import { getEnvParams, getPrivateKey } from "../src/EnvParams"; 5 | 6 | let admin: SignerWithAddress; 7 | 8 | const func: DeployFunction = async ({ 9 | // @ts-ignore 10 | getNamedAccounts, 11 | // @ts-ignore 12 | deployments, 13 | // @ts-ignore 14 | ethers, 15 | network 16 | }) => { 17 | const { deploy } = deployments; 18 | const { deployer } = await getNamedAccounts(); 19 | 20 | [, admin] = await ethers.getSigners(); 21 | const env = getEnvParams(network.name); 22 | 23 | const soulboundIdentityDeployed = await deployments.get("SoulboundIdentity"); 24 | 25 | const constructorArguments = [ 26 | env.ADMIN || admin.address, 27 | env.SOULNAME_NAME, 28 | env.SOULNAME_SYMBOL, 29 | soulboundIdentityDeployed.address, 30 | env.SOULNAME_EXTENSION || ".soul", 31 | env.SOUL_NAME_CONTRACT_URI 32 | ]; 33 | 34 | if ( 35 | network.name === "ethereum" || 36 | network.name === "sepolia" || 37 | network.name === "hardhat" || 38 | network.name === "celo" || 39 | network.name === "alfajores" || 40 | network.name === "base" || 41 | network.name === "basegoerli" 42 | ) { 43 | const soulNameDeploymentResult = await deploy("SoulName", { 44 | from: deployer, 45 | args: constructorArguments, 46 | log: true 47 | }); 48 | 49 | // verify contract with etherscan, if its not a local network or celo 50 | if (network.name !== "hardhat") { 51 | try { 52 | await run("verify:verify", { 53 | address: soulNameDeploymentResult.address, 54 | constructorArguments 55 | }); 56 | } catch (error) { 57 | if ( 58 | !error.message.includes("Contract source code already verified") && 59 | !error.message.includes("Reason: Already Verified") 60 | ) { 61 | throw error; 62 | } 63 | } 64 | } 65 | 66 | if ( 67 | network.name === "hardhat" || 68 | network.name === "alfajores" || 69 | network.name === "basegoerli" 70 | ) { 71 | const soulboundIdentity = await ethers.getContractAt( 72 | "SoulboundIdentity", 73 | soulboundIdentityDeployed.address 74 | ); 75 | const soulName = await ethers.getContractAt( 76 | "SoulName", 77 | soulNameDeploymentResult.address 78 | ); 79 | 80 | // we set the soulName contract in soulboundIdentity and we add soulboundIdentity as soulName minter 81 | const signer = env.ADMIN 82 | ? new ethers.Wallet(getPrivateKey(network.name), ethers.provider) 83 | : admin; 84 | 85 | const MINTER_ROLE = await soulName.MINTER_ROLE(); 86 | await soulboundIdentity 87 | .connect(signer) 88 | .setSoulName(soulNameDeploymentResult.address); 89 | await soulName 90 | .connect(signer) 91 | .grantRole(MINTER_ROLE, soulboundIdentityDeployed.address); 92 | } 93 | } 94 | }; 95 | 96 | func.skip = async ({ network }) => { 97 | return ( 98 | network.name !== "ethereum" && 99 | network.name !== "sepolia" && 100 | network.name !== "hardhat" && 101 | network.name !== "celo" && 102 | network.name !== "alfajores" && 103 | network.name !== "base" && 104 | network.name !== "basegoerli" 105 | ); 106 | }; 107 | func.tags = ["SoulName"]; 108 | func.dependencies = ["SoulboundIdentity"]; 109 | export default func; 110 | -------------------------------------------------------------------------------- /docs/reference/SBTBurnable.md: -------------------------------------------------------------------------------- 1 | # SBTBurnable 2 | 3 | 4 | 5 | > SBT Burnable Token 6 | 7 | 8 | 9 | *SBT Token that can be burned (destroyed).* 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address owner) external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | *See {ISBT-balanceOf}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | owner | address | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | undefined | 34 | 35 | ### burn 36 | 37 | ```solidity 38 | function burn(uint256 tokenId) external nonpayable 39 | ``` 40 | 41 | 42 | 43 | *Burns `tokenId`. See {SBT-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator.* 44 | 45 | #### Parameters 46 | 47 | | Name | Type | Description | 48 | |---|---|---| 49 | | tokenId | uint256 | undefined | 50 | 51 | ### name 52 | 53 | ```solidity 54 | function name() external view returns (string) 55 | ``` 56 | 57 | 58 | 59 | *See {ISBTMetadata-name}.* 60 | 61 | 62 | #### Returns 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | _0 | string | undefined | 67 | 68 | ### ownerOf 69 | 70 | ```solidity 71 | function ownerOf(uint256 tokenId) external view returns (address) 72 | ``` 73 | 74 | 75 | 76 | *See {ISBT-ownerOf}.* 77 | 78 | #### Parameters 79 | 80 | | Name | Type | Description | 81 | |---|---|---| 82 | | tokenId | uint256 | undefined | 83 | 84 | #### Returns 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | _0 | address | undefined | 89 | 90 | ### supportsInterface 91 | 92 | ```solidity 93 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 94 | ``` 95 | 96 | 97 | 98 | *See {IERC165-supportsInterface}.* 99 | 100 | #### Parameters 101 | 102 | | Name | Type | Description | 103 | |---|---|---| 104 | | interfaceId | bytes4 | undefined | 105 | 106 | #### Returns 107 | 108 | | Name | Type | Description | 109 | |---|---|---| 110 | | _0 | bool | undefined | 111 | 112 | ### symbol 113 | 114 | ```solidity 115 | function symbol() external view returns (string) 116 | ``` 117 | 118 | 119 | 120 | *See {ISBTMetadata-symbol}.* 121 | 122 | 123 | #### Returns 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | _0 | string | undefined | 128 | 129 | ### tokenURI 130 | 131 | ```solidity 132 | function tokenURI(uint256 tokenId) external view returns (string) 133 | ``` 134 | 135 | 136 | 137 | *See {ISBTMetadata-tokenURI}.* 138 | 139 | #### Parameters 140 | 141 | | Name | Type | Description | 142 | |---|---|---| 143 | | tokenId | uint256 | undefined | 144 | 145 | #### Returns 146 | 147 | | Name | Type | Description | 148 | |---|---|---| 149 | | _0 | string | undefined | 150 | 151 | 152 | 153 | ## Events 154 | 155 | ### Burn 156 | 157 | ```solidity 158 | event Burn(address indexed _owner, uint256 indexed _tokenId) 159 | ``` 160 | 161 | 162 | 163 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 164 | 165 | #### Parameters 166 | 167 | | Name | Type | Description | 168 | |---|---|---| 169 | | _owner `indexed` | address | undefined | 170 | | _tokenId `indexed` | uint256 | undefined | 171 | 172 | ### Mint 173 | 174 | ```solidity 175 | event Mint(address indexed _owner, uint256 indexed _tokenId) 176 | ``` 177 | 178 | 179 | 180 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 181 | 182 | #### Parameters 183 | 184 | | Name | Type | Description | 185 | |---|---|---| 186 | | _owner `indexed` | address | undefined | 187 | | _tokenId `indexed` | uint256 | undefined | 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /docs/tokens/SBT/extensions/SBTBurnable.md: -------------------------------------------------------------------------------- 1 | # SBTBurnable 2 | 3 | 4 | 5 | > SBT Burnable Token 6 | 7 | 8 | 9 | *SBT Token that can be burned (destroyed).* 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address owner) external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | *See {ISBT-balanceOf}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | owner | address | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | undefined | 34 | 35 | ### burn 36 | 37 | ```solidity 38 | function burn(uint256 tokenId) external nonpayable 39 | ``` 40 | 41 | 42 | 43 | *Burns `tokenId`. See {SBT-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator.* 44 | 45 | #### Parameters 46 | 47 | | Name | Type | Description | 48 | |---|---|---| 49 | | tokenId | uint256 | undefined | 50 | 51 | ### name 52 | 53 | ```solidity 54 | function name() external view returns (string) 55 | ``` 56 | 57 | 58 | 59 | *See {ISBTMetadata-name}.* 60 | 61 | 62 | #### Returns 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | _0 | string | undefined | 67 | 68 | ### ownerOf 69 | 70 | ```solidity 71 | function ownerOf(uint256 tokenId) external view returns (address) 72 | ``` 73 | 74 | 75 | 76 | *See {ISBT-ownerOf}.* 77 | 78 | #### Parameters 79 | 80 | | Name | Type | Description | 81 | |---|---|---| 82 | | tokenId | uint256 | undefined | 83 | 84 | #### Returns 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | _0 | address | undefined | 89 | 90 | ### supportsInterface 91 | 92 | ```solidity 93 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 94 | ``` 95 | 96 | 97 | 98 | *See {IERC165-supportsInterface}.* 99 | 100 | #### Parameters 101 | 102 | | Name | Type | Description | 103 | |---|---|---| 104 | | interfaceId | bytes4 | undefined | 105 | 106 | #### Returns 107 | 108 | | Name | Type | Description | 109 | |---|---|---| 110 | | _0 | bool | undefined | 111 | 112 | ### symbol 113 | 114 | ```solidity 115 | function symbol() external view returns (string) 116 | ``` 117 | 118 | 119 | 120 | *See {ISBTMetadata-symbol}.* 121 | 122 | 123 | #### Returns 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | _0 | string | undefined | 128 | 129 | ### tokenURI 130 | 131 | ```solidity 132 | function tokenURI(uint256 tokenId) external view returns (string) 133 | ``` 134 | 135 | 136 | 137 | *See {ISBTMetadata-tokenURI}.* 138 | 139 | #### Parameters 140 | 141 | | Name | Type | Description | 142 | |---|---|---| 143 | | tokenId | uint256 | undefined | 144 | 145 | #### Returns 146 | 147 | | Name | Type | Description | 148 | |---|---|---| 149 | | _0 | string | undefined | 150 | 151 | 152 | 153 | ## Events 154 | 155 | ### Burn 156 | 157 | ```solidity 158 | event Burn(address indexed _owner, uint256 indexed _tokenId) 159 | ``` 160 | 161 | 162 | 163 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 164 | 165 | #### Parameters 166 | 167 | | Name | Type | Description | 168 | |---|---|---| 169 | | _owner `indexed` | address | undefined | 170 | | _tokenId `indexed` | uint256 | undefined | 171 | 172 | ### Mint 173 | 174 | ```solidity 175 | event Mint(address indexed _owner, uint256 indexed _tokenId) 176 | ``` 177 | 178 | 179 | 180 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 181 | 182 | #### Parameters 183 | 184 | | Name | Type | Description | 185 | |---|---|---| 186 | | _owner `indexed` | address | undefined | 187 | | _tokenId `indexed` | uint256 | undefined | 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /deploy/SoulLinker.ts: -------------------------------------------------------------------------------- 1 | import { run } from "hardhat"; 2 | import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; 3 | import { DeployFunction } from "hardhat-deploy/dist/types"; 4 | import { getEnvParams, getPrivateKey } from "../src/EnvParams"; 5 | 6 | let admin: SignerWithAddress; 7 | 8 | const func: DeployFunction = async ({ 9 | // @ts-ignore 10 | getNamedAccounts, 11 | // @ts-ignore 12 | deployments, 13 | // @ts-ignore 14 | ethers, 15 | network 16 | }) => { 17 | const { deploy } = deployments; 18 | const { deployer } = await getNamedAccounts(); 19 | 20 | // const currentNonce: number = await ethers.provider.getTransactionCount(deployer); 21 | // to solve REPLACEMENT_UNDERPRICED, when needed 22 | 23 | [, admin] = await ethers.getSigners(); 24 | const env = getEnvParams(network.name); 25 | 26 | const soulboundIdentityDeployed = await deployments.get("SoulboundIdentity"); 27 | const soulNameDeployed = await deployments.get("SoulName"); 28 | 29 | const constructorArguments = [ 30 | env.ADMIN || admin.address, 31 | soulboundIdentityDeployed.address, 32 | [soulNameDeployed.address], 33 | [ 34 | env.SWAP_ROUTER, 35 | env.WETH_TOKEN, 36 | env.USDC_TOKEN, 37 | env.MASA_TOKEN, 38 | env.PROJECTFEE_RECEIVER || admin.address, 39 | env.PROTOCOLFEE_RECEIVER || ethers.constants.AddressZero, 40 | env.PROTOCOLFEE_AMOUNT || 0, 41 | env.PROTOCOLFEE_PERCENT || 0, 42 | env.PROTOCOLFEE_PERCENT_SUB || 0 43 | ] 44 | ]; 45 | 46 | if ( 47 | network.name === "ethereum" || 48 | network.name === "sepolia" || 49 | network.name === "hardhat" || 50 | network.name === "mumbai" || 51 | network.name === "polygon" 52 | ) { 53 | const soulLinkerDeploymentResult = await deploy("SoulLinker", { 54 | from: deployer, 55 | args: constructorArguments, 56 | log: true 57 | // nonce: currentNonce + 1 // to solve REPLACEMENT_UNDERPRICED, when needed 58 | }); 59 | 60 | // verify contract with etherscan, if its not a local network or celo 61 | if (network.name !== "hardhat") { 62 | try { 63 | await run("verify:verify", { 64 | address: soulLinkerDeploymentResult.address, 65 | constructorArguments 66 | }); 67 | } catch (error) { 68 | if ( 69 | !error.message.includes("Contract source code already verified") && 70 | !error.message.includes("Reason: Already Verified") 71 | ) { 72 | throw error; 73 | } 74 | } 75 | } 76 | 77 | if (network.name === "hardhat" || network.name === "mumbai") { 78 | // we add payment methods 79 | 80 | const signer = env.ADMIN 81 | ? new ethers.Wallet(getPrivateKey(network.name), ethers.provider) 82 | : admin; 83 | 84 | const soulLinker = await ethers.getContractAt( 85 | "SoulLinker", 86 | soulLinkerDeploymentResult.address 87 | ); 88 | 89 | const paymentMethods = env.PAYMENT_METHODS_SOULLINKER.split(" "); 90 | for (let i = 0; i < paymentMethods.length; i++) { 91 | await soulLinker.connect(signer).enablePaymentMethod(paymentMethods[i]); 92 | } 93 | } 94 | } 95 | }; 96 | 97 | func.skip = async ({ network }) => { 98 | return ( 99 | network.name !== "ethereum" && 100 | network.name !== "sepolia" && 101 | network.name !== "hardhat" && 102 | network.name !== "mumbai" && 103 | network.name !== "polygon" 104 | ); 105 | }; 106 | func.tags = ["SoulLinker"]; 107 | func.dependencies = [ 108 | "SoulboundIdentity", 109 | "SoulName", 110 | "SoulboundCreditScore", 111 | "SoulboundGreen" 112 | ]; 113 | export default func; 114 | -------------------------------------------------------------------------------- /addresses.json: -------------------------------------------------------------------------------- 1 | { 2 | "alfajores": { 3 | "SoulName": "0xf163686d50C800C49ED58836d3a4D1fBA057CeE6", 4 | "SoulStore": "0x1B830e25CcBf8C0D512653800a294876fA658c67", 5 | "SoulboundGreen": "0x1fCE0Ae50a8900f09E4A437F33E95313225Bb4b7", 6 | "SoulboundIdentity": "0xcb85D14082B67e470fD9C2979F3A75341124a338" 7 | }, 8 | "base": { 9 | "SoulName": "0x836198F984431EcdC97A7549C1Bd6B3Cd9E7a89B", 10 | "SoulStore": "0x6Aa37dF2392007209C54A2162beF21623705dC22", 11 | "SoulboundGreen": "0x132237dA1CCf1a0433bf5ed259baa3E444F631D7", 12 | "SoulboundIdentity": "0x576E82208df807B07b9e4B4bDBd7F7862F1152a9" 13 | }, 14 | "basegoerli": { 15 | "SoulName": "0xC6CA7be41Ba10a3645988B77a523231666540b82", 16 | "SoulStore": "0x22b8BCBdEbbbe223435d899B0100A171a106Bb58", 17 | "SoulboundGreen": "0x5a50935a8918220b1941a6Ec91a505C380A64cBd", 18 | "SoulboundIdentity": "0x332aB163a034F912509Cae2F15f91f3263FF6479" 19 | }, 20 | "bsc": { 21 | "SoulboundGreen": "0x4d236e55e54Ed960887659d046C60f377cCa58F8", 22 | "SoulboundIdentity": "0x7ab73C2F083B2725E5b6e245E6EA945d5f3CaaeA" 23 | }, 24 | "bsctest": { 25 | "SoulboundGreen": "0x471e69B65c5b00FdBeB0f343CD46F98E4ea6F5ae", 26 | "SoulboundIdentity": "0x1fCE0Ae50a8900f09E4A437F33E95313225Bb4b7" 27 | }, 28 | "celo": { 29 | "SoulName": "0x376f5039Df4e9E9c864185d8FaBad4f04A7E394A", 30 | "SoulStore": "0x6Aa37dF2392007209C54A2162beF21623705dC22", 31 | "SoulboundGreen": "0x4d236e55e54Ed960887659d046C60f377cCa58F8", 32 | "SoulboundIdentity": "0x836198F984431EcdC97A7549C1Bd6B3Cd9E7a89B" 33 | }, 34 | "ethereum": { 35 | "SoulLinker": "0xc1E0795Dd6d214bbAf94A805D3b25A69408aCBDb", 36 | "SoulName": "0x7ab73C2F083B2725E5b6e245E6EA945d5f3CaaeA", 37 | "SoulStore": "0x1C7652919598b32C576D362E74F44C6E34EF7Aba", 38 | "SoulboundCreditScore": "0x4d236e55e54Ed960887659d046C60f377cCa58F8", 39 | "SoulboundGreen": "0xeB05dca1A7e0E37E364B938d989fc0273Ff3bFCa", 40 | "SoulboundIdentity": "0x8903D8D4F4c06814D7ecb42b1258E2209d53A7d4" 41 | }, 42 | "goerli": { 43 | "SoulLinker": "0xB99CA5896D3cb306B6066e22B3CB82eA10361279", 44 | "SoulName": "0x65627C04433d72283662B58B423bA8A1dfBd3fe3", 45 | "SoulStore": "0x5a50935a8918220b1941a6Ec91a505C380A64cBd", 46 | "SoulboundCreditScore": "0xEd3f3cB6a47bC9Ddcb3F87DA1261E9A4B6F523D7", 47 | "SoulboundGreen": "0xCB3f0EC4019f20D0eA05d7db0f6E82f2DA3a619D", 48 | "SoulboundIdentity": "0x2c4C19752af9182949f237e843e104Dd79F4bfF1" 49 | }, 50 | "masa": { 51 | "SoulboundIdentity": "0x0dDD88779fBB936B4dDd5a7C4D18f29C0bcd8e2d" 52 | }, 53 | "masatest": { 54 | "SoulboundIdentity": "0x4511815866790D0149712FD7c04f6921176E5a04" 55 | }, 56 | "mumbai": { 57 | "SoulLinker": "0xb1262BdA5dce7D57bEbea4ff9c49C2476A43245c", 58 | "SoulStore": "0x65627C04433d72283662B58B423bA8A1dfBd3fe3", 59 | "SoulboundCreditScore": "0xbC4123B1ccf5A972D00e9C5a438b96471a16183C", 60 | "SoulboundGreen": "0xf03cc5996C6d83c7A63Bc7bcAA46F55e691e811c", 61 | "SoulboundIdentity": "0xC6CA7be41Ba10a3645988B77a523231666540b82" 62 | }, 63 | "opbnb": { 64 | "SoulboundIdentity": "0x6Aa37dF2392007209C54A2162beF21623705dC22" 65 | }, 66 | "opbnbtest": { 67 | "SoulboundIdentity": "0xb6f59e114f2bF57B1891f08fC23B3C696b7D3b16" 68 | }, 69 | "polygon": { 70 | "SoulStore": "0x576E82208df807B07b9e4B4bDBd7F7862F1152a9", 71 | "SoulboundCreditScore": "0x1C7652919598b32C576D362E74F44C6E34EF7Aba", 72 | "SoulboundGreen": "0x4d236e55e54Ed960887659d046C60f377cCa58F8", 73 | "SoulboundIdentity": "0x7ab73C2F083B2725E5b6e245E6EA945d5f3CaaeA" 74 | }, 75 | "scroll": { 76 | "SoulboundIdentity": "0x8903D8D4F4c06814D7ecb42b1258E2209d53A7d4" 77 | }, 78 | "scrolltest": { 79 | "SoulboundIdentity": "0x78A660183257C4699a57a2D85a7Cf49b4DA75A6E" 80 | } 81 | } -------------------------------------------------------------------------------- /docs/interfaces/ISoulName.md: -------------------------------------------------------------------------------- 1 | # ISoulName 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### getExtension 14 | 15 | ```solidity 16 | function getExtension() external view returns (string) 17 | ``` 18 | 19 | 20 | 21 | 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | string | undefined | 29 | 30 | ### getSoulNames 31 | 32 | ```solidity 33 | function getSoulNames(uint256 identityId) external view returns (string[] sbtNames) 34 | ``` 35 | 36 | 37 | 38 | 39 | 40 | #### Parameters 41 | 42 | | Name | Type | Description | 43 | |---|---|---| 44 | | identityId | uint256 | undefined | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | sbtNames | string[] | undefined | 51 | 52 | ### getSoulNames 53 | 54 | ```solidity 55 | function getSoulNames(address owner) external view returns (string[] sbtNames) 56 | ``` 57 | 58 | 59 | 60 | 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | owner | address | undefined | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | sbtNames | string[] | undefined | 73 | 74 | ### getTokenData 75 | 76 | ```solidity 77 | function getTokenData(string name) external view returns (string sbtName, bool linked, uint256 identityId, uint256 tokenId, uint256 expirationDate, bool active) 78 | ``` 79 | 80 | 81 | 82 | 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | name | string | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | sbtName | string | undefined | 95 | | linked | bool | undefined | 96 | | identityId | uint256 | undefined | 97 | | tokenId | uint256 | undefined | 98 | | expirationDate | uint256 | undefined | 99 | | active | bool | undefined | 100 | 101 | ### getTokenId 102 | 103 | ```solidity 104 | function getTokenId(string name) external view returns (uint256) 105 | ``` 106 | 107 | 108 | 109 | 110 | 111 | #### Parameters 112 | 113 | | Name | Type | Description | 114 | |---|---|---| 115 | | name | string | undefined | 116 | 117 | #### Returns 118 | 119 | | Name | Type | Description | 120 | |---|---|---| 121 | | _0 | uint256 | undefined | 122 | 123 | ### isAvailable 124 | 125 | ```solidity 126 | function isAvailable(string name) external view returns (bool available) 127 | ``` 128 | 129 | 130 | 131 | 132 | 133 | #### Parameters 134 | 135 | | Name | Type | Description | 136 | |---|---|---| 137 | | name | string | undefined | 138 | 139 | #### Returns 140 | 141 | | Name | Type | Description | 142 | |---|---|---| 143 | | available | bool | undefined | 144 | 145 | ### mint 146 | 147 | ```solidity 148 | function mint(address to, string name, uint256 yearsPeriod, string _tokenURI) external nonpayable returns (uint256) 149 | ``` 150 | 151 | 152 | 153 | 154 | 155 | #### Parameters 156 | 157 | | Name | Type | Description | 158 | |---|---|---| 159 | | to | address | undefined | 160 | | name | string | undefined | 161 | | yearsPeriod | uint256 | undefined | 162 | | _tokenURI | string | undefined | 163 | 164 | #### Returns 165 | 166 | | Name | Type | Description | 167 | |---|---|---| 168 | | _0 | uint256 | undefined | 169 | 170 | ### tokenData 171 | 172 | ```solidity 173 | function tokenData(uint256 tokenId) external view returns (string name, uint256 expirationDate) 174 | ``` 175 | 176 | 177 | 178 | 179 | 180 | #### Parameters 181 | 182 | | Name | Type | Description | 183 | |---|---|---| 184 | | tokenId | uint256 | undefined | 185 | 186 | #### Returns 187 | 188 | | Name | Type | Description | 189 | |---|---|---| 190 | | name | string | undefined | 191 | | expirationDate | uint256 | undefined | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /docs/reference/ISoulName.md: -------------------------------------------------------------------------------- 1 | # ISoulName 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### getExtension 14 | 15 | ```solidity 16 | function getExtension() external view returns (string) 17 | ``` 18 | 19 | 20 | 21 | 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | string | undefined | 29 | 30 | ### getSoulNames 31 | 32 | ```solidity 33 | function getSoulNames(uint256 identityId) external view returns (string[] sbtNames) 34 | ``` 35 | 36 | 37 | 38 | 39 | 40 | #### Parameters 41 | 42 | | Name | Type | Description | 43 | |---|---|---| 44 | | identityId | uint256 | undefined | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | sbtNames | string[] | undefined | 51 | 52 | ### getSoulNames 53 | 54 | ```solidity 55 | function getSoulNames(address owner) external view returns (string[] sbtNames) 56 | ``` 57 | 58 | 59 | 60 | 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | owner | address | undefined | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | sbtNames | string[] | undefined | 73 | 74 | ### getTokenData 75 | 76 | ```solidity 77 | function getTokenData(string name) external view returns (string sbtName, bool linked, uint256 identityId, uint256 tokenId, uint256 expirationDate, bool active) 78 | ``` 79 | 80 | 81 | 82 | 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | name | string | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | sbtName | string | undefined | 95 | | linked | bool | undefined | 96 | | identityId | uint256 | undefined | 97 | | tokenId | uint256 | undefined | 98 | | expirationDate | uint256 | undefined | 99 | | active | bool | undefined | 100 | 101 | ### getTokenId 102 | 103 | ```solidity 104 | function getTokenId(string name) external view returns (uint256) 105 | ``` 106 | 107 | 108 | 109 | 110 | 111 | #### Parameters 112 | 113 | | Name | Type | Description | 114 | |---|---|---| 115 | | name | string | undefined | 116 | 117 | #### Returns 118 | 119 | | Name | Type | Description | 120 | |---|---|---| 121 | | _0 | uint256 | undefined | 122 | 123 | ### isAvailable 124 | 125 | ```solidity 126 | function isAvailable(string name) external view returns (bool available) 127 | ``` 128 | 129 | 130 | 131 | 132 | 133 | #### Parameters 134 | 135 | | Name | Type | Description | 136 | |---|---|---| 137 | | name | string | undefined | 138 | 139 | #### Returns 140 | 141 | | Name | Type | Description | 142 | |---|---|---| 143 | | available | bool | undefined | 144 | 145 | ### mint 146 | 147 | ```solidity 148 | function mint(address to, string name, uint256 yearsPeriod, string _tokenURI) external nonpayable returns (uint256) 149 | ``` 150 | 151 | 152 | 153 | 154 | 155 | #### Parameters 156 | 157 | | Name | Type | Description | 158 | |---|---|---| 159 | | to | address | undefined | 160 | | name | string | undefined | 161 | | yearsPeriod | uint256 | undefined | 162 | | _tokenURI | string | undefined | 163 | 164 | #### Returns 165 | 166 | | Name | Type | Description | 167 | |---|---|---| 168 | | _0 | uint256 | undefined | 169 | 170 | ### tokenData 171 | 172 | ```solidity 173 | function tokenData(uint256 tokenId) external view returns (string name, uint256 expirationDate) 174 | ``` 175 | 176 | 177 | 178 | 179 | 180 | #### Parameters 181 | 182 | | Name | Type | Description | 183 | |---|---|---| 184 | | tokenId | uint256 | undefined | 185 | 186 | #### Returns 187 | 188 | | Name | Type | Description | 189 | |---|---|---| 190 | | name | string | undefined | 191 | | expirationDate | uint256 | undefined | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /src/deployDynamicSSSBT.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | import "@nomiclabs/hardhat-ethers"; 3 | import hre from "hardhat"; 4 | import { deployments, ethers, getNamedAccounts, network } from "hardhat"; 5 | import { getEnvParams, getPrivateKey } from "./EnvParams"; 6 | 7 | /** 8 | * main function 9 | */ 10 | async function main() { 11 | const { deploy } = deployments; 12 | const { deployer } = await getNamedAccounts(); 13 | const env = getEnvParams(network.name); 14 | 15 | const SBT_NAME = ""; 16 | const SBT_SYMBOL = ""; 17 | const SBT_BASE_URI = ""; 18 | const SBT_MAXMINTS = 1; 19 | const PAYMENT_METHODS = "0x0000000000000000000000000000000000000000"; 20 | const MINTING_PRICE = 0; 21 | 22 | console.log( 23 | `Deploying to ${network.name} (chainId: ${network.config.chainId})` 24 | ); 25 | console.log(`Deploying with the account: ${deployer}`); 26 | 27 | const soulboundIdentityDeployed = await deployments.get("SoulboundIdentity"); 28 | 29 | const constructorArguments = [ 30 | env.ADMIN, 31 | SBT_NAME, 32 | SBT_SYMBOL, 33 | SBT_BASE_URI, 34 | soulboundIdentityDeployed.address, 35 | [ 36 | env.SWAP_ROUTER, 37 | env.WETH_TOKEN, 38 | env.USDC_TOKEN, 39 | env.MASA_TOKEN, 40 | env.PROJECTFEE_RECEIVER, 41 | env.PROTOCOLFEE_RECEIVER || ethers.constants.AddressZero, 42 | env.PROTOCOLFEE_AMOUNT || 0, 43 | env.PROTOCOLFEE_PERCENT || 0, 44 | env.PROTOCOLFEE_PERCENT_SUB || 0 45 | ], 46 | SBT_MAXMINTS 47 | ]; 48 | 49 | const sssbt = await deploy("MasaDynamicSSSBT", { 50 | from: deployer, 51 | args: constructorArguments, 52 | log: true 53 | }); 54 | 55 | console.log(`MasaDynamicSSSBT deployed to: ${sssbt.address}`); 56 | 57 | // Verify contract 58 | if ( 59 | network.name !== "hardhat" && 60 | network.name !== "masa" && 61 | network.name !== "masatest" 62 | ) { 63 | try { 64 | await hre.run("verify:verify", { 65 | address: sssbt.address, 66 | constructorArguments 67 | }); 68 | } catch (error) { 69 | if ( 70 | !error.message.includes("Contract source code already verified") && 71 | !error.message.includes("Reason: Already Verified") 72 | ) { 73 | throw error; 74 | } 75 | } 76 | } 77 | 78 | // if it's not a production network, we set the variables 79 | if ( 80 | network.name !== "bsc" && 81 | network.name !== "celo" && 82 | network.name !== "ethereum" && 83 | network.name !== "polygon" && 84 | network.name !== "opbnb" && 85 | network.name !== "masa" && 86 | network.name !== "masatest" 87 | ) { 88 | const signer = new ethers.Wallet( 89 | getPrivateKey(network.name), 90 | ethers.provider 91 | ); 92 | 93 | const MasaDynamicSSSBT = await ethers.getContractAt( 94 | "MasaDynamicSSSBT", 95 | sssbt.address 96 | ); 97 | 98 | // add authorities 99 | const authorities = env.AUTHORITY_WALLET.split(" "); 100 | for (let i = 0; i < authorities.length; i++) { 101 | console.log(`Adding authority ${authorities[i]}`); 102 | await MasaDynamicSSSBT.connect(signer).addAuthority(authorities[i]); 103 | } 104 | 105 | // add mint price 106 | if (+MINTING_PRICE != 0) { 107 | await MasaDynamicSSSBT.connect(signer).setMintPrice(MINTING_PRICE); 108 | } 109 | 110 | // we add payment methods 111 | const paymentMethods = PAYMENT_METHODS.split(" "); 112 | for (let i = 0; i < paymentMethods.length; i++) { 113 | console.log(`Adding payment method ${paymentMethods[i]}`); 114 | await MasaDynamicSSSBT.connect(signer).enablePaymentMethod( 115 | paymentMethods[i] 116 | ); 117 | } 118 | } 119 | } 120 | 121 | main() 122 | .then(() => process.exit(0)) 123 | .catch((error) => { 124 | console.error(error); 125 | process.exit(1); 126 | }); 127 | -------------------------------------------------------------------------------- /src/deploySSSBT.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | import "@nomiclabs/hardhat-ethers"; 3 | import hre from "hardhat"; 4 | import { deployments, ethers, getNamedAccounts, network } from "hardhat"; 5 | import { getEnvParams, getPrivateKey } from "./EnvParams"; 6 | 7 | /** 8 | * main function 9 | */ 10 | async function main() { 11 | const { deploy } = deployments; 12 | const { deployer } = await getNamedAccounts(); 13 | const env = getEnvParams(network.name); 14 | 15 | const SBT_NAME = ""; 16 | const SBT_SYMBOL = ""; 17 | const SBT_BASE_URI = ""; 18 | const SBT_MAXMINTS = 1; 19 | const PAYMENT_METHODS = "0x0000000000000000000000000000000000000000"; 20 | const MINTING_PRICE = 0; 21 | 22 | console.log( 23 | `Deploying to ${network.name} (chainId: ${network.config.chainId})` 24 | ); 25 | console.log(`Deploying with the account: ${deployer}`); 26 | 27 | const soulboundIdentityDeployed = await deployments.get("SoulboundIdentity"); 28 | 29 | const constructorArguments = [ 30 | env.ADMIN, 31 | SBT_NAME, 32 | SBT_SYMBOL, 33 | SBT_BASE_URI, 34 | soulboundIdentityDeployed.address, 35 | [ 36 | env.SWAP_ROUTER, 37 | env.WETH_TOKEN, 38 | env.USDC_TOKEN, 39 | env.MASA_TOKEN, 40 | env.PROJECTFEE_RECEIVER, 41 | env.PROTOCOLFEE_RECEIVER || ethers.constants.AddressZero, 42 | env.PROTOCOLFEE_AMOUNT || 0, 43 | env.PROTOCOLFEE_PERCENT || 0, 44 | env.PROTOCOLFEE_PERCENT_SUB || 0 45 | ], 46 | SBT_MAXMINTS 47 | ]; 48 | 49 | const sssbt = await deploy("ReferenceSBTSelfSovereign", { 50 | from: deployer, 51 | args: constructorArguments, 52 | log: true 53 | }); 54 | 55 | console.log(`ReferenceSBTSelfSovereign deployed to: ${sssbt.address}`); 56 | 57 | // Verify contract 58 | if ( 59 | network.name !== "hardhat" && 60 | network.name !== "masa" && 61 | network.name !== "masatest" 62 | ) { 63 | try { 64 | await hre.run("verify:verify", { 65 | address: sssbt.address, 66 | constructorArguments 67 | }); 68 | } catch (error) { 69 | if ( 70 | !error.message.includes("Contract source code already verified") && 71 | !error.message.includes("Reason: Already Verified") 72 | ) { 73 | throw error; 74 | } 75 | } 76 | } 77 | 78 | // if it's not a production network, we set the variables 79 | if ( 80 | network.name !== "bsc" && 81 | network.name !== "celo" && 82 | network.name !== "ethereum" && 83 | network.name !== "polygon" && 84 | network.name !== "opbnb" && 85 | network.name !== "masa" && 86 | network.name !== "masatest" 87 | ) { 88 | const signer = new ethers.Wallet( 89 | getPrivateKey(network.name), 90 | ethers.provider 91 | ); 92 | 93 | const ReferenceSSSBT = await ethers.getContractAt( 94 | "ReferenceSBTSelfSovereign", 95 | sssbt.address 96 | ); 97 | 98 | // add authorities 99 | const authorities = env.AUTHORITY_WALLET.split(" "); 100 | for (let i = 0; i < authorities.length; i++) { 101 | console.log(`Adding authority ${authorities[i]}`); 102 | await ReferenceSSSBT.connect(signer).addAuthority(authorities[i]); 103 | } 104 | 105 | // add mint price 106 | if (+MINTING_PRICE != 0) { 107 | await ReferenceSSSBT.connect(signer).setMintPrice(MINTING_PRICE); 108 | } 109 | 110 | // we add payment methods 111 | const paymentMethods = PAYMENT_METHODS.split(" "); 112 | for (let i = 0; i < paymentMethods.length; i++) { 113 | console.log(`Adding payment method ${paymentMethods[i]}`); 114 | await ReferenceSSSBT.connect(signer).enablePaymentMethod( 115 | paymentMethods[i] 116 | ); 117 | } 118 | } 119 | } 120 | 121 | main() 122 | .then(() => process.exit(0)) 123 | .catch((error) => { 124 | console.error(error); 125 | process.exit(1); 126 | }); 127 | -------------------------------------------------------------------------------- /docs/reference/ISBTMetadata.md: -------------------------------------------------------------------------------- 1 | # ISBTMetadata 2 | 3 | 4 | 5 | > SBT Soulbound Token Standard, optional metadata extension 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address _owner) external view returns (uint256) 17 | ``` 18 | 19 | Count all SBTs assigned to an owner 20 | 21 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | _owner | address | An address for whom to query the balance | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 34 | 35 | ### name 36 | 37 | ```solidity 38 | function name() external view returns (string) 39 | ``` 40 | 41 | 42 | 43 | *Returns the token collection name.* 44 | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | string | undefined | 51 | 52 | ### ownerOf 53 | 54 | ```solidity 55 | function ownerOf(uint256 _tokenId) external view returns (address) 56 | ``` 57 | 58 | Find the owner of an SBT 59 | 60 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | _tokenId | uint256 | The identifier for an SBT | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | _0 | address | The address of the owner of the SBT | 73 | 74 | ### supportsInterface 75 | 76 | ```solidity 77 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 78 | ``` 79 | 80 | 81 | 82 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | interfaceId | bytes4 | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | _0 | bool | undefined | 95 | 96 | ### symbol 97 | 98 | ```solidity 99 | function symbol() external view returns (string) 100 | ``` 101 | 102 | 103 | 104 | *Returns the token collection symbol.* 105 | 106 | 107 | #### Returns 108 | 109 | | Name | Type | Description | 110 | |---|---|---| 111 | | _0 | string | undefined | 112 | 113 | ### tokenURI 114 | 115 | ```solidity 116 | function tokenURI(uint256 tokenId) external view returns (string) 117 | ``` 118 | 119 | 120 | 121 | *Returns the Uniform Resource Identifier (URI) for `tokenId` token.* 122 | 123 | #### Parameters 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | tokenId | uint256 | undefined | 128 | 129 | #### Returns 130 | 131 | | Name | Type | Description | 132 | |---|---|---| 133 | | _0 | string | undefined | 134 | 135 | 136 | 137 | ## Events 138 | 139 | ### Burn 140 | 141 | ```solidity 142 | event Burn(address indexed _owner, uint256 indexed _tokenId) 143 | ``` 144 | 145 | 146 | 147 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 148 | 149 | #### Parameters 150 | 151 | | Name | Type | Description | 152 | |---|---|---| 153 | | _owner `indexed` | address | undefined | 154 | | _tokenId `indexed` | uint256 | undefined | 155 | 156 | ### Mint 157 | 158 | ```solidity 159 | event Mint(address indexed _owner, uint256 indexed _tokenId) 160 | ``` 161 | 162 | 163 | 164 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 165 | 166 | #### Parameters 167 | 168 | | Name | Type | Description | 169 | |---|---|---| 170 | | _owner `indexed` | address | undefined | 171 | | _tokenId `indexed` | uint256 | undefined | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/reference/ILinkableSBT.md: -------------------------------------------------------------------------------- 1 | # ILinkableSBT 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### addLinkPrice 14 | 15 | ```solidity 16 | function addLinkPrice() external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | uint256 | undefined | 29 | 30 | ### addLinkPriceMASA 31 | 32 | ```solidity 33 | function addLinkPriceMASA() external view returns (uint256) 34 | ``` 35 | 36 | 37 | 38 | 39 | 40 | 41 | #### Returns 42 | 43 | | Name | Type | Description | 44 | |---|---|---| 45 | | _0 | uint256 | undefined | 46 | 47 | ### balanceOf 48 | 49 | ```solidity 50 | function balanceOf(address _owner) external view returns (uint256) 51 | ``` 52 | 53 | Count all SBTs assigned to an owner 54 | 55 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 56 | 57 | #### Parameters 58 | 59 | | Name | Type | Description | 60 | |---|---|---| 61 | | _owner | address | An address for whom to query the balance | 62 | 63 | #### Returns 64 | 65 | | Name | Type | Description | 66 | |---|---|---| 67 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 68 | 69 | ### ownerOf 70 | 71 | ```solidity 72 | function ownerOf(uint256 _tokenId) external view returns (address) 73 | ``` 74 | 75 | Find the owner of an SBT 76 | 77 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 78 | 79 | #### Parameters 80 | 81 | | Name | Type | Description | 82 | |---|---|---| 83 | | _tokenId | uint256 | The identifier for an SBT | 84 | 85 | #### Returns 86 | 87 | | Name | Type | Description | 88 | |---|---|---| 89 | | _0 | address | The address of the owner of the SBT | 90 | 91 | ### queryLinkPrice 92 | 93 | ```solidity 94 | function queryLinkPrice() external view returns (uint256) 95 | ``` 96 | 97 | 98 | 99 | 100 | 101 | 102 | #### Returns 103 | 104 | | Name | Type | Description | 105 | |---|---|---| 106 | | _0 | uint256 | undefined | 107 | 108 | ### queryLinkPriceMASA 109 | 110 | ```solidity 111 | function queryLinkPriceMASA() external view returns (uint256) 112 | ``` 113 | 114 | 115 | 116 | 117 | 118 | 119 | #### Returns 120 | 121 | | Name | Type | Description | 122 | |---|---|---| 123 | | _0 | uint256 | undefined | 124 | 125 | ### supportsInterface 126 | 127 | ```solidity 128 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 129 | ``` 130 | 131 | 132 | 133 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 134 | 135 | #### Parameters 136 | 137 | | Name | Type | Description | 138 | |---|---|---| 139 | | interfaceId | bytes4 | undefined | 140 | 141 | #### Returns 142 | 143 | | Name | Type | Description | 144 | |---|---|---| 145 | | _0 | bool | undefined | 146 | 147 | 148 | 149 | ## Events 150 | 151 | ### Burn 152 | 153 | ```solidity 154 | event Burn(address indexed _owner, uint256 indexed _tokenId) 155 | ``` 156 | 157 | 158 | 159 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 160 | 161 | #### Parameters 162 | 163 | | Name | Type | Description | 164 | |---|---|---| 165 | | _owner `indexed` | address | undefined | 166 | | _tokenId `indexed` | uint256 | undefined | 167 | 168 | ### Mint 169 | 170 | ```solidity 171 | event Mint(address indexed _owner, uint256 indexed _tokenId) 172 | ``` 173 | 174 | 175 | 176 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 177 | 178 | #### Parameters 179 | 180 | | Name | Type | Description | 181 | |---|---|---| 182 | | _owner `indexed` | address | undefined | 183 | | _tokenId `indexed` | uint256 | undefined | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /docs/interfaces/ILinkableSBT.md: -------------------------------------------------------------------------------- 1 | # ILinkableSBT 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### addLinkPrice 14 | 15 | ```solidity 16 | function addLinkPrice() external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | uint256 | undefined | 29 | 30 | ### addLinkPriceMASA 31 | 32 | ```solidity 33 | function addLinkPriceMASA() external view returns (uint256) 34 | ``` 35 | 36 | 37 | 38 | 39 | 40 | 41 | #### Returns 42 | 43 | | Name | Type | Description | 44 | |---|---|---| 45 | | _0 | uint256 | undefined | 46 | 47 | ### balanceOf 48 | 49 | ```solidity 50 | function balanceOf(address _owner) external view returns (uint256) 51 | ``` 52 | 53 | Count all SBTs assigned to an owner 54 | 55 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 56 | 57 | #### Parameters 58 | 59 | | Name | Type | Description | 60 | |---|---|---| 61 | | _owner | address | An address for whom to query the balance | 62 | 63 | #### Returns 64 | 65 | | Name | Type | Description | 66 | |---|---|---| 67 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 68 | 69 | ### ownerOf 70 | 71 | ```solidity 72 | function ownerOf(uint256 _tokenId) external view returns (address) 73 | ``` 74 | 75 | Find the owner of an SBT 76 | 77 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 78 | 79 | #### Parameters 80 | 81 | | Name | Type | Description | 82 | |---|---|---| 83 | | _tokenId | uint256 | The identifier for an SBT | 84 | 85 | #### Returns 86 | 87 | | Name | Type | Description | 88 | |---|---|---| 89 | | _0 | address | The address of the owner of the SBT | 90 | 91 | ### queryLinkPrice 92 | 93 | ```solidity 94 | function queryLinkPrice() external view returns (uint256) 95 | ``` 96 | 97 | 98 | 99 | 100 | 101 | 102 | #### Returns 103 | 104 | | Name | Type | Description | 105 | |---|---|---| 106 | | _0 | uint256 | undefined | 107 | 108 | ### queryLinkPriceMASA 109 | 110 | ```solidity 111 | function queryLinkPriceMASA() external view returns (uint256) 112 | ``` 113 | 114 | 115 | 116 | 117 | 118 | 119 | #### Returns 120 | 121 | | Name | Type | Description | 122 | |---|---|---| 123 | | _0 | uint256 | undefined | 124 | 125 | ### supportsInterface 126 | 127 | ```solidity 128 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 129 | ``` 130 | 131 | 132 | 133 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 134 | 135 | #### Parameters 136 | 137 | | Name | Type | Description | 138 | |---|---|---| 139 | | interfaceId | bytes4 | undefined | 140 | 141 | #### Returns 142 | 143 | | Name | Type | Description | 144 | |---|---|---| 145 | | _0 | bool | undefined | 146 | 147 | 148 | 149 | ## Events 150 | 151 | ### Burn 152 | 153 | ```solidity 154 | event Burn(address indexed _owner, uint256 indexed _tokenId) 155 | ``` 156 | 157 | 158 | 159 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 160 | 161 | #### Parameters 162 | 163 | | Name | Type | Description | 164 | |---|---|---| 165 | | _owner `indexed` | address | undefined | 166 | | _tokenId `indexed` | uint256 | undefined | 167 | 168 | ### Mint 169 | 170 | ```solidity 171 | event Mint(address indexed _owner, uint256 indexed _tokenId) 172 | ``` 173 | 174 | 175 | 176 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 177 | 178 | #### Parameters 179 | 180 | | Name | Type | Description | 181 | |---|---|---| 182 | | _owner `indexed` | address | undefined | 183 | | _tokenId `indexed` | uint256 | undefined | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /docs/tokens/SBT/extensions/ISBTMetadata.md: -------------------------------------------------------------------------------- 1 | # ISBTMetadata 2 | 3 | 4 | 5 | > SBT Soulbound Token Standard, optional metadata extension 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address _owner) external view returns (uint256) 17 | ``` 18 | 19 | Count all SBTs assigned to an owner 20 | 21 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | _owner | address | An address for whom to query the balance | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 34 | 35 | ### name 36 | 37 | ```solidity 38 | function name() external view returns (string) 39 | ``` 40 | 41 | 42 | 43 | *Returns the token collection name.* 44 | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | string | undefined | 51 | 52 | ### ownerOf 53 | 54 | ```solidity 55 | function ownerOf(uint256 _tokenId) external view returns (address) 56 | ``` 57 | 58 | Find the owner of an SBT 59 | 60 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | _tokenId | uint256 | The identifier for an SBT | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | _0 | address | The address of the owner of the SBT | 73 | 74 | ### supportsInterface 75 | 76 | ```solidity 77 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 78 | ``` 79 | 80 | 81 | 82 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | interfaceId | bytes4 | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | _0 | bool | undefined | 95 | 96 | ### symbol 97 | 98 | ```solidity 99 | function symbol() external view returns (string) 100 | ``` 101 | 102 | 103 | 104 | *Returns the token collection symbol.* 105 | 106 | 107 | #### Returns 108 | 109 | | Name | Type | Description | 110 | |---|---|---| 111 | | _0 | string | undefined | 112 | 113 | ### tokenURI 114 | 115 | ```solidity 116 | function tokenURI(uint256 tokenId) external view returns (string) 117 | ``` 118 | 119 | 120 | 121 | *Returns the Uniform Resource Identifier (URI) for `tokenId` token.* 122 | 123 | #### Parameters 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | tokenId | uint256 | undefined | 128 | 129 | #### Returns 130 | 131 | | Name | Type | Description | 132 | |---|---|---| 133 | | _0 | string | undefined | 134 | 135 | 136 | 137 | ## Events 138 | 139 | ### Burn 140 | 141 | ```solidity 142 | event Burn(address indexed _owner, uint256 indexed _tokenId) 143 | ``` 144 | 145 | 146 | 147 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 148 | 149 | #### Parameters 150 | 151 | | Name | Type | Description | 152 | |---|---|---| 153 | | _owner `indexed` | address | undefined | 154 | | _tokenId `indexed` | uint256 | undefined | 155 | 156 | ### Mint 157 | 158 | ```solidity 159 | event Mint(address indexed _owner, uint256 indexed _tokenId) 160 | ``` 161 | 162 | 163 | 164 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 165 | 166 | #### Parameters 167 | 168 | | Name | Type | Description | 169 | |---|---|---| 170 | | _owner `indexed` | address | undefined | 171 | | _tokenId `indexed` | uint256 | undefined | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /src/deployASBT.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | import "@nomiclabs/hardhat-ethers"; 3 | import hre from "hardhat"; 4 | import { deployments, ethers, getNamedAccounts, network } from "hardhat"; 5 | import { getEnvParams, getPrivateKey } from "./EnvParams"; 6 | 7 | /** 8 | * main function 9 | */ 10 | async function main() { 11 | const { deploy } = deployments; 12 | const { deployer } = await getNamedAccounts(); 13 | const env = getEnvParams(network.name); 14 | 15 | const SBT_NAME = ""; 16 | const SBT_SYMBOL = ""; 17 | const SBT_BASE_URI = ""; 18 | const SBT_MAXMINTS = 1; 19 | const PAYMENT_METHODS = "0x0000000000000000000000000000000000000000"; 20 | const MINTING_PRICE = 0; 21 | 22 | console.log( 23 | `Deploying to ${network.name} (chainId: ${network.config.chainId})` 24 | ); 25 | console.log(`Deploying with the account: ${deployer}`); 26 | 27 | const soulboundIdentityDeployed = await deployments.get("SoulboundIdentity"); 28 | 29 | const constructorArguments = [ 30 | env.ADMIN, 31 | SBT_NAME, 32 | SBT_SYMBOL, 33 | SBT_BASE_URI, 34 | soulboundIdentityDeployed.address, 35 | [ 36 | env.SWAP_ROUTER, 37 | env.WETH_TOKEN, 38 | env.USDC_TOKEN, 39 | env.MASA_TOKEN, 40 | env.PROJECTFEE_RECEIVER, 41 | env.PROTOCOLFEE_RECEIVER || ethers.constants.AddressZero, 42 | env.PROTOCOLFEE_AMOUNT || 0, 43 | env.PROTOCOLFEE_PERCENT || 0, 44 | env.PROTOCOLFEE_PERCENT_SUB || 0 45 | ], 46 | SBT_MAXMINTS 47 | ]; 48 | 49 | const asbt = await deploy("ReferenceSBTAuthority", { 50 | from: deployer, 51 | args: constructorArguments, 52 | log: true 53 | }); 54 | 55 | console.log(`ReferenceSBTAuthority deployed to: ${asbt.address}`); 56 | 57 | // Verify contract 58 | if ( 59 | network.name !== "hardhat" && 60 | network.name !== "masa" && 61 | network.name !== "masatest" 62 | ) { 63 | try { 64 | await hre.run("verify:verify", { 65 | address: asbt.address, 66 | constructorArguments 67 | }); 68 | } catch (error) { 69 | if ( 70 | !error.message.includes("Contract source code already verified") && 71 | !error.message.includes("Reason: Already Verified") 72 | ) { 73 | throw error; 74 | } 75 | } 76 | } 77 | 78 | // if it's not a production network, we set the variables 79 | if ( 80 | network.name !== "bsc" && 81 | network.name !== "celo" && 82 | network.name !== "ethereum" && 83 | network.name !== "polygon" && 84 | network.name !== "opbnb" && 85 | network.name !== "masa" && 86 | network.name !== "masatest" 87 | ) { 88 | const signer = new ethers.Wallet( 89 | getPrivateKey(network.name), 90 | ethers.provider 91 | ); 92 | 93 | const ReferenceASBT = await ethers.getContractAt( 94 | "ReferenceSBTAuthority", 95 | asbt.address 96 | ); 97 | 98 | // add minters 99 | const MINTER_ROLE = await ReferenceASBT.MINTER_ROLE(); 100 | 101 | const minters = env.AUTHORITY_WALLET.split(" "); 102 | for (let i = 0; i < minters.length; i++) { 103 | console.log(`Adding authority ${minters[i]}`); 104 | await ReferenceASBT.connect(signer).grantRole(MINTER_ROLE, minters[i]); 105 | } 106 | 107 | // add mint price 108 | if (+MINTING_PRICE != 0) { 109 | await ReferenceASBT.connect(signer).setMintPrice(MINTING_PRICE); 110 | } 111 | 112 | // we add payment methods 113 | const paymentMethods = PAYMENT_METHODS.split(" "); 114 | for (let i = 0; i < paymentMethods.length; i++) { 115 | console.log(`Adding payment method ${paymentMethods[i]}`); 116 | await ReferenceASBT.connect(signer).enablePaymentMethod( 117 | paymentMethods[i] 118 | ); 119 | } 120 | } 121 | } 122 | 123 | main() 124 | .then(() => process.exit(0)) 125 | .catch((error) => { 126 | console.error(error); 127 | process.exit(1); 128 | }); 129 | -------------------------------------------------------------------------------- /docs/reference/IERC20Permit.md: -------------------------------------------------------------------------------- 1 | # IERC20Permit 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.* 10 | 11 | ## Methods 12 | 13 | ### DOMAIN_SEPARATOR 14 | 15 | ```solidity 16 | function DOMAIN_SEPARATOR() external view returns (bytes32) 17 | ``` 18 | 19 | 20 | 21 | *Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | bytes32 | undefined | 29 | 30 | ### nonces 31 | 32 | ```solidity 33 | function nonces(address owner) external view returns (uint256) 34 | ``` 35 | 36 | 37 | 38 | *Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.* 39 | 40 | #### Parameters 41 | 42 | | Name | Type | Description | 43 | |---|---|---| 44 | | owner | address | undefined | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | uint256 | undefined | 51 | 52 | ### permit 53 | 54 | ```solidity 55 | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable 56 | ``` 57 | 58 | 59 | 60 | *Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | owner | address | undefined | 67 | | spender | address | undefined | 68 | | value | uint256 | undefined | 69 | | deadline | uint256 | undefined | 70 | | v | uint8 | undefined | 71 | | r | bytes32 | undefined | 72 | | s | bytes32 | undefined | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /docs/elin/contracts/token/ERC20/extensions/IERC20Permit.md: -------------------------------------------------------------------------------- 1 | # IERC20Permit 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.* 10 | 11 | ## Methods 12 | 13 | ### DOMAIN_SEPARATOR 14 | 15 | ```solidity 16 | function DOMAIN_SEPARATOR() external view returns (bytes32) 17 | ``` 18 | 19 | 20 | 21 | *Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.* 22 | 23 | 24 | #### Returns 25 | 26 | | Name | Type | Description | 27 | |---|---|---| 28 | | _0 | bytes32 | undefined | 29 | 30 | ### nonces 31 | 32 | ```solidity 33 | function nonces(address owner) external view returns (uint256) 34 | ``` 35 | 36 | 37 | 38 | *Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.* 39 | 40 | #### Parameters 41 | 42 | | Name | Type | Description | 43 | |---|---|---| 44 | | owner | address | undefined | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | uint256 | undefined | 51 | 52 | ### permit 53 | 54 | ```solidity 55 | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable 56 | ``` 57 | 58 | 59 | 60 | *Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | owner | address | undefined | 67 | | spender | address | undefined | 68 | | value | uint256 | undefined | 69 | | deadline | uint256 | undefined | 70 | | v | uint8 | undefined | 71 | | r | bytes32 | undefined | 72 | | s | bytes32 | undefined | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Masa Identity Contracts 2 | 3 | 4 | * [Masa Identity Contracts](#masa-identity-contracts) 5 | * [Contract Deployments](#contract-deployments) 6 | * [Addresses of the deployed contracts](#addresses-of-the-deployed-contracts) 7 | * [Configuration](#configuration) 8 | * [Roles](#roles) 9 | * [Interface](#interface) 10 | * [Deployment](#deployment) 11 | * [Preparations](#preparations) 12 | * [Deploy](#deploy) 13 | * [Installation and usage](#installation-and-usage) 14 | * [Generation of a new release](#generation-of-a-new-release) 15 | 16 | 17 | ## Contract Deployments 18 | 19 | ### Addresses of the deployed contracts 20 | 21 | You can see the deployment address of the smart contracts in the [addresses.json](addresses.json) file. For every deployed smart contract you will find a `.` value. 22 | 23 | #### Configuration 24 | 25 | - `Admin`: [`0xA38dd237a3A8D50537B74a4B0D4E7E8A5359386F`](https://sepolia.etherscan.io/address/0xA38dd237a3A8D50537B74a4B0D4E7E8A5359386F) 26 | 27 | The `admin` is allowed to set configuration variables in the smart contracts. 28 | 29 | - `BASE_URI`: https://beta.metadata.masa.finance/v1.0 30 | 31 | The base url for the Metadata url that is being generated from the contract 32 | 33 | ## Roles 34 | 35 | - `deployer`: Deploys the contract, has no rights after everything has properly handed over to other roles 36 | - `admin`: Delegated to the Masa Service account inside the Masa API. It has the rights to administrate the smart 37 | contracts 38 | - `minter`: Minter role. It has the rights to mint tokens to customer's wallets. 39 | 40 | ## Interface 41 | 42 | - [Abstract Soulbound Token Definition](docs/tokens/MasaSBT.md) 43 | - [Abstract Non-Fungible Token Definition](docs/tokens/MasaNFT.md) 44 | - [Soulbound Identity Definition](docs/SoulboundIdentity.md) 45 | - [Soulbound Credit Score Definition](docs/SoulboundCreditScore.md) 46 | - [Soulbound Green Definition](docs/SoulboundGreen.md) 47 | - [Soul Name Definition](docs/SoulName.md) 48 | - [Soul Linker Definition](docs/SoulLinker.md) 49 | - [Soul Store Definition](docs/SoulStore.md) 50 | 51 | ## Deployment 52 | 53 | ### Preparations 54 | 55 | * Set `DEPLOYER_PRIVATE_KEY` to the deployers private key in `.env.{network}.secret` 56 | * Set `COINMARKETCAP_API_KEY` to the CoinMarketCap API key in `.env`, if needed 57 | * Set `ANKR_API_KEY` to the Ankr API key in `.env`, if needed 58 | * Set `ETHERSCAN_API_KEY` to the Etherscan API key in `.env`, if needed 59 | * Set `BSCSCAN_API_KEY` to the Etherscan API key in `.env`, if needed 60 | * Set `POLYGONSCAN_API_KEY` to the Etherscan API key in `.env`, if needed 61 | * Set `CELOSCAN_API_KEY` to the Etherscan API key in `.env`, if needed 62 | * Set `BASESCAN_API_KEY` to the Etherscan API key in `.env`, if needed 63 | 64 | ### Deploy 65 | 66 | Run: `yarn deploy --network {network}` to deploy. 67 | 68 | ## Installation and usage 69 | 70 | Installing via `npm` package: 71 | 72 | ```bash 73 | npm i @masa-finance/masa-contracts-identity 74 | ``` 75 | 76 | Import in your project: 77 | 78 | ```typescript 79 | import { 80 | SoulboundIdentity, 81 | SoulboundIdentity__factory 82 | } from "@masa-finance/masa-contracts-identity"; 83 | 84 | const soulboundIdentity: SoulboundIdentity = SoulboundIdentity__factory.connect( 85 |
, // address of the deployed contract 86 | // web3 provider 87 | ); 88 | console.log(await soulboundIdentity.symbol()); 89 | ``` 90 | 91 | ## Generation of a new release 92 | 93 | From a clean `main` branch you can run the release task bumping the version accordingly based on semantic versioning: 94 | 95 | ```bash 96 | yarn release 97 | ``` 98 | 99 | The task does the following: 100 | 101 | * Bumps the project version in `package.json` 102 | * Creates a Git tag 103 | * Commits and pushes everything 104 | * Creates a GitHub release with commit messages as description 105 | * Git tag push will trigger a GitHub Action workflow to do a `npm` release 106 | 107 | For the GitHub releases steps a GitHub personal access token, exported as `GITHUB_TOKEN` is required. You can add this 108 | environment variable to the `.env` file. [Setup](https://github.com/release-it/release-it#github-releases) 109 | -------------------------------------------------------------------------------- /docs/reference/ISBTEnumerable.md: -------------------------------------------------------------------------------- 1 | # ISBTEnumerable 2 | 3 | 4 | 5 | > SBT Soulbound Token Standard, optional enumeration extension 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address _owner) external view returns (uint256) 17 | ``` 18 | 19 | Count all SBTs assigned to an owner 20 | 21 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | _owner | address | An address for whom to query the balance | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 34 | 35 | ### ownerOf 36 | 37 | ```solidity 38 | function ownerOf(uint256 _tokenId) external view returns (address) 39 | ``` 40 | 41 | Find the owner of an SBT 42 | 43 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 44 | 45 | #### Parameters 46 | 47 | | Name | Type | Description | 48 | |---|---|---| 49 | | _tokenId | uint256 | The identifier for an SBT | 50 | 51 | #### Returns 52 | 53 | | Name | Type | Description | 54 | |---|---|---| 55 | | _0 | address | The address of the owner of the SBT | 56 | 57 | ### supportsInterface 58 | 59 | ```solidity 60 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 61 | ``` 62 | 63 | 64 | 65 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 66 | 67 | #### Parameters 68 | 69 | | Name | Type | Description | 70 | |---|---|---| 71 | | interfaceId | bytes4 | undefined | 72 | 73 | #### Returns 74 | 75 | | Name | Type | Description | 76 | |---|---|---| 77 | | _0 | bool | undefined | 78 | 79 | ### tokenByIndex 80 | 81 | ```solidity 82 | function tokenByIndex(uint256 index) external view returns (uint256) 83 | ``` 84 | 85 | 86 | 87 | *Returns a token ID at a given `index` of all the tokens stored by the contract. Use along with {totalSupply} to enumerate all tokens.* 88 | 89 | #### Parameters 90 | 91 | | Name | Type | Description | 92 | |---|---|---| 93 | | index | uint256 | undefined | 94 | 95 | #### Returns 96 | 97 | | Name | Type | Description | 98 | |---|---|---| 99 | | _0 | uint256 | undefined | 100 | 101 | ### tokenOfOwnerByIndex 102 | 103 | ```solidity 104 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256) 105 | ``` 106 | 107 | 108 | 109 | *Returns a token ID owned by `owner` at a given `index` of its token list. Use along with {balanceOf} to enumerate all of ``owner``'s tokens.* 110 | 111 | #### Parameters 112 | 113 | | Name | Type | Description | 114 | |---|---|---| 115 | | owner | address | undefined | 116 | | index | uint256 | undefined | 117 | 118 | #### Returns 119 | 120 | | Name | Type | Description | 121 | |---|---|---| 122 | | _0 | uint256 | undefined | 123 | 124 | ### totalSupply 125 | 126 | ```solidity 127 | function totalSupply() external view returns (uint256) 128 | ``` 129 | 130 | 131 | 132 | *Returns the total amount of tokens stored by the contract.* 133 | 134 | 135 | #### Returns 136 | 137 | | Name | Type | Description | 138 | |---|---|---| 139 | | _0 | uint256 | undefined | 140 | 141 | 142 | 143 | ## Events 144 | 145 | ### Burn 146 | 147 | ```solidity 148 | event Burn(address indexed _owner, uint256 indexed _tokenId) 149 | ``` 150 | 151 | 152 | 153 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 154 | 155 | #### Parameters 156 | 157 | | Name | Type | Description | 158 | |---|---|---| 159 | | _owner `indexed` | address | undefined | 160 | | _tokenId `indexed` | uint256 | undefined | 161 | 162 | ### Mint 163 | 164 | ```solidity 165 | event Mint(address indexed _owner, uint256 indexed _tokenId) 166 | ``` 167 | 168 | 169 | 170 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 171 | 172 | #### Parameters 173 | 174 | | Name | Type | Description | 175 | |---|---|---| 176 | | _owner `indexed` | address | undefined | 177 | | _tokenId `indexed` | uint256 | undefined | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/tokens/SBT/extensions/ISBTEnumerable.md: -------------------------------------------------------------------------------- 1 | # ISBTEnumerable 2 | 3 | 4 | 5 | > SBT Soulbound Token Standard, optional enumeration extension 6 | 7 | 8 | 9 | 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address _owner) external view returns (uint256) 17 | ``` 18 | 19 | Count all SBTs assigned to an owner 20 | 21 | *SBTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | _owner | address | An address for whom to query the balance | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | The number of SBTs owned by `_owner`, possibly zero | 34 | 35 | ### ownerOf 36 | 37 | ```solidity 38 | function ownerOf(uint256 _tokenId) external view returns (address) 39 | ``` 40 | 41 | Find the owner of an SBT 42 | 43 | *SBTs assigned to zero address are considered invalid, and queries about them do throw.* 44 | 45 | #### Parameters 46 | 47 | | Name | Type | Description | 48 | |---|---|---| 49 | | _tokenId | uint256 | The identifier for an SBT | 50 | 51 | #### Returns 52 | 53 | | Name | Type | Description | 54 | |---|---|---| 55 | | _0 | address | The address of the owner of the SBT | 56 | 57 | ### supportsInterface 58 | 59 | ```solidity 60 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 61 | ``` 62 | 63 | 64 | 65 | *Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.* 66 | 67 | #### Parameters 68 | 69 | | Name | Type | Description | 70 | |---|---|---| 71 | | interfaceId | bytes4 | undefined | 72 | 73 | #### Returns 74 | 75 | | Name | Type | Description | 76 | |---|---|---| 77 | | _0 | bool | undefined | 78 | 79 | ### tokenByIndex 80 | 81 | ```solidity 82 | function tokenByIndex(uint256 index) external view returns (uint256) 83 | ``` 84 | 85 | 86 | 87 | *Returns a token ID at a given `index` of all the tokens stored by the contract. Use along with {totalSupply} to enumerate all tokens.* 88 | 89 | #### Parameters 90 | 91 | | Name | Type | Description | 92 | |---|---|---| 93 | | index | uint256 | undefined | 94 | 95 | #### Returns 96 | 97 | | Name | Type | Description | 98 | |---|---|---| 99 | | _0 | uint256 | undefined | 100 | 101 | ### tokenOfOwnerByIndex 102 | 103 | ```solidity 104 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256) 105 | ``` 106 | 107 | 108 | 109 | *Returns a token ID owned by `owner` at a given `index` of its token list. Use along with {balanceOf} to enumerate all of ``owner``'s tokens.* 110 | 111 | #### Parameters 112 | 113 | | Name | Type | Description | 114 | |---|---|---| 115 | | owner | address | undefined | 116 | | index | uint256 | undefined | 117 | 118 | #### Returns 119 | 120 | | Name | Type | Description | 121 | |---|---|---| 122 | | _0 | uint256 | undefined | 123 | 124 | ### totalSupply 125 | 126 | ```solidity 127 | function totalSupply() external view returns (uint256) 128 | ``` 129 | 130 | 131 | 132 | *Returns the total amount of tokens stored by the contract.* 133 | 134 | 135 | #### Returns 136 | 137 | | Name | Type | Description | 138 | |---|---|---| 139 | | _0 | uint256 | undefined | 140 | 141 | 142 | 143 | ## Events 144 | 145 | ### Burn 146 | 147 | ```solidity 148 | event Burn(address indexed _owner, uint256 indexed _tokenId) 149 | ``` 150 | 151 | 152 | 153 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 154 | 155 | #### Parameters 156 | 157 | | Name | Type | Description | 158 | |---|---|---| 159 | | _owner `indexed` | address | undefined | 160 | | _tokenId `indexed` | uint256 | undefined | 161 | 162 | ### Mint 163 | 164 | ```solidity 165 | event Mint(address indexed _owner, uint256 indexed _tokenId) 166 | ``` 167 | 168 | 169 | 170 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 171 | 172 | #### Parameters 173 | 174 | | Name | Type | Description | 175 | |---|---|---| 176 | | _owner `indexed` | address | undefined | 177 | | _tokenId `indexed` | uint256 | undefined | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /deploy/SoulboundGreen.ts: -------------------------------------------------------------------------------- 1 | import { run } from "hardhat"; 2 | import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; 3 | import { DeployFunction } from "hardhat-deploy/dist/types"; 4 | import { getEnvParams, getPrivateKey } from "../src/EnvParams"; 5 | 6 | let admin: SignerWithAddress; 7 | 8 | const func: DeployFunction = async ({ 9 | // @ts-ignore 10 | getNamedAccounts, 11 | // @ts-ignore 12 | deployments, 13 | // @ts-ignore 14 | ethers, 15 | network 16 | }) => { 17 | const { deploy } = deployments; 18 | const { deployer } = await getNamedAccounts(); 19 | 20 | // const currentNonce: number = await ethers.provider.getTransactionCount(deployer); 21 | // to solve REPLACEMENT_UNDERPRICED, when needed 22 | 23 | [, admin] = await ethers.getSigners(); 24 | const env = getEnvParams(network.name); 25 | const baseUri = `${env.BASE_URI}/green/${network.name}/`; 26 | 27 | let soulboundIdentityDeployedAddress; 28 | if ( 29 | network.name === "ethereum" || 30 | network.name === "sepolia" || 31 | network.name === "hardhat" || 32 | network.name === "celo" || 33 | network.name === "alfajores" || 34 | network.name === "basegoerli" 35 | ) { 36 | const soulboundIdentityDeployed = 37 | await deployments.get("SoulboundIdentity"); 38 | soulboundIdentityDeployedAddress = soulboundIdentityDeployed.address; 39 | } else { 40 | soulboundIdentityDeployedAddress = ethers.constants.AddressZero; 41 | } 42 | 43 | const constructorArguments = [ 44 | env.ADMIN || admin.address, 45 | env.SOULBOUNDGREEN_NAME, 46 | env.SOULBOUNDGREEN_SYMBOL, 47 | baseUri, 48 | soulboundIdentityDeployedAddress, 49 | [ 50 | env.SWAP_ROUTER, 51 | env.WETH_TOKEN, 52 | env.USDC_TOKEN, 53 | env.MASA_TOKEN, 54 | env.PROJECTFEE_RECEIVER || admin.address, 55 | env.PROTOCOLFEE_RECEIVER || ethers.constants.AddressZero, 56 | env.PROTOCOLFEE_AMOUNT || 0, 57 | env.PROTOCOLFEE_PERCENT || 0, 58 | env.PROTOCOLFEE_PERCENT_SUB || 0 59 | ] 60 | ]; 61 | 62 | const soulboundGreenDeploymentResult = await deploy("SoulboundGreen", { 63 | from: deployer, 64 | args: constructorArguments, 65 | log: true 66 | // nonce: currentNonce + 1 // to solve REPLACEMENT_UNDERPRICED, when needed 67 | }); 68 | 69 | // verify contract with etherscan, if its not a local network or celo 70 | if (network.name !== "hardhat") { 71 | try { 72 | await run("verify:verify", { 73 | address: soulboundGreenDeploymentResult.address, 74 | constructorArguments 75 | }); 76 | } catch (error) { 77 | if ( 78 | !error.message.includes("Contract source code already verified") && 79 | !error.message.includes("Reason: Already Verified") 80 | ) { 81 | throw error; 82 | } 83 | } 84 | } 85 | 86 | if ( 87 | network.name === "hardhat" || 88 | network.name === "alfajores" || 89 | network.name === "bsctest" || 90 | network.name === "mumbai" || 91 | network.name === "basegoerli" || 92 | network.name === "opbnbtest" || 93 | network.name === "scrolltest" 94 | ) { 95 | const signer = env.ADMIN 96 | ? new ethers.Wallet(getPrivateKey(network.name), ethers.provider) 97 | : admin; 98 | 99 | const soulboundGreen = await ethers.getContractAt( 100 | "SoulboundGreen", 101 | soulboundGreenDeploymentResult.address 102 | ); 103 | 104 | // add authorities to soulboundGreen 105 | const authorities = (env.AUTHORITY_WALLET || admin.address).split(" "); 106 | for (let i = 0; i < authorities.length; i++) { 107 | await soulboundGreen.connect(signer).addAuthority(authorities[i]); 108 | } 109 | 110 | // add mint price to soulboundCreditScore 111 | await soulboundGreen 112 | .connect(signer) 113 | .setMintPrice(env.SOULBOUNDGREEN_MINTING_PRICE || 1000000); // 1 USDC 114 | 115 | // we add payment methods 116 | const paymentMethods = env.PAYMENT_METHODS_SOULBOUNDGREEN.split(" "); 117 | for (let i = 0; i < paymentMethods.length; i++) { 118 | await soulboundGreen 119 | .connect(signer) 120 | .enablePaymentMethod(paymentMethods[i]); 121 | } 122 | } 123 | }; 124 | 125 | func.skip = async ({ network }) => { 126 | return network.name === "masa" || network.name === "masatest"; 127 | }; 128 | func.tags = ["SoulboundGreen"]; 129 | func.dependencies = ["SoulboundIdentity"]; 130 | export default func; 131 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@masa-finance/masa-contracts-identity", 3 | "version": "1.15.1", 4 | "main": "dist/typechain/index.js", 5 | "types": "dist/typechain/index.d.ts", 6 | "repository": "git@github.com:masa-finance/masa-contracts-identity.git", 7 | "author": "Sebastian Gerske <13647606+H34D@users.noreply.github.com>", 8 | "license": "MIT", 9 | "scripts": { 10 | "compile": "hardhat compile", 11 | "postcompile": "yarn flatten", 12 | "tsc": "npx tsc -p . && cp typechain/*.d.ts dist/typechain/", 13 | "build": "yarn compile && yarn tsc", 14 | "clean": "hardhat clean", 15 | "docgen": "hardhat dodoc", 16 | "coverage": "hardhat coverage", 17 | "deploy:alfajores": "hardhat deploy --network alfajores && yarn addresses", 18 | "deploy:base": "hardhat deploy --network base && yarn addresses", 19 | "deploy:basegoerli": "hardhat deploy --network basegoerli && yarn addresses", 20 | "deploy:bsc": "hardhat deploy --network bsc && yarn addresses", 21 | "deploy:bsctest": "hardhat deploy --network bsctest && yarn addresses", 22 | "deploy:celo": "hardhat deploy --network celo && yarn addresses", 23 | "deploy:sepolia": "hardhat deploy --network sepolia && yarn addresses", 24 | "deploy:ethereum": "hardhat deploy --network ethereum && yarn addresses", 25 | "deploy:mumbai": "hardhat deploy --network mumbai && yarn addresses", 26 | "deploy:polygon": "hardhat deploy --network polygon && yarn addresses", 27 | "deploy:opbnbtest": "hardhat deploy --network opbnbtest && yarn addresses", 28 | "deploy:opbnb": "hardhat deploy --network opbnb && yarn addresses", 29 | "deploy:scrolltest": "hardhat deploy --network scrolltest && yarn addresses", 30 | "deploy:scroll": "hardhat deploy --network scroll && yarn addresses", 31 | "deploy:masatest": "hardhat deploy --network masatest && yarn addresses", 32 | "deploy:masa": "hardhat deploy --network masa && yarn addresses", 33 | "deployASBT": "hardhat run src/deployASBT.ts", 34 | "deploySSSBT": "hardhat run src/deploySSSBT.ts", 35 | "deployDynamicSSSBT": "hardhat run src/deployDynamicSSSBT.ts", 36 | "run:node": "hardhat node", 37 | "test": "hardhat test", 38 | "prettier": "prettier --write 'contracts/**/*.sol' '**/*.ts'", 39 | "solhint": "solhint contracts/**/*.sol", 40 | "release": "GITHUB_TOKEN=$(grep GITHUB_TOKEN .env | cut -d '=' -f2) release-it", 41 | "addresses": "hardhat run src/addresses.ts", 42 | "check-protocol-fee": "hardhat run src/check-protocol-fee.ts", 43 | "flatten": "yarn flatten:asbt && yarn flatten:sssbt", 44 | "flatten:asbt": "hardhat flatten contracts/reference/ReferenceSBTAuthority.sol > contracts/reference/ReferenceSBTAuthorityFlattened.sol", 45 | "flatten:sssbt": "hardhat flatten contracts/reference/ReferenceSBTSelfSovereign.sol > contracts/reference/ReferenceSBTSelfSovereignFlattened.sol" 46 | }, 47 | "dependencies": { 48 | "ethers": "~5.7.2" 49 | }, 50 | "devDependencies": { 51 | "@nomiclabs/hardhat-ethers": "^2.2.3", 52 | "@nomiclabs/hardhat-etherscan": "^3.1.8", 53 | "@nomiclabs/hardhat-solhint": "^4.0.0", 54 | "@nomiclabs/hardhat-waffle": "^2.0.6", 55 | "@openzeppelin/contracts": "^4.9.6", 56 | "@primitivefi/hardhat-dodoc": "^0.2.3", 57 | "@typechain/ethers-v5": "^11.1.2", 58 | "@typechain/hardhat": "^9.1.0", 59 | "@types/chai": "^4.3.14", 60 | "@types/chai-as-promised": "^7.1.8", 61 | "@types/mocha": "^10.0.7", 62 | "@types/node": "^22.5.0", 63 | "@types/sinon-chai": "^3.2.12", 64 | "chai": "^4.4.1", 65 | "chai-as-promised": "^7.1.2", 66 | "chai-ethers": "^0.0.1", 67 | "envfile": "^7.1.0", 68 | "ethereum-waffle": "^4.0.10", 69 | "hardhat": "^2.22.9", 70 | "hardhat-deploy": "^0.12.4", 71 | "hardhat-deploy-ethers": "^0.4.2", 72 | "hardhat-docgen": "^1.3.0", 73 | "hardhat-gas-reporter": "^2.2.1", 74 | "hardhat-waffle": "^0.0.1-security", 75 | "prettier": "^3.3.3", 76 | "prettier-plugin-solidity": "^1.4.1", 77 | "release-it": "^17.6.0", 78 | "solhint": "^5.0.3", 79 | "solhint-plugin-prettier": "^0.1.0", 80 | "solidity-coverage": "^0.8.12", 81 | "ts-generator": "^0.1.1", 82 | "ts-node": "^10.9.2", 83 | "typechain": "^8.3.2", 84 | "typescript": "^5.5.4" 85 | }, 86 | "release-it": { 87 | "hooks": { 88 | "after:bump": "yarn build" 89 | }, 90 | "git": { 91 | "tagName": "v${version}" 92 | }, 93 | "github": { 94 | "release": true 95 | }, 96 | "npm": { 97 | "publish": false 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /docs/reference/SBTEnumerable.md: -------------------------------------------------------------------------------- 1 | # SBTEnumerable 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *This implements an optional extension of {SBT} defined in the EIP that adds enumerability of all the token ids in the contract as well as all token ids owned by each account.* 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address owner) external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | *See {ISBT-balanceOf}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | owner | address | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | undefined | 34 | 35 | ### name 36 | 37 | ```solidity 38 | function name() external view returns (string) 39 | ``` 40 | 41 | 42 | 43 | *See {ISBTMetadata-name}.* 44 | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | string | undefined | 51 | 52 | ### ownerOf 53 | 54 | ```solidity 55 | function ownerOf(uint256 tokenId) external view returns (address) 56 | ``` 57 | 58 | 59 | 60 | *See {ISBT-ownerOf}.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | tokenId | uint256 | undefined | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | _0 | address | undefined | 73 | 74 | ### supportsInterface 75 | 76 | ```solidity 77 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 78 | ``` 79 | 80 | 81 | 82 | *See {IERC165-supportsInterface}.* 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | interfaceId | bytes4 | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | _0 | bool | undefined | 95 | 96 | ### symbol 97 | 98 | ```solidity 99 | function symbol() external view returns (string) 100 | ``` 101 | 102 | 103 | 104 | *See {ISBTMetadata-symbol}.* 105 | 106 | 107 | #### Returns 108 | 109 | | Name | Type | Description | 110 | |---|---|---| 111 | | _0 | string | undefined | 112 | 113 | ### tokenByIndex 114 | 115 | ```solidity 116 | function tokenByIndex(uint256 index) external view returns (uint256) 117 | ``` 118 | 119 | 120 | 121 | *See {ISBTEnumerable-tokenByIndex}.* 122 | 123 | #### Parameters 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | index | uint256 | undefined | 128 | 129 | #### Returns 130 | 131 | | Name | Type | Description | 132 | |---|---|---| 133 | | _0 | uint256 | undefined | 134 | 135 | ### tokenOfOwnerByIndex 136 | 137 | ```solidity 138 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256) 139 | ``` 140 | 141 | 142 | 143 | *See {ISBTEnumerable-tokenOfOwnerByIndex}.* 144 | 145 | #### Parameters 146 | 147 | | Name | Type | Description | 148 | |---|---|---| 149 | | owner | address | undefined | 150 | | index | uint256 | undefined | 151 | 152 | #### Returns 153 | 154 | | Name | Type | Description | 155 | |---|---|---| 156 | | _0 | uint256 | undefined | 157 | 158 | ### tokenURI 159 | 160 | ```solidity 161 | function tokenURI(uint256 tokenId) external view returns (string) 162 | ``` 163 | 164 | 165 | 166 | *See {ISBTMetadata-tokenURI}.* 167 | 168 | #### Parameters 169 | 170 | | Name | Type | Description | 171 | |---|---|---| 172 | | tokenId | uint256 | undefined | 173 | 174 | #### Returns 175 | 176 | | Name | Type | Description | 177 | |---|---|---| 178 | | _0 | string | undefined | 179 | 180 | ### totalSupply 181 | 182 | ```solidity 183 | function totalSupply() external view returns (uint256) 184 | ``` 185 | 186 | 187 | 188 | *See {ISBTEnumerable-totalSupply}.* 189 | 190 | 191 | #### Returns 192 | 193 | | Name | Type | Description | 194 | |---|---|---| 195 | | _0 | uint256 | undefined | 196 | 197 | 198 | 199 | ## Events 200 | 201 | ### Burn 202 | 203 | ```solidity 204 | event Burn(address indexed _owner, uint256 indexed _tokenId) 205 | ``` 206 | 207 | 208 | 209 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 210 | 211 | #### Parameters 212 | 213 | | Name | Type | Description | 214 | |---|---|---| 215 | | _owner `indexed` | address | undefined | 216 | | _tokenId `indexed` | uint256 | undefined | 217 | 218 | ### Mint 219 | 220 | ```solidity 221 | event Mint(address indexed _owner, uint256 indexed _tokenId) 222 | ``` 223 | 224 | 225 | 226 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 227 | 228 | #### Parameters 229 | 230 | | Name | Type | Description | 231 | |---|---|---| 232 | | _owner `indexed` | address | undefined | 233 | | _tokenId `indexed` | uint256 | undefined | 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /docs/tokens/SBT/extensions/SBTEnumerable.md: -------------------------------------------------------------------------------- 1 | # SBTEnumerable 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *This implements an optional extension of {SBT} defined in the EIP that adds enumerability of all the token ids in the contract as well as all token ids owned by each account.* 10 | 11 | ## Methods 12 | 13 | ### balanceOf 14 | 15 | ```solidity 16 | function balanceOf(address owner) external view returns (uint256) 17 | ``` 18 | 19 | 20 | 21 | *See {ISBT-balanceOf}.* 22 | 23 | #### Parameters 24 | 25 | | Name | Type | Description | 26 | |---|---|---| 27 | | owner | address | undefined | 28 | 29 | #### Returns 30 | 31 | | Name | Type | Description | 32 | |---|---|---| 33 | | _0 | uint256 | undefined | 34 | 35 | ### name 36 | 37 | ```solidity 38 | function name() external view returns (string) 39 | ``` 40 | 41 | 42 | 43 | *See {ISBTMetadata-name}.* 44 | 45 | 46 | #### Returns 47 | 48 | | Name | Type | Description | 49 | |---|---|---| 50 | | _0 | string | undefined | 51 | 52 | ### ownerOf 53 | 54 | ```solidity 55 | function ownerOf(uint256 tokenId) external view returns (address) 56 | ``` 57 | 58 | 59 | 60 | *See {ISBT-ownerOf}.* 61 | 62 | #### Parameters 63 | 64 | | Name | Type | Description | 65 | |---|---|---| 66 | | tokenId | uint256 | undefined | 67 | 68 | #### Returns 69 | 70 | | Name | Type | Description | 71 | |---|---|---| 72 | | _0 | address | undefined | 73 | 74 | ### supportsInterface 75 | 76 | ```solidity 77 | function supportsInterface(bytes4 interfaceId) external view returns (bool) 78 | ``` 79 | 80 | 81 | 82 | *See {IERC165-supportsInterface}.* 83 | 84 | #### Parameters 85 | 86 | | Name | Type | Description | 87 | |---|---|---| 88 | | interfaceId | bytes4 | undefined | 89 | 90 | #### Returns 91 | 92 | | Name | Type | Description | 93 | |---|---|---| 94 | | _0 | bool | undefined | 95 | 96 | ### symbol 97 | 98 | ```solidity 99 | function symbol() external view returns (string) 100 | ``` 101 | 102 | 103 | 104 | *See {ISBTMetadata-symbol}.* 105 | 106 | 107 | #### Returns 108 | 109 | | Name | Type | Description | 110 | |---|---|---| 111 | | _0 | string | undefined | 112 | 113 | ### tokenByIndex 114 | 115 | ```solidity 116 | function tokenByIndex(uint256 index) external view returns (uint256) 117 | ``` 118 | 119 | 120 | 121 | *See {ISBTEnumerable-tokenByIndex}.* 122 | 123 | #### Parameters 124 | 125 | | Name | Type | Description | 126 | |---|---|---| 127 | | index | uint256 | undefined | 128 | 129 | #### Returns 130 | 131 | | Name | Type | Description | 132 | |---|---|---| 133 | | _0 | uint256 | undefined | 134 | 135 | ### tokenOfOwnerByIndex 136 | 137 | ```solidity 138 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256) 139 | ``` 140 | 141 | 142 | 143 | *See {ISBTEnumerable-tokenOfOwnerByIndex}.* 144 | 145 | #### Parameters 146 | 147 | | Name | Type | Description | 148 | |---|---|---| 149 | | owner | address | undefined | 150 | | index | uint256 | undefined | 151 | 152 | #### Returns 153 | 154 | | Name | Type | Description | 155 | |---|---|---| 156 | | _0 | uint256 | undefined | 157 | 158 | ### tokenURI 159 | 160 | ```solidity 161 | function tokenURI(uint256 tokenId) external view returns (string) 162 | ``` 163 | 164 | 165 | 166 | *See {ISBTMetadata-tokenURI}.* 167 | 168 | #### Parameters 169 | 170 | | Name | Type | Description | 171 | |---|---|---| 172 | | tokenId | uint256 | undefined | 173 | 174 | #### Returns 175 | 176 | | Name | Type | Description | 177 | |---|---|---| 178 | | _0 | string | undefined | 179 | 180 | ### totalSupply 181 | 182 | ```solidity 183 | function totalSupply() external view returns (uint256) 184 | ``` 185 | 186 | 187 | 188 | *See {ISBTEnumerable-totalSupply}.* 189 | 190 | 191 | #### Returns 192 | 193 | | Name | Type | Description | 194 | |---|---|---| 195 | | _0 | uint256 | undefined | 196 | 197 | 198 | 199 | ## Events 200 | 201 | ### Burn 202 | 203 | ```solidity 204 | event Burn(address indexed _owner, uint256 indexed _tokenId) 205 | ``` 206 | 207 | 208 | 209 | *This emits when an SBT is burned This event emits when SBTs are destroyed* 210 | 211 | #### Parameters 212 | 213 | | Name | Type | Description | 214 | |---|---|---| 215 | | _owner `indexed` | address | undefined | 216 | | _tokenId `indexed` | uint256 | undefined | 217 | 218 | ### Mint 219 | 220 | ```solidity 221 | event Mint(address indexed _owner, uint256 indexed _tokenId) 222 | ``` 223 | 224 | 225 | 226 | *This emits when an SBT is newly minted. This event emits when SBTs are created* 227 | 228 | #### Parameters 229 | 230 | | Name | Type | Description | 231 | |---|---|---| 232 | | _owner `indexed` | address | undefined | 233 | | _tokenId `indexed` | uint256 | undefined | 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /contracts/reference/ReferenceSBTSelfSovereign.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.18; 3 | 4 | import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; 5 | 6 | import "../tokens/MasaSBTSelfSovereign.sol"; 7 | 8 | /// @title Soulbound reference Self-Sovereign SBT 9 | /// @author Masa Finance 10 | /// @notice Soulbound token that represents a Self-Sovereign SBT 11 | /// @dev Inherits from the SBT contract. 12 | contract ReferenceSBTSelfSovereign is MasaSBTSelfSovereign, ReentrancyGuard { 13 | /* ========== STATE VARIABLES =========================================== */ 14 | 15 | /* ========== INITIALIZE ================================================ */ 16 | 17 | /// @notice Creates a new Self-Sovereign SBT 18 | /// @dev Creates a new Self-Sovereign SBT, inheriting from the SBT contract. 19 | /// @param admin Administrator of the smart contract 20 | /// @param name Name of the token 21 | /// @param symbol Symbol of the token 22 | /// @param baseTokenURI Base URI of the token 23 | /// @param soulboundIdentity Address of the SoulboundIdentity contract 24 | /// @param paymentParams Payment gateway params 25 | /// @param maxSBTToMint Maximum number of SBT that can be minted 26 | constructor( 27 | address admin, 28 | string memory name, 29 | string memory symbol, 30 | string memory baseTokenURI, 31 | address soulboundIdentity, 32 | PaymentParams memory paymentParams, 33 | uint256 maxSBTToMint 34 | ) 35 | MasaSBTSelfSovereign( 36 | admin, 37 | name, 38 | symbol, 39 | baseTokenURI, 40 | soulboundIdentity, 41 | paymentParams, 42 | maxSBTToMint 43 | ) 44 | EIP712("ReferenceSBTSelfSovereign", "1.0.0") 45 | {} 46 | 47 | /* ========== RESTRICTED FUNCTIONS ====================================== */ 48 | 49 | /* ========== MUTATIVE FUNCTIONS ======================================== */ 50 | 51 | /// @notice Mints a new SBT 52 | /// @dev The signer of the signature must be a valid authority 53 | /// @param paymentMethod Address of token that user want to pay 54 | /// @param identityId TokenId of the identity to mint the NFT to 55 | /// @param authorityAddress Address of the authority that signed the message 56 | /// @param signatureDate Date of the signature 57 | /// @param signature Signature of the message 58 | /// @return The SBT ID of the newly minted SBT 59 | function mint( 60 | address paymentMethod, 61 | uint256 identityId, 62 | address authorityAddress, 63 | uint256 signatureDate, 64 | bytes calldata signature 65 | ) external payable virtual nonReentrant returns (uint256) { 66 | return 67 | _mintWithCounter( 68 | paymentMethod, 69 | identityId, 70 | _hash(identityId, authorityAddress, signatureDate), 71 | authorityAddress, 72 | signatureDate, 73 | signature 74 | ); 75 | } 76 | 77 | /// @notice Mints a new SBT 78 | /// @dev The signer of the signature must be a valid authority 79 | /// @param paymentMethod Address of token that user want to pay 80 | /// @param to The address to mint the SBT to 81 | /// @param authorityAddress Address of the authority that signed the message 82 | /// @param signatureDate Date of the signature 83 | /// @param signature Signature of the message 84 | /// @return The SBT ID of the newly minted SBT 85 | function mint( 86 | address paymentMethod, 87 | address to, 88 | address authorityAddress, 89 | uint256 signatureDate, 90 | bytes calldata signature 91 | ) external payable virtual nonReentrant returns (uint256) { 92 | return 93 | _mintWithCounter( 94 | paymentMethod, 95 | to, 96 | _hash(to, authorityAddress, signatureDate), 97 | authorityAddress, 98 | signatureDate, 99 | signature 100 | ); 101 | } 102 | 103 | /* ========== VIEWS ===================================================== */ 104 | 105 | function tokenURI( 106 | uint256 tokenId 107 | ) public view virtual override returns (string memory) { 108 | _requireMinted(tokenId); 109 | 110 | return _baseURI(); 111 | } 112 | 113 | /* ========== PRIVATE FUNCTIONS ========================================= */ 114 | 115 | /* ========== MODIFIERS ================================================= */ 116 | 117 | /* ========== EVENTS ==================================================== */ 118 | } 119 | --------------------------------------------------------------------------------