Skip to content

Commit

Permalink
rename cw721 -> cw-ics721
Browse files Browse the repository at this point in the history
  • Loading branch information
taitruong committed Jan 2, 2024
1 parent a2d4965 commit 1fadd3b
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 116 deletions.
157 changes: 79 additions & 78 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ cw721 = { git = "https://github.com/CosmWasm/cw-nfts", branch = "main"} # TODO s
cw721-016 = { version = "0.16.0", package = "cw721" }
cw721-base = { git = "https://github.com/CosmWasm/cw-nfts", branch = "main"} # TODO switch to version 0.18.1/0.19.0, once released
cw721-base-016 = { version = "0.16.0", package = "cw721-base" }
cw721-incoming-proxy = { git = "https://github.com/arkprotocol/cw721-proxy.git", tag = "v0.1.0" }
cw721-outgoing-proxy-rate-limit = { git = "https://github.com/arkprotocol/cw721-proxy.git", tag = "v0.1.0" }
cw-ics721-incoming-proxy = { git = "https://github.com/arkprotocol/cw-ics721-proxy.git", tag = "v0.1.0" }
cw-ics721-incoming-proxy-base = { git = "https://github.com/arkprotocol/cw-ics721-proxy.git", tag = "v0.1.0" }
cw-ics721-outgoing-proxy-rate-limit = { git = "https://github.com/arkprotocol/cw-ics721-proxy.git", tag = "v0.1.0" }
cw-multi-test = { version = "^0.20", features = ["cosmwasm_1_2"] }
cw-utils = "^1.0"
sha2 = "^0.10"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Pause functionality is designed to allow for quick pauses by a trusted group, wi

After a pause, the ICS721 contract will remain paused until governance chooses to unpause it. During the unpause process governance may appoint a new subDAO or reappoint the existing one as pause manager. It is imagined that the admin of this contract will be a chain's community pool, and the pause manager will be a small, active subDAO. This process means that the subDAO may pause the contract in the event of a problem, but may not lock the contract, as in pausing the contract the subDAO burns its ability to do so again.

