-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add all contracts and scripts (#1)
- Loading branch information
1 parent
0ea1a45
commit 6c165f7
Showing
75 changed files
with
13,612 additions
and
2 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,32 @@ | ||
# Copyright 2024 Circle Internet Financial, LTD. All rights reserved. | ||
# | ||
# 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://www.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. | ||
|
||
################################## | ||
# EVM Contract Configurations # | ||
################################## | ||
|
||
EVM_RPC_URL=http://localhost:8500 | ||
|
||
# These values will always be consistent after an Anvil node is started | ||
# and the setup-evm-contracts script is run. | ||
EVM_USDC_ADDRESS=0x700b6a60ce7eaaea56f065753d8dcb9653dbad35 | ||
EVM_MESSAGE_TRANSMITTER_ADDRESS=0x2E983A1Ba5e8b38AAAeC4B440B9dDcFBf72E15d1 | ||
EVM_TOKEN_MINTER_ADDRESS=0xbdEd0D2bf404bdcBa897a74E6657f1f12e5C6fb6 | ||
EVM_TOKEN_MESSENGER_ADDRESS=0x057ef64E23666F000b34aE31332854aCBd1c8544 | ||
EVM_TOKEN_MINTER_DEPLOYER_KEY=0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82 | ||
EVM_TOKEN_CONTROLLER_DEPLOYER_KEY=0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82 | ||
EVM_TOKEN_MESSENGER_DEPLOYER_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 | ||
EVM_ATTESTER_ADDRESS=0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f |
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,3 @@ | ||
node_modules | ||
dist | ||
yarn.lock |
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,75 @@ | ||
{ | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"airbnb-base", | ||
"airbnb-typescript/base", | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": ["@typescript-eslint", "simple-import-sort", "prettier", "prefer-arrow"], | ||
"rules": { | ||
"no-plusplus": "off", | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_" | ||
} | ||
], | ||
"@typescript-eslint/explicit-module-boundary-types": "error", | ||
"@typescript-eslint/ban-types": "warn", | ||
"@typescript-eslint/no-var-requires": "error", | ||
"@typescript-eslint/no-explicit-any": "error", | ||
"@typescript-eslint/no-empty-function": "error", | ||
"@typescript-eslint/ban-ts-comment": "warn", | ||
"@typescript-eslint/adjacent-overload-signatures": "error", | ||
"class-methods-use-this": "off", | ||
"no-undef": "error", | ||
"no-empty": "error", | ||
"simple-import-sort/imports": "error", | ||
"simple-import-sort/exports": "error", | ||
"import/prefer-default-export": "off", | ||
"import/no-relative-packages": "off", | ||
"prettier/prettier": "warn", | ||
"no-console": "error", | ||
"import/no-cycle": "off", // Disabling for now, this is taking multiple seconds to run -- https://github.com/import-js/eslint-plugin-import/issues/2348 | ||
"comma-dangle": [ | ||
"error", | ||
{ | ||
"arrays": "always-multiline", | ||
"exports": "always-multiline", | ||
"functions": "never", | ||
"imports": "always-multiline", | ||
"objects": "always-multiline" | ||
} | ||
], | ||
"prefer-arrow/prefer-arrow-functions": [ | ||
"error", | ||
{ | ||
"disallowPrototype": true, | ||
"singleReturnOnly": false, | ||
"classPropertiesAllowed": false | ||
} | ||
], | ||
"prefer-arrow-callback": ["error", { "allowNamedFunctions": true }], | ||
"func-style": ["error", "expression"] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.ts"] | ||
} | ||
] | ||
} |
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,11 @@ | ||
## Summary | ||
|
||
## Detail | ||
|
||
## Testing | ||
|
||
## Documentation | ||
|
||
--- | ||
|
||
**Requested Reviewers:** @mention |
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,114 @@ | ||
# Copyright (c) 2024, Circle Internet Group, Inc. | ||
# All rights reserved. | ||
# | ||
# 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://www.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. | ||
|
||
name: Continuous Integration | ||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
jobs: | ||
run-message-transmitter-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: "true" | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20.14.0" | ||
|
||
- name: Compile and Run Tests | ||
run: | | ||
make setup | ||
make message-transmitter-coverage | ||
make verify-message-transmitter-coverage | ||
run-token-messenger-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: "true" | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20.14.0" | ||
|
||
- name: Compile and Run Tests | ||
run: | | ||
make setup | ||
make token-messenger-minter-coverage | ||
make verify-token-messenger-minter-coverage | ||
run-e2e-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: "true" | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20.14.0" | ||
|
||
- name: Compile and Run Tests | ||
run: | | ||
./docker-start-containers.sh | ||
sleep 30 | ||
make compile-scripts | ||
yarn test:e2e | ||
spell-checker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20.14.0" | ||
|
||
- name: Compile and Run Tests | ||
run: | | ||
npm install -g cspell@latest | ||
cspell ** | ||
scan: | ||
needs: | ||
- run-message-transmitter-tests | ||
- run-token-messenger-tests | ||
- run-e2e-tests | ||
- spell-checker | ||
if: github.event_name == 'pull_request' | ||
uses: circlefin/circle-public-github-workflows/.github/workflows/pr-scan.yaml@v1 | ||
|
||
release-sbom: | ||
needs: | ||
- run-message-transmitter-tests | ||
- run-token-messenger-tests | ||
- run-e2e-tests | ||
- spell-checker | ||
if: github.event_name == 'push' | ||
uses: circlefin/circle-public-github-workflows/.github/workflows/attach-release-assets.yaml@v1 |
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 @@ | ||
build/ | ||
.idea | ||
|
||
dist | ||
node_modules | ||
|
||
logs |
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,9 @@ | ||
[submodule "evm-cctp-contracts"] | ||
path = evm-cctp-contracts | ||
url = git@github.com:circlefin/evm-cctp-contracts.git | ||
[submodule "aptos-core"] | ||
path = aptos-core | ||
url = git@github.com:aptos-labs/aptos-core.git | ||
[submodule "stablecoin-aptos"] | ||
path = stablecoin-aptos | ||
url = git@github.com:circlefin/stablecoin-aptos.git |
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,3 @@ | ||
pkg:npm/v8-coverage | ||
pkg:npm/sha.js | ||
pkg:npm/sprintf-js |
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 @@ | ||
v20.14.0 |
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,3 @@ | ||
node_modules | ||
dist | ||
yarn.lock |
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,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"printWidth": 120 | ||
} |
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,82 @@ | ||
.PHONY: setup install-aptos test compile-scripts message-transmitter-test message-transmitter-coverage token-messenger-minter-test \ | ||
token-messenger-minter-coverage verify-message-transmitter-coverage verify-token-messenger-minter-coverage compile-message-transmitter-scripts compile-token-messenger-minter-script | ||
|
||
setup: install-aptos | ||
git submodule update --init --recursive | ||
|
||
install-aptos: | ||
@arch=$$(uname -m); \ | ||
if [ "$$arch" = "arm64" ]; then \ | ||
if ! command -v brew >/dev/null 2>&1; then \ | ||
echo "Please install brew."; \ | ||
exit 1; \ | ||
fi; \ | ||
brew install aptos; \ | ||
brew install jq; \ | ||
else \ | ||
if [ ! -f versions.sh ]; then \ | ||
echo "Please ensure versions.sh exists in top-level of repository."; \ | ||
exit 1; \ | ||
fi; \ | ||
. ./versions.sh; \ | ||
if [ -z "$$APTOS_CLI_VERSION" ]; then \ | ||
echo "Please ensure that version is set for APTOS_CLI_VERSION in versions.sh."; \ | ||
exit 1; \ | ||
fi; \ | ||
curl -sSfL -o /tmp/aptos.zip "https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v$$APTOS_CLI_VERSION/aptos-cli-$$APTOS_CLI_VERSION-Ubuntu-22.04-x86_64.zip"; \ | ||
sudo unzip /tmp/aptos.zip -d /usr/local/bin; \ | ||
sudo chmod +x /usr/local/bin/*; \ | ||
fi | ||
|
||
test: message-transmitter-test token-messenger-minter-test | ||
|
||
compile-scripts: compile-message-transmitter-scripts compile-token-messenger-minter-scripts | ||
|
||
message-transmitter-test: | ||
aptos move test --package-dir packages/message_transmitter --dev | ||
|
||
message-transmitter-coverage: | ||
aptos move test --package-dir packages/message_transmitter --coverage --dev | ||
|
||
token-messenger-minter-test: | ||
aptos move test --package-dir packages/token_messenger_minter --dev | ||
|
||
token-messenger-minter-coverage: | ||
aptos move test --package-dir packages/token_messenger_minter --coverage --dev | ||
|
||
verify-message-transmitter-coverage: | ||
@coverage=$$(aptos move test --package-dir packages/message_transmitter --coverage --dev | grep "Move Coverage:" | grep -Eo "[0-9]+" | head -1); \ | ||
if [ $$coverage -eq 100 ]; then \ | ||
echo "Test Coverage is $$coverage%"; \ | ||
else \ | ||
echo "Test Coverage is only $$coverage%. Should be at least 99%"; \ | ||
exit 1; \ | ||
fi | ||
|
||
verify-token-messenger-minter-coverage: | ||
@coverage=$$(aptos move test --package-dir packages/token_messenger_minter --coverage --dev | grep "Move Coverage:" | grep -Eo "[0-9]+" | head -1); \ | ||
if [ $$coverage -eq 100 ]; then \ | ||
echo "Test Coverage is $$coverage%"; \ | ||
else \ | ||
echo "Test Coverage is only $$coverage%. Should be at least 99%"; \ | ||
exit 1; \ | ||
fi | ||
|
||
compile-message-transmitter-scripts: | ||
aptos move compile --package-dir packages/message_transmitter --dev | ||
|
||
compile-token-messenger-minter-scripts: | ||
aptos move compile --package-dir packages/token_messenger_minter --dev | ||
|
||
verify-metadata: | ||
@if [ -z "$(package)" ] || [ -z "$(package_id)" ] || [ -z "$(url)" ] || [ -z "$(included_artifacts)" ]; then \ | ||
echo "Usage: make verify-package package=\"<package_name>\" package_id=\"<package_id>\" included_artifacts=\"<all/sparse/none>\" url=\"<url>\" [named_addresses=\"<named_addresses>\"]"; \ | ||
exit 1; \ | ||
fi; \ | ||
\ | ||
aptos move verify-package \ | ||
--package-dir "packages/$(package)" \ | ||
--account "$(package_id)" \ | ||
--named-addresses "$(named_addresses)" \ | ||
--included-artifacts "$(included_artifacts)" \ | ||
--url "${url}"; |
Oops, something went wrong.