Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 6f884de

Browse files
mvinesmergify[bot]
authored andcommitted
Rename 'delivery' to 'distributor'
1 parent 3930219 commit 6f884de

File tree

6 files changed

+44
-41
lines changed

6 files changed

+44
-41
lines changed

docs/src/feature-proposal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This is done by running:
9999
$ spl-feature-proposal propose feature-proposal.json
100100
Feature Id: HQ3baDfNU7WKCyWvtMYZmi51YPs7vhSiLn1ESYp3jhiA
101101
Token Mint Address: ALvA7Lv9jbo8JFhxqnRpjWWuR3aD12uCb5KBJst4uc3d
102-
Delivery Token Address: GK55hNft4TGc3Hg4KzbjEmju8VfaNuXK8jQNDTZKcsNF
102+
Distributor Token Address: GK55hNft4TGc3Hg4KzbjEmju8VfaNuXK8jQNDTZKcsNF
103103
Acceptance Token Address: AdqKm3mSJf8AtTWjfpA5ZbJszWQPcwyLA2XkRyLbf3Di
104104
Number of validators: 376
105105
Tokens to be minted: 134575791.53064314

feature-proposal/cli/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ fn process_propose(
237237
percent_stake_required: u8,
238238
confirm: bool,
239239
) -> Result<(), Box<dyn std::error::Error>> {
240-
let delivery_token_address =
241-
spl_feature_proposal::get_delivery_token_address(&feature_proposal_keypair.pubkey());
240+
let distributor_token_address =
241+
spl_feature_proposal::get_distributor_token_address(&feature_proposal_keypair.pubkey());
242242
let feature_id_address =
243243
spl_feature_proposal::get_feature_id_address(&feature_proposal_keypair.pubkey());
244244
let acceptance_token_address =
@@ -247,7 +247,7 @@ fn process_propose(
247247

248248
println!("Feature Id: {}", feature_id_address);
249249
println!("Token Mint Address: {}", mint_address);
250-
println!("Delivery Token Address: {}", delivery_token_address,);
250+
println!("Distributor Token Address: {}", distributor_token_address);
251251
println!("Acceptance Token Address: {}", acceptance_token_address);
252252

253253
let vote_accounts = rpc_client.get_vote_accounts()?;
@@ -314,7 +314,7 @@ fn process_propose(
314314
--db-path db.{} \
315315
--fee-payer ~/.config/solana/id.json \
316316
--owner <FEATURE_PROPOSAL_KEYPAIR>",
317-
delivery_token_address,
317+
distributor_token_address,
318318
distribution_file,
319319
&feature_proposal_keypair.pubkey().to_string()[..8]
320320
);

feature-proposal/program/src/instruction.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ pub enum FeatureProposalInstruction {
2020
/// funded by account 0:
2121
/// * A new token mint with a supply of `tokens_to_mint`, owned by the program and never
2222
/// modified again
23-
/// * A new "delivery" token account that holds the total supply, owned by account 0.
23+
/// * A new "distributor" token account that holds the total supply, owned by account 0.
2424
/// * A new "acceptance" token account that holds 0 tokens, owned by the program. Tokens
2525
/// transfers to this address are irrevocable and permanent.
2626
/// * A new feature id account that has been funded and allocated (as described in
2727
/// `solana_program::feature`)
2828
///
2929
/// On successful execution of the instruction, the feature proposer is expected to distribute
30-
/// the tokens in the delivery token account out to all participating parties.
30+
/// the tokens in the distributor token account out to all participating parties.
3131
///
3232
/// Based on the provided acceptance criteria, if `AcceptanceCriteria::tokens_required`
3333
/// tokens are transferred into the acceptance token account before
@@ -41,7 +41,7 @@ pub enum FeatureProposalInstruction {
4141
/// 0. `[writeable,signer]` Funding account (must be a system account)
4242
/// 1. `[writeable,signer]` Unallocated feature proposal account to create
4343
/// 2. `[writeable]` Token mint address from `get_mint_address`
44-
/// 3. `[writeable]` Delivery token account address from `get_delivery_token_address`
44+
/// 3. `[writeable]` Distributor token account address from `get_distributor_token_address`
4545
/// 4. `[writeable]` Acceptance token account address from `get_acceptance_token_address`
4646
/// 5. `[writeable]` Feature id account address from `get_feature_id_address`
4747
/// 6. `[]` System program
@@ -109,7 +109,7 @@ pub fn propose(
109109
acceptance_criteria: AcceptanceCriteria,
110110
) -> Instruction {
111111
let mint_address = get_mint_address(feature_proposal_address);
112-
let delivery_token_address = get_delivery_token_address(feature_proposal_address);
112+
let distributor_token_address = get_distributor_token_address(feature_proposal_address);
113113
let acceptance_token_address = get_acceptance_token_address(feature_proposal_address);
114114
let feature_id_address = get_feature_id_address(feature_proposal_address);
115115

@@ -119,7 +119,7 @@ pub fn propose(
119119
AccountMeta::new(*funding_address, true),
120120
AccountMeta::new(*feature_proposal_address, true),
121121
AccountMeta::new(mint_address, false),
122-
AccountMeta::new(delivery_token_address, false),
122+
AccountMeta::new(distributor_token_address, false),
123123
AccountMeta::new(acceptance_token_address, false),
124124
AccountMeta::new(feature_id_address, false),
125125
AccountMeta::new_readonly(solana_program::system_program::id(), false),

feature-proposal/program/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ pub(crate) fn get_mint_address_with_seed(feature_proposal_address: &Pubkey) -> (
1818
Pubkey::find_program_address(&[&feature_proposal_address.to_bytes(), br"mint"], &id())
1919
}
2020

21-
pub(crate) fn get_delivery_token_address_with_seed(
21+
pub(crate) fn get_distributor_token_address_with_seed(
2222
feature_proposal_address: &Pubkey,
2323
) -> (Pubkey, u8) {
24-
Pubkey::find_program_address(&[&feature_proposal_address.to_bytes(), br"delivery"], &id())
24+
Pubkey::find_program_address(
25+
&[&feature_proposal_address.to_bytes(), br"distributor"],
26+
&id(),
27+
)
2528
}
2629

2730
pub(crate) fn get_acceptance_token_address_with_seed(
@@ -47,8 +50,8 @@ pub fn get_mint_address(feature_proposal_address: &Pubkey) -> Pubkey {
4750

4851
/// Derive the SPL Token token address associated with a feature proposal that receives the initial
4952
/// minted tokens
50-
pub fn get_delivery_token_address(feature_proposal_address: &Pubkey) -> Pubkey {
51-
get_delivery_token_address_with_seed(feature_proposal_address).0
53+
pub fn get_distributor_token_address(feature_proposal_address: &Pubkey) -> Pubkey {
54+
get_distributor_token_address_with_seed(feature_proposal_address).0
5255
}
5356

5457
/// Derive the SPL Token token address associated with a feature proposal that users send their

feature-proposal/program/src/processor.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn process_instruction(
3434
let funder_info = next_account_info(account_info_iter)?;
3535
let feature_proposal_info = next_account_info(account_info_iter)?;
3636
let mint_info = next_account_info(account_info_iter)?;
37-
let delivery_token_info = next_account_info(account_info_iter)?;
37+
let distributor_token_info = next_account_info(account_info_iter)?;
3838
let acceptance_token_info = next_account_info(account_info_iter)?;
3939
let feature_id_info = next_account_info(account_info_iter)?;
4040
let system_program_info = next_account_info(account_info_iter)?;
@@ -49,10 +49,10 @@ pub fn process_instruction(
4949
return Err(ProgramError::InvalidArgument);
5050
}
5151

52-
let (delivery_token_address, delivery_token_bump_seed) =
53-
get_delivery_token_address_with_seed(feature_proposal_info.key);
54-
if delivery_token_address != *delivery_token_info.key {
55-
info!("Error: delivery token address derivation mismatch");
52+
let (distributor_token_address, distributor_token_bump_seed) =
53+
get_distributor_token_address_with_seed(feature_proposal_info.key);
54+
if distributor_token_address != *distributor_token_info.key {
55+
info!("Error: distributor token address derivation mismatch");
5656
return Err(ProgramError::InvalidArgument);
5757
}
5858

@@ -76,10 +76,10 @@ pub fn process_instruction(
7676
&[mint_bump_seed],
7777
];
7878

79-
let delivery_token_signer_seeds: &[&[_]] = &[
79+
let distributor_token_signer_seeds: &[&[_]] = &[
8080
&feature_proposal_info.key.to_bytes(),
81-
br"delivery",
82-
&[delivery_token_bump_seed],
81+
br"distributor",
82+
&[distributor_token_bump_seed],
8383
];
8484

8585
let acceptance_token_signer_seeds: &[&[_]] = &[
@@ -145,33 +145,33 @@ pub fn process_instruction(
145145
],
146146
)?;
147147

148-
info!("Creating delivery token account");
148+
info!("Creating distributor token account");
149149
invoke_signed(
150150
&system_instruction::create_account(
151151
funder_info.key,
152-
delivery_token_info.key,
152+
distributor_token_info.key,
153153
1.max(rent.minimum_balance(spl_token::state::Account::get_packed_len())),
154154
spl_token::state::Account::get_packed_len() as u64,
155155
&spl_token::id(),
156156
),
157157
&[
158158
funder_info.clone(),
159-
delivery_token_info.clone(),
159+
distributor_token_info.clone(),
160160
system_program_info.clone(),
161161
],
162-
&[&delivery_token_signer_seeds],
162+
&[&distributor_token_signer_seeds],
163163
)?;
164164

165-
info!("Initializing delivery token account");
165+
info!("Initializing distributor token account");
166166
invoke(
167167
&spl_token::instruction::initialize_account(
168168
&spl_token::id(),
169-
delivery_token_info.key,
169+
distributor_token_info.key,
170170
mint_info.key,
171171
feature_proposal_info.key,
172172
)?,
173173
&[
174-
delivery_token_info.clone(),
174+
distributor_token_info.clone(),
175175
spl_token_program_info.clone(),
176176
rent_sysvar_info.clone(),
177177
feature_proposal_info.clone(),
@@ -243,21 +243,21 @@ pub fn process_instruction(
243243
],
244244
)?;
245245

246-
// Mint `tokens_to_mint` tokens into `delivery_token_account` owned by
246+
// Mint `tokens_to_mint` tokens into `distributor_token_account` owned by
247247
// `feature_proposal`
248248
info!(&format!("Minting {} tokens", tokens_to_mint));
249249
invoke_signed(
250250
&spl_token::instruction::mint_to(
251251
&spl_token::id(),
252252
mint_info.key,
253-
delivery_token_info.key,
253+
distributor_token_info.key,
254254
mint_info.key,
255255
&[],
256256
tokens_to_mint,
257257
)?,
258258
&[
259259
mint_info.clone(),
260-
delivery_token_info.clone(),
260+
distributor_token_info.clone(),
261261
spl_token_program_info.clone(),
262262
],
263263
&[&mint_signer_seeds],

feature-proposal/program/tests/functional.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async fn test_basic() {
5757

5858
let feature_id_address = get_feature_id_address(&feature_proposal.pubkey());
5959
let mint_address = get_mint_address(&feature_proposal.pubkey());
60-
let delivery_token_address = get_delivery_token_address(&feature_proposal.pubkey());
60+
let distributor_token_address = get_distributor_token_address(&feature_proposal.pubkey());
6161
let acceptance_token_address = get_acceptance_token_address(&feature_proposal.pubkey());
6262

6363
// Create a new feature proposal
@@ -94,15 +94,15 @@ async fn test_basic() {
9494
assert!(mint.freeze_authority.is_none());
9595
assert_eq!(mint.mint_authority, COption::Some(mint_address));
9696

97-
// Confirm delivery token account state
98-
let delivery_token =
99-
get_account_data::<spl_token::state::Account>(&mut banks_client, delivery_token_address)
97+
// Confirm distributor token account state
98+
let distributor_token =
99+
get_account_data::<spl_token::state::Account>(&mut banks_client, distributor_token_address)
100100
.await
101101
.unwrap();
102-
assert_eq!(delivery_token.amount, 42);
103-
assert_eq!(delivery_token.mint, mint_address);
104-
assert_eq!(delivery_token.owner, feature_proposal.pubkey());
105-
assert!(delivery_token.close_authority.is_none());
102+
assert_eq!(distributor_token.amount, 42);
103+
assert_eq!(distributor_token.mint, mint_address);
104+
assert_eq!(distributor_token.owner, feature_proposal.pubkey());
105+
assert!(distributor_token.close_authority.is_none());
106106

107107
// Confirm acceptance token account state
108108
let acceptance_token =
@@ -140,7 +140,7 @@ async fn test_basic() {
140140
let mut transaction = Transaction::new_with_payer(
141141
&[spl_token::instruction::transfer(
142142
&spl_token::id(),
143-
&delivery_token_address,
143+
&distributor_token_address,
144144
&acceptance_token_address,
145145
&feature_proposal.pubkey(),
146146
&[],

0 commit comments

Comments
 (0)