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

Hooks in staking contract #180

Merged
merged 27 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
6 changes: 4 additions & 2 deletions contracts/cw3-dao/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ pub fn instantiate(
admin: Some(env.contract.address.to_string()),
label,
msg: to_binary(&stake_cw20::msg::InstantiateMsg {
admin: Some(env.contract.address),
owner: Some(env.contract.address),
manager: None,
unstaking_duration,
token_address: cw20_addr.addr(),
})?,
Expand Down Expand Up @@ -741,7 +742,8 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result<Response, ContractEr
admin: Some(env.contract.address.to_string()),
label: env.contract.address.to_string(),
msg: to_binary(&stake_cw20::msg::InstantiateMsg {
admin: Some(env.contract.address),
owner: Some(env.contract.address),
manager: None,
unstaking_duration,
token_address: cw20_addr,
})?,
Expand Down
3 changes: 2 additions & 1 deletion contracts/stake-cw20/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use cw20::{
TokenInfoResponse,
};
use stake_cw20::msg::{
ClaimsResponse, ExecuteMsg, GetConfigResponse, InstantiateMsg, QueryMsg,
ClaimsResponse, ExecuteMsg, GetConfigResponse, GetHooksResponse, InstantiateMsg, QueryMsg,
StakedBalanceAtHeightResponse, StakedValueResponse, TotalStakedAtHeightResponse,
TotalValueResponse,
};
Expand All @@ -27,6 +27,7 @@ fn main() {
export_schema(&schema_for!(StakedValueResponse), &out_dir);
export_schema(&schema_for!(TotalValueResponse), &out_dir);
export_schema(&schema_for!(GetConfigResponse), &out_dir);
export_schema(&schema_for!(GetHooksResponse), &out_dir);
export_schema(&schema_for!(ClaimsResponse), &out_dir);
export_schema(&schema_for!(AllowanceResponse), &out_dir);
export_schema(&schema_for!(BalanceResponse), &out_dir);
Expand Down
56 changes: 53 additions & 3 deletions contracts/stake-cw20/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,17 @@
"update_config": {
"type": "object",
"properties": {
"admin": {
"duration": {
"anyOf": [
{
"$ref": "#/definitions/Duration"
},
{
"type": "null"
}
]
},
"manager": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
Expand All @@ -65,10 +75,10 @@
}
]
},
"duration": {
"owner": {
"anyOf": [
{
"$ref": "#/definitions/Duration"
"$ref": "#/definitions/Addr"
},
{
"type": "null"
Expand All @@ -79,6 +89,46 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"add_hook"
],
"properties": {
"add_hook": {
"type": "object",
"required": [
"addr"
],
"properties": {
"addr": {
"$ref": "#/definitions/Addr"
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"remove_hook"
],
"properties": {
"remove_hook": {
"type": "object",
"required": [
"addr"
],
"properties": {
"addr": {
"$ref": "#/definitions/Addr"
}
}
}
},
"additionalProperties": false
}
],
"definitions": {
Expand Down
12 changes: 11 additions & 1 deletion contracts/stake-cw20/schema/get_config_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
"token_address"
],
"properties": {
"admin": {
"manager": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
},
{
"type": "null"
}
]
},
"owner": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
Expand Down
16 changes: 16 additions & 0 deletions contracts/stake-cw20/schema/get_hooks_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GetHooksResponse",
"type": "object",
"required": [
"hooks"
],
"properties": {
"hooks": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
12 changes: 11 additions & 1 deletion contracts/stake-cw20/schema/instantiate_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
"token_address"
],
"properties": {
"admin": {
"manager": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
},
{
"type": "null"
}
]
},
"owner": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
Expand Down
12 changes: 12 additions & 0 deletions contracts/stake-cw20/schema/query_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_hooks"
],
"properties": {
"get_hooks": {
"type": "object"
}
},
"additionalProperties": false
}
]
}
Loading