diff --git a/Makefile b/Makefile index 988c557..fd97784 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ clean: kind delete cluster lint: - helm template charts/firefly --set "erc20.enabled=true" --set "erc1155.enabled=true" --set "ethconnect.enabled=true" + helm template charts/firefly --set "erc20erc721.enabled=true" --set "erc1155.enabled=true" --set "ethconnect.enabled=true" ct lint \ --target-branch=main \ --exclude-deprecated \ @@ -26,7 +26,7 @@ deps: helm repo add prometheus-community https://prometheus-community.github.io/helm-charts || true helm upgrade --install --set kubeStateMetrics.enabled=false --set nodeExporter.enabled=false --set grafana.enabled=false kube-prometheus prometheus-community/kube-prometheus-stack helm repo add bitnami https://charts.bitnami.com/bitnami || true - helm upgrade --install --set postgresqlPassword=firef1y --set extraEnv[0].name=POSTGRES_DATABASE --set extraEnv[0].value=firefly postgresql bitnami/postgresql + helm upgrade --install --set postgresqlPassword=firef1y --set extraEnv[0].name=POSTGRES_DATABASE --set extraEnv[0].value=firefly postgresql bitnami/postgresql --version 10.16.2 kubectl create secret generic custom-psql-config --dry-run --from-literal="url=postgres://postgres:firef1y@postgresql.default.svc:5432/postgres?sslmode=disable" -o json | kubectl apply -f - starter: charts/firefly/local-values.yaml diff --git a/README.md b/README.md index c063390..5b41d84 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ export HELM_EXPERIMENTAL_OCI=1 helm registry login ghcr.io ``` -> **NOTE**: it is recommended to use a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) + +> **NOTE**: you must use a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) > when authenticating to the GHCR registry as opposed to using your GitHub password. ## Development diff --git a/charts/firefly/Chart.yaml b/charts/firefly/Chart.yaml index 7b2ff44..bdc746e 100644 --- a/charts/firefly/Chart.yaml +++ b/charts/firefly/Chart.yaml @@ -18,8 +18,8 @@ apiVersion: v2 name: firefly description: A Helm chart for deploying FireFly and FireFly HTTPS Dataexchange onto Kubernetes. type: application -appVersion: "0.11.5" -version: "0.1.0" +appVersion: "0.12.0" +version: "0.2.0" maintainers: - name: hfuss diff --git a/charts/firefly/README.md b/charts/firefly/README.md index d4c349e..1e65dfe 100644 --- a/charts/firefly/README.md +++ b/charts/firefly/README.md @@ -4,7 +4,7 @@ that simplifies data orchestration on top of blockchain and other peer-to-peer technologies. This chart bootstraps a FireFly deployment on a [Kubernetes](https://kubernetes.io/) cluster using the [Helm](https://helm.sh/) -package manager. It can be used to deploy a FireFly node for a single organization within a multi-party system. +package manager. It can be used to deploy a single FireFly node for an individual organization within a multi-party system. ### Table of Contents @@ -19,6 +19,8 @@ package manager. It can be used to deploy a FireFly node for a single organizati * [Configuration File Templating](#configuration-file-templating) * [Additional Environment Variables](#additional-environment-variables) * [Ethereum](#ethereum) + * [Remote Ethconnect](#remote-ethconnect) + * [Chart-managed Ethconnect](#chart-managed-ethconnect) * [Smart Contract Deployment](#smart-contract-deployment) * [Fabric](#fabric) * [Chaincode](#chaincode) @@ -29,6 +31,7 @@ package manager. It can be used to deploy a FireFly node for a single organizati * [DataExchange HTTPS and cert-manager](#dataexchange-https-and-cert-manager) * [Tokens Connectors](#tokens-connectors) * [ERC1155](#erc1155) + * [ERC20 / ERC721](#erc20--erc721) * [Prometheus Support](#prometheus-support) * [Automated Deployments](#automated-deployments) * [GitOps](#gitops) @@ -55,13 +58,13 @@ export HELM_EXPERIMENTAL_OCI=1 helm registry login ghcr.io ``` -> **NOTE**: it is recommended to use a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) +> **NOTE**: you must use a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) > when authenticating to the GHCR registry as opposed to using your GitHub password. ## Install Chart ```shell -helm install [RELEASE_NAME] --version 0.0.1 oci://ghcr.io/hyperledger/helm/firefly +helm install [RELEASE_NAME] --version 0.2.0 oci://ghcr.io/hyperledger/helm/firefly ``` _See [configuration](#Configuration) below._ @@ -79,7 +82,7 @@ _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command doc ## Upgrading Chart ```shell -helm upgrade [RELEASE_NAME] --install --version 0.0.2 oci://ghcr.io/hyperledger/helm/firefly +helm upgrade [RELEASE_NAME] --install --version 0.2.0 oci://ghcr.io/hyperledger/helm/firefly ``` _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._ @@ -93,7 +96,7 @@ dependencies: # ... - name: firefly repository: "oci://ghcr.io/hyperledger/helm/" - version: 0.0.1 + version: 0.2.0 ``` Then download the chart dependency into your parent chart: @@ -107,8 +110,8 @@ _See [helm dependency](https://helm.sh/docs/helm/helm_dependency/) for command d ## Deployment Architecture -FireFly provides a REST API with an event-driven paradigm that makes building multi-party interactions via -decentralized applications simpler. In order to do so, FireFly leverages extensible [connector plugins](https://hyperledger.github.io/firefly/architecture/plugin_architecture.html) that enable +FireFly provides a REST API with an event-driven paradigm that simplifies building multi-party interactions via +decentralized applications. In order to do so, FireFly leverages extensible [connector plugins](https://hyperledger.github.io/firefly/architecture/plugin_architecture.html) that enable swapping out the underlying blockchain and off-chain infrastructure easily. As a result, a [FireFly node](https://hyperledger.github.io/firefly/architecture/node_component_architecture.html) @@ -125,11 +128,22 @@ has several infrastructural dependencies:

