Skip to content

Commit

Permalink
Allow native SOL to be represented as a token
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jun 30, 2020
1 parent f8f51c1 commit d8c3f4d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions token/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ pub enum TokenInstruction {
/// 2. `[writable]` Token being burned.
/// 3. Optional: `[writable]` Source account if key 1 is a delegate account.
Burn(u64),

/// Initialize a wrapped SOL token account. The full lamport balance in the new account will be wrapped
/// 0. `[writable]` An uninitialized token account
/// 1. `[]` Owner of the new account.
///
/// Since the `InitializeWrappedAccount` instruction requires no signers, it must be included
/// in the same Transaction that creates the token account using the system program. Otherwise
/// it's possible for another party to assume ownership of your new token account.
InitializeWrappedAccount,

/// Deallocate and release all native SOL held by a token account
/// 0. `[signer]` Owner of the token account.
/// 1. `[writable]` Token account to release.
/// 2. `[writable]` Destination account to receive the full SOL balance of the account.
ReleaseAccount,
}
impl TokenInstruction {
/// Deserializes a byte buffer into an [TokenInstruction](enum.TokenInstruction.html)
Expand Down
1 change: 1 addition & 0 deletions token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pub mod instruction;
pub mod option;
pub mod processor;
pub mod state;
pub mod native_token;
3 changes: 3 additions & 0 deletions token/src/native_token.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/// The token type for wrapped native SOL
solana_sdk::declare_id!("So11111111111111111111111111111111111111111");

0 comments on commit d8c3f4d

Please sign in to comment.