forked from Boomtoknlab/solana-program-library
-
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.
Signed-off-by: BOOM TOKEN <marinachris112@outlook.com>
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 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,38 @@ | ||
name: Ethereum Program Address Verification | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
verify-ethereum-program: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Verify Ethereum Program Address | ||
env: | ||
ETH_PROVIDER_URL: ${{ secrets.ETH_PROVIDER_URL }} | ||
PROGRAM_ADDRESS: "0x97293CeAB815896883e8200AEf5a4581a70504b2" | ||
run: | | ||
npx -p ethers node <<'EOF' | ||
const { ethers } = require('ethers'); | ||
(async () => { | ||
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_PROVIDER_URL); | ||
const code = await provider.getCode(process.env.PROGRAM_ADDRESS); | ||
console.log('Contract code at address ' + process.env.PROGRAM_ADDRESS + ': ' + code); | ||
if (code === '0x') { | ||
throw new Error('No contract code found at address ' + process.env.PROGRAM_ADDRESS); | ||
} else { | ||
console.log('Contract code exists at address ' + process.env.PROGRAM_ADDRESS); | ||
} | ||
})(); | ||
EOF |