Skip to content
Closed

Ioio #31964

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d9c8461
test
Jun 3, 2025
0e1061b
Merge pull request #1 from radost5454/test_branch
radost5454 Jun 3, 2025
8883ffa
test
Jun 3, 2025
4577b47
Merge pull request #2 from radost5454/test
radost5454 Jun 3, 2025
4d550d9
test
Jun 3, 2025
43a14bb
update
Jun 3, 2025
3158e36
Merge pull request #3 from radost5454/update
radost5454 Jun 3, 2025
b1e60dc
test docker compose file
Jun 3, 2025
1d7e272
Merge pull request #4 from radost5454/docker-compose
radost5454 Jun 3, 2025
cc3fc03
update_test
Jun 3, 2025
80bcd25
test new workflow
Jun 3, 2025
25f0d9c
Merge pull request #5 from radost5454/test_new_flow
radost5454 Jun 3, 2025
7890843
update the ci/cd
Jun 3, 2025
11cef81
Merge pull request #6 from radost5454/ci_cd
radost5454 Jun 3, 2025
e05f2c0
fix
Jun 3, 2025
c44c20a
Merge pull request #7 from radost5454/update_test
radost5454 Jun 3, 2025
797c696
testttttt
Jun 3, 2025
1a28ff6
testtttttt
Jun 3, 2025
cde9ff7
Merge pull request #8 from radost5454/test_test
radost5454 Jun 3, 2025
916827d
please work
Jun 3, 2025
28f8921
Merge pull request #9 from radost5454/update_code
radost5454 Jun 3, 2025
544f132
run test
Jun 3, 2025
19e6fea
Merge pull request #10 from radost5454/run_test
radost5454 Jun 3, 2025
0901463
last test for today
Jun 3, 2025
2319741
Merge pull request #11 from radost5454/last_test_for_today
radost5454 Jun 3, 2025
8266ed0
opopopo
Jun 3, 2025
9aa6993
Merge pull request #12 from radost5454/testop
radost5454 Jun 3, 2025
4a3c717
aaa
Jun 3, 2025
f534b59
Merge pull request #13 from radost5454/please
radost5454 Jun 3, 2025
ccb5ac8
run test
Jun 4, 2025
cd01048
Merge pull request #14 from radost5454/test_image
radost5454 Jun 4, 2025
86c2857
testttttttt
Jun 4, 2025
6b06765
Merge pull request #15 from radost5454/aide_de
radost5454 Jun 4, 2025
7a02252
testt
Jun 4, 2025
eac983e
test contracts
Jun 4, 2025
a6f91da
Merge pull request #16 from radost5454/compile_contracts
radost5454 Jun 4, 2025
e9f51dc
remove git ignore for the test
Jun 4, 2025
745dcf2
papa
Jun 4, 2025
976a10f
Merge pull request #17 from radost5454/papa
radost5454 Jun 4, 2025
75d5ff6
test
Jun 4, 2025
69ddffa
testtt
Jun 4, 2025
90d9640
Merge pull request #18 from radost5454/ggggg
radost5454 Jun 4, 2025
4fd3e2e
kakakak
Jun 4, 2025
65fe14d
Merge pull request #19 from radost5454/ggggg
radost5454 Jun 4, 2025
dafc1df
ioio
Jun 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
32 changes: 32 additions & 0 deletions .github/workflows/build-on-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Docker Image on CI:Build Label

on:
pull_request:
types: [closed]

jobs:
build_and_push:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build')
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.alltools
push: true
tags: ghcr.io/${{ github.repository_owner }}/go-ethereum:dev-latest
59 changes: 59 additions & 0 deletions .github/workflows/ci-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy Contracts to Devnet

on:
pull_request:
types: [closed]

jobs:
deploy_contracts:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Deploy')
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Start Geth devnet container
run: |
docker run -d --name geth-devnet -p 8545:8545 \
ghcr.io/${{ github.repository_owner }}/go-ethereum:dev-latest \
geth --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3 --dev

- name: Wait for Geth RPC to be available
run: |
for i in {1..10}; do
curl -s http://localhost:8545 && break
echo "Waiting for Geth RPC..." && sleep 3
done

- name: Install Hardhat dependencies
working-directory: hardhat
run: npm install

- name: Compile contracts
working-directory: hardhat
run: npx hardhat compile

- name: Deploy contracts using Ignition
working-directory: hardhat
run: npx hardhat ignition deploy ./ignition/modules/Lock.js --network localhost

- name: Upload contract address artifact
uses: actions/upload-artifact@v2
with:
name: deployment-artifact
path: hardhat/deployment-output.json

