-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"position": 0, | ||
"label": "Solidity by example", | ||
"link": { | ||
"title": "Solidity by example", | ||
"slug": "solidity-by-example", | ||
"type": "generated-index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"position": 2, | ||
"label": "Application", | ||
"link": { | ||
"title": "Application", | ||
"slug": "application", | ||
"type": "generated-index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"position": 0, | ||
"label": "Basic", | ||
"link": { | ||
"slug": "solidity-by-example/basic", | ||
"type": "generated-index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
sidebar_position: 2 | ||
title: First Application | ||
description: Specifies the compiler version of Solidity | ||
--- | ||
|
||
Here is a simple contract that you can get, increment and decrement the count store in this contract. | ||
|
||
```solidity | ||
// SPDX-License-Identifier: MIT | ||
pragma ever-solidity ^0.70.0; | ||
contract Counter { | ||
uint public count; | ||
// Function to increment count by 1 | ||
function inc() public { | ||
// This action is required to process external messages that bring no value | ||
tvm.accept(); | ||
count += 1; | ||
} | ||
// Function to decrement count by 1 | ||
function dec() public { | ||
// This action is required to process external messages that bring no value | ||
tvm.accept(); | ||
// This function will fail if count = 0 | ||
count -= 1; | ||
} | ||
} | ||
``` | ||
|
||
## Deploying the contract | ||
|
||
```shell | ||
npx everdev sol compile first-app.sol | ||
npx everdev contract deploy first-app -v 100000000 | ||
``` | ||
|
||
## Interacting with the contract | ||
|
||
```shell | ||
npx everdev contract run first-app inc | ||
npx everdev contract run-local first-app count | ||
npx everdev contract run first-app dec | ||
npx everdev contract run-local first-app count | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
sidebar_position: 1 | ||
title: "Hello World" | ||
description: Specifies the compiler version of Solidity | ||
--- | ||
|
||
`pragma` specifies the compiler version of Solidity. | ||
|
||
|
||
```solidity | ||
// SPDX-License-Identifier: MIT | ||
// compiler version must be greater than or equal to 0.70.0 and less than 0.71.0 | ||
pragma ever-solidity ^0.70.0; | ||
contract HelloWorld { | ||
string public greet = "Hello World!"; | ||
} | ||
``` | ||
|
||
## Deploying the contract | ||
|
||
```shell | ||
npx everdev sol set --compiler 0.70.0 | ||
npx everdev sol compile hello-world.sol | ||
npx everdev contract deploy hello-world -v 100000000 | ||
``` | ||
|
||
## Interacting with the contract | ||
|
||
```shell | ||
npx everdev contract run-local hello-world greet | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"position": 3, | ||
"label": "Hack", | ||
"link": { | ||
"title": "Hack", | ||
"slug": "hack", | ||
"type": "generated-index" | ||
} | ||
} |