sCrypt-Inc / scrypt-ord

sCrypt 1sat ordinal library
https://docs.scrypt.io/tokens/
21 stars 5 forks source link

refactor #1

Closed xhliu closed 1 year ago

xhliu commented 1 year ago

Remove @props, since they r not on chain.

export class BSV20V1 extends SmartContract {
    @prop(true)
    isBSV20V1: boolean          <--- is this dummy
    /** Ticker: 4 letter identifier of the bsv-20 */
    tick: ByteString

    /** Max supply: set max supply of the bsv-20 */
    max: bigint

    /** Mint limit: If letting users mint to themselves, limit per ordinal. If ommitted or 0, mint amt us unlimited. */
    lim: bigint
}
xhliu commented 1 year ago

Use loadArtifact() https://github.com/sCrypt-Inc/scrypt-ord/blob/0cb3d5f49cb7f6cbdfc14af3f921929ac3e84fad/tests/specs/hashPuzzle.spec.ts#L26

xhliu commented 1 year ago
const hashPuzzle = new HashPuzzle(..., h0)
await hashPuzzle.connect(getDefaultSigner())
await hashPuzzle.deploy()

https://github.com/sCrypt-Inc/scrypt-ord/blob/0cb3d5f49cb7f6cbdfc14af3f921929ac3e84fad/tests/specs/hashPuzzle.spec.ts#L27

xhliu commented 1 year ago

https://github.com/sCrypt-Inc/scrypt-ord/blob/0cb3d5f49cb7f6cbdfc14af3f921929ac3e84fad/tests/specs/hashPuzzle.spec.ts#L42-L85 Should be as simple as sth like

hashPuzzle.transfer([new HashPuzzle(...,h1), new HashPuzzle(...,h2), new HashPuzzle(...,h0)], [amt1, amt2, changeAmt])

Be default, transfer to a new instance, with 0-th output being the instance w/ h1 of amt1, 1st w/ h2 of amt2, 2nd token change output, plus satoshi change output if any.

Make it customizable by customizing the txBuilder.

xhliu commented 1 year ago

This contains the inscription script? https://github.com/sCrypt-Inc/scrypt-ord/blob/0cb3d5f49cb7f6cbdfc14af3f921929ac3e84fad/tests/specs/hashPuzzle.spec.ts#L66