Skip to content

Commit

Permalink
added ImmutablePoolCreator contract
Browse files Browse the repository at this point in the history
  • Loading branch information
mikechaban committed Dec 2, 2024
1 parent 73c85e8 commit 98cafec
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions web3/contracts/security/terminus/ImmutablePoolCreator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface StakerInterface {
function createPool(
uint256 tokenType,
address tokenAddress,
uint256 tokenID,
bool transferable,
uint256 lockupSeconds,
uint256 cooldownSeconds,
address administrator
) external;

function transferPoolAdministration(uint256 poolID, address newAdministrator) external;
}

contract ImmutablePoolCreator {
address public immutable stakerAddress;

event ImmutablePoolCreated(uint256 poolID);

constructor(address _stakerAddress) {
stakerAddress = _stakerAddress;
}

function createImmutablePool(
uint256 tokenType,
address tokenAddress,
uint256 tokenID,
bool transferable,
uint256 lockupSeconds,
uint256 cooldownSeconds
) external {
StakerInterface staker = StakerInterface(stakerAddress);

// sender as the administrator
staker.createPool(tokenType, tokenAddress, tokenID, transferable, lockupSeconds, cooldownSeconds, msg.sender);

// 0 address as the administrator to make the pool immutable
staker.transferPoolAdministration(poolID, address(0));

emit ImmutablePoolCreated(poolID);
}
}

0 comments on commit 98cafec

Please sign in to comment.