Skip to content

Commit

Permalink
Add whitelist-immutable-flex & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Feb 22, 2024
1 parent 7170699 commit e3a57c7
Show file tree
Hide file tree
Showing 19 changed files with 779 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ vending-minter = { version = "3.5.0", path = "contracts/minters/vending-mi
open-edition-factory = { version = "3.5.0", path = "contracts/factories/open-edition-factory" }
open-edition-minter = { version = "3.5.0", path = "contracts/minters/open-edition-minter" }
whitelist-immutable = { version = "3.5.0", path = "contracts/whitelists/whitelist-immutable" }
whitelist-immutable-flex = { version = "3.5.0", path = "contracts/whitelists/whitelist-immutable-flex" }
sg-whitelist-flex = { version = "3.5.0", path = "contracts/whitelists/whitelist-flex" }
ethereum-verify = { version = "3.5.0", path = "packages/ethereum-verify" }
rekt-airdrop = { version = "3.5.0", path = "contracts/rekt-airdrop"}
Expand Down
4 changes: 4 additions & 0 deletions contracts/whitelists/whitelist-immutable-flex/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
15 changes: 15 additions & 0 deletions contracts/whitelists/whitelist-immutable-flex/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build results
/target

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
39 changes: 39 additions & 0 deletions contracts/whitelists/whitelist-immutable-flex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "whitelist-immutable-flex"
authors = ["Michael S<[email protected]>"]
description = "Store-once whitelist for read only use cases"
version = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }
license = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
cw-controllers = "0.16.0"
cw2 = { workspace = true }
cw-utils = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
sg-whitelist = { workspace = true }
sg-std = { workspace = true }
11 changes: 11 additions & 0 deletions contracts/whitelists/whitelist-immutable-flex/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use cosmwasm_schema::write_api;

use whitelist_immutable_flex::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
{
"contract_name": "whitelist-immutable",
"contract_version": "3.5.0",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"required": [
"addresses",
"per_address_limit"
],
"properties": {
"addresses": {
"type": "array",
"items": {
"type": "string"
}
},
"mint_discount_bps": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"per_address_limit": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
},
"execute": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"type": "string",
"enum": []
},
"query": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"oneOf": [
{
"type": "object",
"required": [
"config"
],
"properties": {
"config": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"includes_address"
],
"properties": {
"includes_address": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"admin"
],
"properties": {
"admin": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"address_count"
],
"properties": {
"address_count": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"per_address_limit"
],
"properties": {
"per_address_limit": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
"migrate": null,
"sudo": null,
"responses": {
"address_count": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "uint64",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"admin": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "uint64",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"config": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ConfigResponse",
"type": "object",
"required": [
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/Config"
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"Config": {
"type": "object",
"required": [
"admin",
"per_address_limit"
],
"properties": {
"admin": {
"$ref": "#/definitions/Addr"
},
"mint_discount_bps": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"per_address_limit": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
}
}
},
"includes_address": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Boolean",
"type": "boolean"
},
"per_address_limit": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PerAddressLimitResponse",
"type": "object",
"required": [
"limit"
],
"properties": {
"limit": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
}
}
Loading

0 comments on commit e3a57c7

Please sign in to comment.