编译器
0.8.17+commit.8df45f5f
文件 1 的 9:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 2 的 9:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 3 的 9:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 4 的 9:IToken.sol
pragma solidity ^0.8.0;
interface ICustomToken {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function burn(uint256 amount) external;
function mint(address to, uint256 amount) external;
function totalSupply() external view returns (uint256);
}
文件 5 的 9:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 6 的 9:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
}
function _nonReentrantAfter() private {
_status = _NOT_ENTERED;
}
}
文件 7 的 9:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
文件 8 的 9:Staking.sol
pragma solidity ^0.8.0;
import "./IToken.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
interface IOwnable2Step {
function acceptOwnership() external;
}
contract StakingBondContract is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
ICustomToken public token;
IERC20 public usdcToken;
struct StakeInfo {
uint256 amount;
uint256 pendingRewards;
uint256 lastUpdated;
uint256 epoch;
}
struct Bond {
uint256 id;
uint256 tokenAmount;
uint256 pricePerToken;
uint256 closeEpoch;
bool isActive;
bool isCanceled;
}
struct UserBondInfo {
uint256 amountPurchased;
bool claimed;
}
struct BondClaimDetails {
uint256 bondId;
uint256 amountToClaim;
}
mapping(address => StakeInfo) public userStakes;
mapping(uint256 => Bond) public bonds;
mapping(address => mapping(uint256 => UserBondInfo)) public userBonds;
uint256 public constant SECONDS_IN_YEAR = 31536000;
uint256 public bondCounter;
uint256 public APR;
uint256 public UNSTAKE_TAX;
uint256 public epochDuration;
uint256 public totalStaked;
uint256 public totalBurned;
uint256 public deploymentTime;
uint256 public CLAIM_DELAY_EPOCHS;
event Staked(address indexed user, uint256 amount);
event Unstaked(address indexed user, uint256 amount);
event RewardsMinted(address indexed user, uint256 amount);
event BondOffered(
uint256 bondId,
uint256 tokenAmount,
uint256 pricePerToken
);
event BondPurchased(
address indexed buyer,
uint256 bondId,
uint256 amount,
uint256 cost
);
event BondOfferCancelled(uint256 bondId, uint256 remainingTokenAmount);
event BondClaimed(address indexed buyer, uint256 bondId, uint256 amount);
event BondClosed(uint256 bondId);
event USDCWithdrawn(uint256 amount);
constructor(address _tokenAddress, address _usdcTokenAddress) {
token = ICustomToken(_tokenAddress);
usdcToken = IERC20(_usdcTokenAddress);
deploymentTime = block.timestamp;
epochDuration = 6 hours;
CLAIM_DELAY_EPOCHS = 12;
UNSTAKE_TAX = 10;
APR = 1000;
}
function acceptTokenOwnership() external onlyOwner {
IOwnable2Step(address(token)).acceptOwnership();
}
function offerBond(
uint256 _tokenAmount,
uint256 _pricePerToken
) external onlyOwner {
require(_tokenAmount > 0, "Invalid bond parameters");
bondCounter += 1;
bonds[bondCounter] = Bond({
id: bondCounter,
tokenAmount: _tokenAmount,
pricePerToken: _pricePerToken,
closeEpoch: 0,
isActive: true,
isCanceled: false
});
emit BondOffered(bondCounter, _tokenAmount, _pricePerToken);
}
function purchaseBond(
uint256 _bondId,
uint256 amountInUSDC
) external nonReentrant {
Bond storage bond = bonds[_bondId];
require(bond.isActive, "No active bond offer");
require(amountInUSDC > 0, "Amount must be greater than zero");
uint256 amountDecimaled = amountInUSDC * 1e6;
uint256 bondsToPurchase = (amountDecimaled) / bond.pricePerToken;
require(
bondsToPurchase <= bond.tokenAmount,
"Not enough tokens in bond offer"
);
usdcToken.safeTransferFrom(msg.sender, address(this), amountDecimaled);
bond.tokenAmount -= bondsToPurchase;
if (bond.tokenAmount == 0) {
bond.isActive = false;
bond.closeEpoch = getCurrentEpoch();
emit BondClosed(_bondId);
}
UserBondInfo storage userBond = userBonds[msg.sender][_bondId];
userBond.amountPurchased += bondsToPurchase;
emit BondPurchased(
msg.sender,
_bondId,
bondsToPurchase,
amountDecimaled
);
}
function claimBonds(uint256[] calldata bondIds) external nonReentrant {
uint256 currentEpoch = getCurrentEpoch();
for (uint256 i = 0; i < bondIds.length; i++) {
uint256 _bondId = bondIds[i];
UserBondInfo storage userBond = userBonds[msg.sender][_bondId];
Bond storage bond = bonds[_bondId];
if (bond.isCanceled) {
continue;
}
if (userBond.amountPurchased == 0) {
continue;
}
if (userBond.claimed) {
continue;
}
uint256 requiredEpoch = bond.closeEpoch + CLAIM_DELAY_EPOCHS;
if (bond.closeEpoch == 0 || currentEpoch < requiredEpoch) {
continue;
}
userBond.claimed = true;
uint256 toMint = userBond.amountPurchased * 1e18;
token.mint(msg.sender, toMint);
emit BondClaimed(msg.sender, _bondId, toMint);
}
}
function cancelBondOffer(uint256 _bondId) external onlyOwner {
Bond storage bond = bonds[_bondId];
require(!bond.isCanceled, "Bond offer already canceled");
bond.isCanceled = true;
bond.isActive = false;
emit BondOfferCancelled(_bondId, bond.tokenAmount);
}
function withdrawUSDC(uint256 _amount) external onlyOwner {
uint256 balance = usdcToken.balanceOf(address(this));
require(_amount <= balance, "Amount exceeds balance");
usdcToken.safeTransfer(owner(), _amount);
emit USDCWithdrawn(_amount);
}
function stake(uint256 amount) external nonReentrant {
require(amount > 0, "Amount must be greater than zero");
token.transferFrom(msg.sender, address(this), amount);
token.burn(amount);
totalBurned += amount;
StakeInfo storage stakeInfo = userStakes[msg.sender];
uint256 currentTimestamp = block.timestamp;
uint256 timeElapsed = currentTimestamp - stakeInfo.lastUpdated;
if (stakeInfo.amount > 0 && timeElapsed > 0) {
uint256 rewards = (stakeInfo.amount * APR * timeElapsed) /
(100 * SECONDS_IN_YEAR);
stakeInfo.pendingRewards += rewards;
}
stakeInfo.amount += amount;
stakeInfo.lastUpdated = currentTimestamp;
stakeInfo.epoch = getCurrentEpoch();
totalStaked += amount;
emit Staked(msg.sender, amount);
}
function unstake() external nonReentrant {
StakeInfo storage stakeInfo = userStakes[msg.sender];
uint256 amount = stakeInfo.amount;
require(amount > 0, "No staked amount to unstake");
uint256 currentEpoch = getCurrentEpoch();
require(
currentEpoch > stakeInfo.epoch,
"Cannot unstake before the next epoch"
);
uint256 currentTimestamp = block.timestamp;
uint256 timeElapsed = currentTimestamp - stakeInfo.lastUpdated;
if (timeElapsed > 0) {
uint256 rewards = (stakeInfo.amount * APR * timeElapsed) /
(100 * SECONDS_IN_YEAR);
stakeInfo.pendingRewards += rewards;
stakeInfo.lastUpdated = currentTimestamp;
}
uint256 rewardsToClaim = stakeInfo.pendingRewards;
stakeInfo.pendingRewards = 0;
stakeInfo.lastUpdated = currentTimestamp;
if (rewardsToClaim > 0) {
token.mint(msg.sender, rewardsToClaim);
emit RewardsMinted(msg.sender, rewardsToClaim);
}
stakeInfo.amount -= amount;
totalStaked -= amount;
uint256 taxAmount = (amount * UNSTAKE_TAX) / 100;
uint256 amountAfterTax = amount - taxAmount;
if (amountAfterTax > 0) {
token.mint(msg.sender, amountAfterTax);
totalBurned = totalBurned >= amountAfterTax
? totalBurned - amountAfterTax
: 0;
emit Unstaked(msg.sender, amountAfterTax);
}
}
function calculateRewards(address user) public view returns (uint256) {
StakeInfo storage stakeInfo = userStakes[user];
if (stakeInfo.amount == 0) {
return stakeInfo.pendingRewards;
}
uint256 timeElapsed = block.timestamp - stakeInfo.lastUpdated;
if (timeElapsed == 0) {
return stakeInfo.pendingRewards;
}
uint256 rewards = (stakeInfo.amount * APR * timeElapsed) /
(100 * SECONDS_IN_YEAR);
uint256 totalRewards = stakeInfo.pendingRewards + rewards;
return totalRewards;
}
function claimRewards() external nonReentrant {
StakeInfo storage stakeInfo = userStakes[msg.sender];
require(stakeInfo.amount > 0, "No staked amount");
uint256 currentTimestamp = block.timestamp;
uint256 timeElapsed = currentTimestamp - stakeInfo.lastUpdated;
if (timeElapsed > 0) {
uint256 rewards = (stakeInfo.amount * APR * timeElapsed) /
(100 * SECONDS_IN_YEAR);
stakeInfo.pendingRewards += rewards;
}
uint256 rewardsToClaim = stakeInfo.pendingRewards;
require(rewardsToClaim > 0, "No rewards to claim");
stakeInfo.pendingRewards = 0;
stakeInfo.lastUpdated = currentTimestamp;
token.mint(msg.sender, rewardsToClaim);
totalBurned = totalBurned >= rewardsToClaim
? totalBurned - rewardsToClaim
: 0;
emit RewardsMinted(msg.sender, rewardsToClaim);
}
function compound() external nonReentrant {
StakeInfo storage stakeInfo = userStakes[msg.sender];
require(stakeInfo.amount > 0, "No staked amount to compound");
uint256 currentTimestamp = block.timestamp;
uint256 timeElapsed = currentTimestamp - stakeInfo.lastUpdated;
if (timeElapsed > 0) {
uint256 rewards = (stakeInfo.amount * APR * timeElapsed) /
(100 * SECONDS_IN_YEAR);
stakeInfo.pendingRewards += rewards;
}
uint256 rewardsToCompound = stakeInfo.pendingRewards;
require(rewardsToCompound > 0, "No rewards to compound");
stakeInfo.pendingRewards = 0;
stakeInfo.lastUpdated = currentTimestamp;
stakeInfo.epoch = getCurrentEpoch();
stakeInfo.amount += rewardsToCompound;
totalStaked += rewardsToCompound;
emit Staked(msg.sender, rewardsToCompound);
}
function setAPR(uint256 _newAPR) external onlyOwner {
APR = _newAPR;
}
function setUnstakeTax(uint256 _newTax) external onlyOwner {
UNSTAKE_TAX = _newTax;
}
function setEpochDuration(uint256 _newEpochDuration) external onlyOwner {
epochDuration = _newEpochDuration;
}
function setClaimDelayEpochs(uint256 _newClaimDelay) external onlyOwner {
CLAIM_DELAY_EPOCHS = _newClaimDelay;
}
function setTokenAddress(address _newTokenAddress) external onlyOwner {
token = ICustomToken(_newTokenAddress);
}
function setUsdcTokenAddress(address _newUSDCAddress) external onlyOwner {
usdcToken = IERC20(_newUSDCAddress);
}
function getBondDetails(
uint256 _bondId
)
external
view
returns (
uint256 tokenAmount,
uint256 pricePerToken,
uint256 closeEpoch,
bool isActive
)
{
Bond storage bond = bonds[_bondId];
return (
bond.tokenAmount,
bond.pricePerToken,
bond.closeEpoch,
bond.isActive
);
}
function getCurrentEpoch() public view returns (uint256) {
return (block.timestamp - deploymentTime) / epochDuration;
}
function timeUntilNextEpoch() public view returns (uint256) {
unchecked {
uint256 timeInCurrentEpoch = (block.timestamp - deploymentTime) %
epochDuration;
return epochDuration - timeInCurrentEpoch;
}
}
function getTotalUserStake(address user) public view returns (uint256) {
return userStakes[user].amount;
}
function getNextEpochYield() external view returns (uint256) {
uint256 numerator = APR * epochDuration * 1e6;
uint256 denominator = 100 * SECONDS_IN_YEAR;
uint256 yieldPercentage = numerator / denominator;
return yieldPercentage;
}
function calculateDailyRewards(
address user
) external view returns (uint256) {
StakeInfo storage stakeInfo = userStakes[user];
if (stakeInfo.amount == 0) {
return 0;
}
uint256 dayInSeconds = 1 days;
uint256 rewards = (stakeInfo.amount * APR * dayInSeconds) /
(100 * SECONDS_IN_YEAR);
return rewards;
}
function calculateNextEpochRewards(
address user
) external view returns (uint256) {
StakeInfo storage stakeInfo = userStakes[user];
if (stakeInfo.amount == 0) {
return 0;
}
uint256 epochTime = epochDuration;
uint256 rewards = (stakeInfo.amount * APR * epochTime) /
(100 * SECONDS_IN_YEAR);
return rewards;
}
function getBondInfo(
address user,
bool onlyClaimable
) external view returns (BondClaimDetails[] memory) {
uint256 count = 0;
uint256 currentEpoch = getCurrentEpoch();
BondClaimDetails[] memory tempBonds = new BondClaimDetails[](
bondCounter
);
for (uint256 i = 1; i <= bondCounter; i++) {
UserBondInfo storage userBond = userBonds[user][i];
Bond storage bond = bonds[i];
if (userBond.amountPurchased > 0 && !userBond.claimed) {
bool isClaimable = (bond.closeEpoch > 0 &&
currentEpoch >= bond.closeEpoch + CLAIM_DELAY_EPOCHS);
if (!onlyClaimable || isClaimable) {
tempBonds[count] = BondClaimDetails({
bondId: i,
amountToClaim: userBond.amountPurchased
});
count++;
}
}
}
BondClaimDetails[] memory result = new BondClaimDetails[](count);
for (uint256 j = 0; j < count; j++) {
result[j] = tempBonds[j];
}
return result;
}
}
文件 9 的 9:draft-IERC20Permit.sol
pragma solidity ^0.8.0;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
{
"compilationTarget": {
"contracts/Staking.sol": "StakingBondContract"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"viaIR": true
}
[{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_usdcTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"bondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BondClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bondId","type":"uint256"}],"name":"BondClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingTokenAmount","type":"uint256"}],"name":"BondOfferCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerToken","type":"uint256"}],"name":"BondOffered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"bondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cost","type":"uint256"}],"name":"BondPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"USDCWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"APR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CLAIM_DELAY_EPOCHS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECONDS_IN_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNSTAKE_TAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptTokenOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bondCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bonds","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"uint256","name":"closeEpoch","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"bool","name":"isCanceled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateDailyRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateNextEpochRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bondId","type":"uint256"}],"name":"cancelBondOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"bondIds","type":"uint256[]"}],"name":"claimBonds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"compound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deploymentTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bondId","type":"uint256"}],"name":"getBondDetails","outputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"uint256","name":"closeEpoch","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"onlyClaimable","type":"bool"}],"name":"getBondInfo","outputs":[{"components":[{"internalType":"uint256","name":"bondId","type":"uint256"},{"internalType":"uint256","name":"amountToClaim","type":"uint256"}],"internalType":"struct StakingBondContract.BondClaimDetails[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextEpochYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getTotalUserStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint256","name":"_pricePerToken","type":"uint256"}],"name":"offerBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bondId","type":"uint256"},{"internalType":"uint256","name":"amountInUSDC","type":"uint256"}],"name":"purchaseBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newAPR","type":"uint256"}],"name":"setAPR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newClaimDelay","type":"uint256"}],"name":"setClaimDelayEpochs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newEpochDuration","type":"uint256"}],"name":"setEpochDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newTokenAddress","type":"address"}],"name":"setTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTax","type":"uint256"}],"name":"setUnstakeTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newUSDCAddress","type":"address"}],"name":"setUsdcTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeUntilNextEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract ICustomToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdcToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userBonds","outputs":[{"internalType":"uint256","name":"amountPurchased","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userStakes","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"pendingRewards","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"}]