https://github.com/jonas089/raptor-abi
Proc-macro Compiler for Contracts
https://github.com/jonas089/raptor-abi
metadata proc-macro smart-contract
Last synced: 12 months ago
JSON representation
Proc-macro Compiler for Contracts
- Host: GitHub
- URL: https://github.com/jonas089/raptor-abi
- Owner: jonas089
- Created: 2023-02-22T12:51:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-01-10T13:40:51.000Z (over 2 years ago)
- Last Synced: 2025-04-04T19:46:29.373Z (about 1 year ago)
- Topics: metadata, proc-macro, smart-contract
- Language: Rust
- Homepage:
- Size: 184 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Raptor contract ABI

## Supported casper_types
- Bool
- I32
- I64
- U8
- U32
- U64
- U128
- U256
- U512
- Unit
- String
- Key
- URef
- PublicKey
- Any
```
██╗███╗░░██╗██╗░░██╗██╗
██║████╗░██║██║░██╔╝██║
██║██╔██╗██║█████═╝░██║
██║██║╚████║██╔═██╗░╚═╝
██║██║░╚███║██║░╚██╗██╗
╚═╝╚═╝░░╚══╝╚═╝░░╚═╝╚═╝
```
a smart contract ABI generator for Polkadot
Raptor-abi is essentially a compact implementation of Ink for Casper smart contracts.
As of today, Claptrap supports metadata generation at build-time for **Entry Point** definitions.
## src/ink.rs
Artificial example contract that demonstrates the implementation of **Entry Points** using Claptrap macros.
## code_generator
Procedural macro definitions for contract ABI generation inspired by Ink!.
## helpers
Deadcode Type definitions and filehandlers.
## test.sh
Compile ink.rs => output.json
test.sh deletes the target folder (if present) because otherwise the ink contract is not built from source => no or empty output.json.
## Direct comparison
Native Casper:
```rust
EntryPoint::new("test", vec![...], CLType::Unit, EntryPointAccess::Public, EntryPointType::Contract);
```
Raptor:
```rust
#[derive(Default)]
#[derive(InkCasperMacro)]
struct NewEntryPointArgs1{
sender: Key,
recipient: Key,
amount: U64,
id_first:U256,
text: String
}
let ep = NewEntryPointArgs1::default();
let ep_parameters = ep.get_params();
let entry_point = EntryPoint::new("test", ep_parameters.clone(), CLType::Unit, EntryPointAccess::Public, EntryPointType::Contract);
```
The additional syntax is required as Claptrap parses the struct at compile time using a proc macro to generate valuable metadata for the contract.