Skip to content

Commit b235fca

Browse files
committed
feat: add new category for examples
1 parent 3fb673e commit b235fca

File tree

6 files changed

+114
-0
lines changed

6 files changed

+114
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"position": 0,
3+
"label": "Solidity by example",
4+
"link": {
5+
"title": "Solidity by example",
6+
"slug": "solidity-by-example",
7+
"type": "generated-index"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"position": 2,
3+
"label": "Application",
4+
"link": {
5+
"title": "Application",
6+
"slug": "application",
7+
"type": "generated-index"
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"position": 0,
3+
"label": "Basic",
4+
"link": {
5+
"slug": "solidity-by-example/basic",
6+
"type": "generated-index"
7+
}
8+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
sidebar_position: 2
3+
title: First Application
4+
description: Specifies the compiler version of Solidity
5+
---
6+
7+
Here is a simple contract that you can get, increment and decrement the count store in this contract.
8+
9+
```solidity
10+
// SPDX-License-Identifier: MIT
11+
pragma ever-solidity ^0.70.0;
12+
13+
contract Counter {
14+
uint public count;
15+
16+
// Function to increment count by 1
17+
function inc() public {
18+
// This action is required to process external messages that bring no value
19+
tvm.accept();
20+
count += 1;
21+
}
22+
23+
// Function to decrement count by 1
24+
function dec() public {
25+
// This action is required to process external messages that bring no value
26+
tvm.accept();
27+
// This function will fail if count = 0
28+
count -= 1;
29+
}
30+
}
31+
```
32+
33+
## Deploying the contract
34+
35+
```shell
36+
npx everdev sol compile first-app.sol
37+
npx everdev contract deploy first-app -v 100000000
38+
```
39+
40+
## Interacting with the contract
41+
42+
```shell
43+
npx everdev contract run first-app inc
44+
npx everdev contract run-local first-app count
45+
npx everdev contract run first-app dec
46+
npx everdev contract run-local first-app count
47+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_position: 1
3+
title: "Hello World"
4+
description: Specifies the compiler version of Solidity
5+
---
6+
7+
`pragma` specifies the compiler version of Solidity.
8+
9+
10+
```solidity
11+
// SPDX-License-Identifier: MIT
12+
// compiler version must be greater than or equal to 0.70.0 and less than 0.71.0
13+
pragma ever-solidity ^0.70.0;
14+
15+
contract HelloWorld {
16+
string public greet = "Hello World!";
17+
}
18+
```
19+
20+
## Deploying the contract
21+
22+
```shell
23+
npx everdev sol set --compiler 0.70.0
24+
npx everdev sol compile hello-world.sol
25+
npx everdev contract deploy hello-world -v 100000000
26+
```
27+
28+
## Interacting with the contract
29+
30+
```shell
31+
npx everdev contract run-local hello-world greet
32+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"position": 3,
3+
"label": "Hack",
4+
"link": {
5+
"title": "Hack",
6+
"slug": "hack",
7+
"type": "generated-index"
8+
}
9+
}

0 commit comments

Comments
 (0)