-
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.
REMOVED unused headers ADDED License UPDATED readme
- Loading branch information
1 parent
0a5c342
commit 78c248d
Showing
6 changed files
with
166 additions
and
8 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Current X Changel LLC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -1,5 +1,91 @@ | ||
# web4-cpp-header | ||
🛠 A C++ header file containing Spacetime (web4) primitives 🛸 | ||
# Time and Space Antelope Smart Contract Utilities 🌍⏰ | ||
|
||
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. | ||
|
||
All files are in the `include` directory. | ||
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). | ||
|
||
*All .hpp files are in the `include` directory.* | ||
|
||
## Contents 📁 | ||
1. [Countries Enumeration (`countries.hpp`)](#countries-enumeration) | ||
2. [Continents Enumeration (`continents.hpp`)](#continents-enumeration) | ||
3. [Time Enumeration (`time.hpp`)](#time-enumeration) | ||
4. [Getting Started](#getting-started) | ||
5. [Contributing](#contributing) | ||
6. [License](#license) | ||
|
||
### Countries Enumeration (`countries.hpp`) 🌍 | ||
The `countries.hpp` header provides a comprehensive enumeration of countries (`Countries_ISO3`) using ISO 3166-1 alpha-3 country codes. | ||
|
||
#### Key Features: | ||
- **Cross-Contract Compatibility**: Enum values are explicitly numbered for consistent cross-contract compatibility. | ||
- **Comprehensive Country List**: Includes a wide range of countries, each represented by their ISO 3166-1 alpha-3 codes. | ||
|
||
#### Usage in EOSIO Smart Contract: | ||
```cpp | ||
#include "countries.hpp" | ||
|
||
// Example: Retrieving a country code | ||
Countries_ISO3 country_code = Countries_ISO3::USA; // Retrieves the code for USA | ||
|
||
// Action demonstrating the use of country code | ||
[[eosio::action]] | ||
void showCountryCode() { | ||
Countries_ISO3 country_code = Countries_ISO3::FRA; // Code for France | ||
eosio::print("Country Code: ", static_cast<int>(country_code)); | ||
} | ||
``` | ||
|
||
### Continents Enumeration (`continents.hpp`) 🌐 | ||
The `continents.hpp` header includes an enumeration of continents (`Continents`), providing a straightforward way to categorize geographical data. | ||
|
||
#### Key Features: | ||
- **Simple and Efficient**: Easy-to-use enumeration of all the continents. | ||
- **Versatile Usage**: Suitable for geographic categorization and analysis. | ||
|
||
#### Usage in EOSIO Smart Contract: | ||
```cpp | ||
#include "continents.hpp" | ||
|
||
// Example: Retrieving a continent | ||
Continents continent = Continents::EUROPE; // Retrieves Europe | ||
|
||
// Action demonstrating the use of continent enumeration | ||
[[eosio::action]] | ||
void showContinent() { | ||
Continents continent = Continents::ASIA; // Selects Asia | ||
eosio::print("Selected Continent: ", static_cast<int>(continent)); | ||
} | ||
``` | ||
|
||
### Time Enumeration (`time.hpp`) ⏰ | ||
The `time.hpp` header includes enumerations for common time spans, making time management in contracts more intuitive. | ||
|
||
#### Key Features: | ||
- **Varied Time Units**: Ranges from seconds to weeks for flexible time calculations. | ||
- **Simplified Time Handling**: Streamlines time-related operations in contracts. | ||
|
||
#### Usage in EOSIO Smart Contract: | ||
```cpp | ||
#include "time.hpp" | ||
|
||
// Example: Retrieving a time span value | ||
In time_span = In::Hour; // Retrieves the value for an hour (3600 seconds) | ||
|
||
// Action demonstrating the use of time span | ||
[[eosio::action]] | ||
void showTimeSpan() { | ||
In time_span = In::Day; // Value for a day (86400 seconds) | ||
eosio::print("Time Span in seconds: ", static_cast<int>(time_span)); | ||
} | ||
``` | ||
|
||
## Getting Started 🚀 | ||
To begin, clone this repository and include the necessary headers in your Antelope smart contract. | ||
|
||
|
||
## License 📜 | ||
This project is under the MIT License - see the [LICENSE](LICENSE.md) file for details. | ||
|
||
|
||
This was created in coordination with [cXc.world](https://cxc.world) and [WAX Labs](https://labs.wax.io/proposals/84) |
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,56 @@ | ||
/*/ | ||
This header contains efficient enumerations of continents to use in C++ contracts for WAX blockchains. | ||
Enums are not explicitly numbered because the UN does not produce standardizes numbers for ISO 3166 nor M49 (Antarctica has no code) | ||
/*/ | ||
|
||
|
||
enum class Continents { | ||
AFRICA, | ||
ANTARCTICA, | ||
ASIA, | ||
EUROPE, | ||
NORTH_AMERICA, | ||
OCEANIA, | ||
SOUTH_AMERICA | ||
}; | ||
|
||
|
||
enum class Regions_M49 { | ||
AFRICA, | ||
AMERICAS, | ||
ANTARCTICA, | ||
ASIA, | ||
EUROPE, | ||
OCEANIA | ||
}; | ||
|
||
enum class Continent_Subregions { | ||
WORLD, // World | ||
SOUTHERN_ASIA, // Southern Asia | ||
EASTERN_ASIA, // Eastern Asia | ||
SOUTH_EASTERN_ASIA, // South-eastern Asia | ||
EASTERN_AFRICA, // Eastern Africa | ||
SOUTH_AMERICA, // South America | ||
WESTERN_AFRICA, // Western Africa | ||
NORTHERN_AMERICA, // Northern America | ||
EASTERN_EUROPE, // Eastern Europe | ||
WESTERN_ASIA, // Western Asia | ||
NORTHERN_AFRICA, // Northern Africa | ||
WESTERN_EUROPE, // Western Europe | ||
MIDDLE_AFRICA, // Middle Africa | ||
CENTRAL_AMERICA, // Central America | ||
SOUTHERN_EUROPE, // Southern Europe | ||
NORTHERN_EUROPE, // Northern Europe | ||
CENTRAL_ASIA, // Central Asia | ||
SOUTHERN_AFRICA, // Southern Africa | ||
CARIBBEAN, // Caribbean | ||
AUSTRALIA_AND_NEW_ZEALAND, // Australia and New Zealand | ||
MELANESIA, // Melanesia | ||
POLYNESIA, // Polynesia | ||
MICRONESIA, // Micronesia | ||
ANTARCTICA // Antarctica | ||
}; | ||
|
Empty file.
This file was deleted.
Oops, something went wrong.