Filtering is enabled by an optional proxy that the ICS721 contract may be configured to use. If a proxy is configured, the ICS721 contract will only accept NFTs delivered by the proxy address. This proxy interface is very minimal and enables very flexible rate limiting and filtering. Currently, per-collection rate limiting is implemented. Users of this ICS721 contract are encouraged to implement their own filtering regimes and may add them to the [proxy repository](https://github.com/arkprotocol/cw721-proxy) so that others may use them.
Filtering is enabled by an optional proxy that the ICS721 contract may be configured to use. If a proxy is configured, the ICS721 contract will only accept NFTs delivered by the proxy address. This proxy interface is very minimal and enables very flexible rate limiting and filtering. Currently, per-collection rate limiting is implemented. Users of this ICS721 contract are encouraged to implement their own filtering regimes and may add them to the [proxy repository](https://github.com/arkprotocol/cw-ics721-proxy) so that others may use them.

## Failure handling errata

Expand Down
4 changes: 2 additions & 2 deletions contracts/sg-ics721/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cw-multi-test = { workspace = true }
cw-pause-once = { workspace = true }
cw-storage-plus = { workspace = true }
cw721 = { workspace = true}
cw721-incoming-proxy = { workspace = true }
cw721-outgoing-proxy-rate-limit = { workspace = true }
cw-ics721-incoming-proxy-base = { workspace = true }
cw-ics721-outgoing-proxy-rate-limit = { workspace = true }
cw721-base = { workspace = true}
sha2 = { workspace = true }
28 changes: 15 additions & 13 deletions contracts/sg-ics721/src/testing/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl Test {
fn new(
outgoing_proxy: bool,
incoming_proxy: bool,
source_channels: Option<Vec<String>>,
channels: Option<Vec<String>>,
admin_and_pauser: Option<String>,
cw721_code: Box<dyn Contract<Empty>>,
) -> Self {
Expand All @@ -307,10 +307,12 @@ impl Test {
let proxy_id = app.store_code(outgoing_proxy_contract());
Some(ContractInstantiateInfo {
code_id: proxy_id,
msg: to_json_binary(&cw721_outgoing_proxy_rate_limit::msg::InstantiateMsg {
rate_limit: cw721_outgoing_proxy_rate_limit::Rate::PerBlock(10),
origin: None,
})
msg: to_json_binary(
&cw_ics721_outgoing_proxy_rate_limit::msg::InstantiateMsg {
rate_limit: cw_ics721_outgoing_proxy_rate_limit::Rate::PerBlock(10),
origin: None,
},
)
.unwrap(),
admin: Some(Admin::Instantiator {}),
label: "outgoing proxy rate limit".to_string(),
Expand All @@ -324,9 +326,9 @@ impl Test {
let proxy_id = app.store_code(incoming_proxy_contract());
Some(ContractInstantiateInfo {
code_id: proxy_id,
msg: to_json_binary(&cw721_incoming_proxy::msg::InstantiateMsg {
msg: to_json_binary(&cw_ics721_incoming_proxy_base::msg::InstantiateMsg {
origin: None,
source_channels,
channels,
})
.unwrap(),
admin: Some(Admin::Instantiator {}),
Expand Down Expand Up @@ -546,18 +548,18 @@ fn ics721_contract() -> Box<dyn Contract<Empty>> {

fn incoming_proxy_contract() -> Box<dyn Contract<Empty>> {
let contract = ContractWrapper::new(
cw721_incoming_proxy::contract::execute,
cw721_incoming_proxy::contract::instantiate,
cw721_incoming_proxy::contract::query,
cw_ics721_incoming_proxy_base::contract::execute,
cw_ics721_incoming_proxy_base::contract::instantiate,
cw_ics721_incoming_proxy_base::contract::query,
);
Box::new(contract)
}

fn outgoing_proxy_contract() -> Box<dyn Contract<Empty>> {
let contract = ContractWrapper::new(
cw721_outgoing_proxy_rate_limit::contract::execute,
cw721_outgoing_proxy_rate_limit::contract::instantiate,
cw721_outgoing_proxy_rate_limit::contract::query,
cw_ics721_outgoing_proxy_rate_limit::contract::execute,
cw_ics721_outgoing_proxy_rate_limit::contract::instantiate,
cw_ics721_outgoing_proxy_rate_limit::contract::query,
);
Box::new(contract)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ics721/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ ics721-types = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true }
cw-paginate-storage = { workspace = true }
cw721-incoming-proxy = { workspace = true }
cw-pause-once = { workspace = true }
cw-cii = { workspace = true }
sha2 = { workspace = true }
zip-optional = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
cw-ics721-incoming-proxy-base = { workspace = true }
cw-ics721-outgoing-proxy-rate-limit = { workspace = true }
cw-multi-test = { workspace = true }
cw2 = { workspace = true }
cw721-016 = { workspace = true }
cw721-outgoing-proxy-rate-limit = { workspace = true }
8 changes: 4 additions & 4 deletions packages/ics721/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,22 @@ where
}
from_json::<IbcOutgoingProxyMsg>(msg.clone())
.ok()
.and_then(|msg| {
.map(|msg| {
let mut info = info;
match deps.api.addr_validate(&msg.collection) {
Ok(collection_addr) => {
// set collection address as (initial) sender
info.sender = collection_addr;
Some(self.receive_nft(
self.receive_nft(
deps,
env,
info,
TokenId::new(token_id),
nft_owner,
msg.msg,
))
)
}
Err(err) => Some(Err(ContractError::Std(err))),
Err(err) => Err(ContractError::Std(err)),
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ics721/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(crate) fn ack_callback_msg(

/// If there is an incoming proxy, let proxy validate the packet, in case it fails, we fail the transfer
/// This proxy for example whitelist channels that can send to this contract:
/// https://github.com/arkprotocol/cw721-proxy/tree/main/contracts/cw721-incoming-proxy
/// https://github.com/arkprotocol/cw-ics721-proxy/tree/main/contracts/cw-ics721-incoming-proxy-base
pub(crate) fn get_incoming_proxy_msg(
storage: &dyn Storage,
packet: IbcPacket,
Expand Down
Loading

0 comments on commit 1fadd3b

Please sign in to comment.