Skip to content

Commit c39de16

Browse files
Add a stake rights splitting script
Adds a small POC validator that separates the owner of a stake address (who receives rewards and can reclaim the deposit) and the delegator (who *only* controls the delegation capabilities. This could be used for a cold/hot wallet setup, for example
1 parent 497e4dd commit c39de16

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

validators/stakerights.ak

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use aiken/list
2+
use aiken/transaction.{ScriptContext, WithdrawFrom, Publish}
3+
use aiken/transaction/certificate.{CredentialRegistration, CredentialDeregistration, CredentialDelegation}
4+
5+
validator(owner: ByteArray, delegator: ByteArray) {
6+
fn stake(_r: Data, ctx: ScriptContext) -> Bool {
7+
when ctx.purpose is {
8+
WithdrawFrom(_) -> {
9+
list.has(ctx.transaction.extra_signatories, owner)
10+
}
11+
Publish(cert) -> {
12+
when cert is {
13+
CredentialRegistration(_) | CredentialDeregistration(_) -> {
14+
list.has(ctx.transaction.extra_signatories, owner)
15+
}
16+
CredentialDelegation(_, _) -> {
17+
list.has(ctx.transaction.extra_signatories, delegator)
18+
}
19+
_ -> False
20+
}
21+
}
22+
_ -> False
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)