Skip to content

Commit

Permalink
mirror v0.13.0 release and prepare repo (#13)
Browse files Browse the repository at this point in the history
* Remove .DS_Store file from repository

* mirror v0.13.0 and prepare repo

* Fix test action

* use only node 18

* load secrets

* add dependabot for hardhat-plugin
  • Loading branch information
0xAleksaOpacic authored Sep 3, 2024
1 parent e69b235 commit 2cffb39
Show file tree
Hide file tree
Showing 30 changed files with 1,291 additions and 10,761 deletions.
64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: "\U0001F41E Bug report"
about: Report a bug or problem
labels: Bug
---

# 🐞 Bug Report

### Description

<!-- ✍️--> A clear and concise description of the problem...

<pre>
<code>

</code>
</pre>

### Has this worked before in a previous version?

<!-- Did this behavior use to work in the previous version? -->
Yes, the previous version in which this bug was not present was:

<pre>
<code>

</code>
</pre>

## 🔬 Minimal Reproduction

<!-- ✍️--> Please let us know how we can reproduce this issue.
<pre>
<code>

</code>
</pre>

## 🔥 Error
<!-- ✍️--> If the issue is accompanied by an error, please share the error logs with us below. If you have a lot of logs, place make a paste bin with your logs and share the link with us here:

<pre><code>


</code></pre>


## 🌍 Your Environment

**Operating System:**

<pre>
<code>

</code>
</pre>

**Anything else relevant?**

<pre>
<code>

</code>
</pre>
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: "✨ Feature Request"
about: Suggest a new feature or enhancement
labels: Enhancement
---

# ✨ Feature Request

### Description

<!-- ✍️--> A clear and concise description of the feature you would like to see...

<pre>
<code>

</code>
</pre>

### Use Case

<!-- ✍️--> Explain the context and how this feature will be used...

<pre>
<code>

</code>
</pre>
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 1
commit-message:
prefix: "deps"
labels:
- "dependencies"
ignore:
- dependency-name: "*" # Ignore all dependencies except the one below
allow:
- dependency-name: "@nilfoundation/hardhat-plugin"
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Description

Please provide a detailed description of what was done in this PR

# Changes include

- [ ] Bugfix (non-breaking change that solves an issue)
- [ ] New feature (non-breaking change that adds functionality)

### Manual tests

Please complete this section if you ran manual tests for this functionality, otherwise delete it
29 changes: 29 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Format

on:
pull_request:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

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

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Run Format
run: npm run format
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

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

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Run Lint
run: npm run lint
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

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

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Run Tests
env:
NIL_RPC_ENDPOINT: ${{ secrets.NIL_RPC_ENDPOINT }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
run: npm run tests
35 changes: 11 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@
</div>

## 🚀 Overview
This repository demonstrates how to deploy and interact with smart contracts on the =nil; blockchain using Hardhat and our custom plugin. The =nil; blockchain is an Ethereum Layer 2 solution based on zk-sharding, enhancing transaction efficiency and scalability.

## 📄 Features
**Custom Hardhat Plugin:** Simplifies interactions between Hardhat and the nil blockchain by modifying RPC methods, handling asynchronous communications, and more.

🔧 **Smart Contract Deployment and Interaction:** Easily deploy and manage your smart contracts using Hardhat's familiar workflow.

🛠️ **Support for =nil; Wallets:** Extend your Hardhat configuration to support nil-specific wallet addresses.

## 📚 Prerequisites
- Node.js and npm/yarn installed
- An understanding of Ethereum and smart contract development
This repository demonstrates how to deploy and interact with smart contracts on the =nil; blockchain using Hardhat and our custom plugin. The =nil; blockchain is an Ethereum Layer 2 solution based on zk-sharding, enhancing transaction efficiency and scalability

## 🔧 Installation
1. **Clone the Repository:**
Expand All @@ -29,16 +18,15 @@ This repository demonstrates how to deploy and interact with smart contracts on
```

## ⚙️ Configuration
1. Create a `.env` file in the root directory based on the given `.env.example` file.
2. Update the `.env` file with the RPC URL. The default value corresponds to a locally running =nil; node.
3. Create private key and wallet using `nil_cli`:
1. Create a `.env` file in the root directory based on the given `.env.example` file
2. Update the `.env` file with the RPC URL. The default value corresponds to a locally running =nil; node
3. If you don't have `nil_cli` installed, you can download it from the official repository here
Once you have `nil_cli,` run the following commands to generate a new key and wallet:
```
nil_cli keygen new
nil_cli wallet new
```
4. Update the `.env` file with the private key and wallet address.
You can run `npm test` to check if the configuration is correct.
4. Update the `.env` file with the private key and wallet address

## 🎯 Usage
To deploy and interact with the Incrementer contract, use the following commands:
Expand All @@ -51,15 +39,14 @@ npx hardhat increment --network nil --contract <Contract Address>
```

## 🎯 Testing
To run a test for Incrementer contract, use the following commands:
```
# Deploy the contract
npm run test
To run all tests, use the following command:
```bash
npm run tests
```
Make sure to configure .env with RPC and PRIVATE_KEY
Make sure to configure `.env` with the RPC URL and PRIVATE_KEY

## 💪 Contributing
Contributions are always welcome! Please feel free to submit pull requests or open issues to discuss potential changes or improvements.
Contributions are always welcome! Please feel free to submit pull requests or open issues to discuss potential changes or improvements

## 🚧 Work in Progress
**Please Note:** This project is currently under active development. Not all features are fully implemented, and you may encounter issues. If something isn't working as expected, don't hesitate to open an issue on our GitHub repository. We prioritize addressing these concerns and will get back to you promptly. Your feedback helps us improve!
Expand Down
8 changes: 7 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"lineWidth": 80
},
"files": {
"ignore": ["node_modules", "artifacts", "cache", "typechain-types"]
"ignore": [
"node_modules",
"artifacts",
"cache",
"typechain-types",
"ignition/deployments"
]
}
}
24 changes: 24 additions & 0 deletions contracts/Await.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

import "./nil/Nil.sol";

contract Await {
using Nil for address;

uint256 public result;

function call(address dst) public{
bytes memory temp;
bool ok;
(temp, ok) = Nil.awaitCall(
dst,
abi.encodeWithSignature("getValue()")
);

require(ok == true, "Result not true");

result = abi.decode(temp, (uint256));
}
}

22 changes: 22 additions & 0 deletions contracts/Caller.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./nil/Nil.sol";

contract Caller {
using Nil for address;

function call(address dst) public {
Nil.asyncCall(
dst,
msg.sender,
msg.sender,
100000,
0,
false,
0,
abi.encodeWithSignature("increment()")
);
}
}

16 changes: 16 additions & 0 deletions contracts/Currency.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./nil/NilCurrencyBase.sol";

contract Currency is NilCurrencyBase {
constructor(uint256 initialSupply) {
// Mint the initial supply of tokens
mintCurrencyInternal(initialSupply);
}

// Public function to call the parent internal function sendCurrencyInternal
function transferCurrency(address to, uint256 currencyId, uint256 amount) public {
sendCurrencyInternal(to, currencyId, amount);
}
}
22 changes: 22 additions & 0 deletions contracts/IncrementerPayable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./nil/NilCurrencyBase.sol";
contract IncrementerPayable is NilCurrencyBase {
uint256 private value;

event ValueChanged(uint256 newValue);

constructor() payable {}
receive() external payable {}

function increment() public onlyInternal payable{
value += 1;
emit ValueChanged(value);
}

function getValue() public view returns (uint256) {
return value;
}
}

Loading

0 comments on commit 2cffb39

Please sign in to comment.