I hereby claim:
- I am ethanfrey on github.
- I am confio (https://keybase.io/confio) on keybase.
- I have a public key ASABnwVRWAO3cYEeKxQq0tA5AIP8R0-VaNba6X3NzEc71go
To claim this, I am signing this object:
package bug | |
import ( | |
"encoding/base64" | |
"testing" | |
) | |
func TestWTF(t *testing.T) { | |
assert := assert.New(t) | |
url := base64.URLEncoding |
I hereby claim:
To claim this, I am signing this object:
The following terms are used throughout this agreement:
""" | |
Simple http server to create streams for asyncio tests | |
""" | |
import asyncio | |
import aiohttp | |
from aiohttp import web | |
async def get_data(host, port): | |
url = 'http://{}:{}/'.format(host, port) |
#[cfg_attr(not(feature = "library"), entry_point)] | |
pub fn execute( | |
deps: DepsMut, | |
env: Env, | |
info: MessageInfo, | |
msg: ExecuteMsg, | |
) -> Result<Response, ContractError> { | |
/* your implementation here */ | |
} |
#[cfg_attr(not(feature = "library"), entry_point)] | |
pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result<Binary, StdError> { | |
/* your implementation here */ | |
} |
use cosmwasm_std::{Addr, QuerierWrapper}; | |
use cw4::Cw4Contract; | |
fn assert_membership(querier: &QuerierWrapper, contract: &Addr, account: &Addr) -> StdResult<()> { | |
let contract = Cw4Contract(addr.clone()); | |
if whitelist.is_member(&deps.querier, sender)?.is_none() { | |
return Err(StdError::generic("unauthorized")); | |
} | |
Ok(()) | |
} |
use cw0::parse_reply_instantiate_data; | |
pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> { | |
let res = parse_reply_instantiate_data(msg)?; | |
let child_contract = deps.api.addr_validate(res.contract_address)?; | |
// store this where it belongs... | |
} |
#[entry_point] | |
pub fn sudo(_deps: DepsMut, _env: Env, msg: SudoMsg) -> Result<Response, HackError> { | |
match msg { | |
// you certainly don't want just anyone calling this | |
SudoMsg::TakeFunds { recipient, amount } => { | |
let msg = BankMsg::Send { | |
to_address: recipient, | |
amount, | |
}; | |
Ok(Response::new().add_message(msg)) |
const CONTRACT_NAME: &str = "crates.io:my-crate-name"; | |
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); | |
#[entry_point] | |
pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, ContractError> { | |
let ver = cw2::get_contract_version(deps.storage)?; | |
// ensure we are migrating from an allowed contract | |
if ver.contract != CONTRACT_NAME { | |
return Err(StdError::generic_err("Can only upgrade from same type").into()); | |
} |