@artblocks/contracts 1.5.0 → 1.7.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/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +61 -148
- package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +15 -2
- package/artifacts/contracts/generator/InPlaceDocument.sol/InPlaceDocument.json +10 -0
- package/artifacts/contracts/interfaces/v0.8.x/IAbxfsFileDataReader.sol/IAbxfsFileDataReader.json +109 -0
- package/artifacts/contracts/interfaces/v0.8.x/IAbxfsFileStore.sol/IAbxfsFileStore.json +86 -0
- package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +41 -27
- package/artifacts/contracts/interfaces/v0.8.x/IFormPaletteBindingHooks.sol/IFormPaletteBindingHooks.json +723 -0
- package/artifacts/contracts/interfaces/v0.8.x/IPMPProjectViewsV0.sol/IPMPProjectViewsV0.json +126 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterRequiredPMPV0.sol/ISharedMinterRequiredPMPV0.json +36 -0
- package/artifacts/contracts/libs/v0.8.x/AbxfsCanonical.sol/AbxfsCanonical.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/RequiredPMPLib.sol/RequiredPMPLib.json +10 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPricePMPV0.sol/MinterSetPricePMPV0.json +613 -0
- package/artifacts/contracts/mock/CallProbeMock.sol/CallProbeMock.json +45 -0
- package/artifacts/contracts/mock/GasProbeMock.sol/GasProbeMock.json +45 -0
- package/artifacts/contracts/mock/GenArt721GeneratorV0ScriptyReferenceMock.sol/GenArt721GeneratorV0ScriptyReferenceMock.json +346 -0
- package/artifacts/contracts/mock/GenArt721GeneratorV0ScriptyReferenceMock.sol/ILegacyGenArt721CoreV2_PBAB_Flex.json +47 -0
- package/artifacts/contracts/mock/InPlaceDocumentHarnessMock.sol/InPlaceDocumentHarnessMock.json +161 -0
- package/artifacts/contracts/mock/MockAbxfsFileDataReader.sol/IMockFileStore.json +91 -0
- package/artifacts/contracts/mock/MockAbxfsFileDataReader.sol/MockAbxfsFileDataReader.json +183 -0
- package/artifacts/contracts/mock/MockAbxfsFileStore.sol/MockAbxfsFileStore.json +204 -0
- package/artifacts/contracts/mock/MockPMPMinterReentrantConfigureHook.sol/IMinterPMPPurchase.json +91 -0
- package/artifacts/contracts/mock/MockPMPMinterReentrantConfigureHook.sol/MockPMPMinterReentrantConfigureHook.json +180 -0
- package/artifacts/contracts/mock/MockPMPReentrantConfigureHook.sol/MockPMPReentrantConfigureHook.json +158 -0
- package/artifacts/contracts/mock/RawResponseMock.sol/RawResponseMock.json +61 -0
- package/artifacts/contracts/mock/ReentrancyPMPMockShared.sol/IMinterPurchaseWithPMPs.json +67 -0
- package/artifacts/contracts/mock/ReentrancyPMPMockShared.sol/ReentrancyPMPMockShared.json +154 -0
- package/artifacts/contracts/web3call/combined-hooks/FormPaletteBindingHooks.sol/FormPaletteBindingHooks.json +919 -0
- package/contracts/DependencyRegistryV0.sol +136 -226
- package/contracts/generator/GenArt721GeneratorV0.sol +541 -280
- package/contracts/generator/InPlaceDocument.sol +306 -0
- package/contracts/interfaces/v0.8.x/IAbxfsFileDataReader.sol +67 -0
- package/contracts/interfaces/v0.8.x/IAbxfsFileStore.sol +40 -0
- package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +33 -22
- package/contracts/interfaces/v0.8.x/IFormPaletteBindingHooks.sol +339 -0
- package/contracts/interfaces/v0.8.x/IPMPProjectViewsV0.sol +59 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterRequiredPMPV0.sol +27 -0
- package/contracts/libs/v0.8.x/AbxfsCanonical.sol +23 -0
- package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +10 -4
- package/contracts/libs/v0.8.x/minter-libs/RequiredPMPLib.sol +336 -0
- package/contracts/minter-suite/Minters/MinterSetPricePMPV0.sol +664 -0
- package/contracts/mock/CallProbeMock.sol +20 -0
- package/contracts/mock/GasProbeMock.sol +21 -0
- package/contracts/mock/GenArt721GeneratorV0ScriptyReferenceMock.sol +1316 -0
- package/contracts/mock/InPlaceDocumentHarnessMock.sol +189 -0
- package/contracts/mock/MockAbxfsFileDataReader.sol +134 -0
- package/contracts/mock/MockAbxfsFileStore.sol +125 -0
- package/contracts/mock/MockPMPMinterReentrantConfigureHook.sol +85 -0
- package/contracts/mock/MockPMPReentrantConfigureHook.sol +59 -0
- package/contracts/mock/RawResponseMock.sol +58 -0
- package/contracts/mock/ReentrancyPMPMockShared.sol +81 -0
- package/contracts/web3call/combined-hooks/FormPaletteBindingHooks.sol +1392 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
// @dev 0.8.22 required by the PMP interfaces, which depend on OpenZeppelin 5.0
|
|
5
|
+
pragma solidity 0.8.22;
|
|
6
|
+
|
|
7
|
+
import {IPMPV0} from "../interfaces/v0.8.x/IPMPV0.sol";
|
|
8
|
+
|
|
9
|
+
interface IMinterPurchaseWithPMPs {
|
|
10
|
+
function purchaseWithPMPs(
|
|
11
|
+
uint256 projectId,
|
|
12
|
+
address coreContract,
|
|
13
|
+
IPMPV0.PMPInput[] calldata pmpInputs
|
|
14
|
+
) external payable returns (uint256 tokenId);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
contract ReentrancyPMPMockShared {
|
|
18
|
+
uint256 public currentQtyToPurchase;
|
|
19
|
+
uint256 public currentProjectId;
|
|
20
|
+
address public currentCoreContract;
|
|
21
|
+
uint256 public currentPriceToPay;
|
|
22
|
+
string public currentPMPKey;
|
|
23
|
+
uint8 public currentPMPParamType;
|
|
24
|
+
bytes32 public currentPMPValue;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
@notice This function can be called to induce controlled reentrency attacks
|
|
28
|
+
on a shared AB minter's PMP-accepting purchase function.
|
|
29
|
+
Note that _priceToPay should be > project price per token to induce refund,
|
|
30
|
+
making reentrency possible via fallback function.
|
|
31
|
+
*/
|
|
32
|
+
function attack(
|
|
33
|
+
uint256 _qtyToPurchase,
|
|
34
|
+
address _minterContractAddress,
|
|
35
|
+
uint256 _projectId,
|
|
36
|
+
address _coreContract,
|
|
37
|
+
uint256 _priceToPay,
|
|
38
|
+
string calldata _pmpKey,
|
|
39
|
+
uint8 _pmpParamType,
|
|
40
|
+
bytes32 _pmpValue
|
|
41
|
+
) external payable {
|
|
42
|
+
// update state variables so that receive() knows what to do
|
|
43
|
+
currentQtyToPurchase = _qtyToPurchase;
|
|
44
|
+
currentProjectId = _projectId;
|
|
45
|
+
currentCoreContract = _coreContract;
|
|
46
|
+
currentPriceToPay = _priceToPay;
|
|
47
|
+
currentPMPKey = _pmpKey;
|
|
48
|
+
currentPMPParamType = _pmpParamType;
|
|
49
|
+
currentPMPValue = _pmpValue;
|
|
50
|
+
IMinterPurchaseWithPMPs(_minterContractAddress).purchaseWithPMPs{
|
|
51
|
+
value: _priceToPay
|
|
52
|
+
}(_projectId, _coreContract, _pmpInputs());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// receiver is called when minter sends refunded Ether to this contract.
|
|
56
|
+
receive() external payable {
|
|
57
|
+
// decrement num to be purchased
|
|
58
|
+
currentQtyToPurchase--;
|
|
59
|
+
if (currentQtyToPurchase > 0) {
|
|
60
|
+
// purchase again!
|
|
61
|
+
IMinterPurchaseWithPMPs(msg.sender).purchaseWithPMPs{
|
|
62
|
+
value: currentPriceToPay
|
|
63
|
+
}(currentProjectId, currentCoreContract, _pmpInputs());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function _pmpInputs()
|
|
68
|
+
internal
|
|
69
|
+
view
|
|
70
|
+
returns (IPMPV0.PMPInput[] memory pmpInputs)
|
|
71
|
+
{
|
|
72
|
+
pmpInputs = new IPMPV0.PMPInput[](1);
|
|
73
|
+
pmpInputs[0] = IPMPV0.PMPInput({
|
|
74
|
+
key: currentPMPKey,
|
|
75
|
+
configuredParamType: IPMPV0.ParamType(currentPMPParamType),
|
|
76
|
+
configuredValue: currentPMPValue,
|
|
77
|
+
configuringArtistString: false,
|
|
78
|
+
configuredValueString: ""
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|