Skip to content

Commit

Permalink
new commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zulna10 committed Aug 20, 2024
0 parents commit d8a59f9
Show file tree
Hide file tree
Showing 11 changed files with 7,517 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
```
32 changes: 32 additions & 0 deletions contracts/Hello_swtr.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

//This contract is only intended for testing purposes

contract Swisstronik {
string private message;

/**
* @dev Constructor is used to set the initial message for the contract
* @param _message the message to associate with the message variable.
*/
constructor(string memory _message) payable{
message = _message;
}

/**
* @dev setMessage() updates the stored message in the contract
* @param _message the new message to replace the existing one
*/
function setMessage(string memory _message) public {
message = _message;
}

/**
* @dev getMessage() retrieves the currently stored message in the contract
* @return The message associated with the contract
*/
function getMessage() public view returns(string memory){
return message;
}
}
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.19",
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 };
});
Loading

0 comments on commit d8a59f9

Please sign in to comment.