mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-18 07:26:44 +00:00
upgrade to new version of steel
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use solana_program::pubkey::Pubkey;
|
||||
use steel::*;
|
||||
|
||||
use crate::consts::BUS;
|
||||
@@ -30,4 +28,25 @@ pub fn bus_pda(id: u8) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[BUS, &[id]], &crate::id())
|
||||
}
|
||||
|
||||
impl<'a> From<&'a [u8]> for &'a Bus {
|
||||
fn from(value: &'a [u8]) -> &'a Bus {
|
||||
Bus::try_from_bytes(value).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<*const u8> for &'a Bus {
|
||||
fn from(value: *const u8) -> &'a Bus {
|
||||
unsafe {
|
||||
if Bus::discriminator().ne(&value.add(0).read()) {
|
||||
panic!("");
|
||||
}
|
||||
bytemuck::try_from_bytes::<Bus>(std::slice::from_raw_parts(
|
||||
value.add(8),
|
||||
std::mem::size_of::<Bus>(),
|
||||
))
|
||||
.expect("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
account!(OreAccount, Bus);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use solana_program::pubkey::Pubkey;
|
||||
use steel::*;
|
||||
|
||||
use crate::consts::CONFIG;
|
||||
|
||||
Reference in New Issue
Block a user