Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions contracts/MockERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MockERC20 is ERC20 {
uint8 private _decimals;

constructor(
string memory name,
string memory symbol,
uint8 decimalsValue
) ERC20(name, symbol) {
_decimals = decimalsValue;
// Mint initial supply to deployer for testing
_mint(msg.sender, 1000000 * 10**decimalsValue);
}

function decimals() public view virtual override returns (uint8) {
return _decimals;
}

function mint(address to, uint256 amount) public {
_mint(to, amount);
}
}
16 changes: 14 additions & 2 deletions contracts/SEQICO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contract SEQICO is Ownable {
uint256 _pricePerTokenETH,
uint256 _pricePerTokenUSDT,
uint256 _pricePerTokenUSDC
) {
) Ownable(msg.sender) {
seqToken = IERC20(_seqToken);
usdt = IERC20(_usdt);
usdc = IERC20(_usdc);
Expand All @@ -35,9 +35,21 @@ contract SEQICO is Ownable {
seqToken = IERC20(_seqToken);
}

function updatePriceETH(uint256 _pricePerTokenETH) external onlyOwner {
pricePerTokenETH = _pricePerTokenETH;
}

function updatePriceUSDT(uint256 _pricePerTokenUSDT) external onlyOwner {
pricePerTokenUSDT = _pricePerTokenUSDT;
}

function updatePriceUSDC(uint256 _pricePerTokenUSDC) external onlyOwner {
pricePerTokenUSDC = _pricePerTokenUSDC;
}

function buyWithETH(uint256 tokenAmount) external payable {
require(tokenAmount > 0, "Amount must be greater than 0");
uint256 requiredETH = pricePerTokenETH * tokenAmount;
uint256 requiredETH = pricePerTokenETH * tokenAmount / 1e18;
require(msg.value >= requiredETH, "Insufficient ETH sent");
require(seqToken.balanceOf(address(this)) >= tokenAmount, "Not enough SEQ tokens");

Expand Down
5 changes: 2 additions & 3 deletions contracts/SEQToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ contract SEQToken is ERC20, Ownable {
uint256 totalSupply,
address owner,
address icoContract
) ERC20("SEQ Token", "SEQ") {
) ERC20("SEQ Token", "SEQ") Ownable(owner) {
// Mint 10% to owner, 90% to ICO contract
uint256 ownerAmount = (totalSupply * 10) / 100;
uint256 icoAmount = totalSupply - ownerAmount;

_mint(owner, ownerAmount);
_mint(icoContract, icoAmount);

// Transfer ownership to the specified owner
_transferOwnership(owner);
// Ownership is already set in constructor
}
}
6 changes: 2 additions & 4 deletions hardhat.config.js → hardhat.config.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require("@nomicfoundation/hardhat-toolbox");

/** @type import('hardhat/config').HardhatUserConfig */
const config = {
module.exports = {
solidity: "0.8.24",
networks: {
hardhat: {},
Expand Down Expand Up @@ -29,6 +29,4 @@ const config = {
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
};

module.exports = config;
};
Loading
Loading