@btc-vision/btc-runtime 1.9.3 → 1.9.4
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/package.json +1 -1
- package/runtime/contracts/OP721.ts +11 -16
- package/runtime/env/BlockchainEnvironment.ts +482 -44
- package/runtime/math/abi.ts +1 -3
- package/runtime/types/SafeMath.ts +1047 -334
package/package.json
CHANGED
|
@@ -24,7 +24,13 @@ import { IOP721 } from './interfaces/IOP721';
|
|
|
24
24
|
import { OP721InitParameters } from './interfaces/OP721InitParameters';
|
|
25
25
|
import { ReentrancyGuard } from './ReentrancyGuard';
|
|
26
26
|
import { StoredMapU256 } from '../storage/maps/StoredMapU256';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
ApprovedEvent,
|
|
29
|
+
ApprovedForAllEvent,
|
|
30
|
+
MAX_URI_LENGTH,
|
|
31
|
+
TransferredEvent,
|
|
32
|
+
URIEvent,
|
|
33
|
+
} from '../events/predefined';
|
|
28
34
|
import {
|
|
29
35
|
ON_OP721_RECEIVED_SELECTOR,
|
|
30
36
|
OP712_DOMAIN_TYPE_HASH,
|
|
@@ -642,10 +648,10 @@ export abstract class OP721 extends ReentrancyGuard implements IOP721 {
|
|
|
642
648
|
): void {
|
|
643
649
|
const calldata = new BytesWriter(
|
|
644
650
|
SELECTOR_BYTE_LENGTH +
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
651
|
+
ADDRESS_BYTE_LENGTH * 2 +
|
|
652
|
+
U256_BYTE_LENGTH +
|
|
653
|
+
U32_BYTE_LENGTH +
|
|
654
|
+
data.length,
|
|
649
655
|
);
|
|
650
656
|
calldata.writeSelector(ON_OP721_RECEIVED_SELECTOR);
|
|
651
657
|
calldata.writeAddress(Blockchain.tx.sender);
|
|
@@ -852,17 +858,6 @@ export abstract class OP721 extends ReentrancyGuard implements IOP721 {
|
|
|
852
858
|
return addr;
|
|
853
859
|
}
|
|
854
860
|
|
|
855
|
-
protected _addressToString(addr: Address): string {
|
|
856
|
-
let result = '0x';
|
|
857
|
-
// Convert all 32 bytes to hex string
|
|
858
|
-
for (let i: i32 = 0; i < 32; i++) {
|
|
859
|
-
const byte = addr[i];
|
|
860
|
-
const hex = byte.toString(16);
|
|
861
|
-
result += hex.length == 1 ? '0' + hex : hex;
|
|
862
|
-
}
|
|
863
|
-
return result;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
861
|
// Event creation helpers
|
|
867
862
|
protected createTransferEvent(from: Address, to: Address, tokenId: u256): void {
|
|
868
863
|
this.emitEvent(new TransferredEvent(Blockchain.tx.sender, from, to, tokenId));
|