@opcat-labs/cat-sdk 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/cat20/cat20.json +35 -35
- package/artifacts/cat20/cat20.scrypt +19 -19
- package/artifacts/cat20/cat20Admin.json +34 -34
- package/artifacts/cat20/cat20Admin.scrypt +24 -24
- package/artifacts/cat20/cat20GuardStateLib.json +22 -22
- package/artifacts/cat20/cat20GuardStateLib.scrypt +5 -5
- package/artifacts/cat20/cat20GuardVariants.json +2 -2
- package/artifacts/cat20/cat20GuardVariants.scrypt +1 -1
- package/artifacts/cat20/cat20Guard_12_12_2.json +29 -29
- package/artifacts/cat20/cat20Guard_12_12_2.scrypt +20 -20
- package/artifacts/cat20/cat20Guard_12_12_4.json +29 -29
- package/artifacts/cat20/cat20Guard_12_12_4.scrypt +20 -20
- package/artifacts/cat20/cat20Guard_6_6_2.json +29 -29
- package/artifacts/cat20/cat20Guard_6_6_2.scrypt +20 -20
- package/artifacts/cat20/cat20Guard_6_6_4.json +29 -29
- package/artifacts/cat20/cat20Guard_6_6_4.scrypt +20 -20
- package/artifacts/cat20/cat20StateLib.json +23 -23
- package/artifacts/cat20/cat20StateLib.scrypt +5 -5
- package/artifacts/cat20/minters/cat20ClosedMinter.json +32 -32
- package/artifacts/cat20/minters/cat20ClosedMinter.scrypt +19 -19
- package/artifacts/cat20/minters/cat20OpenMinter.json +32 -32
- package/artifacts/cat20/minters/cat20OpenMinter.scrypt +16 -16
- package/artifacts/cat20/types.json +5 -5
- package/artifacts/cat20/types.scrypt +5 -5
- package/artifacts/cat721/cat721.json +35 -35
- package/artifacts/cat721/cat721.scrypt +19 -19
- package/artifacts/cat721/cat721GuardStateLib.json +22 -22
- package/artifacts/cat721/cat721GuardStateLib.scrypt +5 -5
- package/artifacts/cat721/cat721GuardVariants.json +2 -2
- package/artifacts/cat721/cat721GuardVariants.scrypt +1 -1
- package/artifacts/cat721/cat721Guard_12_12_2.json +29 -29
- package/artifacts/cat721/cat721Guard_12_12_2.scrypt +20 -20
- package/artifacts/cat721/cat721Guard_12_12_4.json +29 -29
- package/artifacts/cat721/cat721Guard_12_12_4.scrypt +20 -20
- package/artifacts/cat721/cat721Guard_6_6_2.json +29 -29
- package/artifacts/cat721/cat721Guard_6_6_2.scrypt +20 -20
- package/artifacts/cat721/cat721Guard_6_6_4.json +29 -29
- package/artifacts/cat721/cat721Guard_6_6_4.scrypt +20 -20
- package/artifacts/cat721/cat721StateLib.json +23 -23
- package/artifacts/cat721/cat721StateLib.scrypt +5 -5
- package/artifacts/cat721/minters/cat721ClosedMinter.json +32 -32
- package/artifacts/cat721/minters/cat721ClosedMinter.scrypt +15 -15
- package/artifacts/cat721/minters/cat721OpenMintInfo.json +5 -5
- package/artifacts/cat721/minters/cat721OpenMintInfo.scrypt +4 -4
- package/artifacts/cat721/minters/cat721OpenMinter.json +37 -37
- package/artifacts/cat721/minters/cat721OpenMinter.scrypt +21 -21
- package/artifacts/cat721/minters/cat721OpenMinterMerkleTree.json +20 -20
- package/artifacts/cat721/minters/cat721OpenMinterMerkleTree.scrypt +6 -6
- package/artifacts/cat721/types.json +5 -5
- package/artifacts/cat721/types.scrypt +5 -5
- package/artifacts/constants.json +2 -2
- package/artifacts/constants.scrypt +1 -1
- package/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/backtrace.scrypt +13 -13
- package/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/contextUtils.scrypt +18 -18
- package/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/stdUtils.scrypt +18 -18
- package/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/txHashPreimageUtils.scrypt +7 -7
- package/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/txUtils.scrypt +12 -12
- package/artifacts/scrypt-ts-opcat/assets/smart-contract/types/structs.scrypt +9 -9
- package/artifacts/types.json +2 -2
- package/artifacts/types.scrypt +2 -2
- package/artifacts/utils/ownerUtils.json +15 -15
- package/artifacts/utils/ownerUtils.scrypt +3 -3
- package/dist/artifacts/cat20/cat20.json +35 -35
- package/dist/artifacts/cat20/cat20.scrypt +19 -19
- package/dist/artifacts/cat20/cat20Admin.json +34 -34
- package/dist/artifacts/cat20/cat20Admin.scrypt +24 -24
- package/dist/artifacts/cat20/cat20GuardStateLib.json +22 -22
- package/dist/artifacts/cat20/cat20GuardStateLib.scrypt +5 -5
- package/dist/artifacts/cat20/cat20GuardVariants.json +2 -2
- package/dist/artifacts/cat20/cat20GuardVariants.scrypt +1 -1
- package/dist/artifacts/cat20/cat20Guard_12_12_2.json +29 -29
- package/dist/artifacts/cat20/cat20Guard_12_12_2.scrypt +20 -20
- package/dist/artifacts/cat20/cat20Guard_12_12_4.json +29 -29
- package/dist/artifacts/cat20/cat20Guard_12_12_4.scrypt +20 -20
- package/dist/artifacts/cat20/cat20Guard_6_6_2.json +29 -29
- package/dist/artifacts/cat20/cat20Guard_6_6_2.scrypt +20 -20
- package/dist/artifacts/cat20/cat20Guard_6_6_4.json +29 -29
- package/dist/artifacts/cat20/cat20Guard_6_6_4.scrypt +20 -20
- package/dist/artifacts/cat20/cat20StateLib.json +23 -23
- package/dist/artifacts/cat20/cat20StateLib.scrypt +5 -5
- package/dist/artifacts/cat20/minters/cat20ClosedMinter.json +32 -32
- package/dist/artifacts/cat20/minters/cat20ClosedMinter.scrypt +19 -19
- package/dist/artifacts/cat20/minters/cat20OpenMinter.json +32 -32
- package/dist/artifacts/cat20/minters/cat20OpenMinter.scrypt +16 -16
- package/dist/artifacts/cat20/types.json +5 -5
- package/dist/artifacts/cat20/types.scrypt +5 -5
- package/dist/artifacts/cat721/cat721.json +35 -35
- package/dist/artifacts/cat721/cat721.scrypt +19 -19
- package/dist/artifacts/cat721/cat721GuardStateLib.json +22 -22
- package/dist/artifacts/cat721/cat721GuardStateLib.scrypt +5 -5
- package/dist/artifacts/cat721/cat721GuardVariants.json +2 -2
- package/dist/artifacts/cat721/cat721GuardVariants.scrypt +1 -1
- package/dist/artifacts/cat721/cat721Guard_12_12_2.json +29 -29
- package/dist/artifacts/cat721/cat721Guard_12_12_2.scrypt +20 -20
- package/dist/artifacts/cat721/cat721Guard_12_12_4.json +29 -29
- package/dist/artifacts/cat721/cat721Guard_12_12_4.scrypt +20 -20
- package/dist/artifacts/cat721/cat721Guard_6_6_2.json +29 -29
- package/dist/artifacts/cat721/cat721Guard_6_6_2.scrypt +20 -20
- package/dist/artifacts/cat721/cat721Guard_6_6_4.json +29 -29
- package/dist/artifacts/cat721/cat721Guard_6_6_4.scrypt +20 -20
- package/dist/artifacts/cat721/cat721StateLib.json +23 -23
- package/dist/artifacts/cat721/cat721StateLib.scrypt +5 -5
- package/dist/artifacts/cat721/minters/cat721ClosedMinter.json +32 -32
- package/dist/artifacts/cat721/minters/cat721ClosedMinter.scrypt +15 -15
- package/dist/artifacts/cat721/minters/cat721OpenMintInfo.json +5 -5
- package/dist/artifacts/cat721/minters/cat721OpenMintInfo.scrypt +4 -4
- package/dist/artifacts/cat721/minters/cat721OpenMinter.json +37 -37
- package/dist/artifacts/cat721/minters/cat721OpenMinter.scrypt +21 -21
- package/dist/artifacts/cat721/minters/cat721OpenMinterMerkleTree.json +20 -20
- package/dist/artifacts/cat721/minters/cat721OpenMinterMerkleTree.scrypt +6 -6
- package/dist/artifacts/cat721/types.json +5 -5
- package/dist/artifacts/cat721/types.scrypt +5 -5
- package/dist/artifacts/constants.json +2 -2
- package/dist/artifacts/constants.scrypt +1 -1
- package/dist/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/backtrace.scrypt +13 -13
- package/dist/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/contextUtils.scrypt +18 -18
- package/dist/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/stdUtils.scrypt +18 -18
- package/dist/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/txHashPreimageUtils.scrypt +7 -7
- package/dist/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/txUtils.scrypt +12 -12
- package/dist/artifacts/scrypt-ts-opcat/assets/smart-contract/types/structs.scrypt +9 -9
- package/dist/artifacts/types.json +2 -2
- package/dist/artifacts/types.scrypt +2 -2
- package/dist/artifacts/utils/ownerUtils.json +15 -15
- package/dist/artifacts/utils/ownerUtils.scrypt +3 -3
- package/dist/cjs/lib/metadata.js +96 -2
- package/dist/cjs/lib/metadata.js.map +1 -1
- package/dist/esm/lib/metadata.js +92 -1
- package/dist/esm/lib/metadata.js.map +1 -1
- package/dist/types/lib/metadata.d.ts +38 -1
- package/dist/types/lib/metadata.d.ts.map +1 -1
- package/package.json +4 -4
package/artifacts/constants.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 10,
|
|
3
3
|
"compilerVersion": "1.22.0+commit.47800da",
|
|
4
|
-
"contract": "
|
|
4
|
+
"contract": "_opcat_labs_cat_sdk_4_1_0__rs__ConstantsLib",
|
|
5
5
|
"md5": "d41d8cd98f00b204e9800998ecf8427e",
|
|
6
6
|
"structs": [],
|
|
7
7
|
"library": [
|
|
8
8
|
{
|
|
9
|
-
"name": "
|
|
9
|
+
"name": "_opcat_labs_cat_sdk_4_1_0__rs__ConstantsLib",
|
|
10
10
|
"params": [],
|
|
11
11
|
"properties": [],
|
|
12
12
|
"genericTypes": []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
library
|
|
4
|
+
library _opcat_labs_cat_sdk_4_1_0__rs__ConstantsLib {
|
|
5
5
|
static const bytes ZERO_SHA1256_HASH = Sha256(b'0000000000000000000000000000000000000000000000000000000000000000');
|
|
6
6
|
static const bytes TOKEN_SCRIPT_HASH_PLACEHOLDER_FF = Sha256(b'00000000000000000000000000000000000000000000000000000000000000ff');
|
|
7
7
|
static const bytes TOKEN_SCRIPT_HASH_PLACEHOLDER_FE = Sha256(b'00000000000000000000000000000000000000000000000000000000000000fe');
|
|
@@ -6,38 +6,38 @@ import "stdUtils.scrypt";
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
struct
|
|
9
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ChainTxVerifyResponse {
|
|
10
10
|
bytes prevPrevScript;
|
|
11
11
|
bytes prevPrevOutpoint;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
library
|
|
14
|
+
library _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Backtrace {
|
|
15
15
|
static const bytes GENESIS_SCRIPT_HASH = b'6712360d7ad09ba9a59cd236aab61db7183c8d881c74ea029debd1f6b26711f8';
|
|
16
|
-
static function checkPrevTxHashPreimage(
|
|
17
|
-
bytes txHash =
|
|
16
|
+
static function checkPrevTxHashPreimage(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage txHashPreimage, bytes t_outpoint) : bool {
|
|
17
|
+
bytes txHash = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimageUtils.getTxHashFromTxHashPreimage(txHashPreimage);
|
|
18
18
|
require(txHash == t_outpoint[0 : 32]);
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
|
-
static function verifyFromOutpoint(
|
|
22
|
-
|
|
21
|
+
static function verifyFromOutpoint(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__BacktraceInfo backtraceInfo, int t_prevOutputIndex, bytes t_genesisOutpoint, bytes t_selfScript, bytes t_prevTxInputList) : bool {
|
|
22
|
+
_opcat_labs_scrypt_ts_opcat_4_1_0__rs__ChainTxVerifyResponse res = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Backtrace.verifyChainTxs(backtraceInfo, t_prevTxInputList);
|
|
23
23
|
if(res.prevPrevOutpoint == t_genesisOutpoint) {
|
|
24
|
-
require(res.prevPrevScript ==
|
|
24
|
+
require(res.prevPrevScript == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Backtrace.GENESIS_SCRIPT_HASH);
|
|
25
25
|
require(t_prevOutputIndex == 0);
|
|
26
26
|
}
|
|
27
27
|
require(res.prevPrevOutpoint == t_genesisOutpoint || res.prevPrevScript == t_selfScript);
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
|
-
static function verifyFromScript(
|
|
31
|
-
|
|
30
|
+
static function verifyFromScript(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__BacktraceInfo backtraceInfo, bytes t_genesisScript, bytes t_selfScript, bytes t_prevTxInputList) : bool {
|
|
31
|
+
_opcat_labs_scrypt_ts_opcat_4_1_0__rs__ChainTxVerifyResponse res = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Backtrace.verifyChainTxs(backtraceInfo, t_prevTxInputList);
|
|
32
32
|
require(res.prevPrevScript == t_genesisScript || res.prevPrevScript == t_selfScript);
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
|
-
static function verifyChainTxs(
|
|
36
|
-
require(t_prevTxInputList[backtraceInfo.prevTxInputIndex * 72 : (backtraceInfo.prevTxInputIndex + 1) * 72] ==
|
|
35
|
+
static function verifyChainTxs(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__BacktraceInfo backtraceInfo, bytes t_prevTxInputList) : _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ChainTxVerifyResponse {
|
|
36
|
+
require(t_prevTxInputList[backtraceInfo.prevTxInputIndex * 72 : (backtraceInfo.prevTxInputIndex + 1) * 72] == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.mergeInput(backtraceInfo.prevTxInput));
|
|
37
37
|
bytes prevPrevTxHash = backtraceInfo.prevTxInput.prevTxHash;
|
|
38
|
-
require(prevPrevTxHash ==
|
|
38
|
+
require(prevPrevTxHash == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimageUtils.getTxHashFromTxHashPreimage(backtraceInfo.prevPrevTxPreimage));
|
|
39
39
|
bytes prevPrevScript = backtraceInfo.prevPrevTxPreimage.outputList[backtraceInfo.prevTxInput.prevOutputIndex * 72 + 8 : (backtraceInfo.prevTxInput.prevOutputIndex) * 72 + 8 + 32];
|
|
40
|
-
bytes prevPrevOutpoint = prevPrevTxHash +
|
|
40
|
+
bytes prevPrevOutpoint = prevPrevTxHash + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.uint32ToByteString(backtraceInfo.prevTxInput.prevOutputIndex);
|
|
41
41
|
return {prevPrevScript, prevPrevOutpoint};
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -5,7 +5,7 @@ import "txUtils.scrypt";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
library
|
|
8
|
+
library _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils {
|
|
9
9
|
static const PrivKey privKey = PrivKey(0x26f00fe2340a84335ebdf30f57e9bb58487117b29355718f5e46bf5168d7df97);
|
|
10
10
|
static const PubKey pubKey = PubKey(b'02ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382');
|
|
11
11
|
static const int invK = 0xc8ffdbaa05d93aa4ede79ec58f06a72562048b775a3507c2bf44bde4f007c40a;
|
|
@@ -18,7 +18,7 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__ContextUtils {
|
|
|
18
18
|
static function sign(int h, PrivKey privKey, int inverseK, int r, bytes rBigEndian, bytes sigHashType) : Sig {
|
|
19
19
|
int s = inverseK * (h + r * privKey);
|
|
20
20
|
|
|
21
|
-
s =
|
|
21
|
+
s = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils.normalize(s, 115792089237316195423570985008687907852837564279074904382605163141518161494337);
|
|
22
22
|
if(s > 115792089237316195423570985008687907852837564279074904382605163141518161494337 / 2) {
|
|
23
23
|
s = 115792089237316195423570985008687907852837564279074904382605163141518161494337 - s;
|
|
24
24
|
}
|
|
@@ -32,13 +32,13 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__ContextUtils {
|
|
|
32
32
|
static function fromBEUnsigned(bytes b) : int {
|
|
33
33
|
return unpack(reverseBytes(b, 32) + b'00');
|
|
34
34
|
}
|
|
35
|
-
static function checkSHPreimage(
|
|
36
|
-
SigHashPreimage preimage =
|
|
35
|
+
static function checkSHPreimage(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__SHPreimage shPreimage, bytes sigHashType) : Sig {
|
|
36
|
+
SigHashPreimage preimage = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils.serializeSHPreimage(shPreimage);
|
|
37
37
|
bytes h = hash256(preimage);
|
|
38
|
-
Sig sig =
|
|
38
|
+
Sig sig = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils.sign(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils.fromBEUnsigned(h), _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils.privKey, 90914631784428570546048907090666684794265392153046400654824470772421497439242, 7252565254521500021189571868467740368187828957595681190666767817830690399852, _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils.rBigEndian, sigHashType);
|
|
39
39
|
return sig;
|
|
40
40
|
}
|
|
41
|
-
static function serializeSHPreimage(
|
|
41
|
+
static function serializeSHPreimage(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__SHPreimage shPreimage) : SigHashPreimage {
|
|
42
42
|
require(len(shPreimage.nVersion) == 4);
|
|
43
43
|
require(len(shPreimage.hashPrevouts) == 32);
|
|
44
44
|
require(shPreimage.inputIndex >= 0);
|
|
@@ -54,44 +54,44 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__ContextUtils {
|
|
|
54
54
|
require(len(shPreimage.hashOutputs) == 32);
|
|
55
55
|
require(shPreimage.nLockTime >= 0);
|
|
56
56
|
require(shPreimage.sigHashType == 1 || shPreimage.sigHashType == 2 || shPreimage.sigHashType == 3 || shPreimage.sigHashType == 0x81 || shPreimage.sigHashType == 0x82 || shPreimage.sigHashType == 0x83);
|
|
57
|
-
bytes preimage = shPreimage.nVersion + shPreimage.hashPrevouts +
|
|
57
|
+
bytes preimage = shPreimage.nVersion + shPreimage.hashPrevouts + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.toLEUnsigned(shPreimage.inputIndex, 4) + shPreimage.outpoint + shPreimage.spentScriptHash + shPreimage.spentDataHash + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.satoshisToByteString(shPreimage.value) + shPreimage.nSequence + shPreimage.hashSpentAmounts + shPreimage.hashSpentScriptHashes + shPreimage.hashSpentDataHashes + shPreimage.hashSequences + shPreimage.hashOutputs + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.toLEUnsigned(shPreimage.nLockTime, 4) + num2bin(shPreimage.sigHashType, 4);
|
|
58
58
|
return SigHashPreimage(preimage);
|
|
59
59
|
}
|
|
60
|
-
static function getOutpoint(
|
|
61
|
-
return {shPreimage.outpoint[0 : 32],
|
|
60
|
+
static function getOutpoint(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__SHPreimage shPreimage) : _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Outpoint {
|
|
61
|
+
return {shPreimage.outpoint[0 : 32], _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.byteStringToUInt32(shPreimage.outpoint[32 : 36])};
|
|
62
62
|
}
|
|
63
|
-
static function checkPrevouts(bytes prevouts, bytes t_hashPrevouts, int t_inputIndex, int t_inputCount) :
|
|
63
|
+
static function checkPrevouts(bytes prevouts, bytes t_hashPrevouts, int t_inputIndex, int t_inputCount) : _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Outpoint {
|
|
64
64
|
require(hash256(prevouts) == t_hashPrevouts);
|
|
65
65
|
require(t_inputIndex < t_inputCount);
|
|
66
|
-
require(t_inputCount ==
|
|
66
|
+
require(t_inputCount == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.checkLenDivisibleBy(prevouts, 36));
|
|
67
67
|
bytes b = prevouts[t_inputIndex * 36 : (t_inputIndex + 1) * 36];
|
|
68
|
-
return {b[0 : 32],
|
|
68
|
+
return {b[0 : 32], _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.byteStringToUInt32(b[32 : 36])};
|
|
69
69
|
}
|
|
70
70
|
static function checkSpentScripts(bytes spentScriptHashes, bytes t_hashSpentScripts, int t_inputCount) : bool {
|
|
71
71
|
require(hash256(spentScriptHashes) == t_hashSpentScripts);
|
|
72
|
-
require(t_inputCount ==
|
|
72
|
+
require(t_inputCount == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.checkLenDivisibleBy(spentScriptHashes, 32));
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
75
75
|
static function checkSpentAmounts(bytes spentAmounts, bytes hashSpentAmounts) : int {
|
|
76
76
|
require(hash256(spentAmounts) == hashSpentAmounts);
|
|
77
|
-
return
|
|
77
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.checkLenDivisibleBy(spentAmounts, 8);
|
|
78
78
|
}
|
|
79
79
|
static function checkSpentDataHashes(bytes spentDataHashes, bytes hashSpentDataHashes, int inputCount) : bool {
|
|
80
80
|
require(hash256(spentDataHashes) == hashSpentDataHashes);
|
|
81
|
-
require(inputCount ==
|
|
81
|
+
require(inputCount == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.checkLenDivisibleBy(spentDataHashes, 32));
|
|
82
82
|
return true;
|
|
83
83
|
}
|
|
84
84
|
static function getSpentScriptHash(bytes spentScriptHashes, int inputIndex) : bytes {
|
|
85
85
|
return spentScriptHashes[inputIndex * 32 : (inputIndex + 1) * 32];
|
|
86
86
|
}
|
|
87
87
|
static function getSpentAmount(bytes spentAmounts, int inputIndex) : int {
|
|
88
|
-
return
|
|
88
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(spentAmounts[inputIndex * 8 : (inputIndex + 1) * 8]);
|
|
89
89
|
}
|
|
90
90
|
static function getSpentDataHash(bytes spentDataHashes, int inputIndex) : bytes {
|
|
91
91
|
return spentDataHashes[inputIndex * 32 : (inputIndex + 1) * 32];
|
|
92
92
|
}
|
|
93
|
-
static function checknLockTime(
|
|
94
|
-
int nSequence =
|
|
93
|
+
static function checknLockTime(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__SHPreimage shPreimage, int nlockTime) : bool {
|
|
94
|
+
int nSequence = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(shPreimage.nSequence);
|
|
95
95
|
return (nSequence < 4294967295 && (nlockTime < 500000000 ? shPreimage.nLockTime < 500000000 : true) && shPreimage.nLockTime >= nlockTime);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
struct
|
|
4
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ReadVarintResult {
|
|
5
5
|
bytes data;
|
|
6
6
|
int nextPos;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
library
|
|
9
|
+
library _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils {
|
|
10
10
|
static const bytes VARINT_2BYTE = b'fd';
|
|
11
11
|
static const bytes VARINT_4BYTE = b'fe';
|
|
12
12
|
static const bytes VARINT_8BYTE = b'ff';
|
|
@@ -20,15 +20,15 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils {
|
|
|
20
20
|
}
|
|
21
21
|
static function uint64ToByteString(int n) : bytes {
|
|
22
22
|
require(n >= 0 && n <= 18446744073709551615);
|
|
23
|
-
return
|
|
23
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.toLEUnsigned(n, 8);
|
|
24
24
|
}
|
|
25
25
|
static function uint32ToByteString(int n) : bytes {
|
|
26
26
|
require(n >= 0 && n <= 4294967295);
|
|
27
|
-
return
|
|
27
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.toLEUnsigned(n, 4);
|
|
28
28
|
}
|
|
29
29
|
static function byteStringToUInt32(bytes b) : int {
|
|
30
30
|
require(len(b) == 4);
|
|
31
|
-
return
|
|
31
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(b);
|
|
32
32
|
}
|
|
33
33
|
static function toLEUnsigned(int n, int l) : bytes {
|
|
34
34
|
bytes m = num2bin(n, l + 1);
|
|
@@ -43,16 +43,16 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils {
|
|
|
43
43
|
if(n < 0xfd) {
|
|
44
44
|
size = 1;
|
|
45
45
|
} else if(n < 0x10000) {
|
|
46
|
-
b =
|
|
46
|
+
b = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.VARINT_2BYTE;
|
|
47
47
|
size = 2;
|
|
48
48
|
} else if(n < 0x100000000) {
|
|
49
|
-
b =
|
|
49
|
+
b = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.VARINT_4BYTE;
|
|
50
50
|
size = 4;
|
|
51
51
|
} else {
|
|
52
|
-
b =
|
|
52
|
+
b = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.VARINT_8BYTE;
|
|
53
53
|
size = 8;
|
|
54
54
|
}
|
|
55
|
-
return b +
|
|
55
|
+
return b + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.toLEUnsigned(n, size);
|
|
56
56
|
}
|
|
57
57
|
static function pushData(bytes buf) : bytes {
|
|
58
58
|
int n = len(buf);
|
|
@@ -73,27 +73,27 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils {
|
|
|
73
73
|
} else {
|
|
74
74
|
require(false);
|
|
75
75
|
}
|
|
76
|
-
return header +
|
|
76
|
+
return header + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.toLEUnsigned(n, size);
|
|
77
77
|
}
|
|
78
|
-
static function readVarint(bytes buf, int pos) :
|
|
78
|
+
static function readVarint(bytes buf, int pos) : _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ReadVarintResult {
|
|
79
79
|
int l = 0;
|
|
80
80
|
bytes ret = b'';
|
|
81
81
|
int nextPos = pos;
|
|
82
82
|
bytes header = buf[pos : pos + 1];
|
|
83
|
-
if(header ==
|
|
84
|
-
l =
|
|
83
|
+
if(header == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.VARINT_2BYTE) {
|
|
84
|
+
l = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 3]);
|
|
85
85
|
ret = buf[pos + 3 : pos + 3 + l];
|
|
86
86
|
nextPos = pos + 3 + l;
|
|
87
|
-
} else if(header ==
|
|
88
|
-
l =
|
|
87
|
+
} else if(header == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.VARINT_4BYTE) {
|
|
88
|
+
l = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 5]);
|
|
89
89
|
ret = buf[pos + 5 : pos + 5 + l];
|
|
90
90
|
nextPos = pos + 5 + l;
|
|
91
|
-
} else if(header ==
|
|
92
|
-
l =
|
|
91
|
+
} else if(header == _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.VARINT_8BYTE) {
|
|
92
|
+
l = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 9]);
|
|
93
93
|
ret = buf[pos + 9 : pos + 9 + l];
|
|
94
94
|
nextPos = pos + 9 + l;
|
|
95
95
|
} else {
|
|
96
|
-
l =
|
|
96
|
+
l = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(buf[pos : pos + 1]);
|
|
97
97
|
ret = buf[pos + 1 : pos + 1 + l];
|
|
98
98
|
nextPos = pos + 1 + l;
|
|
99
99
|
}
|
package/artifacts/scrypt-ts-opcat/assets/smart-contract/builtin-libs/txHashPreimageUtils.scrypt
CHANGED
|
@@ -4,17 +4,17 @@ import "stdUtils.scrypt";
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
library
|
|
8
|
-
static function getTxHashFromTxHashPreimage(
|
|
7
|
+
library _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimageUtils {
|
|
8
|
+
static function getTxHashFromTxHashPreimage(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage txHashPreimage) : bytes {
|
|
9
9
|
require(len(txHashPreimage.version) == 4);
|
|
10
|
-
int inputCount =
|
|
11
|
-
int outputCount =
|
|
12
|
-
return hash256(txHashPreimage.version +
|
|
10
|
+
int inputCount = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.inputList, 72);
|
|
11
|
+
int outputCount = _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.outputList, 72);
|
|
12
|
+
return hash256(txHashPreimage.version + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.writeVarInt(inputCount) + txHashPreimage.inputList + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.writeVarInt(outputCount) + txHashPreimage.outputList + txHashPreimage.nLockTime);
|
|
13
13
|
}
|
|
14
|
-
static function getInputByteString(
|
|
14
|
+
static function getInputByteString(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage txHashPreimage, int inputIndex) : bytes {
|
|
15
15
|
return txHashPreimage.inputList[inputIndex * 72 : (inputIndex + 1) * 72];
|
|
16
16
|
}
|
|
17
|
-
static function getOutputByteString(
|
|
17
|
+
static function getOutputByteString(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage txHashPreimage, int outputIndex) : bytes {
|
|
18
18
|
return txHashPreimage.outputList[outputIndex * 72 : (outputIndex + 1) * 72];
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -4,10 +4,10 @@ import "stdUtils.scrypt";
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
library
|
|
7
|
+
library _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils {
|
|
8
8
|
static const int ZERO_SATS = 0;
|
|
9
9
|
static function buildOutput(bytes scriptHash, int satoshis) : bytes {
|
|
10
|
-
return
|
|
10
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.buildDataOutput(scriptHash, satoshis, sha256(b''));
|
|
11
11
|
}
|
|
12
12
|
static function buildDataOutput(bytes scriptHash, int satoshis, bytes dataHash) : bytes {
|
|
13
13
|
int scriptHashLen = len(scriptHash);
|
|
@@ -15,34 +15,34 @@ library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__TxUtils {
|
|
|
15
15
|
require(scriptHashLen == 32);
|
|
16
16
|
require(dataHashLen == 32);
|
|
17
17
|
require(satoshis > 0);
|
|
18
|
-
return
|
|
18
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.satoshisToByteString(satoshis) + scriptHash + dataHash;
|
|
19
19
|
}
|
|
20
|
-
static function buildChangeOutput(
|
|
21
|
-
return change.satoshis > 0 ?
|
|
20
|
+
static function buildChangeOutput(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxOut change) : bytes {
|
|
21
|
+
return change.satoshis > 0 ? _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.buildDataOutput(change.scriptHash, change.satoshis, change.dataHash) : b'';
|
|
22
22
|
}
|
|
23
|
-
static function mergeInput(
|
|
23
|
+
static function mergeInput(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxIn txInput) : bytes {
|
|
24
24
|
require(len(txInput.prevTxHash) == 32);
|
|
25
25
|
require(len(txInput.scriptHash) == 32);
|
|
26
|
-
return (txInput.prevTxHash +
|
|
26
|
+
return (txInput.prevTxHash + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.uint32ToByteString(txInput.prevOutputIndex) + txInput.scriptHash + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.uint32ToByteString(txInput.sequence));
|
|
27
27
|
}
|
|
28
28
|
static function buildOpReturnOutput(bytes data) : bytes {
|
|
29
29
|
bytes script = b'6a' + pack(len(data)) + data;
|
|
30
|
-
return
|
|
30
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.satoshisToByteString(0) + sha256(script) + sha256(b'');
|
|
31
31
|
}
|
|
32
32
|
static function buildP2PKHScript(Ripemd160 addr) : bytes {
|
|
33
33
|
return (OpCode.OP_DUP + OpCode.OP_HASH160 + pack(20) + addr + OpCode.OP_EQUALVERIFY + OpCode.OP_CHECKSIG);
|
|
34
34
|
}
|
|
35
35
|
static function buildP2PKHOutput(int amount, Ripemd160 addr) : bytes {
|
|
36
|
-
return
|
|
36
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.buildDataOutput(sha256(_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils.buildP2PKHScript(addr)), amount, sha256(b''));
|
|
37
37
|
}
|
|
38
38
|
static function buildOpreturnScript(bytes data) : bytes {
|
|
39
|
-
return OpCode.OP_FALSE + OpCode.OP_RETURN +
|
|
39
|
+
return OpCode.OP_FALSE + OpCode.OP_RETURN + _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.pushData(data);
|
|
40
40
|
}
|
|
41
41
|
static function satoshisToByteString(int n) : bytes {
|
|
42
|
-
return
|
|
42
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.uint64ToByteString(n);
|
|
43
43
|
}
|
|
44
44
|
static function byteStringToSatoshis(bytes bs) : int {
|
|
45
45
|
require(len(bs) == 8);
|
|
46
|
-
return
|
|
46
|
+
return _opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils.fromLEUnsigned(bs);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
struct
|
|
4
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxOut {
|
|
5
5
|
bytes scriptHash;
|
|
6
6
|
bytes dataHash;
|
|
7
7
|
int satoshis;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
struct
|
|
10
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxIn {
|
|
11
11
|
bytes prevTxHash;
|
|
12
12
|
int prevOutputIndex;
|
|
13
13
|
int sequence;
|
|
14
14
|
bytes scriptHash;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
struct
|
|
17
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage {
|
|
18
18
|
bytes version;
|
|
19
19
|
bytes inputList;
|
|
20
20
|
bytes outputList;
|
|
21
21
|
bytes nLockTime;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
struct
|
|
25
|
-
|
|
24
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__BacktraceInfo {
|
|
25
|
+
_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxIn prevTxInput;
|
|
26
26
|
int prevTxInputIndex;
|
|
27
|
-
|
|
27
|
+
_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage prevPrevTxPreimage;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
struct
|
|
30
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__SHPreimage {
|
|
31
31
|
bytes nVersion;
|
|
32
32
|
bytes hashPrevouts;
|
|
33
33
|
int inputIndex;
|
|
@@ -45,12 +45,12 @@ struct _opcat_labs_scrypt_ts_opcat_4_0_0__rs__SHPreimage {
|
|
|
45
45
|
int sigHashType;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
struct
|
|
48
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__Outpoint {
|
|
49
49
|
bytes txHash;
|
|
50
50
|
int outputIndex;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
struct
|
|
53
|
+
struct _opcat_labs_scrypt_ts_opcat_4_1_0__rs__ChangeInfo {
|
|
54
54
|
Ripemd160 pubkeyhash;
|
|
55
55
|
int satoshis;
|
|
56
56
|
Sha256 dataHash;
|
package/artifacts/types.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"md5": "d41d8cd98f00b204e9800998ecf8427e",
|
|
6
6
|
"structs": [
|
|
7
7
|
{
|
|
8
|
-
"name": "
|
|
8
|
+
"name": "_opcat_labs_cat_sdk_4_1_0__rs__CAT20ContractUnlockArgs",
|
|
9
9
|
"params": [
|
|
10
10
|
{
|
|
11
11
|
"name": "spendType",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"genericTypes": []
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"name": "
|
|
30
|
+
"name": "_opcat_labs_cat_sdk_4_1_0__rs__CAT721ContractUnlockArgs",
|
|
31
31
|
"params": [
|
|
32
32
|
{
|
|
33
33
|
"name": "userPubKey",
|
package/artifacts/types.scrypt
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
struct
|
|
4
|
+
struct _opcat_labs_cat_sdk_4_1_0__rs__CAT20ContractUnlockArgs {
|
|
5
5
|
int spendType;
|
|
6
6
|
PubKey userPubKey;
|
|
7
7
|
Sig userSig;
|
|
8
8
|
int spendScriptInputIndex;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
struct
|
|
11
|
+
struct _opcat_labs_cat_sdk_4_1_0__rs__CAT721ContractUnlockArgs {
|
|
12
12
|
PubKey userPubKey;
|
|
13
13
|
Sig userSig;
|
|
14
14
|
int contractInputIndex;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 10,
|
|
3
3
|
"compilerVersion": "1.22.0+commit.47800da",
|
|
4
|
-
"contract": "
|
|
4
|
+
"contract": "_opcat_labs_cat_sdk_4_1_0__rs__OwnerUtils",
|
|
5
5
|
"md5": "d41d8cd98f00b204e9800998ecf8427e",
|
|
6
6
|
"structs": [
|
|
7
7
|
{
|
|
8
|
-
"name": "
|
|
8
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxOut",
|
|
9
9
|
"params": [
|
|
10
10
|
{
|
|
11
11
|
"name": "scriptHash",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"genericTypes": []
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
"name": "
|
|
26
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxIn",
|
|
27
27
|
"params": [
|
|
28
28
|
{
|
|
29
29
|
"name": "prevTxHash",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"genericTypes": []
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
"name": "
|
|
48
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage",
|
|
49
49
|
"params": [
|
|
50
50
|
{
|
|
51
51
|
"name": "version",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"genericTypes": []
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
|
-
"name": "
|
|
70
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__BacktraceInfo",
|
|
71
71
|
"params": [
|
|
72
72
|
{
|
|
73
73
|
"name": "prevTxInput",
|
|
74
|
-
"type": "
|
|
74
|
+
"type": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxIn"
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
"name": "prevTxInputIndex",
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "prevPrevTxPreimage",
|
|
82
|
-
"type": "
|
|
82
|
+
"type": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxHashPreimage"
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
85
|
"genericTypes": []
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
"name": "
|
|
88
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__SHPreimage",
|
|
89
89
|
"params": [
|
|
90
90
|
{
|
|
91
91
|
"name": "nVersion",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"genericTypes": []
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
|
-
"name": "
|
|
154
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__Outpoint",
|
|
155
155
|
"params": [
|
|
156
156
|
{
|
|
157
157
|
"name": "txHash",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"genericTypes": []
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
|
-
"name": "
|
|
168
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__ChangeInfo",
|
|
169
169
|
"params": [
|
|
170
170
|
{
|
|
171
171
|
"name": "pubkeyhash",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"genericTypes": []
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
|
-
"name": "
|
|
186
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__ReadVarintResult",
|
|
187
187
|
"params": [
|
|
188
188
|
{
|
|
189
189
|
"name": "data",
|
|
@@ -199,25 +199,25 @@
|
|
|
199
199
|
],
|
|
200
200
|
"library": [
|
|
201
201
|
{
|
|
202
|
-
"name": "
|
|
202
|
+
"name": "_opcat_labs_cat_sdk_4_1_0__rs__OwnerUtils",
|
|
203
203
|
"params": [],
|
|
204
204
|
"properties": [],
|
|
205
205
|
"genericTypes": []
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
|
-
"name": "
|
|
208
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__TxUtils",
|
|
209
209
|
"params": [],
|
|
210
210
|
"properties": [],
|
|
211
211
|
"genericTypes": []
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
|
-
"name": "
|
|
214
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__ContextUtils",
|
|
215
215
|
"params": [],
|
|
216
216
|
"properties": [],
|
|
217
217
|
"genericTypes": []
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
|
-
"name": "
|
|
220
|
+
"name": "_opcat_labs_scrypt_ts_opcat_4_1_0__rs__StdUtils",
|
|
221
221
|
"params": [],
|
|
222
222
|
"properties": [],
|
|
223
223
|
"genericTypes": []
|
|
@@ -4,17 +4,17 @@ import "../scrypt-ts-opcat/assets/smart-contract/builtin-libs/contextUtils.scryp
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
library
|
|
7
|
+
library _opcat_labs_cat_sdk_4_1_0__rs__OwnerUtils {
|
|
8
8
|
static function pubKeyHashtoLockingScript(bytes pubKeyHash) : bytes {
|
|
9
9
|
require(len(pubKeyHash) == 20);
|
|
10
10
|
return b'76a914' + pubKeyHash + b'88ac';
|
|
11
11
|
}
|
|
12
12
|
static function toLockingScript(bytes pubKey) : bytes {
|
|
13
|
-
|
|
13
|
+
_opcat_labs_cat_sdk_4_1_0__rs__OwnerUtils.checkPubKey(pubKey);
|
|
14
14
|
return b'76a914' + hash160(pubKey) + b'88ac';
|
|
15
15
|
}
|
|
16
16
|
static function checkUserOwner(bytes pubKey, bytes ownerAddr) : bool {
|
|
17
|
-
require(
|
|
17
|
+
require(_opcat_labs_cat_sdk_4_1_0__rs__OwnerUtils.toLockingScript(pubKey) == ownerAddr);
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
static function checkPubKey(bytes pubKey) : bool {
|