Verified contractExactMIT
PreSale
Address0xb5a228198296008d6a08363f90c80acd81cc0fb6
- Balance
0 ETH
- Transactions
7
- Compiler
solc 0.8.11
- Same code
Only this contract
Details
- Compiler
- solc 0.8.11+commit.d7f03943
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- london
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 14,048,968
- Creation transaction
- 0xee1e300b96…60d36a8c0a
contracts/usdt.sol
// 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);
}
interface AggregatorV3Interface {
function latestRoundData()
external
view
returns (
uint80 roundId,
int answer,
uint startedAt,
uint updatedAt,
uint80 answeredInRound
);
}
contract PreSale {
IERC20 immutable public token; //通证的地址
address payable immutable public receiver;
AggregatorV3Interface constant public priceFeed = AggregatorV3Interface(
// 0x8A753747A1Fa494EC906cE90E9f37563A8AF630e //testnet
0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
);
event Deposit(address indexed sender, uint amount, uint t);
constructor(address _token, address payable _receiver) {
token = IERC20(_token);
receiver = _receiver;
}
function deposit() public payable {
uint256 amount = SDamount(msg.value);
require(amount > 0, 'min amount');
receiver.transfer(msg.value);
token.transfer(msg.sender, amount);
emit Deposit(msg.sender, msg.value, 1);
}
function SDamount(uint _value) public view returns (uint256) {
return _value * getLatestPrice() / (1e7 * 23);
}
function getLatestPrice() public view returns (uint256) {
( , int price, , , ) = priceFeed.latestRoundData();
// for BNB / USD price is scaled up by 10 ** 8
return uint256(price);
}
}Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "london",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.