- name: Commit container as new image with contracts
run: |
docker commit geth-devnet ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push new image
run: docker push ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts
42 changes: 42 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test Against Deployed Devnet

on:
workflow_dispatch:

jobs:
test_contracts:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Pull devnet-with-contracts image
run: docker pull ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts

- name: Start devnet-with-contracts container
run: |
docker run -d --name geth-devnet-test -p 8545:8545 \
ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts \
geth --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3 --dev

- name: Wait for Geth RPC to be ready
run: |
for i in {1..15}; do
curl -s http://localhost:8545 && break
echo "Waiting for Geth RPC..." && sleep 3
done



- name: Download contract address artifact
uses: actions/download-artifact@v2
with:
name: deployment-artifact
path: hardhat/

- name: Install dependencies and run test
run: |
cd hardhat
npm install
npx hardhat test test/Lock.external.js --network hell
48 changes: 0 additions & 48 deletions .github/workflows/go.yml

This file was deleted.

17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.8'

services:
geth:
image: ghcr.io/radost5454/go-ethereum:dev-latest
ports:
- "8545:8545"
- "30303:30303"
volumes:
- ./data:/root/.ethereum
command: >
--http
--http.addr 0.0.0.0
--http.port 8545
--http.api eth,net,web3,personal
--nodiscover
--dev
17 changes: 17 additions & 0 deletions hardhat/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# node_modules
# .env

# # Hardhat files
# /cache
# /artifacts

# # TypeChain files
# /typechain
# /typechain-types

# # solidity-coverage files
# /coverage
# /coverage.json

# # Hardhat Ignition default folder for deployments against a local node
# ignition/deployments/chain-31337
13 changes: 13 additions & 0 deletions hardhat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract.

Try running some of the following tasks:

```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat ignition deploy ./ignition/modules/Lock.js
```

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions hardhat/artifacts/contracts/Lock.sol/Lock.dbg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/ad47b6fd82fea4f651540333f2a0887a.json"
}
74 changes: 74 additions & 0 deletions hardhat/artifacts/contracts/Lock.sol/Lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "Lock",
"sourceName": "contracts/Lock.sol",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_unlockTime",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "when",
"type": "uint256"
}
],
"name": "Withdrawal",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address payable",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "unlockTime",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x60806040526040516105d83803806105d8833981810160405281019061002591906100f0565b804210610067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161005e906101a0565b60405180910390fd5b8060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101c0565b600080fd5b6000819050919050565b6100cd816100ba565b81146100d857600080fd5b50565b6000815190506100ea816100c4565b92915050565b600060208284031215610106576101056100b5565b5b6000610114848285016100db565b91505092915050565b600082825260208201905092915050565b7f556e6c6f636b2074696d652073686f756c6420626520696e207468652066757460008201527f7572650000000000000000000000000000000000000000000000000000000000602082015250565b600061018a60238361011d565b91506101958261012e565b604082019050919050565b600060208201905081810360008301526101b98161017d565b9050919050565b610409806101cf6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea26469706673582212202d2006ef26cbefcc4deab66c32f5ff5efb638f080c7490b6633879942caf232764736f6c634300081c0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea26469706673582212202d2006ef26cbefcc4deab66c32f5ff5efb638f080c7490b6633879942caf232764736f6c634300081c0033",
"linkReferences": {},
"deployedLinkReferences": {}
}
41 changes: 41 additions & 0 deletions hardhat/cache/solidity-files-cache.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"_format": "hh-sol-cache-2",
"files": {
"/home/radostina.lyubomirova/homework/go-ethereum-task/hardhat/contracts/Lock.sol": {
"lastModificationDate": 1748971399969,
"contentHash": "7eee587c347fe6b1de50c96688cb9477",
"sourceName": "contracts/Lock.sol",
"solcConfig": {
"version": "0.8.28",
"settings": {
"evmVersion": "paris",
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.28"
],
"artifacts": [
"Lock"
]
}
}
}
34 changes: 34 additions & 0 deletions hardhat/contracts/Lock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;

// Uncomment this line to use console.log
// import "hardhat/console.sol";

contract Lock {
uint public unlockTime;
address payable public owner;

event Withdrawal(uint amount, uint when);

constructor(uint _unlockTime) payable {
require(
block.timestamp < _unlockTime,
"Unlock time should be in the future"
);

unlockTime = _unlockTime;
owner = payable(msg.sender);
}

function withdraw() public {
// Uncomment this line, and the import of "hardhat/console.sol", to print a log in your terminal
// console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp);

require(block.timestamp >= unlockTime, "You can't withdraw yet");
require(msg.sender == owner, "You aren't the owner");

emit Withdrawal(address(this).balance, block.timestamp);

owner.transfer(address(this).balance);
}
}
Loading