-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start to support a faucet for SPN sending
- Loading branch information
Showing
27 changed files
with
3,703 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Deploy Faucet Lambda | ||
|
||
on: | ||
push: | ||
branches: | ||
- development | ||
paths: | ||
- 'cmd/faucet.superposition/**' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- id: go-cache-paths | ||
run: | | ||
echo "::set-output name=go-build::$(go env GOCACHE)" | ||
echo "::set-output name=go-mod::$(go env GOMODCACHE)" | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Go Build Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build }} | ||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Go Mod Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod }} | ||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21.1' | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y zip | ||
- name: Build lambda zip | ||
run: | | ||
cd cmd/faucet.superposition | ||
make lambda | ||
- name: Deploy to AWS Lambda | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: ap-southeast-2 | ||
run: | | ||
aws lambda update-function-code --function-name faucet-superposition \ | ||
--zip-file fileb://cmd/faucet.superposition/bootstrap.zip >&2 >/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy Lambda | ||
name: Deploy GraphQL Lambda | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
faucet.superposition | ||
bootstrap | ||
bootstrap.zip | ||
stakers.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
EXTRA_FILES := stakers.json | ||
|
||
include ../golang.mk | ||
|
||
.PHONY: lambda | ||
|
||
lambda: bootstrap.zip | ||
|
||
stakers.json: ../../config/stakers.json | ||
@cp ../../config/stakers.json stakers.json | ||
|
||
bootstrap: faucet.superposition | ||
@cp faucet.superposition bootstrap | ||
|
||
bootstrap.zip: bootstrap | ||
@zip bootstrap.zip bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
# GraphQL Faucet interface | ||
|
||
Listens for a mutation to request tokens, and sends the SPN token for Superposition | ||
Testnet on demand. With a feature flag optionally supports gating the amount of tokens | ||
send to a list of users. | ||
|
||
## Features | ||
|
||
| Name | Description | | ||
|-----------------------|--------------------------------------------------------| | ||
| `faucet stakers only` | Sends only to the list of stakers in the stakers file. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh -eu | ||
|
||
function_name="$1" | ||
|
||
aws lambda update-function-code \ | ||
--function-name "$function_name" \ | ||
--zip-file "$zip_file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
schema: | ||
- ./*.graphqls | ||
|
||
exec: | ||
filename: graph/generated.go | ||
package: graph | ||
|
||
model: | ||
filename: graph/model/models_gen.go | ||
package: model | ||
|
||
resolver: | ||
layout: follow-schema | ||
dir: graph | ||
package: graph | ||
filename_template: "{name}.resolvers.go" | ||
# Optional: turn on to not generate template comments above resolvers | ||
# omit_template_comment: false | ||
|
||
omit_slice_element_pointers: true | ||
|
||
struct_fields_always_pointers: false | ||
|
||
resolvers_always_return_pointers: false | ||
|
||
return_pointers_in_unmarshalinput: false |
Oops, something went wrong.