More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
Airdrop
Compiler Version
v0.8.7+commit.e28d00a7
Contract Source Code (Solidity)
/** *Submitted for verification at SonicScan.org on 2024-12-22 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC20 { function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function balanceOf(address account) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); } contract Airdrop { address public owner; address public tokenAddress; uint256 public constant MAX_TOKENS = 1_000_000_000 * 10**18; // 1 billion tokens with 18 decimals constructor(address _tokenAddress) { owner = msg.sender; tokenAddress = _tokenAddress; } modifier onlyOwner() { require(msg.sender == owner, "Only owner can call this function"); _; } /** * @dev Approves the contract to manage up to 1 billion tokens on behalf of the owner. */ function approveTokens() external onlyOwner { IERC20 token = IERC20(tokenAddress); require( token.approve(address(this), MAX_TOKENS), "Approval failed" ); } /** * @dev Airdrop tokens directly from the owner's wallet using `transferFrom`. * @param recipients List of recipient addresses. * @param amounts List of token amounts (in smallest units). */ function airdropTokens(address[] calldata recipients, uint256[] calldata amounts) external onlyOwner { require(recipients.length == amounts.length, "Mismatched array lengths"); IERC20 token = IERC20(tokenAddress); for (uint256 i = 0; i < recipients.length; i++) { require(amounts[i] > 0, "Invalid amount"); require(token.transferFrom(owner, recipients[i], amounts[i]), "Transfer failed"); } } /** * @dev Withdraw unused tokens from the contract back to the owner. * @param amount The number of tokens to withdraw (in smallest units). */ function withdrawTokens(uint256 amount) external onlyOwner { IERC20 token = IERC20(tokenAddress); require(token.transfer(owner, amount), "Withdraw failed"); } /** * @dev Get the balance of DONKS tokens in the contract. * @return The current balance of DONKS tokens held by the contract. */ function getContractBalance() external view returns (uint256) { IERC20 token = IERC20(tokenAddress); return token.balanceOf(address(this)); } /** * @dev Updates the token address in case of a new token deployment. * @param _tokenAddress The new token contract address. */ function updateTokenAddress(address _tokenAddress) external onlyOwner { tokenAddress = _tokenAddress; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"MAX_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"airdropTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"approveTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getContractBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"updateTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506040516108b93803806108b983398101604081905261002f91610062565b60008054336001600160a01b031991821617909155600180549091166001600160a01b0392909216919091179055610092565b60006020828403121561007457600080fd5b81516001600160a01b038116811461008b57600080fd5b9392505050565b610818806100a16000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146100e35780639d76ea581461010e578063f47c84c514610121578063fd68f2231461013457600080fd5b8063315a095d1461008d5780636691461a146100a25780636f9fb98a146100b5578063706f6937146100d0575b600080fd5b6100a061009b366004610730565b61013c565b005b6100a06100b0366004610672565b61023b565b6100bd610287565b6040519081526020015b60405180910390f35b6100a06100de3660046106a2565b61030b565b6000546100f6906001600160a01b031681565b6040516001600160a01b0390911681526020016100c7565b6001546100f6906001600160a01b031681565b6100bd6b033b2e3c9fd0803ce800000081565b6100a061052a565b6000546001600160a01b0316331461016f5760405162461bcd60e51b815260040161016690610762565b60405180910390fd5b60015460005460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052911690819063a9059cbb90604401602060405180830381600087803b1580156101c157600080fd5b505af11580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061070e565b6102375760405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b6044820152606401610166565b5050565b6000546001600160a01b031633146102655760405162461bcd60e51b815260040161016690610762565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546040516370a0823160e01b81523060048201526000916001600160a01b03169081906370a082319060240160206040518083038186803b1580156102cd57600080fd5b505afa1580156102e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103059190610749565b91505090565b6000546001600160a01b031633146103355760405162461bcd60e51b815260040161016690610762565b8281146103845760405162461bcd60e51b815260206004820152601860248201527f4d69736d617463686564206172726179206c656e6774687300000000000000006044820152606401610166565b6001546001600160a01b031660005b848110156105225760008484838181106103af576103af6107cc565b90506020020135116103f45760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610166565b6000546001600160a01b03808416916323b872dd911688888581811061041c5761041c6107cc565b90506020020160208101906104319190610672565b878786818110610443576104436107cc565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401602060405180830381600087803b15801561049a57600080fd5b505af11580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d2919061070e565b6105105760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610166565b8061051a816107a3565b915050610393565b505050505050565b6000546001600160a01b031633146105545760405162461bcd60e51b815260040161016690610762565b60015460405163095ea7b360e01b81523060048201526b033b2e3c9fd0803ce800000060248201526001600160a01b0390911690819063095ea7b390604401602060405180830381600087803b1580156105ad57600080fd5b505af11580156105c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e5919061070e565b6106235760405162461bcd60e51b815260206004820152600f60248201526e105c1c1c9bdd985b0819985a5b1959608a1b6044820152606401610166565b50565b60008083601f84011261063857600080fd5b50813567ffffffffffffffff81111561065057600080fd5b6020830191508360208260051b850101111561066b57600080fd5b9250929050565b60006020828403121561068457600080fd5b81356001600160a01b038116811461069b57600080fd5b9392505050565b600080600080604085870312156106b857600080fd5b843567ffffffffffffffff808211156106d057600080fd5b6106dc88838901610626565b909650945060208701359150808211156106f557600080fd5b5061070287828801610626565b95989497509550505050565b60006020828403121561072057600080fd5b8151801515811461069b57600080fd5b60006020828403121561074257600080fd5b5035919050565b60006020828403121561075b57600080fd5b5051919050565b60208082526021908201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6040820152603760f91b606082015260800190565b60006000198214156107c557634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fdfea264697066735822122011334d32b341ac256deed60ee3d34067812b8b873635df4eb1064939c082fd3164736f6c634300080700330000000000000000000000000a54364631ea37813a63edb3bba1c46f8d8304b2
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146100e35780639d76ea581461010e578063f47c84c514610121578063fd68f2231461013457600080fd5b8063315a095d1461008d5780636691461a146100a25780636f9fb98a146100b5578063706f6937146100d0575b600080fd5b6100a061009b366004610730565b61013c565b005b6100a06100b0366004610672565b61023b565b6100bd610287565b6040519081526020015b60405180910390f35b6100a06100de3660046106a2565b61030b565b6000546100f6906001600160a01b031681565b6040516001600160a01b0390911681526020016100c7565b6001546100f6906001600160a01b031681565b6100bd6b033b2e3c9fd0803ce800000081565b6100a061052a565b6000546001600160a01b0316331461016f5760405162461bcd60e51b815260040161016690610762565b60405180910390fd5b60015460005460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052911690819063a9059cbb90604401602060405180830381600087803b1580156101c157600080fd5b505af11580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061070e565b6102375760405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b6044820152606401610166565b5050565b6000546001600160a01b031633146102655760405162461bcd60e51b815260040161016690610762565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546040516370a0823160e01b81523060048201526000916001600160a01b03169081906370a082319060240160206040518083038186803b1580156102cd57600080fd5b505afa1580156102e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103059190610749565b91505090565b6000546001600160a01b031633146103355760405162461bcd60e51b815260040161016690610762565b8281146103845760405162461bcd60e51b815260206004820152601860248201527f4d69736d617463686564206172726179206c656e6774687300000000000000006044820152606401610166565b6001546001600160a01b031660005b848110156105225760008484838181106103af576103af6107cc565b90506020020135116103f45760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610166565b6000546001600160a01b03808416916323b872dd911688888581811061041c5761041c6107cc565b90506020020160208101906104319190610672565b878786818110610443576104436107cc565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401602060405180830381600087803b15801561049a57600080fd5b505af11580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d2919061070e565b6105105760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610166565b8061051a816107a3565b915050610393565b505050505050565b6000546001600160a01b031633146105545760405162461bcd60e51b815260040161016690610762565b60015460405163095ea7b360e01b81523060048201526b033b2e3c9fd0803ce800000060248201526001600160a01b0390911690819063095ea7b390604401602060405180830381600087803b1580156105ad57600080fd5b505af11580156105c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e5919061070e565b6106235760405162461bcd60e51b815260206004820152600f60248201526e105c1c1c9bdd985b0819985a5b1959608a1b6044820152606401610166565b50565b60008083601f84011261063857600080fd5b50813567ffffffffffffffff81111561065057600080fd5b6020830191508360208260051b850101111561066b57600080fd5b9250929050565b60006020828403121561068457600080fd5b81356001600160a01b038116811461069b57600080fd5b9392505050565b600080600080604085870312156106b857600080fd5b843567ffffffffffffffff808211156106d057600080fd5b6106dc88838901610626565b909650945060208701359150808211156106f557600080fd5b5061070287828801610626565b95989497509550505050565b60006020828403121561072057600080fd5b8151801515811461069b57600080fd5b60006020828403121561074257600080fd5b5035919050565b60006020828403121561075b57600080fd5b5051919050565b60208082526021908201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6040820152603760f91b606082015260800190565b60006000198214156107c557634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fdfea264697066735822122011334d32b341ac256deed60ee3d34067812b8b873635df4eb1064939c082fd3164736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000a54364631ea37813a63edb3bba1c46f8d8304b2
-----Decoded View---------------
Arg [0] : _tokenAddress (address): 0x0a54364631Ea37813a63edb3bBa1C46f8d8304B2
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000a54364631ea37813a63edb3bba1c46f8d8304b2
Deployed Bytecode Sourcemap
425:2416:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2053:181;;;;;;:::i;:::-;;:::i;:::-;;2721:117;;;;;;:::i;:::-;;:::i;2396:164::-;;;:::i;:::-;;;5254:25:1;;;5242:2;5227:18;2396:164:0;;;;;;;;1415:463;;;;;;:::i;:::-;;:::i;449:20::-;;;;;-1:-1:-1;;;;;449:20:0;;;;;;-1:-1:-1;;;;;2275:32:1;;;2257:51;;2245:2;2230:18;449:20:0;2111:203:1;476:27:0;;;;;-1:-1:-1;;;;;476:27:0;;;512:59;;549:22;512:59;;971:214;;;:::i;2053:181::-;790:5;;-1:-1:-1;;;;;790:5:0;776:10;:19;768:65;;;;-1:-1:-1;;;768:65:0;;;;;;;:::i;:::-;;;;;;;;;2145:12:::1;::::0;2123::::1;2192:5:::0;2177:29:::1;::::0;-1:-1:-1;;;2177:29:0;;-1:-1:-1;;;;;2192:5:0;;::::1;2177:29;::::0;::::1;2873:51:1::0;2940:18;;;2933:34;;;2145:12:0;::::1;::::0;;;2177:14:::1;::::0;2846:18:1;;2177:29:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2169:57;;;::::0;-1:-1:-1;;;2169:57:0;;3926:2:1;2169:57:0::1;::::0;::::1;3908:21:1::0;3965:2;3945:18;;;3938:30;-1:-1:-1;;;3984:18:1;;;3977:45;4039:18;;2169:57:0::1;3724:339:1::0;2169:57:0::1;2112:122;2053:181:::0;:::o;2721:117::-;790:5;;-1:-1:-1;;;;;790:5:0;776:10;:19;768:65;;;;-1:-1:-1;;;768:65:0;;;;;;;:::i;:::-;2802:12:::1;:28:::0;;-1:-1:-1;;;;;;2802:28:0::1;-1:-1:-1::0;;;;;2802:28:0;;;::::1;::::0;;;::::1;::::0;;2721:117::o;2396:164::-;2491:12;;2522:30;;-1:-1:-1;;;2522:30:0;;2546:4;2522:30;;;2257:51:1;2449:7:0;;-1:-1:-1;;;;;2491:12:0;;;;2522:15;;2230:18:1;;2522:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2515:37;;;2396:164;:::o;1415:463::-;790:5;;-1:-1:-1;;;;;790:5:0;776:10;:19;768:65;;;;-1:-1:-1;;;768:65:0;;;;;;;:::i;:::-;1535:35;;::::1;1527:72;;;::::0;-1:-1:-1;;;1527:72:0;;4957:2:1;1527:72:0::1;::::0;::::1;4939:21:1::0;4996:2;4976:18;;;4969:30;5035:26;5015:18;;;5008:54;5079:18;;1527:72:0::1;4755:348:1::0;1527:72:0::1;1634:12;::::0;-1:-1:-1;;;;;1634:12:0::1;1612;1660:211;1680:21:::0;;::::1;1660:211;;;1744:1;1731:7;;1739:1;1731:10;;;;;;;:::i;:::-;;;;;;;:14;1723:41;;;::::0;-1:-1:-1;;;1723:41:0;;4270:2:1;1723:41:0::1;::::0;::::1;4252:21:1::0;4309:2;4289:18;;;4282:30;-1:-1:-1;;;4328:18:1;;;4321:44;4382:18;;1723:41:0::1;4068:338:1::0;1723:41:0::1;1806:5;::::0;-1:-1:-1;;;;;1787:18:0;;::::1;::::0;::::1;::::0;1806:5:::1;1813:10:::0;;1824:1;1813:13;;::::1;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;1828:7;;1836:1;1828:10;;;;;;;:::i;:::-;1787:52;::::0;-1:-1:-1;;;;;;1787:52:0::1;::::0;;;;;;-1:-1:-1;;;;;2577:15:1;;;1787:52:0::1;::::0;::::1;2559:34:1::0;2629:15;;;;2609:18;;;2602:43;-1:-1:-1;1828:10:0::1;::::0;;::::1;;;2661:18:1::0;;;2654:34;2494:18;;1787:52:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1779:80;;;::::0;-1:-1:-1;;;1779:80:0;;3582:2:1;1779:80:0::1;::::0;::::1;3564:21:1::0;3621:2;3601:18;;;3594:30;-1:-1:-1;;;3640:18:1;;;3633:45;3695:18;;1779:80:0::1;3380:339:1::0;1779:80:0::1;1703:3:::0;::::1;::::0;::::1;:::i;:::-;;;;1660:211;;;;1516:362;1415:463:::0;;;;:::o;971:214::-;790:5;;-1:-1:-1;;;;;790:5:0;776:10;:19;768:65;;;;-1:-1:-1;;;768:65:0;;;;;;;:::i;:::-;1048:12:::1;::::0;1094:40:::1;::::0;-1:-1:-1;;;1094:40:0;;1116:4:::1;1094:40;::::0;::::1;2873:51:1::0;549:22:0::1;2940:18:1::0;;;2933:34;-1:-1:-1;;;;;1048:12:0;;::::1;::::0;;;1094:13:::1;::::0;2846:18:1;;1094:40:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1072:105;;;::::0;-1:-1:-1;;;1072:105:0;;4613:2:1;1072:105:0::1;::::0;::::1;4595:21:1::0;4652:2;4632:18;;;4625:30;-1:-1:-1;;;4671:18:1;;;4664:45;4726:18;;1072:105:0::1;4411:339:1::0;1072:105:0::1;1015:170;971:214::o:0;14:367:1:-;77:8;87:6;141:3;134:4;126:6;122:17;118:27;108:55;;159:1;156;149:12;108:55;-1:-1:-1;182:20:1;;225:18;214:30;;211:50;;;257:1;254;247:12;211:50;294:4;286:6;282:17;270:29;;354:3;347:4;337:6;334:1;330:14;322:6;318:27;314:38;311:47;308:67;;;371:1;368;361:12;308:67;14:367;;;;;:::o;386:286::-;445:6;498:2;486:9;477:7;473:23;469:32;466:52;;;514:1;511;504:12;466:52;540:23;;-1:-1:-1;;;;;592:31:1;;582:42;;572:70;;638:1;635;628:12;572:70;661:5;386:286;-1:-1:-1;;;386:286:1:o;677:773::-;799:6;807;815;823;876:2;864:9;855:7;851:23;847:32;844:52;;;892:1;889;882:12;844:52;932:9;919:23;961:18;1002:2;994:6;991:14;988:34;;;1018:1;1015;1008:12;988:34;1057:70;1119:7;1110:6;1099:9;1095:22;1057:70;:::i;:::-;1146:8;;-1:-1:-1;1031:96:1;-1:-1:-1;1234:2:1;1219:18;;1206:32;;-1:-1:-1;1250:16:1;;;1247:36;;;1279:1;1276;1269:12;1247:36;;1318:72;1382:7;1371:8;1360:9;1356:24;1318:72;:::i;:::-;677:773;;;;-1:-1:-1;1409:8:1;-1:-1:-1;;;;677:773:1:o;1455:277::-;1522:6;1575:2;1563:9;1554:7;1550:23;1546:32;1543:52;;;1591:1;1588;1581:12;1543:52;1623:9;1617:16;1676:5;1669:13;1662:21;1655:5;1652:32;1642:60;;1698:1;1695;1688:12;1737:180;1796:6;1849:2;1837:9;1828:7;1824:23;1820:32;1817:52;;;1865:1;1862;1855:12;1817:52;-1:-1:-1;1888:23:1;;1737:180;-1:-1:-1;1737:180:1:o;1922:184::-;1992:6;2045:2;2033:9;2024:7;2020:23;2016:32;2013:52;;;2061:1;2058;2051:12;2013:52;-1:-1:-1;2084:16:1;;1922:184;-1:-1:-1;1922:184:1:o;2978:397::-;3180:2;3162:21;;;3219:2;3199:18;;;3192:30;3258:34;3253:2;3238:18;;3231:62;-1:-1:-1;;;3324:2:1;3309:18;;3302:31;3365:3;3350:19;;2978:397::o;5290:232::-;5329:3;-1:-1:-1;;5350:17:1;;5347:140;;;5409:10;5404:3;5400:20;5397:1;5390:31;5444:4;5441:1;5434:15;5472:4;5469:1;5462:15;5347:140;-1:-1:-1;5514:1:1;5503:13;;5290:232::o;5527:127::-;5588:10;5583:3;5579:20;5576:1;5569:31;5619:4;5616:1;5609:15;5643:4;5640:1;5633:15
Swarm Source
ipfs://11334d32b341ac256deed60ee3d34067812b8b873635df4eb1064939c082fd31
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.