parent
1d0d27ab3d
commit
8f62566dbb
|
@ -11,3 +11,6 @@ url = "https://api.apr.dev"
|
||||||
[provider]
|
[provider]
|
||||||
cluster = "https://api.devnet.solana.com"
|
cluster = "https://api.devnet.solana.com"
|
||||||
wallet = "~/.config/solana/id.json"
|
wallet = "~/.config/solana/id.json"
|
||||||
|
|
||||||
|
[scripts]
|
||||||
|
export = "anchor build && ./scripts/patch_idl.sh"
|
||||||
|
|
|
@ -169,7 +169,9 @@ pub mod pyth_solana_receiver {
|
||||||
);
|
);
|
||||||
|
|
||||||
let vaa_components = VaaComponents {
|
let vaa_components = VaaComponents {
|
||||||
verification_level: VerificationLevel::Partial(vaa.signature_count()),
|
verification_level: VerificationLevel::Partial {
|
||||||
|
num_signatures: vaa.signature_count(),
|
||||||
|
},
|
||||||
emitter_address: vaa.body().emitter_address(),
|
emitter_address: vaa.body().emitter_address(),
|
||||||
emitter_chain: vaa.body().emitter_chain(),
|
emitter_chain: vaa.body().emitter_chain(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ use {
|
||||||
* If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked */
|
* If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked */
|
||||||
#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, PartialEq, BorshSchema, Debug)]
|
#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, PartialEq, BorshSchema, Debug)]
|
||||||
pub enum VerificationLevel {
|
pub enum VerificationLevel {
|
||||||
Partial(u8),
|
Partial { num_signatures: u8 },
|
||||||
Full,
|
Full,
|
||||||
}
|
}
|
||||||
#[account]
|
#[account]
|
||||||
|
|
|
@ -342,7 +342,7 @@ async fn test_post_price_update_from_vaa() {
|
||||||
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
price_update_account.verification_level,
|
price_update_account.verification_level,
|
||||||
VerificationLevel::Partial(13)
|
VerificationLevel::Partial { num_signatures: 13 }
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Message::PriceFeedMessage(price_update_account.price_message),
|
Message::PriceFeedMessage(price_update_account.price_message),
|
||||||
|
@ -391,7 +391,7 @@ async fn test_post_price_update_from_vaa() {
|
||||||
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
price_update_account.verification_level,
|
price_update_account.verification_level,
|
||||||
VerificationLevel::Partial(13)
|
VerificationLevel::Partial { num_signatures: 13 }
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Message::PriceFeedMessage(price_update_account.price_message),
|
Message::PriceFeedMessage(price_update_account.price_message),
|
||||||
|
@ -444,7 +444,7 @@ async fn test_post_price_update_from_vaa() {
|
||||||
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
price_update_account.verification_level,
|
price_update_account.verification_level,
|
||||||
VerificationLevel::Partial(13)
|
VerificationLevel::Partial { num_signatures: 13 },
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Message::PriceFeedMessage(price_update_account.price_message),
|
Message::PriceFeedMessage(price_update_account.price_message),
|
||||||
|
|
|
@ -94,7 +94,7 @@ async fn test_post_update_atomic() {
|
||||||
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
price_update_account.verification_level,
|
price_update_account.verification_level,
|
||||||
VerificationLevel::Partial(5)
|
VerificationLevel::Partial { num_signatures: 5 }
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Message::PriceFeedMessage(price_update_account.price_message),
|
Message::PriceFeedMessage(price_update_account.price_message),
|
||||||
|
@ -130,7 +130,7 @@ async fn test_post_update_atomic() {
|
||||||
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
price_update_account.verification_level,
|
price_update_account.verification_level,
|
||||||
VerificationLevel::Partial(5)
|
VerificationLevel::Partial { num_signatures: 5 }
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Message::PriceFeedMessage(price_update_account.price_message),
|
Message::PriceFeedMessage(price_update_account.price_message),
|
||||||
|
@ -165,7 +165,7 @@ async fn test_post_update_atomic() {
|
||||||
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
assert_eq!(price_update_account.write_authority, poster.pubkey());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
price_update_account.verification_level,
|
price_update_account.verification_level,
|
||||||
VerificationLevel::Partial(5)
|
VerificationLevel::Partial { num_signatures: 5 }
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Message::PriceFeedMessage(price_update_account.price_message),
|
Message::PriceFeedMessage(price_update_account.price_message),
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#! /bin/bash
|
||||||
|
cat target/idl/pyth_solana_receiver.json |
|
||||||
|
# ADD EXTERNAL TYPES
|
||||||
|
jq --slurpfile external_types target/idl/external_types.json '.types += $external_types[]' > target/idl/tmp.json && mv target/idl/tmp.json target/idl/pyth_solana_receiver.json
|
|
@ -0,0 +1,64 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "PriceFeedMessage",
|
||||||
|
"type": {
|
||||||
|
"kind": "struct",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "feedId",
|
||||||
|
"type": {
|
||||||
|
"array": ["u8", 32]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "price",
|
||||||
|
"type": "i64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "conf",
|
||||||
|
"type": "u64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "exponent",
|
||||||
|
"type": "i32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "publishTime",
|
||||||
|
"type": "i64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "prevPublishTime",
|
||||||
|
"type": "i64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "emaPrice",
|
||||||
|
"type": "i64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "emaConf",
|
||||||
|
"type": "u64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MerklePriceUpdate",
|
||||||
|
"type": {
|
||||||
|
"kind": "struct",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "message",
|
||||||
|
"type": "bytes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "merkleProof",
|
||||||
|
"type": {
|
||||||
|
"vec": {
|
||||||
|
"array": ["u8", 20]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue