Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shade protocol #153

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c666c8a
rough start on shade adapter
DrPresident Dec 9, 2024
ef5c55a
need to fix error types
DrPresident Dec 9, 2024
404bd24
switch storage to a single object
DrPresident Dec 9, 2024
91cdcbf
shade protocol contract building
DrPresident Dec 10, 2024
ea1a105
contract building, no tests
DrPresident Dec 10, 2024
8be7000
rough start on entry point
DrPresident Dec 10, 2024
d919849
moved more skip code into contract
DrPresident Dec 10, 2024
276598b
secret-skip package builds
DrPresident Dec 11, 2024
69c8a6c
secret-entry-point close but needs ibc compatibility
DrPresident Dec 11, 2024
2f797ca
switched to secret-skip package
DrPresident Dec 11, 2024
470c1e4
added secret-skip to cargo.toml
DrPresident Dec 11, 2024
e65341f
secret entry point building
DrPresident Dec 16, 2024
43a77b8
all contracts building
DrPresident Dec 17, 2024
52cac14
clean up warnings and tidy up types
DrPresident Dec 17, 2024
4f2b852
execute receive test passing
DrPresident Dec 17, 2024
c0e5c01
cleaned cargo toml
DrPresident Dec 17, 2024
75b84f2
execute receive test passing
DrPresident Dec 19, 2024
50907c1
1 test passing for ibc hook
DrPresident Dec 19, 2024
ee7c8b6
ibc hook tests passing
DrPresident Dec 20, 2024
419b78b
reworked some things
DrPresident Dec 20, 2024
8940e42
error instantiate case
DrPresident Dec 20, 2024
97d7ba1
instantiate and reply tests passing
DrPresident Dec 20, 2024
26942e0
execute swap tests
DrPresident Dec 20, 2024
e8a171b
transfer funds back query not working yet
DrPresident Dec 26, 2024
9ba48a5
transfer funds working
DrPresident Dec 26, 2024
fc5f5df
fixed builds with secret contracts
DrPresident Jan 6, 2025
2883b8f
contracts building into wasm
DrPresident Jan 6, 2025
48c8235
Update contracts/adapters/ibc/secret-ibc-hooks/README.md
DrPresident Jan 16, 2025
336a031
Update contracts/adapters/ibc/secret-ibc-hooks/src/contract.rs
DrPresident Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
621 changes: 497 additions & 124 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
resolver = "2"
members = [
"contracts/entry-point",
"contracts/secret-entry-point",
"contracts/adapters/hyperlane",
"contracts/adapters/ibc/*",
"contracts/adapters/swap/*",
Expand Down Expand Up @@ -52,6 +53,7 @@ serde = { version = "1.0.194", default-features = false, features
serde-cw-value = "0.7.0"
serde-json-wasm = "1.0.1"
skip = { version = "0.3.0", path = "./packages/skip" }
secret-skip = { version = "0.3.0", path = "./packages/secret-skip" }
test-case = "3.3.1"
thiserror = "1"
white-whale-std = "1.1.1"
Expand Down
43 changes: 43 additions & 0 deletions contracts/adapters/ibc/secret-ibc-hooks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[package]
name = "skip-go-secret-ibc-adapter-ibc-hooks"
version = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }
documentation = { workspace = true }
keywords = { workspace = true }

[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 }
cw2 = { workspace = true }
cw20 = { workspace = true }
#cw-storage-plus = { workspace = true }
ibc-proto = { workspace = true }
prost = { workspace = true }
serde-json-wasm = { workspace = true }
serde-cw-value = { workspace = true }
# skip = { workspace = true }
thiserror = { workspace = true }

secret-skip = { workspace = true }
serde = "1.0.114"
schemars = "0.8.1"
secret-toolkit = { git = "https://github.com/scrtlabs/secret-toolkit", tag = "v0.10.0" }
secret-storage-plus = { git = "https://github.com/securesecrets/secret-plus-utils", tag = "v0.1.1", features = [] }
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.11"}

[dev-dependencies]
test-case = { workspace = true }
68 changes: 68 additions & 0 deletions contracts/adapters/ibc/secret-ibc-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Osmosis IBC Transfer Adapter Contract
DrPresident marked this conversation as resolved.
Show resolved Hide resolved

The Osmosis IBC Transfer adapter contract is responsible for:
1. Dispatching the IBC transfer.
2. Failing the entire transaction if the IBC transfer errors on the swap chain (sending the caller back their original funds).
3. Refunding the caller on the swap chain if the IBC transfer errors or times out once it reaches the destination chain.

WARNING: Do not send funds directly to the contract without calling one of its functions. Funds sent directly to the contract do not trigger any contract logic that performs validation / safety checks (as the Cosmos SDK handles direct fund transfers in the `Bank` module and not the `Wasm` module). There are no explicit recovery mechanisms for accidentally sent funds.

## InstantiateMsg

Instantiates a new Osmosis IBC Transfer adapter contract.

``` json
{}
```

## ExecuteMsg

### `ibc_transfer`

Dispatches an ICS-20 IBC Transfer given the parameters provided in the contract call.

Note: Fees sent as parameters with the contract call are unused by the contract since Osmosis currently does not require ICS-29 fees for outgoing ibc transfers. The fee field is still included in the call data to keep the interface the same across all IBC transfer adapter contracts.

``` json
{
"ibc_transfer": {
"info": {
"source_channel": "channel-1",
"receiver": "cosmos...",
"fee": {
"recv_fee": [],
"ack_fee": [],
"timeout_fee": []
},
"memo": "",
"recover_address": "osmo..."
},
"coin": {
"denom": "uosmo",
"amount": "1000000"
},
"timeout_timestamp": 1000000000000
}
}
```

## QueryMsg

### `in_progress_recover_address`

Returns the in progress recover address associated with the given `channel_id` and `sequence_id` (which make up a unique identifier mapped to in progress ibc transfers in the sub msg reply handler).

Query:
``` json
{
"in_progress_recover_address": {
"channel_id": "channel-1",
"sequence_id": 420
}
}
```

Response:
``` json
"osmo..."
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use cosmwasm_schema::write_api;
use secret_skip::ibc::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg
}
}
Loading