Skip to content

Commit

Permalink
Allow delegate to withdraw rewards.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Sep 17, 2024
1 parent 2ddb5a3 commit 40f61f5
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 13 deletions.
2 changes: 1 addition & 1 deletion aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/fuzz@v2" = [{ secs_since_epoch = 1726502893, nanos_since_epoch = 747424000 }, "34ffec10cce786bf823c7505589a3b5e0663792ef8efd31f870d7bcc37e0f593"]
"aiken-lang/fuzz@v2" = [{ secs_since_epoch = 1726578692, nanos_since_epoch = 99170000 }, "34ffec10cce786bf823c7505589a3b5e0663792ef8efd31f870d7bcc37e0f593"]
12 changes: 4 additions & 8 deletions aiken.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "cardanosolutions/proxy-dreps"
version = "0.0.0"
compiler = "v1.1.1"
compiler = "v1.1.2"
plutus = "v3"
license = "MPL-2.0"
description = "Aiken contracts for project 'cardanosolutions/proxy-dreps'"
Expand All @@ -26,13 +26,9 @@ version = "v2"
source = "github"

[config.default]
threshold = 1 # How many administrors signatories are required to approve actions
quorum = 1 # How many administrators signatories are required to approve actions

# List of administators (verification key hashes)
# List of administrators (verification key hashes)
[[config.default.administrators]]
bytes = "00000000000000000000000000000000000000000000000000000000"
encoding = "base16"

[[config.default.administrators]]
bytes = "00000000000000000000000000000000000000000000000000000001"
bytes = "491512406d99b03de5fa4d03ddd2b7f047eeb6681731916fb803f23d"
encoding = "base16"
206 changes: 206 additions & 0 deletions plutus.json

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions validators/proxy.ak
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use sundae/multisig.{MultisigScript}

const administrator: MultisigScript =
multisig.AtLeast {
required: config.threshold,
required: config.quorum,
scripts: list.map(config.administrators, multisig.Signature),
}

Expand All @@ -39,7 +39,7 @@ validator direct_proxy {
RegisterDelegateRepresentative {
delegate_representative: credential,
..
} |
} |
UnregisterDelegateRepresentative {
delegate_representative: credential,
..
Expand Down Expand Up @@ -79,8 +79,18 @@ validator direct_proxy {
}

// Withdrawal of rewards must be approved by the delegate
withdraw(_redeemer: Data, _account: Credential, self: Transaction) {
must_be_approved_by_administrator(self, administrator)
withdraw(
redeemer: Data<MultisigScript>,
account: Credential,
self: Transaction,
) {
or {
must_be_approved_by_administrator(self, administrator)?,
{
expect rules: MultisigScript = redeemer
must_be_approved_by_delegate(self, rules, account, Governance)?
},
}
}

publish(
Expand Down
2 changes: 2 additions & 0 deletions validators/proxy.test.ak
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ test prop_proxy_drep_ko(
)
}

// ------------------------------------------------------------- post-conditions

// ------------------------------------------------------------------ generators

// TODO: Voting
Expand Down

0 comments on commit 40f61f5

Please sign in to comment.