CashScript SLP
TOKENS
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 & NFT1-Child contract.
NFT.cash
Meep

Last updated
Was this helpful?