Skip to content

Instantly share code, notes, and snippets.

@lcfr-eth
Last active October 22, 2022 18:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lcfr-eth/9b3e75ecc77fdf74a4380e89404f015d to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
interface INameWrapper {
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) external;
}
interface IETHRegistrarController {
function available(string memory) external returns (bool);
function makeCommitment(
string memory,
address,
uint256,
bytes32,
address,
bytes[] calldata,
bool,
uint32,
uint64
) external returns (bytes32);
function commit(bytes32) external;
function register(
string calldata,
address,
uint256,
bytes32,
address,
bytes[] calldata,
bool,
uint32,
uint64
) external payable;
function renew(string calldata, uint256) external payable;
}
contract ExpireTest is Test {
//Counter public counter;
address ensReg = address(0x9C51161bA2FB02Cc0a403332B607117685f34831);
address Wrapper = address(0x582224b8d4534F4749EFA4f22eF7241E0C56D4B8);
//ran at the start of every test
function setUp() public {
}
function testExpired1155ETH2LDTransfer() public {
string memory name = "lcfrWrapped";
address owner = address(0x328eBc7bb2ca4Bf4216863042a960E3C64Ed4c10);
uint duration = 31556952;
bytes32 secret = bytes32(0);
address resolver = address(0xE264d5bb84bA3b8061ADC38D3D76e6674aB91852);
bytes[] memory data;
bool reverseRecord = false;
uint32 fuses = 0;
uint64 wrapperExpiry = 31556952;
IETHRegistrarController controller = IETHRegistrarController(ensReg);
INameWrapper nameWrapper = INameWrapper(Wrapper);
// start executing as lcfr
vm.startPrank(owner);
bytes32 commitment = controller.makeCommitment(name, owner, duration, secret, resolver, data, reverseRecord, fuses, wrapperExpiry);
controller.commit(commitment);
vm.warp(block.timestamp + 60);
controller.register{value: 1000000000000000000}(name, owner, duration, secret, resolver, data, reverseRecord, fuses, wrapperExpiry);
// expired ++ out of grace
vm.warp(block.timestamp + (duration + duration));
// transfer expired
nameWrapper.safeTransferFrom(owner, address(0x9E5916079eD74C38FaA3322bDAec62307beA1D9b), 27949844422937690035200873550242027254593755523825974100076274775564884645311, 1, "");
/*
Fix?
ERC1155Fuse.sol
function getData(uint256 tokenId)
...
if (block.timestamp > expiry) {
//fuses = 0; // allow transfers on expiration
fuses = 4; // CANNOT_TRANSFER enabled.
} else {
fuses = uint32(t >> 160);
}
...
}
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment