CashScript SLP
TOKENS
Valid transaction using the FT.cash contract with single OP_RETURN: https://explorer.bitcoin.com/bch/tx/a71eae6cd8864dca5e184f49093f1b0b9cb49572959354f9ad72e5d0c0a3fa8c
Valid transaction using the FT.cash contract with 2 OP_RETURN (SLP AND MEMO): https://explorer.bitcoin.com/bch/tx/9d1893ddedd9f1d041521c3f98508883856c3efde2406980dd3aa7af1c1b19bb
FT.cash
pragma cashscript ^0.6.3;
contract FT(bytes20 owner) {
// Warning: This method 'reclaim' should only be used in testing.
// Backdoor to reclaim funds,
function reclaim(pubkey pk, sig s) {
require(checkSig(s, pk));
}
function createToken(
pubkey pk,
sig s,
bytes20 recipientPkh,
bytes lokadId,
bytes tokenType,
string actionType,
string symbol,
string name,
string documentURI,
string documentHash,
bytes decimals,
bytes baton,
bytes initialQuantity,
int minerFee,
//string memoText
) {
require(hash160(pk) == owner);
require(checkSig(s, pk));
int dust = 546;
bytes token = new OutputNullData([
lokadId,
tokenType,
bytes(actionType),
bytes(symbol),
bytes(name),
bytes(documentURI),
bytes(documentHash),
decimals,
baton,
initialQuantity
]);
// bytes memo = new OutputNullData([
// 0x6d02,
// bytes(memoText)
// ]);
int changeAmount = int(bytes(tx.value)) - minerFee - dust;
if (changeAmount >= dust) {
bytes34 recipient = new OutputP2PKH(bytes8(dust), recipientPkh);
// Get the change back to the contract i.e Pay to Script Hash which is the current contract.
bytes32 change = new OutputP2SH(bytes8(changeAmount), hash160(tx.bytecode));
//require(hash256(token + recipient + change + memo) == tx.hashOutputs);
require(hash256(token + recipient + change) == tx.hashOutputs);
} else {
require(hash256(token) == tx.hashOutputs);
}
}
} Usage
Valid transactions
NFT1-Group: https://explorer.bitcoin.com/bch/tx/110426292c63fe0db0932b4dc1c49594127e9b2e1a6d66a3e5696a830de9f3dd
Genesis: 5000
NFT1-Child: https://explorer.bitcoin.com/bch/tx/546c0ca35ac4612a5ed800acc27b7c67888c874717fd1e385c07a9790240701b
Genesis: 1
Document URI: (hex to utf8)456c656374726963204d6f75736520302e346d20362e306b67 = Electric Mouse 0.4m 6.0kg
Document hash: 4335393041313135313339423742383046324543323237334431364436353744 = C590A115139B7B80F2EC2273D16D657D
NFT1-Group & NFT1-Child contract.
NFT.cash
Meep
https://explorer.bitcoin.com/bch/tx/dc8cbc6486709dea0f23db356549a23d53714a1845172c034fec201cd55c203f

Last updated
Was this helpful?