First commit

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-01-21 19:21:46 +01:00
commit 66172881a1
18 changed files with 2728 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.anchor
.DS_Store
target
**/*.rs.bk
node_modules
.idea

12
Anchor.toml Normal file
View File

@ -0,0 +1,12 @@
[programs.localnet]
mango_v4 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
[registry]
url = "https://anchor.projectserum.com"
[provider]
cluster = "localnet"
wallet = "/Users/mc/.config/solana/id.json"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

1362
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

4
Cargo.toml Normal file
View File

@ -0,0 +1,4 @@
[workspace]
members = [
"programs/*"
]

5
README.md Normal file
View File

@ -0,0 +1,5 @@
Development
* rustc 1.57.0 (f1edd0429 2021-11-29)
* anchor-cli 0.20.1
* npm 8.1.2
* node v16.13.1

12
migrations/deploy.ts Normal file
View File

@ -0,0 +1,12 @@
// Migrations are an early feature. Currently, they're nothing more than this
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.
const anchor = require("@project-serum/anchor");
module.exports = async function (provider) {
// Configure client to use the provider.
anchor.setProvider(provider);
// Add your deploy script here.
}

12
package.json Normal file
View File

@ -0,0 +1,12 @@
{
"dependencies": {
"@project-serum/anchor": "^0.20.1"
},
"devDependencies": {
"chai": "^4.3.4",
"mocha": "^9.0.3",
"ts-mocha": "^8.0.0",
"@types/mocha": "^9.0.0",
"typescript": "^4.3.5"
}
}

View File

@ -0,0 +1,21 @@
[package]
name = "mango-v4"
version = "0.1.0"
description = "Created with Anchor"
edition = "2018"
[lib]
crate-type = ["cdylib", "lib"]
name = "mango_v4"
[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = "0.20.1"
anchor-spl = "0.20.1"
static_assertions = "1.1"

View File

@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []

View File

@ -0,0 +1,7 @@
use anchor_lang::prelude::*;
#[error]
pub enum ErrorCode {
#[msg("")]
SomeError,
}

View File

@ -0,0 +1,11 @@
use anchor_lang::prelude::*;
use crate::error::*;
#[derive(Accounts)]
pub struct Initialize {}
pub fn handler(ctx: Context<Initialize>) -> ProgramResult {
require!(1==1, ErrorCode::SomeError);
Ok(())
}

View File

@ -0,0 +1,3 @@
pub use initialiaze::*;
pub mod initialiaze;

View File

@ -0,0 +1,22 @@
#[macro_use]
extern crate static_assertions;
use anchor_lang::prelude::*;
mod state;
mod instructions;
mod error;
use instructions::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod mango_v4 {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> ProgramResult {
instructions::initialiaze::handler(ctx)
}
}

View File

4
run-tests.sh Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cargo test-bpf

17
tests/mango-v4.ts Normal file
View File

@ -0,0 +1,17 @@
import * as anchor from '@project-serum/anchor';
import { Program } from '@project-serum/anchor';
import { MangoV4 } from '../target/types/mango_v4';
describe('mango-v4', () => {
// Configure the client to use the local cluster.
anchor.setProvider(anchor.Provider.env());
const program = anchor.workspace.MangoV4 as Program<MangoV4>;
it('Is initialized!', async () => {
// Add your test here.
const tx = await program.rpc.initialize({});
console.log("Your transaction signature", tx);
});
});

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2015"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
}

1217
yarn.lock Normal file

File diff suppressed because it is too large Load Diff