Add sysvar support (#5838)

This commit is contained in:
Jack May
2019-09-09 10:55:35 -07:00
committed by GitHub
parent ee0c570d54
commit a317e9513f
17 changed files with 156 additions and 110 deletions

View File

@@ -179,7 +179,7 @@ pub fn process_instruction(
me.delegate_stake(
vote,
stake,
&sysvar::clock::from_keyed_account(&rest[1])?,
&sysvar::clock_account::from_keyed_account(&rest[1])?,
&config::from_keyed_account(&rest[2])?,
)
}
@@ -209,7 +209,7 @@ pub fn process_instruction(
me.withdraw(
lamports,
&mut to,
&sysvar::clock::from_keyed_account(&sysvar[0])?,
&sysvar::clock_account::from_keyed_account(&sysvar[0])?,
&sysvar::stake_history::from_keyed_account(&sysvar[1])?,
)
}
@@ -221,7 +221,7 @@ pub fn process_instruction(
let vote = &mut vote[0];
let clock = &rest[0];
me.deactivate_stake(vote, &sysvar::clock::from_keyed_account(&clock)?)
me.deactivate_stake(vote, &sysvar::clock_account::from_keyed_account(&clock)?)
}
}
}
@@ -238,7 +238,7 @@ mod tests {
.iter()
.map(|meta| {
if sysvar::clock::check_id(&meta.pubkey) {
sysvar::clock::create_account(1, 0, 0, 0, 0)
sysvar::clock_account::new(1, 0, 0, 0, 0)
} else if sysvar::rewards::check_id(&meta.pubkey) {
sysvar::rewards::create_account(1, 0.0, 0.0)
} else if sysvar::stake_history::check_id(&meta.pubkey) {
@@ -336,7 +336,7 @@ mod tests {
KeyedAccount::new(
&sysvar::clock::id(),
false,
&mut sysvar::clock::create_account(1, 0, 0, 0, 0)
&mut sysvar::clock_account::new(1, 0, 0, 0, 0)
),
KeyedAccount::new(
&config::id(),