Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
"
},
"@openzeppelin/contracts/utils/ReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
"
},
"contracts/hooks/IPonstrHook.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title IPonstrHook
* @dev Interface for PonStrategy token hooks
*/
interface IPonstrHook {
/**
* @dev Called when a transfer occurs
* @param from The address tokens are transferred from
* @param to The address tokens are transferred to
* @param amount The amount of tokens transferred
*/
function onTransfer(address from, address to, uint256 amount) external;
/**
* @dev Called when a transferFrom occurs
* @param from The address tokens are transferred from
* @param to The address tokens are transferred to
* @param amount The amount of tokens transferred
*/
function onTransferFrom(address from, address to, uint256 amount) external;
}
"
},
"contracts/hooks/SimplePonstrHook.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IPonstrHook} from "./IPonstrHook.sol";
interface IPonstrToken {
function addFees() external payable;
function owner() external view returns (address);
function currentFees() external view returns (uint256);
}
/**
* @title SimplePonstrHook
* @dev Simple hook contract for PonStrategy token that collects ETH fees
* This is a simplified version for testing without Uniswap integration
*/
contract SimplePonstrHook is IPonstrHook, Ownable, ReentrancyGuard {
// Core addresses
address public immutable ponstrToken;
// Fee configuration
uint256 public feeBps = 1000; // 10% fee
uint256 public protocolFeeShareBps = 9700; // 97% to protocol
// DEX configuration
address public liquidityPair;
mapping(address => bool) public isExcludedFromFee;
// Events
event FeeCollected(address indexed from, address indexed to, uint256 tokenAmount, uint256 ethAmount);
event FeesAdded(uint256 amount, uint256 totalFees);
event HookConfigured(address indexed ponstrToken, address indexed pair);
// Errors
error Unauthorized();
error InvalidAddress();
error FeeTooHigh();
constructor(
address ponstrToken_,
address owner_
) Ownable(owner_) {
if (ponstrToken_ == address(0)) revert InvalidAddress();
ponstrToken = ponstrToken_;
emit HookConfigured(ponstrToken_, address(0));
}
/**
* @dev Called by PonStrategy token on transfer
*/
function onTransfer(address from, address to, uint256 amount) external override {
if (msg.sender != ponstrToken) revert Unauthorized();
_processTransfer(from, to, amount);
}
/**
* @dev Called by PonStrategy token on transferFrom
*/
function onTransferFrom(address from, address to, uint256 amount) external override {
if (msg.sender != ponstrToken) revert Unauthorized();
_processTransfer(from, to, amount);
}
/**
* @dev Internal function to process transfer and collect fees
*/
function _processTransfer(address from, address to, uint256 amount) internal nonReentrant {
// Skip if no fee or excluded addresses
if (feeBps == 0 || isExcludedFromFee[from] || isExcludedFromFee[to]) {
return;
}
// Only collect fees on DEX trades
bool isDexTrade = (from == liquidityPair || to == liquidityPair) && liquidityPair != address(0);
if (!isDexTrade) {
return;
}
// Calculate fee
uint256 feeAmount = (amount * feeBps) / 10000;
if (feeAmount == 0) return;
// Calculate protocol share (97%)
uint256 protocolFee = (feeAmount * protocolFeeShareBps) / 10000;
// For testing: simulate fee collection by sending ETH directly
// In production, this would be handled by the DEX or external mechanism
if (protocolFee > 0) {
// Simulate ETH fee (0.001 ETH per 1000 tokens)
uint256 ethFee = (protocolFee * 1e15) / 1e18; // 0.001 ETH per 1000 tokens
if (ethFee > 0 && address(this).balance >= ethFee) {
// Send ETH to PonStrategy token
IPonstrToken(ponstrToken).addFees{value: ethFee}();
emit FeesAdded(ethFee, IPonstrToken(ponstrToken).currentFees());
}
}
emit FeeCollected(from, to, feeAmount, protocolFee);
}
/**
* @dev Set liquidity pair address
*/
function setLiquidityPair(address pair_) external onlyOwner {
liquidityPair = pair_;
}
/**
* @dev Set fee configuration
*/
function setFees(uint256 feeBps_, uint256 protocolShareBps_) external onlyOwner {
if (feeBps_ > 2000) revert FeeTooHigh(); // Max 20%
if (protocolShareBps_ > 10000) revert FeeTooHigh(); // Max 100%
feeBps = feeBps_;
protocolFeeShareBps = protocolShareBps_;
}
/**
* @dev Set excluded addresses
*/
function setExcluded(address account, bool excluded) external onlyOwner {
isExcludedFromFee[account] = excluded;
}
/**
* @dev Add ETH fees to the main token contract
*/
function addFees() external payable {
if (msg.sender != owner()) revert Unauthorized();
IPonstrToken(ponstrToken).addFees{value: msg.value}();
}
/**
* @dev Emergency withdraw ETH
*/
function emergencyWithdrawETH(address payable to, uint256 amount) external onlyOwner {
(bool success,) = to.call{value: amount}("");
require(success, "ETH transfer failed");
}
/**
* @dev Emergency withdraw tokens
*/
function emergencyWithdrawToken(address token, address to, uint256 amount) external onlyOwner {
// Use low-level call to avoid interface issues
(bool success,) = token.call(abi.encodeWithSignature("transfer(address,uint256)", to, amount));
require(success, "Token transfer failed");
}
/**
* @dev Receive ETH
*/
receive() external payable {}
}
"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": false,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}
Submitted on: 2025-09-17 12:31:54
Comments
Log in to comment.
No comments yet.