GithubHelp home page GithubHelp logo

Comments (16)

friedger avatar friedger commented on June 26, 2024 1

@LNow Yes, please! That is a good proposal. We should also add standard error codes for

  • unsupported token: u500
  • insufficient balance: u103
  • not authorized to mint: u403

I would like to move from sip-10 to sip-transferable (#52)

For wrapped stx

I suggest to not include stx minting here but define
mint-with-ustx, etc.

from sips.

LNow avatar LNow commented on June 26, 2024 1

@radicleart that's the thing - it will work with any fungible token that is compliant with SIP-010. Citycoins, USDA, DIKO, Nothing, wbtc, xbtc, wrapped-bitcoin, ANY.

Does this suggestion also impact sip-0013 ?

Sure, why not.
I want this to be a separate trait that can be used in any contract that you think it can be used in.

from sips.

LNow avatar LNow commented on June 26, 2024 1

@radicleart Yes, generalized version of #51 would look like you described it.

from sips.

LNow avatar LNow commented on June 26, 2024 1

@MarvinJanssen something like this?

(define-public (mint-with (tender <sip-010-trait>) (customPrice (optional uint)))
  (let
    (
      (pricing (unwrap! (map-get? TenderPricing (contract-of tender)) ERR_UNKNOWN_TENDER))
      (price (match customPrice price (max price (get price pricing)) (get price pricing)))
      ;; remaining local variables
    )
    ;; minting operations
    (ok true)
  )
)

(define-private (max (a uint) (b uint))
  (if (> a b) a b)
)

or

(define-public (mint-with (tender <sip-010-trait>) (customPrice uint))
  (let
    (
      (pricing (unwrap! (map-get? TenderPricing (contract-of tender)) ERR_UNKNOWN_TENDER))
      (price (max customPrice (get price pricing)))
      ;; remaining local variables
    )
    ;; minting operations
    (ok true)
  )
)

(define-private (max (a uint) (b uint))
  (if (> a b) a b)
)

with extra function that returns price if it has been set:

(define-read-only (get-mint-price-in (tender <sip-010-trait>))
  (get price (map-get? TenderPricing (contract-of tender)))
)

from sips.

radicleart avatar radicleart commented on June 26, 2024 1

Started on this here @friedger - see list-in-token and buy-in-token ?

from sips.

radicleart avatar radicleart commented on June 26, 2024

Can this approach work with Arkadikos or ALEX's wrapped bitcoin as in SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wbtc ?

from sips.

radicleart avatar radicleart commented on June 26, 2024

Does this suggestion also impact sip-0013 ?

from sips.

LNow avatar LNow commented on June 26, 2024

@friedger

The problem with stx as a sip-10 is that it can't be operated. Implementations might need to implement two cases anyway.

What do you mean when you say it can't be operated and why you might need to implement two cases?

Also the UI for post-conditions would need to handle two different cases.
Yes, UI will have to generate two different types of post-conditions. One when someone choose wstx and another one when other FT is used.

With regards to wSTX name, I'm not attached to it. We can change it to STX-FT or anything else.

I suggest to not include stx minting here but define
mint-with-ustx, etc.

The key concept of this idea is to not have separate function for ustx or anything else. Instead of implementing different logic for STX, and different for FT you'll have just one. Example: https://github.com/LNow/clarity-projects/blob/2163db81b9286f0c30b00dd7728fb0e93dfc6243/contracts/tokens/mintable-nft-token.clar#L42-L59

One function to rule them all

from sips.

radicleart avatar radicleart commented on June 26, 2024

@LNow i think most people (me for sure, stxnft i believe) are following this for the commission since crash punks

(define-trait commission
    ((pay (uint uint) (response bool uint)))
)

which could be generalised to...

(use-trait sip-010-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)

(define-trait commission
    ((pay (<sip-010-trait> uint uint) (response bool uint)))
)

and the listing and buying methods also need to be generalised...

(define-public (list-in-ustx (id uint) (price uint) (comm <commission-trait>))

to

(define-public (list-in-token (id uint) (price uint) (comm <commission-trait>) (token <sip-010-trait>))...

likewise for the buy-in-ustx ?

from sips.

radicleart avatar radicleart commented on June 26, 2024

@LNow so is the answer to @friedger on this point?

The key concept of this idea is to not have separate function for ustx or anything else. Instead of implementing different logic for STX, and different for FT you'll have just one. Example: https://github.com/LNow/clarity-projects/blob/2163db81b9286f0c30b00dd7728fb0e93dfc6243/contracts/tokens/mintable-nft-token.clar#L42-L59

that at this line

    (and (> price u0) (try! (contract-call? tender transfer price tx-sender artistAddress none)))
    (and (> commission u0) (try! (contract-call? tender transfer commission tx-sender commissionAddress none)))

the tender contract passed in is an ft trait impl that just implements transfer as stx-transfer? as opposed to ft-transfer ?

Hence only one function needed for both transfer types in the main contract?

from sips.

LNow avatar LNow commented on June 26, 2024

the tender contract passed in is an ft trait impl that just implements transfer as stx-transfer? as opposed to ft-transfer ?
Hence only one function needed for both transfer types in the main contract?

Yes

from sips.

friedger avatar friedger commented on June 26, 2024

How do you build post conditions for these txs if they can transfer either STXs or FTs?

from sips.

LNow avatar LNow commented on June 26, 2024

The same way Alex/Arkadiko/Stackswaps are doing it. Based on token address user picked on the UI. With one additional if statement.
If user choose wrapped stx -> STX post-condition, otherwise -> FT post-condition.

from sips.

MarvinJanssen avatar MarvinJanssen commented on June 26, 2024

Great idea. Is there a way to allow for flexibility in payment schedule? When the Jellyboo NFT project was launched, it featured a pay-what-you-want model to mint (with a set minimum). The standard would be a lot more flexibility if you can set a price per NFT in mint-with and mint-with-many. Then it is also possible to introduce discounts in cases. For projects with a fixed price you just specify whatever get-mint-price-in returns.

from sips.

unclemantis avatar unclemantis commented on June 26, 2024

I LOVE IT!

from sips.

friedger avatar friedger commented on June 26, 2024

We could even extend it to tradables which would include nfts

from sips.

Related Issues (20)

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.