-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Lead-Studios:main' into main
- Loading branch information
Showing
9 changed files
with
1,573 additions
and
134 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,80 @@ | ||
name: Smart Contract CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: | ||
- 'onchain/**' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- 'onchain/**' | ||
|
||
jobs: | ||
smart-contract-ci: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./onchain | ||
env: | ||
PATH: "/root/.local/bin:$PATH" | ||
SCARB_HOME: "/root/.local/share/scarb-install/latest" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
apt-get update | ||
apt-get install -y curl bash | ||
- name: Set up Scarb | ||
shell: bash | ||
run: | | ||
mkdir -p /root/.local/bin | ||
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash | ||
echo "${SCARB_HOME}/bin" >> $GITHUB_PATH | ||
ls -la /root/.local/bin | ||
which scarb || echo "scarb not in PATH" | ||
/root/.local/bin/scarb --version | ||
- name: Cache Scarb dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.scarb | ||
target/ | ||
key: ${{ runner.os }}-scarb-${{ hashFiles('**/Scarb.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-scarb- | ||
- name: Check Cairo formatting | ||
shell: bash | ||
run: /root/.local/bin/scarb fmt --check | ||
|
||
- name: Build smart contracts | ||
shell: bash | ||
run: /root/.local/bin/scarb build | ||
|
||
- name: Run tests | ||
shell: bash | ||
run: /root/.local/bin/scarb test | ||
|
||
- name: Run security checks | ||
run: | | ||
echo "Running security checks..." | ||
! find . -type f -name "*.cairo" -exec grep -l "assert_not_zero" {} \; | ||
! find . -type f -name "*.cairo" -exec grep -l "unsafe_" {} \; | ||
- name: Upload compilation artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: compiled-contracts | ||
path: target/ | ||
retention-days: 7 | ||
|
||
- name: Report Status | ||
if: always() | ||
run: | | ||
echo "CI Process Complete" | ||
echo "Compilation Status: ${{ job.status }}" |
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 @@ | ||
import { registerAs } from "@nestjs/config"; | ||
|
||
export default registerAs('contractService', () => { | ||
return { | ||
contractAddress: process.env.CONTRACT_ADDRESS, | ||
contractAbi: process.env.CONTRACT_ABI, | ||
adminSigner: process.env.ADMIN_SIGNER | ||
} | ||
}) |
Oops, something went wrong.