Code Monkey home page Code Monkey logo

provwasm's Introduction

Provenance CosmWasm Bindings

This crate provides bindings to enable CosmWasm smart contracts to interact with custom provenance blockchain modules.

Crate Download Docs
provwasm-std provwasm-std on crates.io Docs
provwasm-mocks provwasm-mocks on crates.io Docs

Compatibility

The following table shows provwasm version compatibility for smart contract development and testing.

provwasm wasmd cosmos provenance module support
v2.1.0 v0.30.X v0.46.X v1.17.X attribute,exchange,hold,marker,metadata,msgfees,name,reward,trigger
v2.0.0 v0.30.X v0.46.X v1.15.X attribute,marker,metadata,msgfees,name,reward
v1.2.0 v0.30.X v0.46.X v1.15.X attribute,marker,metadata,msgfees,name
v1.1.2 v0.29.X v0.46.X v1.13.X attribute,marker,metadata,msgfees,name
v1.1.1 v0.29.X v0.46.X v1.13.X attribute,marker,metadata,msgfees,name
v1.1.0 v0.26.X v0.45.X v1.10.X - v1.12.X attribute,marker,metadata,msgfees,name
v1.0.0 v0.26.X v0.45.X v1.8.X - v1.9.X attribute,marker,metadata,name

Getting Started

Start with the tutorial for a complete guide to developing smart contracts for the Provenance Blockchain.

IBC

Once the tutorial has been completed and you are ready for a more advanced topic, checkout the IBC Overview to learn more about IBC Smart Contracts and a guided tour of a multi-contract IBC project.

Contents

In addition to the core CosmWasm functionality, the provenance bindings include

Query Support

Queries are available for these Provenance modules:

  • Attribute
    • provenance.attribute.v1.QueryParamsRequest
    • provenance.attribute.v1.QueryAttributeRequest
    • provenance.attribute.v1.QueryAttributesRequest
    • provenance.attribute.v1.QueryScanRequest
  • Exchange
    • provenance.exchange.v1.QueryOrderFeeCalcRequest
    • provenance.exchange.v1.QueryGetOrderRequest
    • provenance.exchange.v1.QueryGetOrderByExternalIDRequest
    • provenance.exchange.v1.QueryGetMarketOrdersRequest
    • provenance.exchange.v1.QueryGetOwnerOrdersRequest
    • provenance.exchange.v1.QueryGetAssetOrdersRequest
    • provenance.exchange.v1.QueryGetAllOrdersRequest
    • provenance.exchange.v1.QueryGetMarketRequest
    • provenance.exchange.v1.QueryGetAllMarketsRequest
    • provenance.exchange.v1.QueryParamsRequest
    • provenance.exchange.v1.QueryValidateCreateMarketRequest
    • provenance.exchange.v1.QueryValidateMarketRequest
    • provenance.exchange.v1.QueryValidateManageFeesRequest
  • Hold
    • provenance.hold.v1.GetHoldsRequest
    • provenance.hold.v1.GetAllHoldsRequest
  • Marker
    • provenance.marker.v1.QueryParamsRequest
    • provenance.marker.v1.QueryMarkerRequest
    • provenance.marker.v1.QueryHoldingRequest
    • provenance.marker.v1.QuerySupplyRequest
    • provenance.marker.v1.QueryEscrowRequest
    • provenance.marker.v1.QueryAccessRequest
    • provenance.marker.v1.QueryDenomMetadataRequest
  • Metadata
    • provenance.metadata.v1.QueryParamsRequest
    • provenance.metadata.v1.ScopeRequest
    • provenance.metadata.v1.SessionsRequest
    • provenance.metadata.v1.RecordsRequest
    • provenance.metadata.v1.OwnershipRequest
    • provenance.metadata.v1.ValueOwnershipRequest
    • provenance.metadata.v1.ScopeSpecificationRequest
    • provenance.metadata.v1.ContractSpecificationRequest
    • provenance.metadata.v1.RecordSpecificationsForContractSpecificationRequest
    • provenance.metadata.v1.RecordSpecificationRequest
    • provenance.metadata.v1.OSLocatorParamsRequest
    • provenance.metadata.v1.OSLocatorRequest
    • provenance.metadata.v1.OSLocatorsByURIRequest
    • provenance.metadata.v1.OSLocatorsByScopeRequest
    • The following has deserialization issues and will be None until fixed:
      • ContractSpecification.source
      • InputSpecification.source
      • Process.process_id
      • SessionIdComponents.scope_identifier
  • MsgFees
    • provenance.msgfees.v1.QueryParamsRequest
  • Name
    • provenance.name.v1.QueryParamsRequest
    • provenance.name.v1.QueryResolveRequest
    • provenance.name.v1.QueryReverseLookupRequest
  • Reward
    • provenance.reward.v1.QueryRewardProgramByIDRequest
    • provenance.reward.v1.QueryRewardProgramsRequest
    • provenance.reward.v1.QueryClaimPeriodRewardDistributionsRequest
    • provenance.reward.v1.QueryClaimPeriodRewardDistributionsByIDRequest
    • provenance.reward.v1.QueryRewardDistributionsByAddressRequest
    • The following has deserialization issues and will be None until fixed:
      • QualifyingAction.type
  • Trigger
    • Query support unavailable until #123 is resolved

