Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The charts are published to the OCI registry at `oci://us-west1-docker.pkg.dev/d
- [op-tx-overload](./charts/op-tx-overload/README.md) - Generate load on Optimism Bedrock using transactions with random calldata.
- [op-ufm](./charts/op-ufm/README.md) - A Helm chart for OP User Facing Monitoring
- [optics-keymaster](./charts/optics-keymaster/README.md) - Optics Keymaster
- [periodic-chain-call](./charts/periodic-chain-call/README.md) - Calls a blockchain smart contract function on a schedule
- [prysm](./charts/prysm/README.md) - Go implementation of Ethereum proof of stake.
- [rosetta](./charts/rosetta/README.md) - Rosetta Client for Celo Networks
- [safe-client-gateway](./charts/safe-client-gateway/README.md) - Helm chart for deploying Celo Safe Client Gateway
Expand Down
21 changes: 21 additions & 0 deletions charts/periodic-chain-call/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: periodic-chain-call
apiVersion: v2
version: 0.1.0
description: Calls a blockchain smart contract function on a schedule
home: https://clabs.co
sources:
- https://celo.org
- https://docs.celo.org
- https://clabs.co
- https://github.com/celo-org
keywords:
- celo
- blockchain
maintainers:
- name: cLabs
email: [email protected]
url: https://clabs.co
type: application
icon: https://pbs.twimg.com/profile_images/1613170131491848195/InjXBNx9_400x400.jpg
appVersion: v1.0.0
39 changes: 39 additions & 0 deletions charts/periodic-chain-call/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# periodic-chain-call

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.0.0](https://img.shields.io/badge/AppVersion-v1.0.0-informational?style=flat-square)

Calls a blockchain smart contract function on a schedule

**Homepage:** <https://clabs.co>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| cLabs | <[email protected]> | <https://clabs.co> |

## Source Code

* <https://celo.org>
* <https://docs.celo.org>
* <https://clabs.co>
* <https://github.com/celo-org>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| contractAddress | string | `"0x78Af211Ad79bCE6BF636640CE8c2C2b29e02365A"` | Address of the L2 CeloDistributionSchedule contract |
| functionArgs | string | `""` | Args to pass to function |
| functionSignature | string | `"distributeAccordingToSchedule()(bool)"` | Signature of function to call |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/foundry-rs/foundry"` | |
| image.tag | string | `"latest"` | |
| rpcURL | string | `"https://forno.dango.celo-testnet.org"` | RPC URL for L2 blockchain |
| schedule | string | `"0 0 * * *"` | |
| senderKey | object | `{"value":""}` | Private key of the sender account (for signing transactions) |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs). To regenerate run `helm-docs` command at this folder.
19 changes: 19 additions & 0 deletions charts/periodic-chain-call/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.maintainersSection" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

----------------------------------------------
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs). To regenerate run `helm-docs` command at this folder.
76 changes: 76 additions & 0 deletions charts/periodic-chain-call/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "periodic-chain-call.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "periodic-chain-call.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "periodic-chain-call.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "periodic-chain-call.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "periodic-chain-call.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "periodic-chain-call.labels" -}}
helm.sh/chart: {{ include "periodic-chain-call.chart" . }}
{{ include "periodic-chain-call.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "periodic-chain-call.selectorLabels" -}}
app.kubernetes.io/name: {{ include "periodic-chain-call.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "periodic-chain-call.healthcheck" -}}
{{- $context := index . 0 }}
{{- $root := index . 1 }}
{{- if and $root.exec (kindIs "string" $root.exec.command) }}
{{- omit $root "enabled" "exec" | toYaml }}
exec:
command:
{{- tpl $root.exec.command $context | nindent 4 }}
{{- else }}
{{- omit $root "enabled" | toYaml }}
{{- end }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/periodic-chain-call/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Release.Name }}
labels:
{{- include "periodic-chain-call.labels" . | nindent 4 }}
component: periodic-chain-call
spec:
schedule: "{{ .Values.schedule }}"
concurrencyPolicy: Forbid
jobTemplate:
spec:
backoffLimit: 0
template:
metadata:
labels:
{{- include "periodic-chain-call.labels" . | nindent 12 }}
spec:
serviceAccountName: {{ include "periodic-chain-call.serviceAccountName" . }}
initContainers:
containers:
- name: distribute-call
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/sh
- -c
args:
- |
{{- include (print $.Template.BasePath "/scripts/_call.tpl") . | nindent 14 }}
restartPolicy: Never
10 changes: 10 additions & 0 deletions charts/periodic-chain-call/templates/scripts/_call.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.senderKey.value }}
sender_address=$(cast wallet address --private-key {{ .Values.senderKey.value }})
balance=$(cast balance --rpc-url {{ .Values.rpcURL}} $sender_address)

echo "Sending address $sender_address has $balance account balance"

cast send --private-key "{{ .Values.senderKey.value }}" --rpc-url "{{ .Values.rpcURL }}" "{{ .Values.contractAddress }}" "{{ .Values.functionSignature }}" "{{ .Values.functionArgs }}"
{{- else }}
cast call --rpc-url {{ .Values.rpcURL }} "{{ .Values.contractAddress }}" "{{ .Values.functionSignature }}" "{{ .Values.functionArgs }}"
{{- end }}
10 changes: 10 additions & 0 deletions charts/periodic-chain-call/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "periodic-chain-call.serviceAccountName" . }}
labels:
{{- include "periodic-chain-call.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/periodic-chain-call/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
serviceAccount:
create: true
annotations: {}
schedule: "0 0 * * *" # -- Run every day at midnight
# -- RPC URL for L2 blockchain
rpcURL: https://forno.dango.celo-testnet.org
# -- Address of the L2 CeloDistributionSchedule contract
contractAddress: "0x78Af211Ad79bCE6BF636640CE8c2C2b29e02365A"
# -- Signature of function to call
functionSignature: "distributeAccordingToSchedule()(bool)"
# -- Args to pass to function
functionArgs: ""
# -- Private key of the sender account (for signing transactions)
senderKey:
value: ""
# secretName: test
# secretKey: test
image:
repository: ghcr.io/foundry-rs/foundry
tag: latest
pullPolicy: IfNotPresent