Skip to content

Commit 81529d6

Browse files
committed
Move mixed entrypoint macros from burner to queue and add overview
1 parent 5d96ee2 commit 81529d6

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

contracts/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,23 @@ docker run --rm -v "$(pwd)":/code \
4141
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
4242
cosmwasm/rust-optimizer:0.10.5 ./contracts/staking
4343
```
44+
45+
## Entry points
46+
47+
The development contracts in this folder contain a variety of different entry
48+
points in order to demonstrate and test the flexibility we have.
49+
50+
| Contract | Macro | Has `query` | Has `migrate` |
51+
| -------- | --------------------------------------------- | ----------- | ------------- |
52+
| burner | `#[entry_point]` | yes | yes |
53+
| hackatom | [`create_entry_points_with_migration!`][cepm] | yes | yes |
54+
| queue | mixed<sup>1</sup> | yes | yes |
55+
| reflect | [`create_entry_points!`][cep] | yes | no |
56+
| staking | `#[entry_point]` | yes | no |
57+
58+
<sup>1</sup> Because we can. Don't try this at home.
59+
60+
[cepm]:
61+
https://docs.rs/cosmwasm-std/0.13.0/cosmwasm_std/macro.create_entry_points_with_migration.html
62+
[cep]:
63+
https://docs.rs/cosmwasm-std/0.13.0/cosmwasm_std/macro.create_entry_points.html

contracts/burner/src/contract.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use cosmwasm_std::{
55

66
use crate::msg::{HandleMsg, InitMsg, MigrateMsg, QueryMsg};
77

8+
#[entry_point]
89
pub fn init(
910
_deps: DepsMut,
1011
_env: Env,
@@ -16,6 +17,7 @@ pub fn init(
1617
))
1718
}
1819

20+
#[entry_point]
1921
pub fn handle(
2022
_deps: DepsMut,
2123
_env: Env,
@@ -62,6 +64,7 @@ pub fn migrate(
6264
})
6365
}
6466

67+
#[entry_point]
6568
pub fn query(_deps: Deps, _env: Env, _msg: QueryMsg) -> StdResult<QueryResponse> {
6669
Err(StdError::generic_err(
6770
"You can only use this contract for migrations",

contracts/burner/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
pub mod contract;
22
pub mod msg;
3-
4-
#[cfg(target_arch = "wasm32")]
5-
cosmwasm_std::create_entry_points!(contract);

contracts/queue/src/contract.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use schemars::JsonSchema;
44
use serde::{Deserialize, Serialize};
55

66
use cosmwasm_std::{
7-
from_slice, to_binary, to_vec, Binary, Deps, DepsMut, Env, HandleResponse, InitResponse,
8-
MessageInfo, MigrateResponse, Order, QueryResponse, StdResult, Storage,
7+
entry_point, from_slice, to_binary, to_vec, Binary, Deps, DepsMut, Env, HandleResponse,
8+
InitResponse, MessageInfo, MigrateResponse, Order, QueryResponse, StdResult, Storage,
99
};
1010

1111
use crate::msg::{InitMsg, MigrateMsg};
@@ -124,6 +124,7 @@ fn handle_dequeue(deps: DepsMut) -> StdResult<HandleResponse> {
124124
}
125125
}
126126

127+
#[entry_point]
127128
pub fn migrate(
128129
deps: DepsMut,
129130
_env: Env,

contracts/queue/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pub mod contract;
22
pub mod msg;
33

44
#[cfg(target_arch = "wasm32")]
5-
cosmwasm_std::create_entry_points_with_migration!(contract);
5+
cosmwasm_std::create_entry_points!(contract);

0 commit comments

Comments
 (0)