Coder Social home page Coder Social logo

secretswap's People

Contributors

assafmo avatar eshelb avatar joowonyun avatar ouiliame avatar toml01 avatar yun-yeo 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

secretswap's Issues

Executing a swap with a swap message?

I'm using secret-sdk python to submit a swap to secret swap.

I can't seem to submit a valid transaction, and I think it's that the message is incorrect. I am using the example syntax given in your GitHub, but it isn't working for me.

I want to trade sSCRT for sETH, here is the message I have written by your specifications:

swap_msg = {
                "swap": {
                    "offer_asset": {
                        "info": {
                            "native_token": {
                                "denom": "sSCRT"
                            }
                        },
                        "amount": 1
                    }
                }
            }

then I package it into a transaction:

#get message into a send message format
send_msg = secret.wasm.contract_execute_msg(wallet.key.acc_address,contract_address,swap_msg)

#get message into transaction format
tx = wallet.create_and_sign_tx(
        msgs=[send_msg],
        memo="",
        fee=StdFee(50000, "5000uscrt")
    )

#broadcast to chain
result = secret.tx.broadcast(tx)
print(result)

However, this transaction doesn't ever end up going through successfully.

I assume that the message I am submitting is incorrect; however, it's impossible to know how it should look because everything is hashed.

Here is my full code if it's of interest:

#import required dependencies
from secret_sdk.client.lcd import LCDClient
from secret_sdk.key.mnemonic import MnemonicKey
from secret_sdk.core.auth import StdFee
from secret_sdk.core.bank import MsgSend

#endpoints
node_rest_endpoint = "http://api.scrt.network/"
chain_id = "secret-4"

#create wallet from mnemonic
MNEMONIC = "my mnemonic"
secret = LCDClient(chain_id=chain_id, url=node_rest_endpoint)
mk = MnemonicKey(mnemonic=MNEMONIC) 
wallet = secret.wallet(mk)

#point to sSCRT contract address
contract_address = "secret1k0jntykt7e4g3y88ltc60czgjuqdy4c9e8fzek"

#create a message for secretswap


swap_msg = {
                "swap": {
                    "offer_asset": {
                        "info": {
                            "native_token": {
                                "denom": "sSCRT"
                            }
                        },
                        "amount": 1
                    }
                }
            }

#get message into a send message format
send_msg = secret.wasm.contract_execute_msg(wallet.key.acc_address,contract_address,swap_msg)

#get message into transaction format
tx = wallet.create_and_sign_tx(
        msgs=[send_msg],
        memo="",
        fee=StdFee(50000, "5000uscrt")
    )

#broadcast to chain
result = secret.tx.broadcast(tx)
print(result)

SecretSwap's Balances

Hello guys,
I see that SecretSwap's balances are publicly accessible, hence the viewing key is static and public,
here I see a possible attack vector, where everyone can monitor the network and see the balance changes after each tx.
Not private enough I think..
Am I right?

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.