Description:
Smart contract deployed on Ethereum with Factory, Oracle features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface AggregatorV3Interface {
function latestRoundData() external view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
contract ArtCubeSociety {
// Token Information
string public name = "ArtCubeSociety";
string public symbol = "ACS";
uint8 public decimals = 18;
uint256 public totalSupply;
uint256 public constant MAX_SUPPLY = 10_000_000 * 10**18; // 10 million tokens
// Owner
address public owner;
// Pausable
bool public paused = false;
// Balances and Allowances
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
// Chainlink Price Feed (ETH/USD on Ethereum Mainnet)
AggregatorV3Interface public priceFeed;
// Token Metadata
string public logoUrl = "https://artcubesociety.org/artcube-logo.png";
string public website = "https://artcubesociety.org";
string public description = "ArtCubeSociety - Next Generation Digital Art Token";
// Events
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Mint(address indexed to, uint256 amount);
event Burn(address indexed from, uint256 amount);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event Paused(address account);
event Unpaused(address account);
event MetadataUpdated(string logoUrl, string website);
event Withdrawal(address indexed to, uint256 amount);
// Modifiers
modifier onlyOwner() {
require(msg.sender == owner, "Not the owner");
_;
}
modifier whenNotPaused() {
require(!paused, "Token transfers are paused");
_;
}
/**
* @dev Constructor - Deploys token and mints initial supply
*/
constructor() {
owner = msg.sender;
totalSupply = MAX_SUPPLY;
balanceOf[msg.sender] = MAX_SUPPLY;
// Chainlink ETH/USD Price Feed on Ethereum Mainnet
priceFeed = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
emit Transfer(address(0), msg.sender, MAX_SUPPLY);
emit Mint(msg.sender, MAX_SUPPLY);
}
/**
* @dev Standard ERC20 transfer function
*/
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(to != address(0), "Cannot transfer to zero address");
require(balanceOf[msg.sender] >= value, "Insufficient balance");
balanceOf[msg.sender] -= value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
return true;
}
/**
* @dev Send tokens (alias for transfer)
*/
function send(address to, uint256 amount) external returns (bool) {
return transfer(to, amount);
}
/**
* @dev Approve spender to spend tokens
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0), "Cannot approve zero address");
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
*/
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
require(from != address(0), "Cannot transfer from zero address");
require(to != address(0), "Cannot transfer to zero address");
require(balanceOf[from] >= value, "Insufficient balance");
require(allowance[from][msg.sender] >= value, "Allowance exceeded");
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
/**
* @dev Receive tokens from another address (requires approval)
*/
function receiveFrom(address from, uint256 amount) external returns (bool) {
return transferFrom(from, msg.sender, amount);
}
/**
* @dev Mint new tokens (only owner)
*/
function mint(address to, uint256 amount) external onlyOwner {
require(to != address(0), "Cannot mint to zero address");
require(totalSupply + amount <= MAX_SUPPLY, "Exceeds maximum supply");
totalSupply += amount;
balanceOf[to] += amount;
emit Transfer(address(0), to, amount);
emit Mint(to, amount);
}
/**
* @dev Burn tokens from caller's balance
*/
function burn(uint256 amount) external {
require(balanceOf[msg.sender] >= amount, "Insufficient balance to burn");
balanceOf[msg.sender] -= amount;
totalSupply -= amount;
emit Transfer(msg.sender, address(0), amount);
emit Burn(msg.sender, amount);
}
/**
* @dev Burn tokens from specific address (requires approval)
*/
function burnFrom(address from, uint256 amount) external {
require(balanceOf[from] >= amount, "Insufficient balance");
require(allowance[from][msg.sender] >= amount, "Allowance exceeded");
balanceOf[from] -= amount;
totalSupply -= amount;
allowance[from][msg.sender] -= amount;
emit Transfer(from, address(0), amount);
emit Burn(from, amount);
}
/**
* @dev Withdraw ETH from contract (only owner)
*/
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "No ETH to withdraw");
(bool success, ) = owner.call{value: balance}("");
require(success, "Withdrawal failed");
emit Withdrawal(owner, balance);
}
/**
* @dev Withdraw specific amount of ETH (only owner)
*/
function withdrawAmount(uint256 amount) external onlyOwner {
require(address(this).balance >= amount, "Insufficient ETH balance");
(bool success, ) = owner.call{value: amount}("");
require(success, "Withdrawal failed");
emit Withdrawal(owner, amount);
}
/**
* @dev Get latest ETH/USD price from Chainlink Oracle
* @return ETH price in USD (8 decimals)
*/
function getETHPrice() public view returns (int) {
(
/* uint80 roundID */,
int price,
/* uint startedAt */,
/* uint timeStamp */,
/* uint80 answeredInRound */
) = priceFeed.latestRoundData();
return price; // Returns price with 8 decimals (e.g., 200000000000 = $2000.00)
}
/**
* @dev Get token price in USD (example: 1 ACS = 0.001 ETH)
* Modify the calculation based on your tokenomics
*/
function getTokenPriceUSD() public view returns (int) {
int ethPrice = getETHPrice();
// Example: If 1 ACS = 0.001 ETH
// Token price = (ETH price * 0.001)
return ethPrice / 1000; // Adjust ratio as needed
}
/**
* @dev Update Chainlink price feed address (only owner)
*/
function updatePriceFeed(address newPriceFeed) external onlyOwner {
require(newPriceFeed != address(0), "Invalid address");
priceFeed = AggregatorV3Interface(newPriceFeed);
}
/**
* @dev Update token metadata (only owner)
*/
function updateMetadata(
string memory _logoUrl,
string memory _website,
string memory _description
) external onlyOwner {
logoUrl = _logoUrl;
website = _website;
description = _description;
emit MetadataUpdated(_logoUrl, _website);
}
/**
* @dev Get token metadata
*/
function getMetadata() external view returns (
string memory _name,
string memory _symbol,
string memory _logoUrl,
string memory _website,
string memory _description
) {
return (name, symbol, logoUrl, website, description);
}
/**
* @dev Pause token transfers (only owner)
*/
function pause() external onlyOwner {
paused = true;
emit Paused(msg.sender);
}
/**
* @dev Unpause token transfers (only owner)
*/
function unpause() external onlyOwner {
paused = false;
emit Unpaused(msg.sender);
}
/**
* @dev Transfer ownership (only owner)
*/
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "New owner cannot be zero address");
address oldOwner = owner;
owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev Allow contract to receive ETH
*/
receive() external payable {}
/**
* @dev Fallback function
*/
fallback() external payable {}
}
/**
* ═══════════════════════════════════════════════════════════════════════════
* ???? DEPLOYMENT INSTRUCTIONS FOR REMIX IDE
* ═══════════════════════════════════════════════════════════════════════════
*
* STEP 1: Open Remix
* - Go to: https://remix.ethereum.org
*
* STEP 2: Create New File
* - Click "+" in Files Explorer
* - Name it: ArtCubeSociety.sol
* - Paste this entire code
*
* STEP 3: Compile
* - Click "Solidity Compiler" tab (left sidebar)
* - Select Compiler: 0.8.20 or higher
* - Click "Compile ArtCubeSociety.sol"
*
* STEP 4: Deploy
* - Click "Deploy & Run Transactions" tab
* - ENVIRONMENT: Select "Injected Provider - MetaMask"
* - Connect your MetaMask wallet
* - Make sure you're on ETHEREUM MAINNET
* - Make sure you have at least 0.3-0.5 ETH for gas
* - CONTRACT: Select "ArtCubeSociety"
* - Click "Deploy"
* - Confirm transaction in MetaMask
*
* STEP 5: Verify on Etherscan
* - Go to: https://etherscan.io/verifyContract
* - Enter your contract address
* - Compiler: 0.8.20
* - Optimization: No
* - Paste this entire code
* - Click "Verify and Publish"
*
* STEP 6: Add Logo
* - Upload logo to IPFS (https://nft.storage or https://pinata.cloud)
* - Call updateMetadata() with your logo URL
*
* STEP 7: Submit to CoinGecko
* - Go to: https://www.coingecko.com/en/coins/new
* - Fill in:
* - Contract Address: [Your deployed address]
* - Project Name: ArtCubeSociety
* - Symbol: ACS
* - Logo URL: [Your IPFS or hosted URL]
* - Website: https://artcubesociety.com
* - Description: Next Generation Digital Art Token
*
* STEP 8: Access CoinGecko API (After Approval)
* - Price: https://api.coingecko.com/api/v3/simple/price?ids=artcubesociety&vs_currencies=usd
* - Market Data: https://api.coingecko.com/api/v3/coins/artcubesociety
*
* ═══════════════════════════════════════════════════════════════════════════
* ???? CONTRACT FEATURES
* ═══════════════════════════════════════════════════════════════════════════
*
* ✅ MINT: Owner can mint new tokens up to MAX_SUPPLY
* ✅ BURN: Anyone can burn their own tokens
* ✅ SEND: Send tokens to any address
* ✅ RECEIVE: receiveFrom() - Receive tokens from approved address
* ✅ WITHDRAW: Owner can withdraw ETH from contract
* ✅ CHAINLINK: Real-time ETH/USD price from Oracle
* ✅ LOGO: Store and update logo URL
* ✅ PAUSE: Emergency pause functionality
* ✅ COINGECKO: Ready for API integration
*
* ═══════════════════════════════════════════════════════════════════════════
* ⚠️ IMPORTANT SECURITY NOTES
* ═══════════════════════════════════════════════════════════════════════════
*
* 1. Use a SECURE wallet for deployment
* 2. Consider using Gnosis Safe multi-sig as owner
* 3. Test on SEPOLIA testnet first (get free test ETH)
* 4. NEVER share your private key
* 5. Verify contract on Etherscan immediately after deployment
* 6. Save contract address securely
*
* ═══════════════════════════════════════════════════════════════════════════
*/
Submitted on: 2025-10-12 10:04:13
Comments
Log in to comment.
No comments yet.