Message Encoding

All messages are available for these Provenance modules:

Migration

Please see this guide for information regarding api changes and upgrading contracts

provwasm's People

Contributors

carp-cobain avatar fkneeland-figure avatar iramiller avatar jonas089 avatar ktalley-figure avatar kwtalley avatar leeduan avatar piercetrey-figure avatar taztingo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

provwasm's Issues

Uploading wasm binary fails with unknown interface_version_* marker export

I built my own helloworld contract and tried uploading the optimized binary to a local Provenance network and it failed. Out of curiosity, I tried following the latest tutorial instructions and got the same failure on Step 9

Summary of Bug

Uploading wasm binary fails with the following error

(base) ---------- 21:04:50 (duc@DucMacBook) :~/Dev/provenance ----------
==> provenanced tx wasm store tutorial.wasm \
    --instantiate-only-address tp1aht5v4wxq0qsh96aa8kxuwg5sd2mj5a5d2my2n \
    --from tp1aht5v4wxq0qsh96aa8kxuwg5sd2mj5a5d2my2n \
    --keyring-backend test \
    --home build/node0 \
    --chain-id chain-local \
    --gas auto \
    --gas-prices="1905nhash" \
        --gas-adjustment=1.5 \
    --broadcast-mode block \
    --yes \
    --testnet \
        --output json | jq