-As depicted above, the chart only aims to provide a means for deploying FireFly core, and then optionally [FireFly Ethconnect](https://github.com/hyperledger/firefly-ethconnect), [FireFly Fabconnect](https://github.com/hyperledger/firefly-fabconnect), -[FireFly DataExchange HTTPS](https://github.com/hyperledger/firefly-dataexchange-https) and the [FireFly Tokens ERC1155](https://github.com/hyperledger/firefly-tokens-erc1155) microservices. +As depicted above, the chart only aims to provide a means for deploying the following components: -> **NOTE**: support for deploying Ethconnect, Fabconnect, and Tokens ERC1155 is under development and will be included -> as part of the chart for its `0.1.0` release. + +| Component | Status | Optional | Enabled by Default | +|------------------------------------------------------------------------------------------|------------------|----------|--------------------| +| [FireFly Core]( https://github.com/hyperledger/firefly) | βeta | ❌ | N/A | +| [FireFly Ethconnect]( https://github.com/hyperledger/firefly-ethconnect) | ⍺lpha ⚠️ | ✅ | ❌ | +| [FireFly Fabconnect]( https://github.com/hyperledger/firefly-fabconnect) | Unimplemented 🙈 | N/A | N/A | +| [FireFly DataExchange HTTPS]( https://github.com/hyperledger/firefly-dataexchange-https) | βeta | ✅ | ✅ | +| [FireFly Tokens ERC1155]( https://github.com/hyperledger/firefly-tokens-erc1155) | βeta | ✅ | ❌ | +| [FireFly Tokens ERC20 / ERC721]( https://github.com/hyperledger/firefly-tokens-erc20-erc721) | ⍺lpha ⚠️ | ✅ | ❌ | + + +> **NOTE**: "Status" is meant to indicate the level of stability of the _chart's_ support for the particular component. +> It is _not_ meant to indicate the maturity of the component itself, though the component's maturity does have an impact +> on the community's ability to support it via the chart. All other infrastructural dependencies such as the blockchain, PostgreSQL, and IPFS are considered out of scope for the chart, and must be pre-provisioned in order for FireFly to be fully functioning. @@ -155,7 +169,8 @@ The following values are required in order for FireFly to startup correctly: * `config.postgresUrl` * `config.ipfsApiUrl` and `config.ipfsGatewayUrl` * either: - * `config.ethconnectUrl` and `config.fireflyContractAddress` + * `config.fireflyContractAddress`, and then either `config.ethconnectUrl` or `ethconnect.enabled` + (see [Ethereum](#ethereum) below for more details) * or, `config.fabconnectUrl` and `config.fabconnectSigner` You can find documentation regarding each of these values, as well as all the other `config` values, @@ -236,23 +251,102 @@ core: Configuring FireFly to use an [Ethereum](https://ethereum.org/en/) blockchain such as [Geth](https://geth.ethereum.org/), [Quorum](https://github.com/ConsenSys/quorum), or [Hyperledger Besu](https://www.hyperledger.org/use/besu) requires first having an instance of [FireFly Ethconnect](https://github.com/hyperledger/firefly-ethconnect) deployed and connected to -the JSONRPC port of an Ethereum node in the underlying network. +the JSONRPC port of an Ethereum node in the underlying network. You can either configure the chart to use a "remote", +pre-provisioned Ethconnect instance, or the chart can create a "local" Ethconnect instance for you alongside your FireFly. -As was noted in [Deployment Architecture](#deployment-architecture), the chart will include support for deploying Ethconnect -as part of its `0.1.0` release. See [#272](https://github.com/hyperledger/firefly/issues/272) to track its progress. For now, -you can either deploy Ethconnect yourself or use a cloud provider like [Kaleido](https://www.kaleido.io) which provides -Ethconnect alongside its Ethereum nodes. +> **NOTE**: Ethconnect itself has two modes: local registry versus remote registry mode. If you are provisioning Ethconnect +> yourself using the chart or other means, then it will likely be in local registry mode. This means FireFly will interact +> with contract instances using the `/contracts/{address}` API. However, if you are using Ethconnect provisioned via a +> cloud provider such as [Kaledio](https://www.kaleido.io) then it will be in remote registry mode and FireFly will need +> use the `/instances/{address}` API instead. -Once you have an Ethconnect instance ready, FireFly then needs three pieces of configuration: +Regardless of how you provision Ethconnect, the chart will need the following config to tell FireFly how to submit +and sign batch pin transactions via its smart contract (one of the core operations): -* `config.organizationKey`: the Ethereum address of the organization's wallet / key which will be used for signing transactions -* `config.ethconnectUrl`: the HTTP/S URL of the Ethconnect instance FireFly will use +```yaml +config: + organizationKey: "{organizationWalletAddress}" + fireflyContractAddress: "/contracts/{fireflyContractAddress}" +``` + +where: + +* `config.organizationKey`: is the Ethereum address of the organization's wallet / key which will be used for signing transactions * `config.fireflyContractAddress`: the Ethconnect URI representing the deployed FireFly smart contract i.e. - `/instances/0x965b92929108df1c77c156ba73d00ca851dcd2e1`. See [Smart Contract Deployment](#smart-contract-deployment) - for how to you can deploy the contract yourself. + `/contracts/0x965b92929108df1c77c156ba73d00ca851dcd2e1` or `/instances/0x965b92929108df1c77c156ba73d00ca851dcd2e1`. + See [Smart Contract Deployment](#smart-contract-deployment) for how to you can deploy the contract yourself. + +#### Remote Ethconnect -These will enable the FireFly deployment to connect to the Ethereum blockchain and submit batch pin transactions via -its smart contract on behalf of the organization it's representing. +Assuming you have an Ethconnect instance ready, the chart will need the following additional configuration to have FireFly +(and any enabled [tokens connectors](#tokens-connectors)) connect to it: + +```yaml +config: + ethconnectUrl: "https://ethconnect.acme.org" +``` + +#### Chart-managed Ethconnect + +Assuming you have an Ethereum node ready, the chart can be configured to automatically provision Ethconnect for you given +the following: + +```yaml + +ethconnect: + enabled: true + + config: + jsonRpcUrl: "https://eth.acme.org" + + jobs: + registerContracts: + enabled: true +``` + +Because the chart-managed Ethconnect is in "local registry mode", it will not be aware of any pre-deployed smart contracts +without first registering them. By default, the chart will run a job which will attempt to register the presumably, pre-deployed +FireFly and [ERC1155](#erc1155) contracts provided via the `config.fireflyContractAdderess` and `erc1155.contractAddress` +values. + +> **NOTE**: With the ongoing work on [Custom On-Chain Logic](https://github.com/hyperledger/firefly-fir/pull/2) within FireFly, +> the support around contract registration and deployment is subject to change in the near future. + +If you are unable to pre-deploy the contracts, you can disable registration and boot up FireFly in a "pre-init" +state instead: + +```yaml +config: + preInit: true + +core: + jobs: + registration: + enabled: false + +ethconnect: + enabled: true + + config: + jsonRpcUrl: "https://eth.acme.org" + + jobs: + registerContracts: + enabled: false +``` + +This will allow you to install the chart, [deploy your smart contracts](#smart-contract-deployment) to the chart-managed Ethconnect, +then you can upgrade the chart with pre-init disabled to have FireFly finish its startup and network registration: + +```yaml +config: + preInit: false + +core: + jobs: + registration: + enabled: true +``` #### Smart Contract Deployment @@ -284,10 +378,9 @@ Configuring FireFly to use a [Hyperledger Fabric](https://www.hyperledger.org/us having an instance of [FireFly Fabconnect](https://github.com/hyperledger/firefly-fabconnect) deployed and connected to the gRPC port of a Fabric peer in the underlying network. -As was noted in [Deployment Architecture](#deployment-architecture), the chart will include support for deploying Fabconnect -as part of its `0.1.0` release. See [#272](https://github.com/hyperledger/firefly/issues/272) to track its progress. For now, -you can either deploy Fabconnect yourself or use a cloud provider like [Kaleido](https://www.kaleido.io) which provides -Fabconnect alongside its Fabric peer nodes. +As was noted in [Deployment Architecture](#deployment-architecture), the chart will eventually include support for deploying +Fabconnect. For now, you can either deploy Fabconnect yourself or use a cloud provider like [Kaleido](https://www.kaleido.io) +which provides Fabconnect alongside its Fabric peer nodes. Once you have a Fabconnect instance ready, FireFly then needs three pieces of configuration: @@ -347,6 +440,9 @@ core: annotations: # recommended for handling blob data transfers and broadcasts nginx.ingress.kubernetes.io/proxy-body-size: 128m + # recommended for having websocket connections live longer than the default 60s + nginx.ingress.kubernetes.io/proxy-read-timeout: "1800" + nginx.ingress.kubernetes.io/proxy-send-timeout: "1800" # example cert-manager ClusterIssuer for Let's Encrypt cert-manager.io/cluster-issuer: letsencrypt-prod hosts: @@ -447,7 +543,7 @@ annotation can be set on the `Ingress`: By default, the chart comes with the [FireFly Tokens ERC1155 connector](https://github.com/hyperledger/firefly-tokens-erc1155) disabled. -The ERC1155 connect requires its [ERC1155 smart contract](https://github.com/hyperledger/firefly-tokens-erc1155/blob/main/solidity/contracts/ERC1155MixedFungible.sol) +The ERC1155 connector requires its [ERC1155 smart contract](https://github.com/hyperledger/firefly-tokens-erc1155/blob/main/solidity/contracts/ERC1155MixedFungible.sol) to be deployed via Ethconnect. To do so, you can follow the same process for deploying the [FireFly smart contract](#smart-contract-deployment). Once the smart contract is deployed, you can enable the ERC1155 connect and provide the contract address to the chart: @@ -457,6 +553,39 @@ erc1155: contractAddress: "/instances/0xf778b86fa74e846c4f0a1fbd1335fe81c00a0c91" ``` +#### ERC20 / ERC721 + +By default, the chart comes with the [FireFly Tokens ERC20 / ERC721 connector](https://github.com/hyperledger/firefly-tokens-erc20) +disabled. [ERC20](https://eips.ethereum.org/EIPS/eip-20) is the token standard used for fungible tokens as part of this connector, +whereas [ERC721](https://eips.ethereum.org/EIPS/eip-721) is used for the [non-fungible tokens](https://en.wikipedia.org/wiki/Non-fungible_token) (NFTs). + +Unlike other token connectors, ERC20 / ERC721 is stateless and currently comes with [experimental support](scripts/ff-deploy-erc20-erc721-contracts/index.js) +for automatically deploying its smart contracts to your Ethconnect instance and preparing them to be used +by their respective [token pools](https://hyperledger.github.io/firefly/gettingstarted/mint_tokens.html#create-a-pool): + +```yaml +erc20Erc721: + enabled: true + + erc20: + enabled: true + tokenName: "FF" # enter the symbol / name for your fungible tokens here + + erc721: + enabled: false + tokenName: "NFFT" # enter the symbol / name for your NFTs here + + job: + deployContracts: + enabled: true +``` + +see the [values.yaml](values.yaml) for more information around configuration options depending on if you are using an +Ethconnect instance in local or remote registry mode. + +> **NOTE**: With the ongoing work on [Custom On-Chain Logic](https://github.com/hyperledger/firefly-fir/pull/2) within FireFly, +> the support around contract deployment is subject to change in the near future. + ### Prometheus Support FireFly comes with an [metrics endpoint](https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-example) diff --git a/charts/firefly/contracts/erc20.json b/charts/firefly/contracts/erc20.json deleted file mode 100644 index e85eb0a..0000000 --- a/charts/firefly/contracts/erc20.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "abi": [{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"burnWithData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mintWithData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"transferWithData","outputs":[],"stateMutability":"nonpayable","type":"function"}], - "bytecode": "0x60806040523480156200001157600080fd5b5060405162001a7038038062001a70833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b5060405250505081818160039080519060200190620001cf9291906200020f565b508060049080519060200190620001e89291906200020f565b506012600560006101000a81548160ff021916908360ff16021790555050505050620002b5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200025257805160ff191683800117855562000283565b8280016001018555821562000283579182015b828111156200028257825182559160200191906001019062000265565b5b50905062000292919062000296565b5090565b5b80821115620002b157600081600090555060010162000297565b5090565b6117ab80620002c56000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806383e49c531161008c578063a457c2d711610066578063a457c2d71461051e578063a9059cbb14610582578063c0ea7a7a146105e6578063dd62ed3e146106a9576100ea565b806383e49c531461035557806395d89b41146103f857806396adfe421461047b576100ea565b806323b872dd116100c857806323b872dd146101f4578063313ce56714610278578063395093511461029957806370a08231146102fd576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d6575b600080fd5b6100f7610721565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c3565b60405180821515815260200191505060405180910390f35b6101de6107e1565b6040518082815260200191505060405180910390f35b6102606004803603606081101561020a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107eb565b60405180821515815260200191505060405180910390f35b6102806108c4565b604051808260ff16815260200191505060405180910390f35b6102e5600480360360408110156102af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108db565b60405180821515815260200191505060405180910390f35b61033f6004803603602081101561031357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061098e565b6040518082815260200191505060405180910390f35b6103f66004803603606081101561036b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156103b257600080fd5b8201836020820111156103c457600080fd5b803590602001918460018302840111640100000000831117156103e657600080fd5b90919293919293905050506109d6565b005b6104006109e6565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610440578082015181840152602081019050610425565b50505050905090810190601f16801561046d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61051c6004803603606081101561049157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156104d857600080fd5b8201836020820111156104ea57600080fd5b8035906020019184600183028401116401000000008311171561050c57600080fd5b9091929391929390505050610a88565b005b61056a6004803603604081101561053457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a98565b60405180821515815260200191505060405180910390f35b6105ce6004803603604081101561059857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b65565b60405180821515815260200191505060405180910390f35b6106a7600480360360808110156105fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561066357600080fd5b82018360208201111561067557600080fd5b8035906020019184600183028401116401000000008311171561069757600080fd5b9091929391929390505050610b83565b005b61070b600480360360408110156106bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b95565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b95780601f1061078e576101008083540402835291602001916107b9565b820191906000526020600020905b81548152906001019060200180831161079c57829003601f168201915b5050505050905090565b60006107d76107d0610c1c565b8484610c24565b6001905092915050565b6000600254905090565b60006107f8848484610e1b565b6108b984610804610c1c565b6108b4856040518060600160405280602881526020016116bf60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061086a610c1c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b610c24565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60006109846108e8610c1c565b8461097f85600160006108f9610c1c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119690919063ffffffff16565b610c24565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6109e0848461121e565b50505050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050905090565b610a9284846113e2565b50505050565b6000610b5b610aa5610c1c565b84610b56856040518060600160405280602581526020016117516025913960016000610acf610c1c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b610c24565b6001905092915050565b6000610b79610b72610c1c565b8484610e1b565b6001905092915050565b610b8e858585610e1b565b5050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610caa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061172d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116776022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117086025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116326023913960400191505060405180910390fd5b610f328383836115a9565b610f9d81604051806060016040528060268152602001611699602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611030816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611189576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561114e578082015181840152602081019050611133565b50505050905090810190601f16801561117b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600080828401905083811015611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806116e76021913960400191505060405180910390fd5b6112b0826000836115a9565b61131b81604051806060016040528060228152602001611655602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611372816002546115ae90919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611485576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b611491600083836115a9565b6114a68160025461119690919063ffffffff16565b6002819055506114fd816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b505050565b600082821115611626576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b81830390509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212206bea29669abdd5553ee4682303a6935fde3576c9a7fdb0a9e8012b2b622342a964736f6c634300060c0033" -} \ No newline at end of file diff --git a/charts/firefly/contracts/erc20Factory.json b/charts/firefly/contracts/erc20Factory.json deleted file mode 100644 index 8c61c0a..0000000 --- a/charts/firefly/contracts/erc20Factory.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "contract_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "TokenCreate", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "create", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x608060405234801561001057600080fd5b50611f15806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632f237e8214610030575b600080fd5b6101d56004803603606081101561004657600080fd5b810190808035906020019064010000000081111561006357600080fd5b82018360208201111561007557600080fd5b8035906020019184600183028401116401000000008311171561009757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156100fa57600080fd5b82018360208201111561010c57600080fd5b8035906020019184600183028401116401000000008311171561012e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561019157600080fd5b8201836020820111156101a357600080fd5b803590602001918460018302840111640100000000831117156101c557600080fd5b90919293919293905050506101d7565b005b600084846040516101e790610462565b808060200180602001838103835285818151815260200191508051906020019080838360005b8381101561022857808201518184015260208101905061020d565b50505050905090810190601f1680156102555780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561028e578082015181840152602081019050610273565b50505050905090810190601f1680156102bb5780820380516001836020036101000a031916815260200191505b50945050505050604051809103906000f0801580156102de573d6000803e3d6000fd5b5090508073ffffffffffffffffffffffffffffffffffffffff1661030061045a565b73ffffffffffffffffffffffffffffffffffffffff167f526f9a5156dc0b4718266874dcfcb1ebfe1a07691c12da6362cbafd6ae907bda8787878760405180806020018060200180602001848103845288818151815260200191508051906020019080838360005b83811015610383578082015181840152602081019050610368565b50505050905090810190601f1680156103b05780820380516001836020036101000a031916815260200191505b50848103835287818151815260200191508051906020019080838360005b838110156103e95780820151818401526020810190506103ce565b50505050905090810190601f1680156104165780820380516001836020036101000a031916815260200191505b508481038252868682818152602001925080828437600081840152601f19601f82011690508083019250505097505050505050505060405180910390a35050505050565b600033905090565b611a70806104708339019056fe60806040523480156200001157600080fd5b5060405162001a7038038062001a70833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b5060405250505081818160039080519060200190620001cf9291906200020f565b508060049080519060200190620001e89291906200020f565b506012600560006101000a81548160ff021916908360ff16021790555050505050620002b5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200025257805160ff191683800117855562000283565b8280016001018555821562000283579182015b828111156200028257825182559160200191906001019062000265565b5b50905062000292919062000296565b5090565b5b80821115620002b157600081600090555060010162000297565b5090565b6117ab80620002c56000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806383e49c531161008c578063a457c2d711610066578063a457c2d71461051e578063a9059cbb14610582578063c0ea7a7a146105e6578063dd62ed3e146106a9576100ea565b806383e49c531461035557806395d89b41146103f857806396adfe421461047b576100ea565b806323b872dd116100c857806323b872dd146101f4578063313ce56714610278578063395093511461029957806370a08231146102fd576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d6575b600080fd5b6100f7610721565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c3565b60405180821515815260200191505060405180910390f35b6101de6107e1565b6040518082815260200191505060405180910390f35b6102606004803603606081101561020a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107eb565b60405180821515815260200191505060405180910390f35b6102806108c4565b604051808260ff16815260200191505060405180910390f35b6102e5600480360360408110156102af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108db565b60405180821515815260200191505060405180910390f35b61033f6004803603602081101561031357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061098e565b6040518082815260200191505060405180910390f35b6103f66004803603606081101561036b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156103b257600080fd5b8201836020820111156103c457600080fd5b803590602001918460018302840111640100000000831117156103e657600080fd5b90919293919293905050506109d6565b005b6104006109e6565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610440578082015181840152602081019050610425565b50505050905090810190601f16801561046d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61051c6004803603606081101561049157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156104d857600080fd5b8201836020820111156104ea57600080fd5b8035906020019184600183028401116401000000008311171561050c57600080fd5b9091929391929390505050610a88565b005b61056a6004803603604081101561053457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a98565b60405180821515815260200191505060405180910390f35b6105ce6004803603604081101561059857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b65565b60405180821515815260200191505060405180910390f35b6106a7600480360360808110156105fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561066357600080fd5b82018360208201111561067557600080fd5b8035906020019184600183028401116401000000008311171561069757600080fd5b9091929391929390505050610b83565b005b61070b600480360360408110156106bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b95565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b95780601f1061078e576101008083540402835291602001916107b9565b820191906000526020600020905b81548152906001019060200180831161079c57829003601f168201915b5050505050905090565b60006107d76107d0610c1c565b8484610c24565b6001905092915050565b6000600254905090565b60006107f8848484610e1b565b6108b984610804610c1c565b6108b4856040518060600160405280602881526020016116bf60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061086a610c1c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b610c24565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60006109846108e8610c1c565b8461097f85600160006108f9610c1c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119690919063ffffffff16565b610c24565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6109e0848461121e565b50505050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050905090565b610a9284846113e2565b50505050565b6000610b5b610aa5610c1c565b84610b56856040518060600160405280602581526020016117516025913960016000610acf610c1c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b610c24565b6001905092915050565b6000610b79610b72610c1c565b8484610e1b565b6001905092915050565b610b8e858585610e1b565b5050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610caa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061172d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116776022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117086025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116326023913960400191505060405180910390fd5b610f328383836115a9565b610f9d81604051806060016040528060268152602001611699602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611030816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611189576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561114e578082015181840152602081019050611133565b50505050905090810190601f16801561117b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600080828401905083811015611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806116e76021913960400191505060405180910390fd5b6112b0826000836115a9565b61131b81604051806060016040528060228152602001611655602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dc9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611372816002546115ae90919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611485576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b611491600083836115a9565b6114a68160025461119690919063ffffffff16565b6002819055506114fd816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b505050565b600082821115611626576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b81830390509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220dc9a19ab8aad867c075442eb2d229a3ef07480be1c3ce321df886a65017cd31764736f6c634300060c0033a2646970667358221220d4be8b7cbedfa3bada247438439e115306ab4e368667f08fa2d1609283146f7e64736f6c634300060c0033" -} \ No newline at end of file diff --git a/charts/firefly/scripts/ff-deploy-erc20-erc721-contracts/index.js b/charts/firefly/scripts/ff-deploy-erc20-erc721-contracts/index.js new file mode 100644 index 0000000..6f5ee56 --- /dev/null +++ b/charts/firefly/scripts/ff-deploy-erc20-erc721-contracts/index.js @@ -0,0 +1,129 @@ +'use strict'; + +// Copyright © 2022 Kaleido, Inc. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://swww.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const axios = require('axios'); + +const erc20ContractJson = require('/root/solidity/build/contracts/ERC20WithData.json'); +const erc721ContractJson = require('/root/solidity/build/contracts/ERC721WithData.json'); + +const deployContracts = async () => { + let FormData = require("form-data"); + const ETHCONNECT_BASE_URL = process.env.ETHCONNECT_URL; + const ETHCONNECT_PREFIX = process.env.ETHCONNECT_PREFIX || "firefly"; + const ABIS_URI = process.env.ABIS_URI || "/abis"; + const CONTRACTS_URI = process.env.CONTRACTS_URI || "/contracts"; + + // does not currently support using an address resolver to look up the wallet address i.e. must be in hex format + const TOKENS_OWNER_KEY = process.env.TOKENS_OWNER_KEY; + + const ERC20_ENABLED = process.env.ERC20_ENABLED === "true"; + const ERC20_TOKEN_NAME = process.env.ERC20_TOKEN_NAME; + + const ERC721_ENABLED = process.env.ERC721_ENABLED === "true"; + const ERC721_TOKEN_NAME = process.env.ERC721_TOKEN_NAME; + + async function deployTokenContract(jsonLink, tokenName) { + const abi = jsonLink.abi; + const byteCode = jsonLink.bytecode; + + // POST /abis + const bodyFormData = new FormData(); + bodyFormData.append("abi", JSON.stringify(abi)); + bodyFormData.append("bytecode", byteCode); + console.log(`POST ${ETHCONNECT_BASE_URL}${ABIS_URI} with abi/bytecode form data`); + const abiRes = await axios + .post(`${ETHCONNECT_BASE_URL}${ABIS_URI}`, bodyFormData, { + headers: bodyFormData.getHeaders(), + }) + .catch((err) => { + throw `Error in POST ${ETHCONNECT_BASE_URL}${ABIS_URI} with form data. ${err}`; + }); + + console.log("Sleeping 10s for sync..."); + await new Promise((f) => setTimeout(f, 10000)); + + // POST /abis/ + console.log(`POST ${ETHCONNECT_BASE_URL}${ABIS_URI}/${abiRes.data.id}`); + const contractRes = await axios + .post( + `${ETHCONNECT_BASE_URL}${ABIS_URI}/${abiRes.data.id}`, + JSON.stringify({ + name: tokenName, + symbol: tokenName, + }), + { + headers: { + accept: "application/json", + "Content-Type": "application/json", + [`x-${ETHCONNECT_PREFIX}-from`]: TOKENS_OWNER_KEY, + }, + } + ) + .catch((err) => { + throw `Error in POST ${ETHCONNECT_BASE_URL}${ABIS_URI}/${abiRes.data.id}. ${err}`; + }); + + console.log("Sleeping 10s for sync..."); + await new Promise((f) => setTimeout(f, 10000)); + + console.log(`GET ${ETHCONNECT_BASE_URL}${CONTRACTS_URI}`); + const contracts = await axios + .get(`${ETHCONNECT_BASE_URL}${CONTRACTS_URI}`, { + headers: { + accept: "application/json", + "Content-Type": "application/json", + }, + }) + .catch((err) => { + console.log(`Error in GET ${ETHCONNECT_BASE_URL}${CONTRACTS_URI}. ${err}`); + }); + + const contract = contracts.data.filter(contract => contract.abi === abiRes.data.id)[0]; + + return { + address: `0x${contract.address}`, + abiId: abiRes.data.id + }; + } + + + console.log("\n\n"); + + if (ERC20_ENABLED) { + const erc20Contract = await deployTokenContract(erc20ContractJson, ERC20_TOKEN_NAME); + console.log("ERC20"); + console.log(`\tAddress: ${erc20Contract.address}`); + console.log(`\tABI ID: ${erc20Contract.abiId}\n`); + } + + if (ERC721_ENABLED) { + const erc721Contract = await deployTokenContract(erc721ContractJson, ERC721_TOKEN_NAME); + console.log("ERC721"); + console.log(`\tAddress: ${erc721Contract.address}`); + console.log(`\tABI ID: ${erc721Contract.abiId}\n`); + } +}; + +(async () => { + try { + await deployContracts(); + } catch (e) { + console.error(`Failed to deploy contracts due to: ${e}`); + process.exit(1); + } +})(); diff --git a/charts/firefly/scripts/ff-deploy-erc20-erc721-contracts/package.json b/charts/firefly/scripts/ff-deploy-erc20-erc721-contracts/package.json new file mode 100644 index 0000000..d66df83 --- /dev/null +++ b/charts/firefly/scripts/ff-deploy-erc20-erc721-contracts/package.json @@ -0,0 +1,16 @@ +{ + "name": "ff-deploy-erc20-erc721-contracts", + "version": "0.1.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "private": true, + "author": "", + "license": "Apache-2.0", + "dependencies": { + "axios": "^0.25.0", + "form-data": "^4.0.0" + } +} diff --git a/charts/firefly/scripts/ff-register-contracts.sh b/charts/firefly/scripts/ff-register-contracts.sh index b60c899..42b02e9 100644 --- a/charts/firefly/scripts/ff-register-contracts.sh +++ b/charts/firefly/scripts/ff-register-contracts.sh @@ -20,7 +20,7 @@ set -e apk add curl jq -until STATUS=$(curl -s ${ETHCONNECT_URL}/contracts); do +until STATUS=$(curl --fail -s ${ETHCONNECT_URL}/contracts); do echo "Waiting for Ethconnect..." sleep 5 done @@ -36,22 +36,24 @@ done # FF contract -publishResponse=$(curl -s --fail -F "abi=$(cat /var/lib/ethconnect/contracts/firefly.json | jq -r '.abi')" -F bytecode=$(cat /var/lib/ethconnect/contracts/firefly.json | jq -r '.bytecode') "${ETHCONNECT_URL}/abis") -curl -s --fail -H "Content-Type: application/json" -X POST -H "x-${ETHCONNECT_PREFIX}-sync: true" -H "x-${ETHCONNECT_PREFIX}-register: firefly" "${ETHCONNECT_URL}$(echo -n $publishResponse | jq -r .path)/${FIREFLY_CONTRACT_ADDRESS}" +if ! curl --fail -s "${ETHCONNECT_URL}/contracts/${FIREFLY_CONTRACT_ADDRESS}"; then + echo "[${FIREFLY_CONTRACT_ADDRESS}] has not been registered for the FireFly contract, registering now..." + publishResponse=$(curl -s --fail -F "abi=$(cat /var/lib/ethconnect/contracts/firefly.json | jq -r '.abi')" -F bytecode=$(cat /var/lib/ethconnect/contracts/firefly.json | jq -r '.bytecode') "${ETHCONNECT_URL}/abis") + curl -s --fail -H "Content-Type: application/json" -X POST -H "x-${ETHCONNECT_PREFIX}-sync: true" -H "x-${ETHCONNECT_PREFIX}-register: firefly" "${ETHCONNECT_URL}$(echo -n $publishResponse | jq -r .path)/${FIREFLY_CONTRACT_ADDRESS}" +else + echo "[${FIREFLY_CONTRACT_ADDRESS}] is already registered for the FireFly contract." +fi + # ERC1155 contract if [[ "${FIREFLY_ERC1155_ENABLED}" == "true" ]]; then - # publish and register ERC1155 - publishResponse=$(curl -s --fail -F "abi=$(cat /var/lib/ethconnect/contracts/erc1155.json | jq -r '.abi')" -F bytecode=$(cat /var/lib/ethconnect/contracts/erc1155.json | jq -r '.bytecode') "${ETHCONNECT_URL}/abis") - curl -s --fail -H "Content-Type: application/json" -X POST -H "x-${ETHCONNECT_PREFIX}-sync: true" -H "x-${ETHCONNECT_PREFIX}-register: firefly-erc1155" "${ETHCONNECT_URL}$(echo -n $publishResponse | jq -r .path)/${FIREFLY_ERC1155_CONTRACT_ADDRESS}" -fi - -if [[ "${FIREFLY_ERC20_ENABLED}" == "true" ]]; then - # publish and register ERC20 factory - publishResponse=$(curl -s --fail -F "abi=$(cat /var/lib/ethconnect/contracts/erc20Factory.json | jq -r '.abi')" -F bytecode=$(cat /var/lib/ethconnect/contracts/erc20Factory.json | jq -r '.bytecode') "${ETHCONNECT_URL}/abis") - curl --fail -H "Content-Type: application/json" -X POST -H "x-${ETHCONNECT_PREFIX}-sync: true" -H "x-${ETHCONNECT_PREFIX}-register: firefly-erc20-factory" "${ETHCONNECT_URL}$(echo -n $publishResponse | jq -r .path)/${FIREFLY_ERC20_FACTORY_CONTRACT_ADDRESS}" - # publish ERC20 - publishResponse=$(curl -s --fail -F "abi=$(cat /var/lib/ethconnect/contracts/erc20.json | jq -r '.abi')" -F bytecode=$(cat /var/lib/ethconnect/contracts/erc20.json | jq -r '.bytecode') "${ETHCONNECT_URL}/abis") - echo "ERC20 ABI URI: $(echo -n $publishResponse | jq -r .path)" + if ! curl --fail -s "${ETHCONNECT_URL}/contracts/${FIREFLY_ERC1155_CONTRACT_ADDRESS}"; then + # publish and register ERC1155 + echo "[${FIREFLY_ERC1155_CONTRACT_ADDRESS}] has not been registered for the FireFly ERC1155 contract, registering now..." + publishResponse=$(curl -s --fail -F "abi=$(cat /var/lib/ethconnect/contracts/erc1155.json | jq -r '.abi')" -F bytecode=$(cat /var/lib/ethconnect/contracts/erc1155.json | jq -r '.bytecode') "${ETHCONNECT_URL}/abis") + curl -s --fail -H "Content-Type: application/json" -X POST -H "x-${ETHCONNECT_PREFIX}-sync: true" -H "x-${ETHCONNECT_PREFIX}-register: firefly-erc1155" "${ETHCONNECT_URL}$(echo -n $publishResponse | jq -r .path)/${FIREFLY_ERC1155_CONTRACT_ADDRESS}" + else + echo "[${FIREFLY_ERC1155_CONTRACT_ADDRESS}] is already registered for the FireFly ERC1155 contract." + fi fi diff --git a/charts/firefly/templates/_helpers.tpl b/charts/firefly/templates/_helpers.tpl index f853103..37a617a 100644 --- a/charts/firefly/templates/_helpers.tpl +++ b/charts/firefly/templates/_helpers.tpl @@ -81,9 +81,9 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} app.kuberentes.io/part-of: {{ .Chart.Name }} {{- end }} -{{- define "firefly.erc20Labels" -}} +{{- define "firefly.erc20erc721Labels" -}} helm.sh/chart: {{ include "firefly.chart" . }} -{{ include "firefly.erc20SelectorLabels" . }} +{{ include "firefly.erc20erc721SelectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -125,10 +125,10 @@ app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: erc1155 {{- end }} -{{- define "firefly.erc20SelectorLabels" -}} +{{- define "firefly.erc20erc721SelectorLabels" -}} app.kubernetes.io/name: {{ include "firefly.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/component: erc20 +app.kubernetes.io/component: erc20-erc721 {{- end }} {{- define "firefly.ethconnectSelectorLabels" -}} @@ -137,6 +137,14 @@ app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: ethconnect {{- end }} +{{- define "firefly.ethconnectRegisterContractsJobName" -}} +{{ printf "%s-%s-%s-register-contracts" (include "firefly.fullname" .) (.Values.config.organizationName | lower) .Chart.Version | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "firefly.erc20erc721DeployContractsJobName" -}} +{{ printf "%s-%s-%s-erc20-erc-721-deploy-contracts" (include "firefly.fullname" .) (.Values.config.organizationName | lower) .Chart.Version | trunc 63 | trimSuffix "-" }} +{{- end }} + {{/* Config helpers */}} @@ -300,17 +308,17 @@ dataexchange: {{- if .Values.config.tokensOverride }} tokens: {{- tpl .Values.config.tokensOverride . | nindent 2 }} -{{- else if or .Values.erc1155.enabled .Values.erc20.enabled }} +{{- else if or .Values.erc1155.enabled .Values.erc20erc721.enabled }} tokens: {{- if .Values.erc1155.enabled }} - plugin: fftokens name: erc1155 url: http://{{ include "firefly.fullname" . }}-erc1155.{{ .Release.Namespace }}.svc:{{ .Values.erc1155.service.port }} {{- end }} - {{- if .Values.erc20.enabled }} + {{- if .Values.erc20erc721.enabled }} - plugin: fftokens - name: erc20 - url: http://{{ include "firefly.fullname" . }}-erc20.{{ .Release.Namespace }}.svc:{{ .Values.erc20.service.port }} + name: erc20-erc721 + url: http://{{ include "firefly.fullname" . }}-erc20-erc721.{{ .Release.Namespace }}.svc:{{ .Values.erc20erc721.service.port }} {{- end }} {{- end }} {{- end }} diff --git a/charts/firefly/templates/core/job-migrations.yaml b/charts/firefly/templates/core/job-migrations.yaml index 8f79157..0ed5964 100644 --- a/charts/firefly/templates/core/job-migrations.yaml +++ b/charts/firefly/templates/core/job-migrations.yaml @@ -20,7 +20,9 @@ apiVersion: batch/v1 kind: Job metadata: - name: "{{ template "firefly.fullname" . }}-{{ .Values.core.image.tag | default (printf "v%s" .Chart.AppVersion) }}-migrations" + name: "{{ include "firefly.fullname" . }}-{{ .Values.core.image.tag | default (printf "v%s" .Chart.AppVersion) }}-migrations" + labels: + {{- include "firefly.coreLabels" . | nindent 4 }} spec: backoffLimit: 5 activeDeadlineSeconds: 12000 diff --git a/charts/firefly/templates/core/job-registration.yaml b/charts/firefly/templates/core/job-registration.yaml index cf13479..dfea391 100644 --- a/charts/firefly/templates/core/job-registration.yaml +++ b/charts/firefly/templates/core/job-registration.yaml @@ -20,7 +20,9 @@ apiVersion: batch/v1 kind: Job metadata: - name: "{{ template "firefly.fullname" . }}-{{ .Values.config.organizationName | lower }}-registration" + name: "{{ include "firefly.fullname" . }}-{{ .Values.config.organizationName | lower }}-{{ .Values.core.image.tag | default (printf "v%s" .Chart.AppVersion) }}-registration" + labels: + {{- include "firefly.coreLabels" . | nindent 4 }} spec: backoffLimit: 5 activeDeadlineSeconds: 12000 diff --git a/charts/firefly/templates/erc20erc721/configmap-deploy-scripts.yaml b/charts/firefly/templates/erc20erc721/configmap-deploy-scripts.yaml new file mode 100644 index 0000000..800d251 --- /dev/null +++ b/charts/firefly/templates/erc20erc721/configmap-deploy-scripts.yaml @@ -0,0 +1,28 @@ +{{/* + Copyright © 2022 Kaleido, Inc. + + SPDX-License-Identifier: Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://swww.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/}} + +{{- if and .Values.erc20erc721.enabled .Values.erc20erc721.job.deployContracts.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "firefly.fullname" . }}-erc20-erc721-deploy-scripts + labels: + {{- include "firefly.erc20erc721Labels" . | nindent 4 }} +data: +{{ (.Files.Glob "scripts/ff-deploy-erc20-erc721-contracts/*").AsConfig | indent 2 }} +{{- end }} \ No newline at end of file diff --git a/charts/firefly/templates/erc20/deployment.yaml b/charts/firefly/templates/erc20erc721/deployment.yaml similarity index 67% rename from charts/firefly/templates/erc20/deployment.yaml rename to charts/firefly/templates/erc20erc721/deployment.yaml index 034a7f9..4783d3e 100644 --- a/charts/firefly/templates/erc20/deployment.yaml +++ b/charts/firefly/templates/erc20erc721/deployment.yaml @@ -16,42 +16,42 @@ limitations under the License. */}} -{{- if .Values.erc20.enabled }} +{{- if .Values.erc20erc721.enabled }} apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "firefly.fullname" . }}-erc20 + name: {{ include "firefly.fullname" . }}-erc20-erc721 labels: - {{- include "firefly.erc20Labels" . | nindent 4 }} + {{- include "firefly.erc20erc721Labels" . | nindent 4 }} spec: replicas: 1 selector: matchLabels: - {{- include "firefly.erc20SelectorLabels" . | nindent 6 }} + {{- include "firefly.erc20erc721SelectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.erc20.podAnnotations }} + {{- with .Values.erc20erc721.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "firefly.erc20SelectorLabels" . | nindent 8 }} + {{- include "firefly.erc20erc721SelectorLabels" . | nindent 8 }} spec: - {{- with .Values.erc20.imagePullSecrets }} + {{- with .Values.erc20erc721.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: - {{- toYaml .Values.erc20.podSecurityContext | nindent 8 }} + {{- toYaml .Values.erc20erc721.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }}-erc20 securityContext: - {{- toYaml .Values.erc20.securityContext | nindent 12 }} - image: "{{ .Values.erc20.image.repository }}:{{ .Values.erc20.image.tag }}" - imagePullPolicy: {{ .Values.erc20.image.pullPolicy }} + {{- toYaml .Values.erc20erc721.securityContext | nindent 12 }} + image: "{{ .Values.erc20erc721.image.repository }}:{{ .Values.erc20erc721.image.tag }}" + imagePullPolicy: {{ .Values.erc20erc721.image.pullPolicy }} ports: - name: http - containerPort: {{ .Values.erc20.service.port }} + containerPort: {{ .Values.erc20erc721.service.port }} protocol: TCP livenessProbe: httpGet: @@ -74,11 +74,9 @@ spec: env: {{- include "firefly.ethconnectUrlEnvVar" . | nindent 12 }} - name: PORT - value: {{ .Values.erc20.service.port | quote }} - - name: ETHCONNECT_INSTANCE - value: {{ .Values.erc20.factoryContractAddress }} + value: {{ .Values.erc20erc721.service.port | quote }} - name: ETHCONNECT_TOPIC - value: {{ .Values.erc20.ethconnectTopic | quote }} + value: {{ .Values.erc20erc721.ethconnectTopic | quote }} - name: ETHCONNECT_PREFIX value: {{ .Values.config.ethconnectPrefixShort | default "fly" }} {{- if and .Values.config.ethconnectUsername .Values.config.ethconnectPassword }} @@ -87,21 +85,19 @@ spec: - name: ETHCONNECT_PASSWORD value: {{ .Values.config.ethconnectPassword | quote }} {{- end }} - - name: ETHCONNECT_CONTRACT_URI - value: {{ .Values.erc20.contractUri }} - name: AUTO_INIT value: "true" resources: - {{- toYaml .Values.erc20.resources | nindent 12 }} - {{- with .Values.erc20.nodeSelector }} + {{- toYaml .Values.erc20erc721.resources | nindent 12 }} + {{- with .Values.erc20erc721.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.erc20.affinity }} + {{- with .Values.erc20erc721.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.erc20.tolerations }} + {{- with .Values.erc20erc721.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/firefly/templates/erc20erc721/job-deploy-contracts.yaml b/charts/firefly/templates/erc20erc721/job-deploy-contracts.yaml new file mode 100644 index 0000000..5f343b6 --- /dev/null +++ b/charts/firefly/templates/erc20erc721/job-deploy-contracts.yaml @@ -0,0 +1,83 @@ +{{/* + Copyright © 2022 Kaleido, Inc. + + SPDX-License-Identifier: Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://swww.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/}} + +{{- if and .Values.erc20erc721.enabled .Values.erc20erc721.job.deployContracts.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ include "firefly.erc20erc721DeployContractsJobName" . }}" + labels: + {{- include "firefly.erc20erc721Labels" . | nindent 4 }} +spec: + backoffLimit: 5 + activeDeadlineSeconds: 12000 + template: + spec: + volumes: + - name: deploy-scripts + configMap: + name: {{ include "firefly.fullname" . }}-erc20-erc721-deploy-scripts + - name: tmp + emptyDir: {} + containers: + - name: deploy-contracts + image: "{{ .Values.erc20erc721.image.repository }}:{{ .Values.erc20erc721.image.tag }}" + command: + - sh + - -ce + - | + #!/bin/sh + + until STATUS=$(curl --fail -s ${ETHCONNECT_URL}${ABIS_URI}); do + echo "Waiting for Ethconnect..." + sleep 5 + done + + set -e + + mkdir /tmp/ff-deploy-erc20-erc721-contracts + cp /var/lib/ff-deploy-erc20-erc721-contracts/* /tmp/ff-deploy-erc20-erc721-contracts/ + cd /tmp/ff-deploy-erc20-erc721-contracts/ + + npm i + exec node index.js + env: + {{- include "firefly.ethconnectUrlEnvVar" . | nindent 12 }} + - name: ETHCONNECT_PREFIX + value: {{ .Values.config.ethconnectPrefixLong | default "firefly" }} + - name: ABIS_URI + value: {{ .Values.erc20erc721.abisUri | default "/abis" }} + - name: CONTRACTS_URI + value: {{ .Values.erc20erc721.contractsUri | default "/contracts" }} + - name: TOKENS_OWNER_KEY + value: {{ .Values.erc20erc721.ownerKey | default .Values.config.organizationKey }} + - name: ERC20_ENABLED + value: {{ .Values.erc20erc721.erc20.enabled | quote }} + - name: ERC20_TOKEN_NAME + value: {{ .Values.erc20erc721.erc20.tokenName }} + - name: ERC721_ENABLED + value: {{ .Values.erc20erc721.erc721.enabled | quote }} + - name: ERC721_TOKEN_NAME + value: {{ .Values.erc20erc721.erc721.tokenName }} + volumeMounts: + - name: deploy-scripts + mountPath: /var/lib/ff-deploy-erc20-erc721-contracts/ + - name: tmp + mountPath: /tmp + restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/charts/firefly/templates/erc20/service.yaml b/charts/firefly/templates/erc20erc721/service.yaml similarity index 70% rename from charts/firefly/templates/erc20/service.yaml rename to charts/firefly/templates/erc20erc721/service.yaml index 7655198..dcad585 100644 --- a/charts/firefly/templates/erc20/service.yaml +++ b/charts/firefly/templates/erc20erc721/service.yaml @@ -16,20 +16,20 @@ limitations under the License. */}} -{{- if .Values.erc20.enabled }} +{{- if .Values.erc20erc721.enabled }} apiVersion: v1 kind: Service metadata: - name: {{ include "firefly.fullname" . }}-erc20 + name: {{ include "firefly.fullname" . }}-erc20-erc721 labels: - {{- include "firefly.erc20Labels" . | nindent 4 }} + {{- include "firefly.erc20erc721Labels" . | nindent 4 }} spec: - type: {{ .Values.erc20.service.type }} + type: {{ .Values.erc20erc721.service.type }} ports: - - port: {{ .Values.erc20.service.port }} + - port: {{ .Values.erc20erc721.service.port }} targetPort: http protocol: TCP name: http selector: - {{- include "firefly.erc20SelectorLabels" . | nindent 4 }} + {{- include "firefly.erc20erc721SelectorLabels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/charts/firefly/templates/ethconnect/configmap-contracts.yaml b/charts/firefly/templates/ethconnect/configmap-contracts.yaml index 655efc5..08d07cd 100644 --- a/charts/firefly/templates/ethconnect/configmap-contracts.yaml +++ b/charts/firefly/templates/ethconnect/configmap-contracts.yaml @@ -16,7 +16,7 @@ limitations under the License. */}} -{{- if and .Values.ethconnect.enabled .Values.ethconnect.job.contracts.enabled }} +{{- if and .Values.ethconnect.enabled .Values.ethconnect.job.registerContracts.enabled }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/firefly/templates/ethconnect/ingress.yaml b/charts/firefly/templates/ethconnect/ingress.yaml index b6b8a21..fdf0f3e 100644 --- a/charts/firefly/templates/ethconnect/ingress.yaml +++ b/charts/firefly/templates/ethconnect/ingress.yaml @@ -42,12 +42,16 @@ spec: {{- if and .Values.ethconnect.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ethconnect.ingress.className }} {{- end }} + {{- if .Values.ethconnect.ingress.tls }} tls: + {{- range .Values.ethconnect.ingress.tls }} - hosts: - {{- range .Values.ethconnect.ingress.hosts }} - - {{ .host | quote }} + {{- range .hosts }} + - {{ . | quote }} {{- end }} - secretName: {{- printf "%s-ethconnect-tls" $fullName}} + secretName: {{ .secretName }} + {{- end }} + {{- end }} rules: {{- range .Values.ethconnect.ingress.hosts }} - host: {{ .host | quote }} diff --git a/charts/firefly/templates/ethconnect/job-contracts.yaml b/charts/firefly/templates/ethconnect/job-register-contracts.yaml similarity index 79% rename from charts/firefly/templates/ethconnect/job-contracts.yaml rename to charts/firefly/templates/ethconnect/job-register-contracts.yaml index 25987e7..545b21e 100644 --- a/charts/firefly/templates/ethconnect/job-contracts.yaml +++ b/charts/firefly/templates/ethconnect/job-register-contracts.yaml @@ -16,11 +16,13 @@ limitations under the License. */}} -{{- if and .Values.ethconnect.enabled .Values.ethconnect.job.contracts.enabled }} +{{- if and .Values.ethconnect.enabled .Values.ethconnect.job.registerContracts.enabled }} apiVersion: batch/v1 kind: Job metadata: - name: "{{ template "firefly.fullname" . }}-{{ .Values.config.organizationName | lower }}-contracts" + name: "{{ include "firefly.ethconnectRegisterContractsJobName" . }}" + labels: + {{- include "firefly.ethconnectLabels" . | nindent 4 }} spec: backoffLimit: 5 activeDeadlineSeconds: 12000 @@ -33,7 +35,7 @@ spec: - name: tmp emptyDir: {} containers: - - name: register-ccontraccts + - name: register-contracts image: "{{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default (printf "v%s" .Chart.AppVersion) }}" command: - sh @@ -52,12 +54,6 @@ spec: - name: FIREFLY_ERC1155_CONTRACT_ADDRESS value: {{ .Values.erc1155.contractAddress | replace "/contracts/" "" }} {{- end }} - {{- if .Values.erc20.enabled }} - - name: FIREFLY_ERC20_ENABLED - value: "true" - - name: FIREFLY_ERC20_FACTORY_CONTRACT_ADDRESS - value: {{ .Values.erc20.factoryContractAddress | replace "/contracts/" "" }} - {{- end }} volumeMounts: - name: contracts mountPath: /var/lib/ethconnect/contracts diff --git a/charts/firefly/templates/ethconnect/secret.yaml b/charts/firefly/templates/ethconnect/secret.yaml index d9b271e..464dc0b 100644 --- a/charts/firefly/templates/ethconnect/secret.yaml +++ b/charts/firefly/templates/ethconnect/secret.yaml @@ -33,6 +33,8 @@ stringData: eventPollingIntervalSec: {{ .Values.ethconnect.config.eventPollingIntervalSec }} storagePath: /var/run/ethconnect/abis eventsDB: /var/run/ethconnect/events + catchupModePageSize: {{ .Values.ethconnect.config.catchupModePageSize }} + catchupModeBlockGap: {{ .Values.ethconnect.config.catchupModeBlockGap }} http: port: {{ .Values.ethconnect.service.apiPort }} maxTXWaitTime: {{ .Values.ethconnect.config.maxTXWaitTimeSec }} diff --git a/charts/firefly/values.yaml b/charts/firefly/values.yaml index 63f4e20..0ea39c0 100644 --- a/charts/firefly/values.yaml +++ b/charts/firefly/values.yaml @@ -101,7 +101,7 @@ config: # The short prefix FireFly will prepend to certain headers it sends to Ethconnect i.e. fly or kld ethconnectPrefixShort: "" - # The long prefix FireFly will prepend to certain headers it sends to Ethconnect i.e. FireFly or Kaleido + # The long prefix FireFly will prepend to certain headers it sends to Ethconnect i.e. firefly or kaleido ethconnectPrefixLong: "" # The URL of the Fabconnect API and WS server to use for the blockchain plugin of type `fabric` @@ -267,7 +267,7 @@ dataexchange: image: repository: ghcr.io/hyperledger/firefly-dataexchange-https pullPolicy: IfNotPresent - tag: v0.9.3 + tag: v0.10.3 imagePullSecrets: [] nameOverride: "" @@ -350,7 +350,7 @@ erc1155: image: repository: ghcr.io/hyperledger/firefly-tokens-erc1155 pullPolicy: IfNotPresent - tag: v0.10.3 + tag: v0.10.4 imagePullSecrets: [] @@ -389,22 +389,42 @@ erc1155: affinity: {} -erc20: +erc20erc721: enabled: false - # The Ethconnect URI representing the deployed ERC20 tokens Factory contract - factoryContractAddress: "/contracts/erc20FactoryAddress" - - # The Ethconnect URI representing the stage ERC20 tokens contract - contractUri: "/abis/erc20AbiId" + # The wallet address of the owner of the contract instances and therefore the token pools that will be associated with them + # defaults to config.organizationKey if this is not set + ownerKey: "" # The Ethconnect topic to use for tokens event subscriptions - ethconnectTopic: "tokensERC20" + ethconnectTopic: "tokensERC20ERC721" + + erc20: + enabled: true + + # The name and symbol to use when instantiating the ERC20 tokens contract + tokenName: "FF" + + erc721: + enabled: false + + # The name and symbol to use when instantiating the ERC721 tokens contract + tokenName: "NFFT" + + # The URI to use when publishing ABIs to Ethconnect, should either be '/abis' or '/gateways'. Defaults to '/abis' + abisUri: "" + + # The URI to use when looking up contracts instances via Ethconnect, should either be '/contracts' or '/instances'. Defaults to '/contracts' + contractsUri: "" + + job: + deployContracts: + enabled: true image: - repository: ghcr.io/hyperledger/firefly-tokens-erc20 + repository: ghcr.io/hyperledger/firefly-tokens-erc20-erc721 pullPolicy: IfNotPresent - tag: v0.1.3 + tag: v0.1.5 imagePullSecrets: [] @@ -452,13 +472,21 @@ ethconnect: eventPollingIntervalSec: 1 maxTXWaitTimeSec: 60 maxInFlight: 10 + catchupModePageSize: 5000 + catchupModeBlockGap: 5000 ingress: enabled: false className: "" annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" hosts: - host: chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local imagePullSecrets: [] @@ -478,7 +506,7 @@ ethconnect: image: repository: ghcr.io/hyperledger/firefly-ethconnect pullPolicy: Always - tag: v3.1.1 + tag: v3.1.2 extraEnv: [] # - name: LOG_LEVEL @@ -509,7 +537,7 @@ ethconnect: affinity: {} job: - contracts: + registerContracts: enabled: true persistentVolume: diff --git a/img/helm_chart_deployment_architecture.jpg b/img/helm_chart_deployment_architecture.jpg index da8b2bd..43ed91a 100644 Binary files a/img/helm_chart_deployment_architecture.jpg and b/img/helm_chart_deployment_architecture.jpg differ