diff --git a/.github/workflows/ci_deploy.yaml b/.github/workflows/ci_deploy.yaml index 55aac95f8e..19867985e3 100644 --- a/.github/workflows/ci_deploy.yaml +++ b/.github/workflows/ci_deploy.yaml @@ -26,23 +26,25 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' +# - name: Set up Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: '20' - - name: Install dependencies - run: npm install --save-dev hardhat +# - name: Install dependencies +# run: npm install --save-dev hardhat - name: Run local devnet - run: | - docker-compose up -d + run: docker-compose up -d - - name: Deploy contracts - run: | - cd /home/runner/work/go-ethereum/go-ethereum/hardhat - npm install --save-dev @nomicfoundation/hardhat-toolbox - npx hardhat ignition deploy ./ignition/modules/Lock.js + - name: Build a new image with Apollo contract + run: docker build -t hardhat-ignition . + +# - name: Deploy contracts +# run: | +# cd /home/runner/work/go-ethereum/go-ethereum/hardhat +# npm install --save-dev @nomicfoundation/hardhat-toolbox +# npx hardhat ignition deploy ./ignition/modules/Lock.js - name: Build and push Docker image @@ -52,6 +54,5 @@ jobs: push: true tags: e1018mc/limechain:deployed - - name: Tear down local devnet - run: | - docker-compose down + - name: Destroy local devnet + run: docker-compose down diff --git a/hardhat.config.js b/hardhat.config.js deleted file mode 100644 index 8ba99bc91c..0000000000 --- a/hardhat.config.js +++ /dev/null @@ -1,6 +0,0 @@ -require("@nomicfoundation/hardhat-toolbox"); - -/** @type import('hardhat/config').HardhatUserConfig */ -module.exports = { - solidity: "0.8.24", -}; diff --git a/hardhat/Dockerfile b/hardhat/Dockerfile new file mode 100644 index 0000000000..d84144f35a --- /dev/null +++ b/hardhat/Dockerfile @@ -0,0 +1,15 @@ +FROM node:lts-alpine + +RUN apk add --no-cache bash + +WORKDIR /usr/app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +EXPOSE 8545 + +CMD ["npx", "hardhat", "ignition", "deploy", "/usr/app/ignition/modules/Apollo.js"] \ No newline at end of file diff --git a/hardhat/contracts/Rocket.sol b/hardhat/contracts/Rocket.sol new file mode 100644 index 0000000000..cd9f9aeaac --- /dev/null +++ b/hardhat/contracts/Rocket.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +contract Rocket { + string public name; + string public status; + + constructor(string memory _name) { + name = _name; + status = "ignition"; + } + + function launch() public { + status = "lift-off"; + } +} \ No newline at end of file diff --git a/hardhat/hardhat.config.js b/hardhat/hardhat.config.js index 8ba99bc91c..c9092abe73 100644 --- a/hardhat/hardhat.config.js +++ b/hardhat/hardhat.config.js @@ -1,4 +1,5 @@ require("@nomicfoundation/hardhat-toolbox"); +require("@nomicfoundation/hardhat-ignition-ethers"); /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { diff --git a/hardhat/ignition/modules/Apollo.js b/hardhat/ignition/modules/Apollo.js new file mode 100644 index 0000000000..d343984501 --- /dev/null +++ b/hardhat/ignition/modules/Apollo.js @@ -0,0 +1,9 @@ +const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules"); + +module.exports = buildModule("Apollo", (m) => { + const apollo = m.contract("Rocket", ["Saturn V"]); + + m.call(apollo, "launch", []); + + return { apollo }; +}); \ No newline at end of file diff --git a/hardhat/package-lock.json b/hardhat/package-lock.json index 1d9bf45576..396c55059c 100644 --- a/hardhat/package-lock.json +++ b/hardhat/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { + "@nomicfoundation/hardhat-ignition-ethers": "^0.15.4", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "hardhat": "^2.22.5" } @@ -1333,7 +1334,6 @@ "integrity": "sha512-vY30V4b788GSziW/nOd0L/4IPw6mwpluahLs4+gPUUKWaHHGMA8OIeHaYpRRljM1i0M/Kg1yIozrDM/aeRebkg==", "dev": true, "license": "MIT", - "peer": true, "peerDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomicfoundation/hardhat-ignition": "^0.15.4", diff --git a/hardhat/package.json b/hardhat/package.json index 22076eeced..ddcc29c58e 100644 --- a/hardhat/package.json +++ b/hardhat/package.json @@ -5,10 +5,12 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "keywords": [], "author": "", "license": "ISC", "description": "", "devDependencies": { + "@nomicfoundation/hardhat-ignition-ethers": "^0.15.4", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "hardhat": "^2.22.5" }