Skip to content

Instantly share code, notes, and snippets.

@ccoincash
Created December 9, 2020 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccoincash/dedd386a0d2a9368868ef0ceaad2127f to your computer and use it in GitHub Desktop.
Save ccoincash/dedd386a0d2a9368868ef0ceaad2127f to your computer and use it in GitHub Desktop.
sell token for bsv
import "util.scrypt";
contract TokenSellContract {
Ripemd160 bsvRecAddr;
int bsvRecAmount;
public function unlock(
SigHashPreimage txPreimage
) {
SigHashType sigHashType = SigHash.SINGLE | SigHash.FORKID;
require(Util.checkPreimageSigHashType(txPreimage, sigHashType));
bytes outputScript = Util.buildPublicKeyHashScript(this.bsvRecAddr);
bytes output = Util.buildOutput(outputScript, this.bsvRecAmount);
require(hash256(output) == Util.hashOutputs(txPreimage));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment