Skip to content

Commit 43ce39d

Browse files
Add Inflow Proxy contract (#347)
* Add mock proxy forwarder contract * Inflow Proxy contract implementation * addressed PR comments * recompiled contracts, regenerated schema * moved changelog entry into right folder * addressed PR comment --------- Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
1 parent c1b3222 commit 43ce39d

38 files changed

+1736
-182
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add an Inflow proxy contract that allows permissionlessly forwarding deposits to Inflow, and gates withdrawals to only be callable by a designated admin. ([\#347](https://github.com/informalsystems/hydro/pull/347))

Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ members = [
1111
"contracts/gatekeeper",
1212
"contracts/inflow/vault",
1313
"contracts/inflow/control-center",
14+
"contracts/inflow/proxy",
1415
"packages/cw-orch-interface",
1516
"packages/interface",
17+
"packages/test-utils",
1618
"test/e2e",
1719
]
1820
resolver = "2"

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ schema:
4545
cd contracts/gatekeeper && cargo run --bin gatekeeper_schema
4646
cd contracts/marketplace && cargo run --bin marketplace_schema
4747
cd contracts/inflow/vault && cargo run --bin inflow_vault_schema
48+
cd contracts/inflow/proxy && cargo run --bin inflow_proxy_schema
4849
cd contracts/inflow/control-center && cargo run --bin inflow_control_center_schema
4950

5051
$(MAKE) ts-codegen-inner SCHEMA_LOCATION=./contracts/hydro/schema NAME=HydroBase
@@ -56,6 +57,7 @@ schema:
5657
$(MAKE) ts-codegen-inner SCHEMA_LOCATION=./contracts/gatekeeper/schema NAME=GatekeeperBase
5758
$(MAKE) ts-codegen-inner SCHEMA_LOCATION=./contracts/marketplace/schema NAME=MarketplaceBase
5859
$(MAKE) ts-codegen-inner SCHEMA_LOCATION=./contracts/inflow/vault/schema NAME=InflowVaultBase
60+
$(MAKE) ts-codegen-inner SCHEMA_LOCATION=./contracts/inflow/proxy/schema NAME=InflowProxyBase
5961
$(MAKE) ts-codegen-inner SCHEMA_LOCATION=./contracts/inflow/control-center/schema NAME=InflowControlCenterBase
6062

6163
ts-codegen-inner:

artifacts/checksums.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ d062fb428609edf49aa6cfd94c7660812d555e190a0d60dd74cd866783ab7440 d_token_info_p
66
08bb8e57954d5be8ada802fe88343e76fb69702583ef3e9417fbefe07488fac8 liquid_collateral.wasm
77
52d879641c2fc5a572a51a483be661f511dc6d13f54ab4d7ab95ee0158bea563 lsm_token_info_provider.wasm
88
d0fba7e337da1f00b3f0e8987530fbdfda53a89a81a5767516372a97fe3b0a67 marketplace.wasm
9+
76701e6e9c5d49ead12bb278b66fca39f988f0599febbd18a146f8c4a150c315 proxy.wasm
910
32a36e944eaf8f7c527dc95db123a9779830e1f1d69a804411d7036caf25822a st_token_info_provider.wasm
1011
b0dfafc02e2e752bc9edb87f34c352f2759cdb3ef5d009c991aa2206407df0e4 tribute.wasm
11-
41046d132fab35f4047b94789527c03d81439ffbab0d237d9b2755f58335451a vault.wasm
12+
0756364fb18379a1c206953f276369d95dd36979974152364854d7bb06f6f2b6 vault.wasm

artifacts/proxy.wasm

245 KB
Binary file not shown.

artifacts/vault.wasm

56 Bytes
Binary file not shown.

contracts/inflow/proxy/Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "proxy"
3+
version = { workspace = true }
4+
edition = { workspace = true }
5+
6+
[lib]
7+
crate-type = ["cdylib", "rlib"]
8+
9+
[features]
10+
library = []
11+
12+
[dependencies]
13+
cosmwasm-std = { workspace = true }
14+
cosmwasm-schema = { workspace = true }
15+
cw-storage-plus = { workspace = true }
16+
cw2 = { workspace = true }
17+
serde = { workspace = true }
18+
schemars = { workspace = true }
19+
thiserror = { workspace = true }
20+
interface = { path = "../../../packages/interface" }
21+
22+
[dev-dependencies]
23+
test-utils = { path = "../../../packages/test-utils" }
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
"contract_name": "proxy",
3+
"contract_version": "3.6.5",
4+
"idl_version": "1.0.0",
5+
"instantiate": {
6+
"$schema": "http://json-schema.org/draft-07/schema#",
7+
"title": "InstantiateMsg",
8+
"type": "object",
9+
"required": [
10+
"admins",
11+
"control_centers"
12+
],
13+
"properties": {
14+
"admins": {
15+
"type": "array",
16+
"items": {
17+
"type": "string"
18+
}
19+
},
20+
"control_centers": {
21+
"type": "array",
22+
"items": {
23+
"type": "string"
24+
}
25+
}
26+
},
27+
"additionalProperties": false
28+
},
29+
"execute": {
30+
"$schema": "http://json-schema.org/draft-07/schema#",
31+
"title": "ExecuteMsg",
32+
"oneOf": [
33+
{
34+
"type": "object",
35+
"required": [
36+
"forward_to_inflow"
37+
],
38+
"properties": {
39+
"forward_to_inflow": {
40+
"type": "object",
41+
"additionalProperties": false
42+
}
43+
},
44+
"additionalProperties": false
45+
},
46+
{
47+
"type": "object",
48+
"required": [
49+
"withdraw_receipt_tokens"
50+
],
51+
"properties": {
52+
"withdraw_receipt_tokens": {
53+
"type": "object",
54+
"required": [
55+
"address",
56+
"coin"
57+
],
58+
"properties": {
59+
"address": {
60+
"type": "string"
61+
},
62+
"coin": {
63+
"$ref": "#/definitions/Coin"
64+
}
65+
},
66+
"additionalProperties": false
67+
}
68+
},
69+
"additionalProperties": false
70+
},
71+
{
72+
"type": "object",
73+
"required": [
74+
"withdraw_funds"
75+
],
76+
"properties": {
77+
"withdraw_funds": {
78+
"type": "object",
79+
"required": [
80+
"address",
81+
"coin"
82+
],
83+
"properties": {
84+
"address": {
85+
"type": "string"
86+
},
87+
"coin": {
88+
"$ref": "#/definitions/Coin"
89+
}
90+
},
91+
"additionalProperties": false
92+
}
93+
},
94+
"additionalProperties": false
95+
}
96+
],
97+
"definitions": {
98+
"Coin": {
99+
"type": "object",
100+
"required": [
101+
"amount",
102+
"denom"
103+
],
104+
"properties": {
105+
"amount": {
106+
"$ref": "#/definitions/Uint128"
107+
},
108+
"denom": {
109+
"type": "string"
110+
}
111+
},
112+
"additionalProperties": false
113+
},
114+
"Uint128": {
115+
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
116+
"type": "string"
117+
}
118+
}
119+
},
120+
"query": {
121+
"$schema": "http://json-schema.org/draft-07/schema#",
122+
"title": "QueryMsg",
123+
"oneOf": [
124+
{
125+
"type": "object",
126+
"required": [
127+
"config"
128+
],
129+
"properties": {
130+
"config": {
131+
"type": "object",
132+
"additionalProperties": false
133+
}
134+
},
135+
"additionalProperties": false
136+
}
137+
]
138+
},
139+
"migrate": null,
140+
"sudo": null,
141+
"responses": {
142+
"config": {
143+
"$schema": "http://json-schema.org/draft-07/schema#",
144+
"title": "ConfigResponse",
145+
"type": "object",
146+
"required": [
147+
"config"
148+
],
149+
"properties": {
150+
"config": {
151+
"$ref": "#/definitions/Config"
152+
}
153+
},
154+
"additionalProperties": false,
155+
"definitions": {
156+
"Addr": {
157+
"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.",
158+
"type": "string"
159+
},
160+
"Config": {
161+
"type": "object",
162+
"required": [
163+
"admins",
164+
"control_centers"
165+
],
166+
"properties": {
167+
"admins": {
168+
"type": "array",
169+
"items": {
170+
"$ref": "#/definitions/Addr"
171+
}
172+
},
173+
"control_centers": {
174+
"type": "array",
175+
"items": {
176+
"$ref": "#/definitions/Addr"
177+
}
178+
}
179+
},
180+
"additionalProperties": false
181+
}
182+
}
183+
}
184+
}
185+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "ExecuteMsg",
4+
"oneOf": [
5+
{
6+
"type": "object",
7+
"required": [
8+
"forward_to_inflow"
9+
],
10+
"properties": {
11+
"forward_to_inflow": {
12+
"type": "object",
13+
"additionalProperties": false
14+
}
15+
},
16+
"additionalProperties": false
17+
},
18+
{
19+
"type": "object",
20+
"required": [
21+
"withdraw_receipt_tokens"
22+
],
23+
"properties": {
24+
"withdraw_receipt_tokens": {
25+
"type": "object",
26+
"required": [
27+
"address",
28+
"coin"
29+
],
30+
"properties": {
31+
"address": {
32+
"type": "string"
33+
},
34+
"coin": {
35+
"$ref": "#/definitions/Coin"
36+
}
37+
},
38+
"additionalProperties": false
39+
}
40+
},
41+
"additionalProperties": false
42+
},
43+
{
44+
"type": "object",
45+
"required": [
46+
"withdraw_funds"
47+
],
48+
"properties": {
49+
"withdraw_funds": {
50+
"type": "object",
51+
"required": [
52+
"address",
53+
"coin"
54+
],
55+
"properties": {
56+
"address": {
57+
"type": "string"
58+
},
59+
"coin": {
60+
"$ref": "#/definitions/Coin"
61+
}
62+
},
63+
"additionalProperties": false
64+
}
65+
},
66+
"additionalProperties": false
67+
}
68+
],
69+
"definitions": {
70+
"Coin": {
71+
"type": "object",
72+
"required": [
73+
"amount",
74+
"denom"
75+
],
76+
"properties": {
77+
"amount": {
78+
"$ref": "#/definitions/Uint128"
79+
},
80+
"denom": {
81+
"type": "string"
82+
}
83+
},
84+
"additionalProperties": false
85+
},
86+
"Uint128": {
87+
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
88+
"type": "string"
89+
}
90+
}
91+
}

0 commit comments

Comments
 (0)