Skip to content

Commit fa3dcdd

Browse files
committed
Swisstronik Challenge
0 parents  commit fa3dcdd

10 files changed

+17535
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
.env
3+
coverage
4+
coverage.json
5+
typechain
6+
typechain-types
7+
8+
# Hardhat files
9+
cache
10+
artifacts
11+

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Sample Hardhat Project
2+
3+
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
4+
5+
Try running some of the following tasks:
6+
7+
```shell
8+
npx hardhat help
9+
npx hardhat test
10+
REPORT_GAS=true npx hardhat test
11+
npx hardhat node
12+
npx hardhat run scripts/deploy.js
13+
```

contracts/Hello_swtr.sol

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.19;
3+
4+
//This contract is only intended for testing purposes
5+
6+
contract Swisstronik {
7+
string private message;
8+
9+
/**
10+
* @dev Constructor is used to set the initial message for the contract
11+
* @param _message the message to associate with the message variable.
12+
*/
13+
constructor(string memory _message) payable{
14+
message = _message;
15+
}
16+
17+
/**
18+
* @dev setMessage() updates the stored message in the contract
19+
* @param _message the new message to replace the existing one
20+
*/
21+
function setMessage(string memory _message) public {
22+
message = _message;
23+
}
24+
25+
/**
26+
* @dev getMessage() retrieves the currently stored message in the contract
27+
* @return The message associated with the contract
28+
*/
29+
function getMessage() public view returns(string memory){
30+
return message;
31+
}
32+
}

hardhat.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require("@nomicfoundation/hardhat-toolbox");
2+
require("dotenv").config({ path: ".env" });
3+
4+
const { PRIVATE_KEY } = process.env;
5+
6+
/** @type import('hardhat/config').HardhatUserConfig */
7+
module.exports = {
8+
solidity: "0.8.19",
9+
networks: {
10+
swisstronik: {
11+
url: "https://json-rpc.testnet.swisstronik.com/", //URL of the RPC node for Swisstronik.
12+
accounts: [`0x${PRIVATE_KEY}`], //Your private key starting with "0x"
13+
//Make sure you have enough funds in this wallet to deploy the smart contract
14+
},
15+
},
16+
};

0 commit comments

Comments
 (0)