Skip to content

Commit 78c248d

Browse files
committed
REMOVED unused headers ADDED License UPDATED readme
1 parent 0a5c342 commit 78c248d

File tree

6 files changed

+166
-8
lines changed

6 files changed

+166
-8
lines changed

.DS_Store

6 KB
Binary file not shown.

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Current X Changel LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,91 @@
1-
# web4-cpp-header
2-
🛠 A C++ header file containing Spacetime (web4) primitives 🛸
1+
# Time and Space Antelope Smart Contract Utilities 🌍⏰
32

3+
Welcome to the EOSIO Smart Contract Utilities repository! This project provides essential C++ headers for EOSIO / Antelope smart contracts, designed to empower dapps on the WAX blockchain. It includes enumerations for countries, continents, and time spans, all designed for easy integration into your smart contracts.
44

5-
All files are in the `include` directory.
5+
This allows you to write contracts using common names instead of country codes, and ensures compatibilities when interacting with ISO 3166 (Alpha-2 and Alpha-3 [two and three lette codes]) nations and third-party contracts who also use this convention, like [Tetra](https://github.com/TetraGrids), and [cXc's Metadata Standards](https://github.com/currentxchange/WAX-NFT-Metadata-Standards).
6+
7+
*All .hpp files are in the `include` directory.*
8+
9+
## Contents 📁
10+
1. [Countries Enumeration (`countries.hpp`)](#countries-enumeration)
11+
2. [Continents Enumeration (`continents.hpp`)](#continents-enumeration)
12+
3. [Time Enumeration (`time.hpp`)](#time-enumeration)
13+
4. [Getting Started](#getting-started)
14+
5. [Contributing](#contributing)
15+
6. [License](#license)
16+
17+
### Countries Enumeration (`countries.hpp`) 🌍
18+
The `countries.hpp` header provides a comprehensive enumeration of countries (`Countries_ISO3`) using ISO 3166-1 alpha-3 country codes.
19+
20+
#### Key Features:
21+
- **Cross-Contract Compatibility**: Enum values are explicitly numbered for consistent cross-contract compatibility.
22+
- **Comprehensive Country List**: Includes a wide range of countries, each represented by their ISO 3166-1 alpha-3 codes.
23+
24+
#### Usage in EOSIO Smart Contract:
25+
```cpp
26+
#include "countries.hpp"
27+
28+
// Example: Retrieving a country code
29+
Countries_ISO3 country_code = Countries_ISO3::USA; // Retrieves the code for USA
30+
31+
// Action demonstrating the use of country code
32+
[[eosio::action]]
33+
void showCountryCode() {
34+
Countries_ISO3 country_code = Countries_ISO3::FRA; // Code for France
35+
eosio::print("Country Code: ", static_cast<int>(country_code));
36+
}
37+
```
38+
39+
### Continents Enumeration (`continents.hpp`) 🌐
40+
The `continents.hpp` header includes an enumeration of continents (`Continents`), providing a straightforward way to categorize geographical data.
41+
42+
#### Key Features:
43+
- **Simple and Efficient**: Easy-to-use enumeration of all the continents.
44+
- **Versatile Usage**: Suitable for geographic categorization and analysis.
45+
46+
#### Usage in EOSIO Smart Contract:
47+
```cpp
48+
#include "continents.hpp"
49+
50+
// Example: Retrieving a continent
51+
Continents continent = Continents::EUROPE; // Retrieves Europe
52+
53+
// Action demonstrating the use of continent enumeration
54+
[[eosio::action]]
55+
void showContinent() {
56+
Continents continent = Continents::ASIA; // Selects Asia
57+
eosio::print("Selected Continent: ", static_cast<int>(continent));
58+
}
59+
```
60+
61+
### Time Enumeration (`time.hpp`) ⏰
62+
The `time.hpp` header includes enumerations for common time spans, making time management in contracts more intuitive.
63+
64+
#### Key Features:
65+
- **Varied Time Units**: Ranges from seconds to weeks for flexible time calculations.
66+
- **Simplified Time Handling**: Streamlines time-related operations in contracts.
67+
68+
#### Usage in EOSIO Smart Contract:
69+
```cpp
70+
#include "time.hpp"
71+
72+
// Example: Retrieving a time span value
73+
In time_span = In::Hour; // Retrieves the value for an hour (3600 seconds)
74+
75+
// Action demonstrating the use of time span
76+
[[eosio::action]]
77+
void showTimeSpan() {
78+
In time_span = In::Day; // Value for a day (86400 seconds)
79+
eosio::print("Time Span in seconds: ", static_cast<int>(time_span));
80+
}
81+
```
82+
83+
## Getting Started 🚀
84+
To begin, clone this repository and include the necessary headers in your Antelope smart contract.
85+
86+
87+
## License 📜
88+
This project is under the MIT License - see the [LICENSE](LICENSE.md) file for details.
89+
90+
91+
This was created in coordination with [cXc.world](https://cxc.world) and [WAX Labs](https://labs.wax.io/proposals/84)

include/continents.hpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*/
2+
3+
This header contains efficient enumerations of continents to use in C++ contracts for WAX blockchains.
4+
5+
Enums are not explicitly numbered because the UN does not produce standardizes numbers for ISO 3166 nor M49 (Antarctica has no code)
6+
7+
/*/
8+
9+
10+
enum class Continents {
11+
AFRICA,
12+
ANTARCTICA,
13+
ASIA,
14+
EUROPE,
15+
NORTH_AMERICA,
16+
OCEANIA,
17+
SOUTH_AMERICA
18+
};
19+
20+
21+
enum class Regions_M49 {
22+
AFRICA,
23+
AMERICAS,
24+
ANTARCTICA,
25+
ASIA,
26+
EUROPE,
27+
OCEANIA
28+
};
29+
30+
enum class Continent_Subregions {
31+
WORLD, // World
32+
SOUTHERN_ASIA, // Southern Asia
33+
EASTERN_ASIA, // Eastern Asia
34+
SOUTH_EASTERN_ASIA, // South-eastern Asia
35+
EASTERN_AFRICA, // Eastern Africa
36+
SOUTH_AMERICA, // South America
37+
WESTERN_AFRICA, // Western Africa
38+
NORTHERN_AMERICA, // Northern America
39+
EASTERN_EUROPE, // Eastern Europe
40+
WESTERN_ASIA, // Western Asia
41+
NORTHERN_AFRICA, // Northern Africa
42+
WESTERN_EUROPE, // Western Europe
43+
MIDDLE_AFRICA, // Middle Africa
44+
CENTRAL_AMERICA, // Central America
45+
SOUTHERN_EUROPE, // Southern Europe
46+
NORTHERN_EUROPE, // Northern Europe
47+
CENTRAL_ASIA, // Central Asia
48+
SOUTHERN_AFRICA, // Southern Africa
49+
CARIBBEAN, // Caribbean
50+
AUSTRALIA_AND_NEW_ZEALAND, // Australia and New Zealand
51+
MELANESIA, // Melanesia
52+
POLYNESIA, // Polynesia
53+
MICRONESIA, // Micronesia
54+
ANTARCTICA // Antarctica
55+
};
56+

include/space.hpp

Whitespace-only changes.

include/web4.hpp

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)