Skip to content

Instantly share code, notes, and snippets.

View muzam1l's full-sized avatar
👻
Wandering

muzamil muzam1l

👻
Wandering
View GitHub Profile
@muzam1l
muzam1l / README.md
Last active December 7, 2022 09:47 — forked from xrplfgists/README.md

Starter

Starter is the simplest possible hook: it just accepts all transactions and logs that it is running.

to test:

  • in the develop pane, compile starter.c
  • in the deploy pane, deploy it to Alice account
  • set up payment transaction from Alice to Bob
  • run it and see in the debug stream 'Accept.c: Called.'

Carbon

Carbon hook sends a percentage of outgoing payments to a dedicated account.

The beneficiary account is hard-coded, so while the default version of carbon.c works, it works with an account that cannot be imported into Hooks Builder (unless you know its secret key). See later examples for how to parametrize a hook.

to test:

  • make sure Hooks Builder has at least 3 accounts: Alice, Bob and Carol
  • in carbon.c, change hardcoded beneficiary to Carol account
  • compile carbon.c and deploy it to Alice account
@muzam1l
muzam1l / README.md
Last active February 13, 2023 13:10 — forked from xrplfgists/README.md
Peggy

Peggy

Peggy hook provides an automated way to issue and redeem an over-collateralised XRP-backed stablecoin.

Sending XRP to it creates a vault and sends back stablecoin, which can be redeemed against the vault to get back the original XRP.

The exchange rate between XRP and stablecoin is the limit set on a trustline established between two special oracle accounts.

If the value of XRP falls too far, the vault gets under a minimum collateralization threshold. This means anyone who wants to top up the vault above the threshold can come along and take it over.

@muzam1l
muzam1l / README.md
Last active May 7, 2023 19:37 — forked from xrplfgists/README.md
Notary

Notary

Notary hook collects signatures for multi-sign transactions. It has two modes of operation:

  1. Attach a proposed transaction to a memo and send it to the hook account
  2. Endorse an already proposed transaction by using its unique ID as invoice ID and sending a 1 drop payment to the hook.

It relies on the signer list on the account the hook is running on. Only accounts on this list can propose and endorse multisign transactions through this hook.

to test:

  • make sure Hooks Builder has at least 3 accounts: Alice, Bob and Carol
@muzam1l
muzam1l / README.md
Last active February 9, 2023 16:17 — forked from xrplfgists/README.md
Firewall

Firewall

Firewall is an example of cooperating hooks: firewall hook instances filter incoming payments, based on shared state maintained by blacklist hook.

To cooperate, the hooks need information about each other, which must be obtained before deploying them, because it's passed to them as install-time parameters.

to test:

  • make sure Hooks Builder has at least 4 accounts: Alice, Bob, Carol and Carlos
  • run key.js to get a public key of the blacklist admin account, e.g. Alice; it asks for that account's secret key
    • verify the script is using it just to derive the public key