Files
core/test/TestTest.t.sol
donosonaumczuk 18af50537e test: Tests fixed after removing migration admin
Co-authored-by: Victor Naumik <vicnaum@gmail.com>
2023-10-31 18:37:13 -03:00

130 lines
12 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import 'test/base/BaseTest.t.sol';
// A contraption to quickly investigate onchain actions
contract TestTest is BaseTest {
using stdJson for string;
function setUp() public override {
super.setUp();
address newLensHub = address(
new LensHubInitializable({
followNFTImpl: 0x535FDf959f86E95eB95d03E112fb7CFA2Bf4fE15,
collectNFTImpl: 0x0000000000000000000000000000000000000000,
moduleRegistry: 0x8834aE494ADD3C56d274Fe88243526DBAB15dEF8,
tokenGuardianCooldown: 300,
migrationParams: Types.MigrationParams({
lensHandlesAddress: address(0),
tokenHandleRegistryAddress: address(0),
legacyFeeFollowModule: address(0),
legacyProfileFollowModule: address(0),
newFeeFollowModule: address(0)
})
})
);
vm.etch(0xEA0563b6Af1Af7B9b132Be335a518b41cFf35536, newLensHub.code);
}
function testTestPost() public onlyFork {
return;
bytes
memory rawCalldata = hex'0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5866525258737774747655775a734c564d7a4552394b6841654e76686a3371695076697a3563384e716d5a6300000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ad4b61776f60e4696eb540d395b45e5c31cf36ee0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000';
Types.PostParams memory postParams = abi.decode(rawCalldata, (Types.PostParams));
// struct PostParams {
// uint256 profileId;
// string contentURI;
// address[] actionModules;
// bytes[] actionModulesInitDatas;
// address referenceModule;
// bytes referenceModuleInitData;
// }
console.log('postParams:');
console.log('\tprofileId: %s', postParams.profileId);
console.log('\tcontentURI: %s', postParams.contentURI);
console.log('\tactionModules.length: %s', postParams.actionModules.length);
if (postParams.actionModules.length > 0) {
console.log('\tactionModules[0]: %s', postParams.actionModules[0]);
}
console.log('\tactionModulesInitDatas.length: %s', postParams.actionModulesInitDatas.length);
if (postParams.actionModulesInitDatas.length > 0) {
console.log('\tactionModulesInitDatas[0]:');
// console.logBytes(postParams.actionModulesInitDatas[0]);
(
uint8 donHostedSecretsSlotID,
uint64 donHostedSecretsVersion,
bytes32 percentageOff,
uint64 quantityAvailable
) = abi.decode(postParams.actionModulesInitDatas[0], (uint8, uint64, bytes32, uint64));
console.log('\t\tdonHostedSecretsSlotID: %s', donHostedSecretsSlotID);
console.log('\t\tdonHostedSecretsVersion: %s', donHostedSecretsVersion);
console.log('\t\tpercentageOff:');
console.logBytes32(percentageOff);
console.log('\t\tquantityAvailable: %s', quantityAvailable);
}
console.log('\treferenceModule: %s', postParams.referenceModule);
console.log('\treferenceModuleInitData:');
postParams.actionModules[0] = 0xFB0A0BC7feB519a3Ddd0efa970EAe0d9dE7976CA;
address guy = 0x6C1e1bC39b13f9E0Af9424D76De899203F47755F;
vm.prank(guy);
hub.post(postParams);
}
function testCommentWithoutReferenceModule() public onlyFork {
return;
bytes
memory rawCalldata = hex'0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5866525258737774747655775a734c564d7a4552394b6841654e76686a3371695076697a3563384e716d5a63000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';
Types.CommentParams memory commentParams = abi.decode(rawCalldata, (Types.CommentParams));
// struct CommentParams {
// uint256 profileId;
// string contentURI;
// uint256 pointedProfileId;
// uint256 pointedPubId;
// uint256[] referrerProfileIds;
// uint256[] referrerPubIds;
// bytes referenceModuleData;
// address[] actionModules;
// bytes[] actionModulesInitDatas;
// address referenceModule;
// bytes referenceModuleInitData;
// }
console.log('commentParams:');
console.log('\tprofileId: %s', commentParams.profileId);
console.log('\tcontentURI: %s', commentParams.contentURI);
console.log('\tpointedProfileId: %s', commentParams.pointedProfileId);
console.log('\tpointedPubId: %s', commentParams.pointedPubId);
console.log('\treferrerProfileIds.length: %s', commentParams.referrerProfileIds.length);
if (commentParams.referrerProfileIds.length > 0) {
console.log('\treferrerProfileIds[0]: %s', commentParams.referrerProfileIds[0]);
}
console.log('\treferrerPubIds.length: %s', commentParams.referrerPubIds.length);
if (commentParams.referrerPubIds.length > 0) {
console.log('\treferrerPubIds[0]: %s', commentParams.referrerPubIds[0]);
}
console.log('\treferenceModuleData:');
console.logBytes(commentParams.referenceModuleData);
console.log('\tactionModules.length: %s', commentParams.actionModules.length);
if (commentParams.actionModules.length > 0) {
console.log('\tactionModules[0]: %s', commentParams.actionModules[0]);
}
console.log('\tactionModulesInitDatas.length: %s', commentParams.actionModulesInitDatas.length);
if (commentParams.actionModulesInitDatas.length > 0) {
console.log('\tactionModulesInitDatas[0]:');
console.logBytes(commentParams.actionModulesInitDatas[0]);
}
console.log('\treferenceModule: %s', commentParams.referenceModule);
console.log('\treferenceModuleInitData:');
console.logBytes(commentParams.referenceModuleInitData);
address guy = 0x6C1e1bC39b13f9E0Af9424D76De899203F47755F;
vm.prank(guy);
hub.comment(commentParams);
}
}