This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
generated from eosnetworkfoundation/product
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from AntelopeIO/larryk85/docs
Docs changes and a couple of small fixes.
- Loading branch information
Showing
27 changed files
with
306 additions
and
1,287 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,6 @@ | ||
This example project houses a simple 'hello world' project and smart contract. | ||
|
||
To build run the command `antler-proj build`, | ||
this should create the hello_world.wasm and hello_world.abi file needed for deployment. | ||
|
||
Look at documentation for DUNE or cleos for how to deploy and call the actions. |
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 @@ | ||
#include <hello.hpp> | ||
|
||
[[eosio::action]] | ||
void hello::hi( name nm ) { | ||
/* generated example action */ | ||
print_f("Hello, world : %", nm); | ||
} | ||
|
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,13 @@ | ||
#include <eosio/eosio.hpp> | ||
|
||
using namespace eosio; | ||
|
||
class [[eosio::contract]] hello: public contract { | ||
public: | ||
using contract::contract; | ||
|
||
[[eosio::action]] | ||
void hi( name nm ); | ||
using hi_action = action_wrapper<"hi"_n, &hello::hi>; | ||
}; | ||
|
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,7 @@ | ||
project: hello-world | ||
version: 1.0.0 | ||
apps: | ||
- name: hello | ||
lang: CXX | ||
compile_options: "" | ||
link_options: "" |
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,10 @@ | ||
This project houses a simple project that creates and utilizes C and C++ libraries for smart contract development. | ||
|
||
The `print_number` C++ library houses a small function that will print a number of type `int`. | ||
The `print_float` C library houses a small function that will print a number of type float. | ||
|
||
The smart contract app `lib_usage` depends on the two above libraries. | ||
|
||
The `lib_usage.wasm` and `lib_usage.abi` should be produced by this project for deployment. | ||
|
||
Look at documentation for DUNE or cleos for how to deploy and call the actions. |
10 changes: 10 additions & 0 deletions
10
docs/examples/lib_usage_example/apps/lib_usage/lib_usage.cpp
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,10 @@ | ||
#include <lib_usage.hpp> | ||
|
||
#include <print_number.hpp> | ||
#include <print_float.h> | ||
|
||
[[eosio::action]] | ||
void lib_usage::exec(int inum, float fnum) { | ||
print_num(inum); // C++ library call | ||
print_float(fnum); // C library call | ||
} |
13 changes: 13 additions & 0 deletions
13
docs/examples/lib_usage_example/include/lib_usage/lib_usage.hpp
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,13 @@ | ||
#include <eosio/eosio.hpp> | ||
|
||
using namespace eosio; | ||
|
||
class [[eosio::contract]] lib_usage: public contract { | ||
public: | ||
using contract::contract; | ||
|
||
[[eosio::action]] | ||
void exec(int, float); | ||
using exec_action = action_wrapper<"exec"_n, &lib_usage::exec>; | ||
}; | ||
|
11 changes: 11 additions & 0 deletions
11
docs/examples/lib_usage_example/include/print_float/print_float.h
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,11 @@ | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void print_float(float); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
docs/examples/lib_usage_example/include/print_number/print_number.hpp
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,3 @@ | ||
#pragma once | ||
|
||
void print_num(int); |
5 changes: 5 additions & 0 deletions
5
docs/examples/lib_usage_example/libs/print_float/print_float.c
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,5 @@ | ||
#include <stdio.h> | ||
|
||
void print_float(float f) { | ||
printf("%f\n", f); | ||
} |
7 changes: 7 additions & 0 deletions
7
docs/examples/lib_usage_example/libs/print_number/print_number.cpp
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,7 @@ | ||
#include <cstdio> | ||
|
||
#include <eosio/print.hpp> | ||
|
||
void print_num(int num) { | ||
eosio::print_f("%\n", num); | ||
} |
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,27 @@ | ||
project: lib_usage | ||
version: 1.0.0 | ||
apps: | ||
- name: lib_usage | ||
lang: CXX | ||
compile_options: "" | ||
link_options: "" | ||
depends: | ||
- name: print_float | ||
location: "" | ||
tag: "" | ||
release: "" | ||
hash: "" | ||
- name: print_number | ||
location: "" | ||
tag: "" | ||
release: "" | ||
hash: "" | ||
libs: | ||
- name: print_float | ||
lang: C | ||
compile_options: "" | ||
link_options: "" | ||
- name: print_number | ||
lang: CXX | ||
compile_options: "" | ||
link_options: "" |
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,5 @@ | ||
This project creates the same `hello-world` contract as the hello-world project and a new `send-inline` project that utilizes that contract. | ||
|
||
The `hello_world.wasm`, `send_inline.wasm`, `hello_world.abi`, and `send_inline.abi` should be produced by this project for deployment. | ||
|
||
Look at documentation for DUNE or cleos for how to deploy and call the actions. |
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 @@ | ||
#include <hello.hpp> | ||
|
||
[[eosio::action]] | ||
void hello::hi( name nm ) { | ||
/* generated example action */ | ||
print_f("Hello : %", nm); | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
docs/examples/send-inline-example/apps/send_inline/send_inline.cpp
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,12 @@ | ||
#include <send_inline.hpp> | ||
|
||
#include <hello.hpp> | ||
|
||
[[eosio::action]] | ||
void send_inline::test( name user, name inline_code ) { | ||
// the code the contract is deployed on and a set of permissions | ||
hello::hi_action hi (inline_code, {_self, "active"_n}); | ||
|
||
hi.send(user); | ||
} | ||
|
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,13 @@ | ||
#include <eosio/eosio.hpp> | ||
|
||
using namespace eosio; | ||
|
||
class [[eosio::contract]] hello: public contract { | ||
public: | ||
using contract::contract; | ||
|
||
[[eosio::action]] | ||
void hi( name nm ); | ||
using hi_action = action_wrapper<"hi"_n, &hello::hi>; | ||
}; | ||
|
14 changes: 14 additions & 0 deletions
14
docs/examples/send-inline-example/include/send_inline/send_inline.hpp
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,14 @@ | ||
#include <eosio/eosio.hpp> | ||
|
||
using namespace eosio; | ||
|
||
class [[eosio::contract]] send_inline: public contract { | ||
public: | ||
using contract::contract; | ||
|
||
[[eosio::action]] | ||
void test( name user, name inline_code ); | ||
|
||
using test_action = action_wrapper<"test"_n, &send_inline::test>; | ||
}; | ||
|
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,17 @@ | ||
project: send_inline | ||
version: 0.0.0 | ||
apps: | ||
- name: send_inline | ||
lang: CXX | ||
compile_options: "" | ||
link_options: "" | ||
depends: | ||
- name: hello | ||
location: "" | ||
tag: "" | ||
release: "" | ||
hash: "" | ||
- name: hello | ||
lang: CXX | ||
compile_options: "" | ||
link_options: "" |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.