forked from solana-labs/solana-program-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
197 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
bin | ||
*/target/ | ||
.vscode | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ install: | |
- clang-7 --version | ||
- nvm install node | ||
- node --version | ||
- ./do.sh update | ||
|
||
jobs: | ||
include: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,7 @@ cd "$(dirname "$0")/.." | |
|
||
set -e | ||
|
||
./do.sh update | ||
./do.sh build memo | ||
./do.sh doc memo | ||
./do.sh test memo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$0")/../token/js" | ||
|
||
set -e | ||
|
||
npm install | ||
npm run build:program | ||
npm run test | ||
npm run cluster:devnet | ||
npm run start | ||
( | ||
cd "$(dirname "$0")/.." | ||
|
||
./do.sh update | ||
./do.sh build token | ||
./do.sh doc token | ||
./do.sh test token | ||
) | ||
|
||
( | ||
cd "$(dirname "$0")/../token/js" | ||
|
||
npm install | ||
npm run build:program | ||
npm run cluster:devnet | ||
npm run start | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
#![deny(missing_docs)] | ||
|
||
//! A simple program that accepts a string of encoded characters and verifies that it parses. Currently handles UTF-8. | ||
pub mod processor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
//! Instruction types | ||
/// Specifies the financial specifics of a token. | ||
#[repr(C)] | ||
#[derive(Clone, Copy, Debug, Default, PartialEq)] | ||
pub struct TokenInfo { | ||
/// Total supply of tokens. | ||
pub supply: u64, | ||
/// Number of base 10 digits to the right of the decimal place in the total supply. | ||
pub decimals: u64, | ||
} | ||
|
||
/// Instructions supported by the token program. | ||
#[repr(C)] | ||
#[derive(Clone, Debug, PartialEq)] | ||
pub enum Instruction { | ||
/// Creates a new token and deposit all the newly minted tokens in an account. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. [writable, signer] New token to create. | ||
/// 1. [writable] Account to hold all the newly minted tokens. | ||
/// 2. Optional: [] Owner of the token, if present allows further minting of tokens. | ||
NewToken(TokenInfo), | ||
/// Creates a new account. The new account can either hold tokens or be a delegate | ||
/// for another account. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. [writable, signer] New account being created. | ||
/// 1. [] Owner of the new account. | ||
/// 2. [] Token this account will be associated with. | ||
/// 3. Optional: [] Source account that this account will be a delegate for. | ||
NewAccount, | ||
/// Transfers tokens from one account to another either directly or via a delegate. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. `[signer]` Owner of the source account. | ||
/// 1. `[writable]` Source/Delegate account. | ||
/// 2. `[writable]` Destination account. | ||
/// 3. Optional: `[writable]` Source account if key 1 is a delegate account. | ||
Transfer(u64), | ||
/// Approves a delegate. A delegate account is given the authority to transfer | ||
/// another accounts tokens without the other account's owner signing the transfer. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. [signer] Owner of the source account. | ||
/// 1. [] Source account. | ||
/// 2. [writable] Delegate account. | ||
Approve(u64), | ||
/// Sets a new owner of an account. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. [signer] Current owner of the account. | ||
/// 1. [writable] account to change the owner of. | ||
/// 2. [] New owner of the account. | ||
SetOwner, | ||
/// Mints new tokens to an account. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. [signer] Owner of the token. | ||
/// 1. [writable] Token to mint. | ||
/// 2. [writable] Account to mint tokens to. | ||
MintTo(u64), | ||
/// Burns tokens by removing them from an account and the total supply. | ||
/// | ||
/// # Accounts expected by this instruction: | ||
/// | ||
/// 0. [signer] Owner of the account to burn from. | ||
/// 1. [writable] Account to burn from. | ||
/// 2. [writable] Token being burned. | ||
Burn(u64), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
#![deny(missing_docs)] | ||
|
||
//! An ERC20-like Token program for the Solana blockchain | ||
pub mod error; | ||
pub mod instruction; | ||
pub mod processor; | ||
pub mod state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.