-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(devops): Add cycles ledger and depositor #2375
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,37 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
print_help() { | ||
cat <<-EOF | ||
Creates the cycles_depositor installation arguments. | ||
|
||
The file is installed at the location defined for 'cycles_depositor' in 'dfx.json'. | ||
EOF | ||
} | ||
|
||
[[ "${1:-}" != "--help" ]] || { | ||
print_help | ||
exit 0 | ||
} | ||
|
||
DFX_NETWORK="${DFX_NETWORK:-local}" | ||
ARG_FILE="$(jq -r .canisters.cycles_depositor.init_arg_file dfx.json)" | ||
|
||
#### | ||
# Computes the install args, overwriting any existing args file. | ||
|
||
CANISTER_ID_CYCLES_LEDGER="${CANISTER_ID_CYCLES_LEDGER:-$(dfx canister id cycles_ledger --network "$DFX_NETWORK")}" | ||
|
||
# .. Creates the init args file | ||
rm -f "$ARG_FILE" | ||
mkdir -p "$(dirname "$ARG_FILE")" | ||
cat <<EOF >"$ARG_FILE" | ||
(record { ledger_id = principal "$CANISTER_ID_CYCLES_LEDGER" }) | ||
EOF | ||
|
||
#### | ||
# Success | ||
cat <<EOF | ||
SUCCESS: The cycles_depositor argument file has been created: | ||
cycles_depositor install args: $(sha256sum "$ARG_FILE") | ||
EOF |
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,59 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
print_help() { | ||
cat <<-EOF | ||
Creates the cycles_depositor installation files: | ||
|
||
- The Wasm and Candid files are downloaded. | ||
- The installation args are computed based on the target network, | ||
determined by the DFX_NETWORK environment variable. | ||
|
||
The files are installed at at the locations defined for 'cycles_depositor' in 'dfx.json'. | ||
EOF | ||
} | ||
|
||
[[ "${1:-}" != "--help" ]] || { | ||
print_help | ||
exit 0 | ||
} | ||
|
||
DFX_NETWORK="${DFX_NETWORK:-local}" | ||
|
||
LEDGER_RELEASE="v1.0.1" | ||
CANDID_URL="https://github.com/dfinity/cycles-ledger/releases/download/cycles-ledger-${LEDGER_RELEASE}/depositor.did" | ||
WASM_URL="https://github.com/dfinity/cycles-ledger/releases/download/cycles-ledger-${LEDGER_RELEASE}/depositor.wasm.gz" | ||
|
||
CANDID_FILE="$(jq -r .canisters.cycles_depositor.candid dfx.json)" | ||
WASM_FILE="$(jq -r .canisters.cycles_depositor.wasm dfx.json)" | ||
ARG_FILE="$(jq -r .canisters.cycles_depositor.init_arg_file dfx.json)" | ||
|
||
#### | ||
# Downloads the candid file, if it does not exist already. | ||
if test -e "$CANDID_FILE"; then | ||
echo "Using existing cycles_depositor candid file" | ||
else | ||
mkdir -p "$(dirname "$CANDID_FILE")" | ||
curl -sSL "$CANDID_URL" >"$CANDID_FILE" | ||
fi | ||
|
||
#### | ||
# Downloads the Wasm file, if it does not exist already. | ||
if test -e "$WASM_FILE"; then | ||
echo "Using existing cycles_depositor Wasm file" | ||
else | ||
mkdir -p "$(dirname "$WASM_FILE")" | ||
curl -sSL "$WASM_URL" >"$WASM_FILE" | ||
fi | ||
|
||
#### | ||
# Computes the install args, overwriting any existing args file. | ||
scripts/build.cycles_depositor.args.sh | ||
|
||
# Success | ||
cat <<EOF | ||
SUCCESS: The cycles_depositor installation files have been created: | ||
cycles_depositor candid: $CANDID_FILE | ||
cycles_depositor Wasm: $WASM_FILE | ||
cycles_depositor install args: $ARG_FILE | ||
EOF |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use
candid
andwasm
entries because the arguments need to be dynamic?