Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ariesgun committed Jun 18, 2024
1 parent 095b7b2 commit d047f2e
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 53 deletions.
8 changes: 6 additions & 2 deletions contracts/contract-callback/src/handlers/execute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use cosmwasm_std::{coins, to_json_binary, BankMsg, Binary, Coin, CosmosMsg, DepsMut, Env, MessageInfo, Response, Timestamp, Uint128, WasmMsg};
use crate::{msg::{ExecuteMsg, MsgCancelCallback, MsgRequestCallback}, state::{RenewInfo, ACC_JOB_MAP, CONFIG, CUR_BLOCK_ID, DEFAULT_ID, JOBS, RENEW_JOBS_MAP, RENEW_MAP, STATE}, ContractError};
use cosmwasm_std::{coins, to_json_binary, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, Timestamp, Uint128, WasmMsg};

Check warning on line 1 in contracts/contract-callback/src/handlers/execute.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `Deps`

Check warning on line 1 in contracts/contract-callback/src/handlers/execute.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `Deps`
use prost::Message;

Check warning on line 2 in contracts/contract-callback/src/handlers/execute.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `prost::Message`

Check warning on line 2 in contracts/contract-callback/src/handlers/execute.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `prost::Message`
use crate::{msg::{ExecuteMsg, MsgCancelCallback, MsgRequestCallback},
state::{RenewInfo, ACC_JOB_MAP, CONFIG, CUR_BLOCK_ID, DEFAULT_ID, JOBS, RENEW_JOBS_MAP, RENEW_MAP, STATE},
ContractError};


pub fn execute_handler(
deps: DepsMut,
Expand Down
7 changes: 4 additions & 3 deletions contracts/contract-callback/src/handlers/sudo.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use cosmwasm_std::{Binary, CosmosMsg, DepsMut, Env, Response, SubMsg, Uint128, WasmMsg};

use crate::{msg::{MsgRequestCallback, SudoMsg}, state::{ACC_JOB_MAP, CONFIG, CUR_BLOCK_ID, RENEW_JOBS_MAP, RENEW_MAP, STATE}, ContractError};
use crate::{msg::{MsgRequestCallback, SudoMsg},
state::{ACC_JOB_MAP, CONFIG, CUR_BLOCK_ID, RENEW_JOBS_MAP, RENEW_MAP, STATE},
ContractError};
use std::u64;


Expand All @@ -24,7 +26,6 @@ pub fn handle_error(
_input_payload: String,
_error_message: String,
) -> Result<Response, ContractError> {

Ok(Response::new())
}

Expand Down Expand Up @@ -150,4 +151,4 @@ pub fn handle_renew_callback(deps: DepsMut, env: Env, job_id: u64) -> Result<Res
} else {
Ok(Response::new())
}
}
}
2 changes: 0 additions & 2 deletions contracts/contract-callback/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub enum ExecuteMsg {
},
#[payable]
Deposit {

},
Withdraw {
},
Expand Down Expand Up @@ -166,4 +165,3 @@ pub struct QueryErrorsRequest {
#[prost(string, tag = "1")]
pub contract_address: ::prost::alloc::string::String,
}

56 changes: 33 additions & 23 deletions schema/contract-callback.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,6 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"reset"
],
"properties": {
"reset": {
"type": "object",
"required": [
"count"
],
"properties": {
"count": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -147,6 +124,14 @@
"properties": {
"cancel_auto_renew": {
"type": "object",
"required": [
"domain_name"
],
"properties": {
"domain_name": {
"type": "string"
}
},
"additionalProperties": false
}
},
Expand Down Expand Up @@ -186,6 +171,19 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"stop_cron_job"
],
"properties": {
"stop_cron_job": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -344,6 +342,7 @@
"callback_height",
"count",
"owner",
"renew_status",
"status"
],
"properties": {
Expand All @@ -360,6 +359,11 @@
"owner": {
"$ref": "#/definitions/Addr"
},
"renew_status": {
"type": "integer",
"format": "uint8",
"minimum": 0.0
},
"status": {
"type": "integer",
"format": "uint8",
Expand Down Expand Up @@ -499,6 +503,12 @@
"domain_id": {
"type": "string"
},
"err_message": {
"type": [
"string",
"null"
]
},
"execute_msg": {
"$ref": "#/definitions/Binary"
},
Expand Down
44 changes: 21 additions & 23 deletions schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,6 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"reset"
],
"properties": {
"reset": {
"type": "object",
"required": [
"count"
],
"properties": {
"count": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -109,6 +86,14 @@
"properties": {
"cancel_auto_renew": {
"type": "object",
"required": [
"domain_name"
],
"properties": {
"domain_name": {
"type": "string"
}
},
"additionalProperties": false
}
},
Expand Down Expand Up @@ -148,6 +133,19 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"stop_cron_job"
],
"properties": {
"stop_cron_job": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down
6 changes: 6 additions & 0 deletions schema/raw/response_to_get_count.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"callback_height",
"count",
"owner",
"renew_status",
"status"
],
"properties": {
Expand All @@ -38,6 +39,11 @@
"owner": {
"$ref": "#/definitions/Addr"
},
"renew_status": {
"type": "integer",
"format": "uint8",
"minimum": 0.0
},
"status": {
"type": "integer",
"format": "uint8",
Expand Down
51 changes: 51 additions & 0 deletions schema/raw/response_to_get_ica_state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GetIcaStateResponse",
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"$ref": "#/definitions/IcaState"
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"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.",
"type": "string"
},
"IcaState": {
"type": "object",
"required": [
"connection_id",
"errors",
"ica_address",
"owner",
"timeout",
"voted"
],
"properties": {
"connection_id": {
"type": "string"
},
"errors": {
"type": "string"
},
"ica_address": {
"type": "string"
},
"owner": {
"$ref": "#/definitions/Addr"
},
"timeout": {
"type": "boolean"
},
"voted": {
"type": "boolean"
}
}
}
}
}
6 changes: 6 additions & 0 deletions schema/raw/response_to_query_renew_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
"domain_id": {
"type": "string"
},
"err_message": {
"type": [
"string",
"null"
]
},
"execute_msg": {
"$ref": "#/definitions/Binary"
},
Expand Down

0 comments on commit d047f2e

Please sign in to comment.