Error: rpc error: code = InvalidArgument desc = failed to execute message; 
message index: 0: Error calling the VM: Error during static Wasm validation: 
Wasm contract has unknown interface_version_* marker export 
(see https://github.com/CosmWasm/cosmwasm/blob/main/packages/vm/README.md): 
create wasm contract failed: invalid request

Version

Latest tutorial codebase from https://github.com/provenance-io/provwasm

Steps to Reproduce

Follow tutorial @ https://github.com/provenance-io/provwasm/blob/main/docs/tutorial/01-overview.md


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Expand Mock Querier

Summary

Add the ability to set bank balances on the provenance mock querier.

Problem Definition

Currently, it is only possible to set the contract balance in the provenance mock querier.

Proposal

Add a new function - mock_dependencies_with_balances - that takes a series of balances that will be passed through to the cosmwasm mock bank querier. In addition, make the base in provenance querier field public, so balances can be updated after initialization with deps.querier.base.update_balance(...).


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Add types aliases

Summary

It would be very helpful to have typed aliases in our provwasm-std. I noticed a lot of projects define these to make it easier to read and write contracts.

Problem Definition

It can be difficult for new contract developers to know what the correct types are in a provwasm contract. It can also confuse people who are newer to Rust.

Proposal

Create the following four type aliases in provwasm-std so that every project can make use of them:

pub type ProvDeps<'a> = Deps<'a, ProvenanceQuery>;
pub type ProvDepsMut<'a> = DepsMut<'a, ProvenanceQuery>;
pub type ProvTxResponse = Result<Response<ProvenanceMsg>, ContractError>;
pub type ProvQueryResponse = Result<Binary, ContractError>;

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Add example contract wasms to release assets

Summary

The example contracts wasm files were previously tracked in git. They were removed and untracked as of #84. Let's add them back to the release assets like the tutorial wasm is currently, however not zipped. The tutorial contract should also change to not zipped. This will affect integration tests in provenance, so that size should be updated as well.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Fee struct

Summary

There is no struct to represent a message fee. It would be helpful to have Fee struct so developers don't have to define it themselves.

Problem Definition

I think most use cases for message fees will require an amount and a receiver. Every smart contract will either have to manually define these two attributes, or define their own struct. This makes it a bit easier for developers and makes the code more consistent across contracts.

Proposal

Add the following type or something similar...

#[cw_serde]
pub struct Fee {
    pub recipient: Addr,
    pub amount: Coin,
}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Upgrade to cosmwasm 1.0.0-beta4

Summary

The latest wasmd for 1.8 Provenance release requires cosmwasm 1.0.0-beta4


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Template Contract

Summary

It would be nice if there was a structured template contract repo that was up to date with the latest features of cosmwasm and provwasm. This would help onboard developers and get them creating contracts in little time. This can also act as a testing ground for figuring out what common features should be moved into provwasm.

Problem Definition

One major issue with provwasm is that there is not a single go to contract that developers can quickly clone and start developing with. Every user is forced to use the tutorial contract or the cosmwasm template. These do not contain the latest features, and if using the cosmwasm template does not contain our dependencies. Additionally, there is no standard repo structure for cosmwasml. This results in every smart contract having a different repo layout and structure.

Proposal

  • Develop a new contract that acts as a template for all future contracts
  • It must contain a well structured repo that can easily be understood. A good starting point is the metadata-bilateral-exchange.
  • It must contain tests to demonstrate how to test contracts
  • It must be easily buildable and deployable.
  • It must have a README to act as a publishing guide.
  • It must have all functions documented to aide users in code documentation.
  • It should have message fees incorporated to encourage developers to use them.

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Create example IBC contract

Summary

With IBC gaining traction, an example IBC contract would be useful for the community

Proposal

Create an example IBC bidirectional contract that can be deployed on two chains


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Automated Integration Tests

Add automation scripts that will store, instantiate, execute and query all smart contract integration test WASM. Bonus: write an event listener that verifies against a gold copy. This listener can just verify that wasm events are generated and all expected action attributes are emitted.

Add scope modification example to readme

Summary

The scope contract should have an example message for modifying scopes


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

All permissions grant on markers regardless of marker type

// Create and dispatch a message that will grant all permissions to a marker for an address.

The approach of assigning all access rights to a marker regardless of need/configuration is a potential issue when validation prevents assignment of the transfer role to a unrestricted aka COIN type markers. This constraint has been on the list to add to the marker module but thankfully hasn't been implemented yet because this code would break.

This is also a bit risky in the future as there are other types under consideration that would potentially add further access right options which would be incompatible with the other marker types.

Create new release with `wasmd` "0.19" support for Cosmos SDK 0.43

Summary

When the next version of wasmd is published (tentatively 0.19) based on provenance-io/provenance#409 a corresponding release of provwasm (and cosmwasm) will be required due to breaking api changes.

Problem Definition

An updated version of provwasm will be required to support the upcoming Provenance 1.6.0 release based on Cosmos SDK 0.43+ which contains an updated wasmd release

Proposal

When provenance-io/provenance#409 is complete develop an updated provwasm (and possibly cosmwasm) release that is compatible.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Public types

Review the provwasm bindings and ensure that all useful types are exposed. For example:

  • MarkerStatus
  • MarkerType

Contribution Documentation

Add a document that describes all the steps that should be taken before filing and issue and submitting a PR against provwasm.

Add sanity check test to prs

Summary

Add a github action that does a sanity test for building all of the smart contracts and verifying that there are no errors on each pr. This could just call the make all inside of contracts. This way if a pr breaks our contracts we will know.

Problem Definition

Proposal


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Type coherence bug

Problem

Currently, custom Provenance types cannot be used with core BankMsg, StakingMsg, and WasmMsg in the smart contract handle and init functions. It is suspected the issue stems from coherence rules.

Solution

Unknown. Basically, fix the type here if possible.

Marker module integration

Ensure the provwasm bindings, mocks and integration test contract (contracts/marker) work correctly with the integrations done in the provenance blockchain marker module.

Publish to crates.io

This is a placeholder ticket - once fully integrated with the provenance blockchain, we will need to publish provwasm to crates.io.

Add basic integration test with Provenance

Summary

We should add a basic integration test that pulls in the latest version of Provenance to a docker container, runs it, then stores instantiates and executes the tutorial smart contract to verify that everything is working as expected. This test should run in github actions on pull requests and pushes to main.

Problem Definition

Proposal


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Expand marker test contract

The following actions should be added to the marker integration test contract (contracts/marker)

  • Transfer
  • Mint supply
  • Burn supply
  • Cancel marker
  • Destroy marker

Use correct WebAssembly abbreviation

Summary

The correct abbreviation of WebAssembly is Wasm as defined in the spec.

Replace all instances of WASM (all caps) in this repo with the correct contraction - Wasm

Smart Contract MsgFee Support

Summary

Add support for registering a msg fee from a contract

Problem Definition

Currently a smart contract does not have a uniform way to charge a fee within the contract. This capability is required to implement many value based fee scenarios

Proposal

Create a binding for a new msg based fee endpoint that allows a smart contract author to charge an arbitrary msg fee from within their contract. Endpoint should accept any single coin structured amount (i.e 100coins) along with an optional 'ip owner' address that will receive the platform assigned cut of the fee (currently 50% according to the tokenomics paper). If the address is not provided then the entire fee will be sent to the fee module account for distribution.

Note: the actual details of the implementation within the msgfees module is a separate issue in the provenance repository. It is included here for clarity.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

update tutorial documentation

Summary

The tutorial documentation has become stale and needs a refresh


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

upgrade to cosmwasm 1.1.9

Summary

cosmwasm 1.1.9 includes a few bug fixes and schema updates

Proposal

upgrade to latest cosmwasm 1.1.9


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Epic: Use protos instead of json for bindings

Summary

The current provenance and cosmos bindings use json for serde. Moving to protos that can be sourced from provenance and cosmos would simplify the module side encoding/decoding process.

Problem Definition

Proposal

Investigate how osmosis has achieved this and implement similarly for provenance. This requires changes in provwasm as well as provenance.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Upgrade to CosmWasm 1.0.0-rc0

Summary

CosmWasm 1.0.0-rc0 was released and Provwasm should be upgraded to it


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

VM error when storing CosmWasm contract on Provenance

Summary of Bug

When trying to store a custom smart contract on a localnet running on Ubuntu 20.04 on AWS, I get the following error Error: rpc error: code = InvalidArgument desc = failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation: Wasm contract has unknown interface_version_* marker export (see https://github.com/CosmWasm/cosmwasm/blob/main/packages/vm/README.md): create wasm contract failed: invalid request

I tried storing the sample contracts in provenance-io/provwasm/contracts onto my localnet instead and got the same error.

Version

I am using the same dependencies as the ProvWasm tutorial.

[dependencies]
provwasm-std = { version = "1.0.0-beta2" }
cosmwasm-std = { version = "1.0.0-beta5", default-features = false }
cosmwasm-storage = { version = "1.0.0-beta5" }
cw-storage-plus = "0.8.0"
cw2 = "0.8.1"
schemars = "0.8.3"
serde = { version = "1.0.127", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.26" }

[dev-dependencies]
provwasm-mocks = { version = "1.0.0-beta2" }
cosmwasm-schema = { version = "1.0.0-beta5" }

Steps to Reproduce

I copied the optimized contracts to my provenance directory and try to store it from there using :

provenanced tx wasm store contract.wasm \
    --instantiate-only-address $node0 \
    --from node0 \
    --keyring-backend test \
    --home build/node0 \
    --chain-id chain-local \
    --gas auto --gas-prices 1905nhash --gas-adjustment 2 \
    --broadcast-mode block \
    --yes \
    --testnet -o json | jq

where $node0 is defined to be the address of node0.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Add custom bank send bindings

Add bindings for calling private bank extensions added to the Provenance Blockchain. This will allow us to issue marker transfers and bank sends from the same contract handle function; eliminating the need for separate helper contracts to handle settlements.

Add README to bindings

It would be a nice-to-have - for the next release of provwasm bindings to crates.io - to have a descriptive README.

Simplify getting the contract admin and mocking it.

Summary

Allow the user to easily query for the contract admin, and provide an easier way for a user to set the admin for mock dependencies.

Problem Definition

It is possible for a contract to use the admin within it's logic. There is currently a way to obtain the admin by querying the ContractInfo, but it's a bit clumsy. It is also very work intensive in setting up the test mock admin because the user must know how to work with the handlers.

Proposal

Create a command get_admin() that allows the user to obtain an Optional for the admin.
Create a set_admin(Option) command, update provwasm's mock_dependencies(&[Coin], Option), or create an additional mock_dependencies_with_admin(&[Coin], Option) that allows users to configure the admin while testing.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Upgrade to latest cosmwasm

Summary

Upgrade to latest CosmWasm 1.1.2

Problem Definition

Provenance 1.13 is upgrading to wasmd 0.28 which requires CosmWasm 1.1.2


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Update Tutorial

Once provwasm v0.14.0 is released, update the tutorial to use this version.

Implement From for ProvenanceMsg

Summary

The From trait should be implemented by the ProvenanceMsg struct to follow the same pattern as the rest of the messages.

Problem Definition

We are unable to fluently use some methods such as add_messages without this. There is a workaround which is to use add_submessages, but this should still be possible.

Proposal

Implement From for ProvenanceMsg and use the CosmosMsg implementation of it as a guide.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Add forced transfer support to marker message

Summary

Forced transfer support for restricted markers has been added to Provenance, but is not a parameter available to Provwasm

Proposal

Add the field allow_forced_transfer: bool to the marker type


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Account "validator" does not exist

There seems to be no default faucet account that I can use to fund new accounts.
Please help me understand how to properly fund accounts on a local testnet.
Kind regards.

Add support for Scope mutation

Summary

Add capability to update Scope data_access and value_owner in a provwasm contract.

Problem Definition

A Scope can be owned (at the value_owner level) by either an Account Address or a Marker. In the latter case, ownership transfer would occur through Marker updates. In the case that a Scope is owned by a single address, however, it should be possible to write a contract that updates the value_owner field if the submitter is said address/account. Similarly, the data_access field should be able to be changed if all parties in the data access list have signed the request to execute the contract.

Open for discussion is whether and when any other fields of a Scope could be mutated in a contract.

Proposal

Create hooks that allow contract to issue MsgWriteScopeRequest


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Extend Marker Withdrawals

Currently, it is only possible to withdraw funds created by a marker (ie using the marker denom) from smart contracts. Add support for withdrawing funds with any denom from a marker account.

Add or extend the type here.

NOTE: The blockchain must support the changes first. Ref blockchain issue here.

Best Practices Documentation

Add a document that sets suggested best practices for smart contract development on Provenance. This document should be linked in the top-level README and in the tutorial where appropriate; in the development section for example.

Metadata module integration

Add bindings, mocks, and an integration test contract for the metadata module in the Provenance Blockchain.

Support UpdateAttribute

Summary

Add support for the Update Attribute message type

Problem Definition

Currently it is possible to add/delete attributes within a smart contract, but you can't update an attribute directly as you can via grpc, for example. Since there is a fee of 10 hash for adding an attribute, this means any updates to an attribute via a contract have to take the form of delete/add, which results in an additional 10 hash that would otherwise be unnecessary.

Proposal

Add support for the update attribute message type. The main weird thing here is probably that you have to supply the original, as well as the updated attribute value in the message, not sure if that introduces any weird considerations for this vs. any other type of message.

As long as this is being added, it might be worthwhile exposing the DeleteDistinctAttribute functionality as well, as it operates similarly (i.e. passing the existing value) and would, I believe, bring all the attribute module functionality into provwasm.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Update Tutorial to work with last version of Provenance

Summary

If the tutorial for creating a simple smart contract on provenance is used on the current version of Provenance the smart contract will fail when attempted to be instantiated on the blockchain due to an out of date version. We should update the tutorial to work with the latest version of the Provenance blockchain.

Problem Definition

Proposal


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Bilateral Exchange Smart Contract

Develop a bilateral exchange smart contract utilized by Figure marketplace

Problem Statement

Marketplace needs a bilateral exchange of value, which is atomic and is controlled on chain(not through clients) for e.g exchange markers for stable coin or even one stable coin for another.Transfer marker a(pool of loans) -> for marker b(stable coin) from acc 1 -> acc 2 where a and b are both guaranteed the exchange will settle immediately between acc1 and acc2.

This should in our view involve creation of a smart contract which can do this exchange.

Proposed Solution

Smart contract owns marker pool a(smart contract owned by accnt 1 or trusted escrow/custodian)
--> publishes
--> when it receives stable coin b( i.e the ask for the contract)
--> it transfer's the collateral (marker a) to acct2
--> transfer marker a to accnt 1

contract has an owner/creator

contract owns marker a

handle method:

exercise (transfer collateral marker a to acct2.. transfer stable coin marker 2 to accnt 1 )

maybe transfer and burn/destroy methods also

A great example is the SimpleOption smart contract example in cosmwasm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.