Run permissioned tests against local crate (#201)
This commit is contained in:
parent
6b1f166e9b
commit
57b9281374
|
@ -62,9 +62,9 @@ checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483"
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-access-control"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cb6a4b9c53ca04146d47df41db96e79ca3fd1fe60ba2691b317648a5e314bbd"
|
||||
checksum = "13e53fd8d0aa034bb2e647c39eec4e399095438dbc83526949ac6a072e3c4ce7"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -76,9 +76,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-account"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "568fdd7655eca414649cba63c10d34856569aa07acc5996d50eaf74e28495f80"
|
||||
checksum = "362b1b119372b38cdd45949bd8f09a8f5c56a701d49a747fc43d7a59393b647f"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -91,9 +91,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-error"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1653f067f9830a3851d3171c3a5b94b4a25780369e7d57961a3d8eff0dff5272"
|
||||
checksum = "41c8be43ca34309afcafb24274bba6733b6b5d59be47f1cc11ef3afe9584e5cd"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"proc-macro2 1.0.24",
|
||||
|
@ -103,9 +103,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-event"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0e5631befc10143e6c64dea1ce4d1106300ab06f8b82e33c33bacb076057402"
|
||||
checksum = "899640f277f8296da82d6505312b03a4cd4901c3c6d6fe8eb3ca2db33f26ebb9"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -116,9 +116,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-interface"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32f56e9d28f58effb298763e6397ebadfb7b84e3a853fd1995d8316d4d76fe5d"
|
||||
checksum = "f514a6502a0ad56f321df492f1c699ee8ad3912c6354acd087f3d28431a0fac4"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -130,9 +130,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-program"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c1f2ba3fe5da5f5653742781d0fcecbddb7105e4f933ba968802a2e10db294c"
|
||||
checksum = "fadc2f9bcaeb3be4a8efb76c455bc772b5d257c01796b415eb3aa4bd93ed43fe"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -143,9 +143,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-attribute-state"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3086b3196184a98f8ff1fe4584c4f391c686bf38cfab2cbfac9f224cdcfef5cd"
|
||||
checksum = "adbff8f1a2b53a42ef547f3188e25f7e3d6933113ab0f94b11afb825eee80f47"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -156,9 +156,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-derive-accounts"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "640ae4b58427c05900d4903bd5a042fc7841272977d643b3e7f3ea73f6704720"
|
||||
checksum = "458185d8bd23559f6ed35c4a7a7d0f83ac4d7837b2e790d90e50cafc9371503e"
|
||||
dependencies = [
|
||||
"anchor-syn",
|
||||
"anyhow",
|
||||
|
@ -169,9 +169,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-lang"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c38773566b5111c76f47cb33c93a82b86131cb35405587a90be639de904cf00"
|
||||
checksum = "46dd615c2eb55d88de8800c46fa7ed51ef045d76ed669222a798976d0a447f59"
|
||||
dependencies = [
|
||||
"anchor-attribute-access-control",
|
||||
"anchor-attribute-account",
|
||||
|
@ -190,12 +190,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-spl"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c995dfac730f6ead86280aa32636e0abd6ec3189dd42e37cc3be4df380cc7008"
|
||||
checksum = "a6d6c8fbc834319618581a4e19807a30e76326b9981abd069addb55acf0647db"
|
||||
dependencies = [
|
||||
"anchor-lang",
|
||||
"lazy_static",
|
||||
"serum_dex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-program",
|
||||
"spl-associated-token-account",
|
||||
|
@ -204,9 +203,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anchor-syn"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dda645a57fe2222560ebb5fde2e22d6fd1e2b65dd7ba14250c468b285bd615f"
|
||||
checksum = "77faec86e3bf8e15568d026bd586e381910610544aa0b2642b942b37698029e5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bs58 0.3.1",
|
||||
|
@ -711,22 +710,6 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a50aab2529019abfabfa93f1e6c41ef392f91fbf179b347a7e96abb524884a08"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"regex",
|
||||
"terminal_size",
|
||||
"unicode-width",
|
||||
"winapi 0.3.9",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.14.1"
|
||||
|
@ -1723,7 +1706,7 @@ version = "0.15.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4"
|
||||
dependencies = [
|
||||
"console 0.13.0",
|
||||
"console 0.14.1",
|
||||
"lazy_static",
|
||||
"number_prefix",
|
||||
"regex",
|
||||
|
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
anchor-lang = "0.18.0"
|
||||
anchor-spl = "0.18.0"
|
||||
serum_dex = { path = "../" }
|
||||
anchor-lang = "0.18.2"
|
||||
anchor-spl = { version = "0.18.2", features = ["dex"] }
|
||||
serum_dex = { path = "../", features = ["no-entrypoint"] }
|
||||
spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
|
||||
|
|
|
@ -3,3 +3,4 @@ mod proxy;
|
|||
|
||||
pub use middleware::*;
|
||||
pub use proxy::*;
|
||||
pub use serum_dex;
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
cluster = "localnet"
|
||||
wallet = "~/.config/solana/id.json"
|
||||
|
||||
[programs.localnet]
|
||||
permissioned_markets = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
|
||||
|
||||
[[test.genesis]]
|
||||
address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"
|
||||
program = "../../target/deploy/serum_dex.so"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "permissioned-markets-quickstart",
|
||||
"name": "permissioned-markets",
|
||||
"version": "1.0.0",
|
||||
"description": "This repo demonstrates how to create \"permissioned markets\" on Serum via a proxy smart contract. A permissioned market is a regular Serum market with an additional open orders authority, which must sign every transaction to create an open orders account.",
|
||||
"main": "index.js",
|
||||
|
@ -23,7 +23,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/project-serum/permissioned-markets-quickstart#readme",
|
||||
"devDependencies": {
|
||||
"@project-serum/anchor": "^0.18.0",
|
||||
"@project-serum/anchor": "^0.18.2",
|
||||
"@project-serum/anchor-cli": "^0.18.2",
|
||||
"@project-serum/common": "^0.0.1-beta.3",
|
||||
"@project-serum/serum": "^0.13.55",
|
||||
|
|
|
@ -15,6 +15,8 @@ cpi = ["no-entrypoint"]
|
|||
default = []
|
||||
|
||||
[dependencies]
|
||||
anchor-lang = "0.13.2"
|
||||
anchor-spl = "0.13.2"
|
||||
solana-program = "=1.7.8"
|
||||
anchor-lang = "0.18.2"
|
||||
anchor-spl = { version = "0.18.2", features = ["dex"] }
|
||||
serum_dex = { path = "../../../../" }
|
||||
serum-dex-permissioned = { path = "../../../../permissioned" }
|
||||
solana-program = "1.8.0"
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// Note. This example depends on unreleased Serum DEX changes.
|
||||
|
||||
use anchor_lang::prelude::*;
|
||||
use anchor_spl::dex::serum_dex::instruction::{CancelOrderInstructionV2, NewOrderInstructionV3};
|
||||
use anchor_spl::dex::{
|
||||
use serum_dex_permissioned::serum_dex::instruction::{
|
||||
CancelOrderInstructionV2, NewOrderInstructionV3,
|
||||
};
|
||||
use serum_dex_permissioned::{
|
||||
Context, Logger, MarketMiddleware, MarketProxy, OpenOrdersPda, ReferralFees,
|
||||
};
|
||||
use solana_program::account_info::AccountInfo;
|
||||
|
@ -10,6 +12,8 @@ use solana_program::entrypoint::ProgramResult;
|
|||
use solana_program::pubkey::Pubkey;
|
||||
use solana_program::sysvar::rent;
|
||||
|
||||
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
|
||||
|
||||
/// # Permissioned Markets
|
||||
///
|
||||
/// This demonstrates how to create "permissioned markets" on Serum via a proxy.
|
||||
|
@ -89,7 +93,7 @@ impl MarketMiddleware for Identity {
|
|||
///
|
||||
/// 0. Authorization token.
|
||||
/// ..
|
||||
fn new_order_v3(&self, ctx: &mut Context, _ix: &NewOrderInstructionV3) -> ProgramResult {
|
||||
fn new_order_v3(&self, ctx: &mut Context, _ix: &mut NewOrderInstructionV3) -> ProgramResult {
|
||||
verify_and_strip_auth(ctx)
|
||||
}
|
||||
|
||||
|
@ -97,7 +101,11 @@ impl MarketMiddleware for Identity {
|
|||
///
|
||||
/// 0. Authorization token.
|
||||
/// ..
|
||||
fn cancel_order_v2(&self, ctx: &mut Context, _ix: &CancelOrderInstructionV2) -> ProgramResult {
|
||||
fn cancel_order_v2(
|
||||
&self,
|
||||
ctx: &mut Context,
|
||||
_ix: &mut CancelOrderInstructionV2,
|
||||
) -> ProgramResult {
|
||||
verify_and_strip_auth(ctx)
|
||||
}
|
||||
|
||||
|
@ -105,7 +113,11 @@ impl MarketMiddleware for Identity {
|
|||
///
|
||||
/// 0. Authorization token.
|
||||
/// ..
|
||||
fn cancel_order_by_client_id_v2(&self, ctx: &mut Context, _client_id: u64) -> ProgramResult {
|
||||
fn cancel_order_by_client_id_v2(
|
||||
&self,
|
||||
ctx: &mut Context,
|
||||
_client_id: &mut u64,
|
||||
) -> ProgramResult {
|
||||
verify_and_strip_auth(ctx)
|
||||
}
|
||||
|
||||
|
@ -129,7 +141,7 @@ impl MarketMiddleware for Identity {
|
|||
///
|
||||
/// 0. Authorization token (revoked).
|
||||
/// ..
|
||||
fn prune(&self, ctx: &mut Context, _limit: u16) -> ProgramResult {
|
||||
fn prune(&self, ctx: &mut Context, _limit: &mut u16) -> ProgramResult {
|
||||
verify_revoked_and_strip_auth(ctx)?;
|
||||
|
||||
// Sign with the prune authority.
|
||||
|
|
Loading…
Reference in New Issue