Revert "solana/token_bridge: sollet mints renamed to generic external"
This reverts commit 496d2385f5
.
Reason for revert: not supporting external mints
Change-Id: I996f4fcbfb71a6539094f2d4a6adbff481fefb7d
This commit is contained in:
parent
e6a6c39620
commit
7a504108cd
|
@ -242,9 +242,9 @@ pub fn complete_wrapped(
|
|||
accs.vaa.verify(ctx.program_id)?;
|
||||
accs.vaa.claim(ctx, accs.payer.key)?;
|
||||
|
||||
let (_, is_external) =
|
||||
let (_, is_sollet) =
|
||||
derive_mint_for_token(ctx.program_id, accs.vaa.token_address, accs.vaa.token_chain);
|
||||
let (amount, fee) = if is_external && accs.wrapped_meta.original_decimals > 6 {
|
||||
let (amount, fee) = if is_sollet && accs.wrapped_meta.original_decimals > 6 {
|
||||
// Sollet assets are truncated to 6 decimals, however Wormhole uses 8 and assumes
|
||||
// wire-truncation to 8 decimals.
|
||||
(
|
||||
|
|
|
@ -102,7 +102,7 @@ impl<'b> InstructionContext<'b> for CreateWrapped<'b> {
|
|||
pub struct CreateWrappedData {}
|
||||
|
||||
#[cfg(not(feature = "test"))]
|
||||
pub static EXTERNAL_MINTS: phf::Map<&str, (u16, &str)> = phf_map! {
|
||||
pub static SOLLET_MINTS: phf::Map<&str, (u16, &str)> = phf_map! {
|
||||
// "WETH",
|
||||
"000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" => (2, "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk"),
|
||||
// "YFI",
|
||||
|
@ -150,7 +150,7 @@ pub static EXTERNAL_MINTS: phf::Map<&str, (u16, &str)> = phf_map! {
|
|||
};
|
||||
|
||||
#[cfg(feature = "test")]
|
||||
pub static EXTERNAL_MINTS: phf::Map<&str, (u16, &str)> = phf_map! {
|
||||
pub static SOLLET_MINTS: phf::Map<&str, (u16, &str)> = phf_map! {
|
||||
// "TEST",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" => (2, "FDhdMYh3KsF64Jxzh8tnx9rJXQTcN461rguUK9z9zm64"),
|
||||
};
|
||||
|
@ -160,8 +160,8 @@ pub fn derive_mint_for_token(
|
|||
token_address: Address,
|
||||
token_chain: ChainID,
|
||||
) -> (Pubkey, bool) {
|
||||
let mut external_mint = EXTERNAL_MINTS.get(hex::encode(token_address).as_str());
|
||||
if let Some(mint) = external_mint {
|
||||
let mut sollet_mint = SOLLET_MINTS.get(hex::encode(token_address).as_str());
|
||||
if let Some(mint) = sollet_mint {
|
||||
if mint.0 == token_chain {
|
||||
return (Pubkey::from_str(mint.1).unwrap(), true);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ pub fn create_wrapped(
|
|||
accs: &mut CreateWrapped,
|
||||
data: CreateWrappedData,
|
||||
) -> Result<()> {
|
||||
let (mint, is_external) =
|
||||
let (mint, is_sollet) =
|
||||
derive_mint_for_token(ctx.program_id, accs.vaa.token_address, accs.vaa.token_chain);
|
||||
if *accs.mint.info().key != mint {
|
||||
return Err(InvalidMint.into());
|
||||
|
@ -201,7 +201,7 @@ pub fn create_wrapped(
|
|||
accs.vaa.verify(ctx.program_id)?;
|
||||
accs.vaa.claim(ctx, accs.payer.key)?;
|
||||
|
||||
if !is_external {
|
||||
if !is_sollet {
|
||||
// Create mint account
|
||||
accs.mint
|
||||
.create(&((&*accs).into()), ctx, accs.payer.key, Exempt)?;
|
||||
|
|
|
@ -331,12 +331,12 @@ pub fn transfer_wrapped(
|
|||
|
||||
invoke(&transfer_ix, ctx.accounts)?;
|
||||
|
||||
let (_, is_external) = derive_mint_for_token(
|
||||
let (_, is_sollet) = derive_mint_for_token(
|
||||
ctx.program_id,
|
||||
accs.wrapped_meta.token_address,
|
||||
accs.wrapped_meta.chain,
|
||||
);
|
||||
let (amount, fee) = if is_external && accs.wrapped_meta.original_decimals > 6 {
|
||||
let (amount, fee) = if is_sollet && accs.wrapped_meta.original_decimals > 6 {
|
||||
// Sollet assets are truncated to 6 decimals, however Wormhole uses 8 and assumes
|
||||
// wire-truncation to 8 decimals.
|
||||
(
|
||||
|
|
|
@ -28,7 +28,7 @@ use crate::{
|
|||
TransferNativeData,
|
||||
TransferWrappedData,
|
||||
UpgradeContractData,
|
||||
EXTERNAL_MINTS,
|
||||
SOLLET_MINTS,
|
||||
},
|
||||
messages::{
|
||||
PayloadAssetMeta,
|
||||
|
|
|
@ -98,7 +98,7 @@ use token_bridge::{
|
|||
WrappedDerivationData,
|
||||
WrappedMint,
|
||||
},
|
||||
api::EXTERNAL_MINTS,
|
||||
api::SOLLET_MINTS,
|
||||
messages::{
|
||||
PayloadAssetMeta,
|
||||
PayloadGovernanceRegisterChain,
|
||||
|
@ -650,8 +650,8 @@ fn test_create_wrapped_preexisting(context: &mut Context) -> (Pubkey) {
|
|||
|
||||
let nonce = rand::thread_rng().gen();
|
||||
println!("{}", hex::encode([0xaau8; 32]));
|
||||
println!("{:?}", EXTERNAL_MINTS);
|
||||
println!("{:?}", EXTERNAL_MINTS.get(hex::encode([0xaau8; 32]).as_str()));
|
||||
println!("{:?}", SOLLET_MINTS);
|
||||
println!("{:?}", SOLLET_MINTS.get(hex::encode([0xaau8; 32]).as_str()));
|
||||
|
||||
let payload = PayloadAssetMeta {
|
||||
token_address: [0xaau8; 32],
|
||||
|
|
Loading…
Reference in New Issue