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
@external("env", "_g") | |
declare function _g(id: i32, maxiter: i32): i32 | |
@external("env", "accept") | |
declare function accept(read_ptr: string, read_len: i32, err: i64): i64 | |
@external("env", "trace") | |
declare function trace(mread_ptr: string, mread_len: i32, dread_ptr: string, dread_len: i32, as_hex: i32): i64 | |
export function cbak(reserved: i32): i64 { |
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
/** | |
* Hook API include file | |
* | |
* Note to the reader: | |
* This include defines two types of things: external functions and macros | |
* Functions are used sparingly because a non-inlining compiler may produce | |
* undesirable output. | |
* | |
* Find documentation here: https://xrpl-hooks.readme.io/reference/ | |
*/ |
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
#include <stdint.h> | |
#include "hookapi.h" | |
int64_t cbak(int64_t reserved) | |
{ | |
return 0; | |
} | |
int64_t hook(int64_t reserved ) { |
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
/** | |
* Peggy.c - An oracle based stable coin hook | |
* | |
* Author: Richard Holland | |
* Date: 1 Mar 2021 | |
* | |
**/ | |
#include <stdint.h> | |
#include "hookapi.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
//Authors: NeilH, RichardAH | |
// (joke) test hook that doubles incoming XRP payments and sends it back | |
// April 1st 2021: Added (unfair) coin flip | |
#include <stdint.h> | |
#include "../hookapi.h" | |
int64_t cbak(uint32_t reserved) | |
{ | |
return 0; | |
} |
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
#include <stdint.h> | |
#include "hookapi.h" | |
int64_t cbak(uint32_t reserved) | |
{ | |
TRACESTR("Carbon: callback called."); | |
return 0; | |
} | |
int64_t hook(uint32_t reserved) |
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
/** | |
* Notary.c - An example hook for collecting signatures for multi-sign transactions without blocking sequence number | |
* on the account. | |
* | |
* Author: Richard Holland | |
* Date: 11 Feb 2021 | |
* | |
**/ | |
#include <stdint.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
#include "hookapi.h" | |
// this hook has no emitted tx and therefore no callbacks | |
int64_t cbak(uint32_t reserved) | |
{ | |
return 0; | |
} | |
int64_t hook(uint32_t reserved) | |
{ |
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
/** | |
* This hook just accepts any transaction coming through it | |
*/ | |
#include "hookapi.h" | |
int64_t cbak(uint32_t reserved) { | |
return 0; | |
} |
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
# testing |