Skip to content

Commit bdb59b0

Browse files
Ryun1gitbook-bot
authored andcommitted
GITBOOK-1125: Ryan's Oct 10 changes
1 parent 95bb43d commit bdb59b0

File tree

1 file changed

+97
-5
lines changed
  • cardano-facilitation-services/cardano-budget/intersect-administration-services/2025-apply-for-tender/open-tenders/civics-committee/cip-149-optional-drep-compensation

1 file changed

+97
-5
lines changed

cardano-facilitation-services/cardano-budget/intersect-administration-services/2025-apply-for-tender/open-tenders/civics-committee/cip-149-optional-drep-compensation/requirements.md

Lines changed: 97 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,115 @@
22

33
### Project Scope - Technical Requirements
44

5-
Each grantee will implement CIP-149 functionality tailored to their platform:
5+
Each grantee will implement [CIP-149 | Optional DRep Compensation](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0149/README.md) functionality tailored to their platform:
66

77
**a) Wallets**
88

9-
* Implement CIP-149 Optional DRep Compensation during staking reward withdrawals.
9+
* Implement CIP-149 Optional DRep Compensation during staking reward withdrawal.
1010
* Provide supporting UI to inform users about donating to their DRep.
1111
* (Optional) Enable creation of DRep delegations containing CIP-149 metadata.
1212

1313
**b) Governance Tools**
1414

1515
* Enable creation of DRep delegations with CIP-149 metadata.
16-
* (Optional) Display compensation amounts received by DReps.
16+
* See example transaction: [8c86970a2431a9f43a0363b116b4c60471a29cc35d253c0ed8c18c1dff3dcf10](https://preview.cardanoscan.io/transaction/8c86970a2431a9f43a0363b116b4c60471a29cc35d253c0ed8c18c1dff3dcf10?tab=metadata)
17+
* (Optional) Display compensation amounts received by DReps and a wallet's donation history.
1718

1819
**c) SDKs/Libraries**
1920

20-
* Add functions for creating CIP-149 DRep delegation transactions.
21-
* Add functions for indexing CIP-149 delegation transactions.
21+
Due to variance within SDK/Library design and functionality, there is flexibility with proposed implementations, suggested functions:
22+
23+
* Add functions for creating CIP-149 DRep delegation transactions.
24+
25+
* The motivation for this is to governance tool makers a straight forward way to build DRep delegation transactions, containing CIP-149 compliant metadata.
26+
* i.e. As a part of transaction building, give users methods to add CIP149 compliant metadata `transaction.addCIP149Delegation(stakeAddr, dRepID, donationBasisPoints)`
27+
28+
```typescript
29+
// Eample of what interfaces and functions could look like
30+
// SDKs and libraries are free to interpret and implement as suits their implementation
31+
32+
// values based on (preview): 8c86970a2431a9f43a0363b116b4c60471a29cc35d253c0ed8c18c1dff3dcf10
33+
34+
const stakeAddr = "stake1u8sa8kegf22wcjqqlc0230rtlemck5lhqycd3u8lattqh2cdjuzs4"
35+
const dRepID = "drep1yfhx2j5j7q989gfvj6cg04htakpqn32a3yuhtytjxt9m80qt5ekm3"
36+
const donationBasisPoints = 150 // 15% donation
37+
38+
/**
39+
* Where transaction is an existing object from library (something else can be used)
40+
* addCIP149Metadata adds a VoteDelegation certificate and CIP149 compliant metadata
41+
*/
42+
transaction.addCIP149Delegation(stakeAddr, dRepID, donationBasisPoints)
43+
44+
console.log(transaction.toJson())
45+
/**
46+
...
47+
"certs":[
48+
0:{
49+
"VoteDelegation":{
50+
"stake_credential":{
51+
"Key":"e1d3db284a94ec4800fe1ea8bc6bfe778b53f70130d8f0ffea…"
52+
}
53+
"drep":{
54+
"KeyHash":"6e654a92f00a72a12c96b087d6ebed8209c55d893975917232…"
55+
}
56+
}
57+
}
58+
]
59+
...
60+
"auxiliary_data":{
61+
"metadata":{
62+
"3692": {
63+
donationBasisPoints: 150
64+
}
65+
}
66+
}
67+
...
68+
*/
69+
```
70+
* Add functions for indexing CIP-149 delegation transactions.
71+
72+
* The motivation for this is to wallets and governance tool makers an example implementation of how to index chain to find a given stake credential's CIP-149 delegations.
73+
* i.e. When a wallet is building a staking reward withdrawal transaction `getLastestCIP149Delegation()`
74+
75+
```typescript
76+
// Example of what interfaces and functions could look like
77+
// SDKs and libraries are free to interpret and implement as suits their implementation
78+
79+
interface CIP149Delegation {
80+
txId: string;
81+
drepId: string;
82+
drepPaymentAddr: string;
83+
basisPoints: number;
84+
}
85+
86+
/**
87+
* NoCIP149Delegation: The stakeKey has not delegated to a DRep using CIP149 correctly
88+
* NoDRepPaymentAddr: The DRep has not included payment address in their metadata
89+
*/
90+
interface CIP149DelegationError {
91+
type: "NoCIP149Delegation" | "NoDRepPaymentAddr" ; // some more error cases
92+
message: string;
93+
}
94+
95+
/**
96+
* getLastestCIP149Delegation triggers a chain query (using a given provider)
97+
* to find the most recent valid CIP149 delegation.
98+
* Indexing will invovle indexing the stakeKey's most recent vote delegation transacion
99+
* its transaction metadata and the DRep's latest metadata (to find DRep's payment address)
100+
*/
101+
const cip149Delegation: CIP149Delegation | CIP149DelegationError = getLastestCIP149Delegation("stake1u8sa8kegf22wcjqqlc0230rtlemck5lhqycd3u8lattqh2cdjuzs4")
102+
103+
const rewardsAvaliable = 100 // 100 ada avaliable in rewards account
104+
105+
/**
106+
* Where withdrawalTransaction is an existing object from library (something else can be used)
107+
* The wallet can then use this information, to build the withdrawal transaction
108+
* using drepPaymentAddr and basisPoints to donate to the DRep
109+
*/
110+
withdarawalTransaction.addRewardsWithdrawal(rewardsAvaliable)
111+
withdrawalTransaction.addOutput(cip149Delegation.drepPaymentAddr, (rewardsAvaliable/100 * cip149Delegation.basisPoints/10))
112+
113+
```
22114

23115
### Eligibility
24116

0 commit comments

Comments
 (0)