Skip to content

Commit

Permalink
feat: initiated the project
Browse files Browse the repository at this point in the history
  • Loading branch information
rabiu30 committed Jul 27, 2024
1 parent 8d94d2b commit 0d130bb
Show file tree
Hide file tree
Showing 14 changed files with 7,505 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .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 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
```
Empty file modified chrome2.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions contract.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xC1e1888E1C3e0cD6229a1f40E40b5a8E101C5C3f
16 changes: 16 additions & 0 deletions contracts/Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20 {
constructor()ERC20("chrome2","chr"){}

function mint100tokens() public {
_mint(msg.sender, 100*10**18);
}

function burn100tokens() public{
_burn(msg.sender, 100*10**18);
}
}
12 changes: 12 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();

module.exports = {
solidity: "0.8.20",
networks: {
swisstronik: {
url: "https://json-rpc.testnet.swisstronik.com/",
accounts: [`0x${process.env.PRIVATE_KEY}`],
},
},
};
15 changes: 15 additions & 0 deletions ignition/modules/Lock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");

const JAN_1ST_2030 = 1893456000;
const ONE_GWEI = 1_000_000_000n;

module.exports = buildModule("LockModule", (m) => {
const unlockTime = m.getParameter("unlockTime", JAN_1ST_2030);
const lockedAmount = m.getParameter("lockedAmount", ONE_GWEI);

const lock = m.contract("Lock", [unlockTime], {
value: lockedAmount,
});

return { lock };
});
32 changes: 32 additions & 0 deletions loader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
tput civis

# Clear Line
CL="\e[2K"
# Spinner Character
SPINNER="⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"

function spinner() {
task=$1
msg=$2
while :; do
jobs %1 > /dev/null 2>&1
[ $? = 0 ] || {
printf "${CL}${task} Done\n"
break
}
for (( i=0; i<${#SPINNER}; i++ )); do
sleep 0.05
printf "${CL}${SPINNER:$i:1} ${task} ${msg}\r"
done
done
}

msg="${2-InProgress}"
task="${3-$1}"
$1 & spinner "$task" "$msg"

tput cnorm

# usage => ./loader.sh "<TIMER_TO_SLEEP>" "<PROGRESS>" "<TASK_NAME>"
# e.g => ./loader.sh "sleep 5" "..." "Installing Dependencies"
Loading

0 comments on commit 0d130bb

Please sign in to comment.