编译器
0.8.15+commit.e14f2714
文件 1 的 16:AccessControl.sol
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
文件 2 的 16: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 functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(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) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 3 的 16: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;
}
}
文件 4 的 16:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 5 的 16:ForgeV1.sol
pragma solidity 0.8.15;
import "@openzeppelin/contracts/access/AccessControl.sol";
import {IWETH} from "./interfaces/IWETH.sol";
import "./interfaces/IUniswapV2Router.sol";
import {IDynaset} from "./interfaces/IDynaset.sol";
import "./interfaces/IDynasetTvlOracle.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract ForgeV1 is AccessControl , ReentrancyGuard {
using SafeERC20 for IERC20;
struct ForgeInfo {
bool isEth;
address contributionToken;
uint256 dynasetLp;
uint256 totalContribution;
uint256 minContribution;
uint256 maxContribution;
uint256 maxCap;
uint256 contributionPeriod;
bool withdrawEnabled;
bool depositEnabled;
bool forging;
uint256 nextForgeContributorIndex;
}
struct UserInfo {
uint256 depositAmount;
uint256 dynasetsOwed;
}
struct Contributor {
address contributorAddress;
uint256 contributedAmount;
}
bytes32 public constant BLACK_SMITH = keccak256(abi.encode("BLACK_SMITH"));
address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
uint256 public constant USDC_DECIMALS = 6;
uint256 public constant DYNASET_DECIMALS = 18;
uint256 public constant SLIPPAGE_FACTOR = 1000;
uint256 public constant WITHDRAW_FEE_FACTOR = 10000;
uint256 public constant WITHDRAW_FEE_5_PERCENT = 500;
uint256 public constant WITHDRAW_FEE_4_PERCENT = 400;
uint256 public constant WITHDRAW_FEE_2_5_PERCENT = 250;
uint256 public constant WITHDRAW_FEE_5_PERCENT_PERIOD = 30 days;
uint256 public constant WITHDRAW_FEE_4_PERCENT_PERIOD = 60 days;
uint256 public constant WITHDRAW_FEE_2_5_PERCENT_PERIOD = 90 days;
mapping(uint256 => Contributor[]) public contributors;
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
ForgeInfo[] public forgeInfo;
IDynaset public dynaset;
IDynasetTvlOracle public dynasetTvlOracle;
address public uniswapV2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 public totalForges;
uint256 public slippage = 50;
uint256 public totalFee;
bool public lpWithdraw;
uint256 public deadline;
event LogForgeAddition(uint256 indexed forgeId, address indexed contributionToken);
event Deposited(address indexed caller, address indexed user, uint256 amount);
event ForgingStarted(uint256 indexed forgeId, uint256 indexed nextForgeContributorIndex);
event DepositedLP(address indexed user, uint256 indexed forgeId, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event Redeemed(address indexed user, uint256 amount);
event Forged(address indexed user, uint256 indexed amount, uint256 price);
event SetlpWithdraw(bool lpWithdraw);
event ForgeWithdrawEnabled(bool status, uint256 forgeId);
event ForgeDepositEnabled(bool status, uint256 forgeId);
event OracleUpdated(address oracle);
event RouterUpgraded(address router);
constructor(
address _blacksmith,
address _dynaset,
address _dynasetTvlOracle
) {
require(
_blacksmith != address(0)
&& _dynaset != address(0)
&& _dynasetTvlOracle != address(0),
"ERR_ZERO_ADDRESS"
);
dynaset = IDynaset(_dynaset);
dynasetTvlOracle = IDynasetTvlOracle(_dynasetTvlOracle);
_setupRole(BLACK_SMITH, _blacksmith);
}
function createForge(
bool isEth,
address contributionToken,
uint256 mincontrib,
uint256 maxcontrib,
uint256 maxcapital
) external onlyRole(BLACK_SMITH) {
require(
mincontrib > 0 && maxcontrib > 0 && maxcapital > 0,
"PRICE_ERROR"
);
if(isEth) {
require(contributionToken == WETH, "INCORRECT_CONTRIBUTION_TOKEN");
}
forgeInfo.push(
ForgeInfo({
isEth: isEth,
dynasetLp: 0,
contributionToken: contributionToken,
totalContribution: 0,
minContribution: mincontrib,
maxContribution: maxcontrib,
maxCap: maxcapital,
contributionPeriod: block.timestamp,
withdrawEnabled: false,
depositEnabled: false,
forging: false,
nextForgeContributorIndex: 0
})
);
totalForges = totalForges + 1;
emit LogForgeAddition(forgeInfo.length - 1, contributionToken);
}
function startForging(uint256 forgeId) external onlyRole(BLACK_SMITH) {
ForgeInfo memory forge = forgeInfo[forgeId];
require(!forge.forging, "ERR_FORGING_STARTED");
require(
forge.nextForgeContributorIndex < contributors[forgeId].length,
"ERR_NO_DEPOSITORS"
);
forge.forging = true;
forge.depositEnabled = false;
forgeInfo[forgeId] = forge;
emit ForgingStarted(forgeId, forge.nextForgeContributorIndex);
}
function forgeFunction(
uint256 forgeId,
uint256 contributorsToMint,
uint256 minimumAmountOut
) external nonReentrant onlyRole(BLACK_SMITH) {
uint256 _forgeId = forgeId;
ForgeInfo memory forge = forgeInfo[_forgeId];
require(forge.forging, "ERR_FORGING_NOT_STARTED");
require(!forge.depositEnabled, "ERR_DEPOSITS_NOT_DISABLED");
require(contributorsToMint > 0, "CONTRIBUTORS_TO_MINT_IS_ZERO");
uint256 finalIndex = forge.nextForgeContributorIndex + (contributorsToMint - 1);
uint256 totalContributors = contributors[_forgeId].length;
forge.forging = (finalIndex < totalContributors - 1);
if (finalIndex >= totalContributors) {
finalIndex = totalContributors - 1;
}
uint256 forgedAmount;
uint256 amountToForge;
uint256 i;
for (i = forge.nextForgeContributorIndex; i <= finalIndex; i++) {
amountToForge += contributors[_forgeId][i].contributedAmount;
}
require(amountToForge > 0, "ERR_AMOUNT_TO_FORGE_ZERO");
uint256 tokensMinted = _mintDynaset(forge.contributionToken, amountToForge);
require(tokensMinted >= minimumAmountOut, "ERR_MINIMUM_AMOUNT_OUT");
for (i = forge.nextForgeContributorIndex; i <= finalIndex && forgedAmount < amountToForge; i++) {
address contributorAddress = contributors[_forgeId][i].contributorAddress;
UserInfo storage user = userInfo[_forgeId][contributorAddress];
uint256 userContributedAmount = contributors[_forgeId][i].contributedAmount;
forgedAmount += userContributedAmount;
user.depositAmount = user.depositAmount - userContributedAmount;
uint256 userTokensMinted = tokensMinted * userContributedAmount / amountToForge;
user.dynasetsOwed += userTokensMinted;
emit Forged(
contributorAddress,
userTokensMinted,
userContributedAmount
);
}
forge.nextForgeContributorIndex = finalIndex + 1;
forge.totalContribution = forge.totalContribution - forgedAmount;
forge.dynasetLp += tokensMinted;
forgeInfo[_forgeId] = forge;
}
function deposit(
uint256 forgeId,
uint256 amount,
address to
) external nonReentrant payable {
require(to != address(0), "ERR_ZERO_ADDRESS");
ForgeInfo memory forge = forgeInfo[forgeId];
require(forge.depositEnabled, "ERR_DEPOSIT_DISABLED");
require(amount > 0, "ERR_ZERO_AMOUNT");
UserInfo storage user = userInfo[forgeId][to];
if (forge.isEth) {
require(amount == msg.value, "ERR_INVALID_AMOUNT_VALUE");
uint256 totalContribution = user.depositAmount + msg.value;
require(
forge.minContribution <= amount,
"ERR_AMOUNT_BELOW_MINCONTRIBUTION"
);
require(
totalContribution <= forge.maxContribution,
"ERR_AMOUNT_ABOVE_MAXCONTRIBUTION"
);
require(
(forge.totalContribution + msg.value) <= forge.maxCap,
"MAX_CAP"
);
user.depositAmount = (user.depositAmount + msg.value);
forge.totalContribution = (forge.totalContribution + msg.value);
forgeInfo[forgeId] = forge;
contributors[forgeId].push(Contributor(to, msg.value));
IWETH(WETH).deposit{value: msg.value}();
emit Deposited(msg.sender, to, amount);
} else {
require(
(forge.totalContribution + amount) <= forge.maxCap,
"MAX_CAP"
);
IERC20 tokenContribution = IERC20(forge.contributionToken);
require(
tokenContribution.balanceOf(msg.sender) >= amount,
"ERR_NOT_ENOUGH_TOKENS"
);
require(
tokenContribution.allowance(msg.sender, address(this)) >=
amount,
"ERR_INSUFFICIENT_ALLOWANCE"
);
uint256 contribution = user.depositAmount + amount;
require(
forge.minContribution <= contribution,
"ERR_AMOUNT_BELOW_MINCONTRIBUTION"
);
require(
contribution <= forge.maxContribution,
"ERR_AMOUNT_ABOVE_MAXCONTRIBUTION"
);
require(
tokenContribution.balanceOf(address(this)) <= forge.maxCap,
"MAX_CAP"
);
user.depositAmount = contribution;
forge.totalContribution = forge.totalContribution + amount;
forgeInfo[forgeId] = forge;
contributors[forgeId].push(Contributor(to, amount));
tokenContribution.safeTransferFrom(
msg.sender,
address(this),
amount
);
emit Deposited(msg.sender, to, amount);
}
}
function redeem(
uint256 forgeId,
uint256 amount,
address redeemToken,
uint256 minimumAmountOut
) public nonReentrant {
ForgeInfo memory forge = forgeInfo[forgeId];
require(forge.withdrawEnabled, "ERR_WITHDRAW_DISABLED");
UserInfo storage user = userInfo[forgeId][msg.sender];
require(user.dynasetsOwed >= amount, "ERR_INSUFFICIENT_USER_BALANCE");
uint256 dynasetBalance = dynaset.balanceOf(
address(this)
);
require(dynasetBalance >= amount, "ERR_FORGE_BALANCE_INSUFFICIENT");
uint256 startTime = forge.contributionPeriod;
uint256 amountSlashed = capitalSlash(amount, startTime);
totalFee = totalFee + (amount - amountSlashed);
(address[] memory tokens, uint256[] memory amounts) = dynaset.calcTokensForAmount(amountSlashed);
address _redeemToken = redeemToken;
require(
_checkValidToken(tokens, _redeemToken),
"ERR_INVALID_REDEEM_TOKEN"
);
uint256 initialRedeemTokenBalance = IERC20(_redeemToken).balanceOf(
address(this)
);
forge.dynasetLp = forge.dynasetLp - amount;
forgeInfo[forgeId] = forge;
user.dynasetsOwed = user.dynasetsOwed - amount;
userInfo[forgeId][msg.sender] = user;
dynaset.exitDynaset(amountSlashed);
uint256 amountOut = 0;
for (uint256 i = 0; i < tokens.length; i++) {
address tokenOut = tokens[i];
uint256 amountIn = amounts[i];
require(
IERC20(tokenOut).balanceOf(address(this)) >= amountIn,
"ERR_INSUFFICIENT_FUNDS_MINT"
);
if (tokenOut != _redeemToken) {
IERC20(tokenOut).safeIncreaseAllowance(
uniswapV2Router,
amountIn
);
address wethAddress = WETH;
uint256 pathLength;
if (tokenOut != wethAddress && _redeemToken != wethAddress) {
pathLength = 3;
} else {
pathLength = 2;
}
address[] memory path;
path = new address[](pathLength);
path[0] = tokenOut;
if (tokenOut != wethAddress && _redeemToken != wethAddress) {
path[1] = wethAddress;
path[2] = _redeemToken;
} else {
path[1] = _redeemToken;
}
uint256[] memory uniAmountsOut = IUniswapV2Router(uniswapV2Router).getAmountsOut(amountIn, path);
uint256 minimumAmountOut_ = uniAmountsOut[pathLength - 1]
* (SLIPPAGE_FACTOR - slippage) / SLIPPAGE_FACTOR;
uint256[] memory amountsOut = IUniswapV2Router(uniswapV2Router)
.swapExactTokensForTokens(
amountIn,
minimumAmountOut_,
path,
msg.sender,
block.timestamp + deadline
);
require(amountsOut.length == path.length, "ERR_SWAP_FAILED");
amountOut += amountsOut[amountsOut.length - 1];
} else {
amountOut += amountIn;
}
}
require(amountOut >= minimumAmountOut, "ERR_MINIMUM_AMOUNT_OUT");
uint256 amountToTransfer = (IERC20(_redeemToken).balanceOf(address(this)) - initialRedeemTokenBalance);
IERC20(_redeemToken).safeTransfer(msg.sender, amountToTransfer);
emit Redeemed(msg.sender, amount);
}
function setlpWithdraw(bool status) external onlyRole(BLACK_SMITH) {
lpWithdraw = status;
emit SetlpWithdraw(lpWithdraw);
}
function withdrawFee() external nonReentrant onlyRole(BLACK_SMITH) {
require(dynaset.balanceOf(address(this)) >= totalFee, "ERR_INSUFFICIENT_BALANCE");
uint256 feeToRedeem = totalFee;
totalFee = 0;
require(dynaset.transfer(msg.sender, feeToRedeem), "ERR_TRANSFER_FAILED");
}
function setWithdraw(bool status, uint256 forgeId) external onlyRole(BLACK_SMITH) {
require(forgeId < totalForges, "ERR_NONEXISTENT_FORGE");
ForgeInfo memory forge = forgeInfo[forgeId];
forge.withdrawEnabled = status;
forgeInfo[forgeId] = forge;
emit ForgeWithdrawEnabled(status, forgeId);
}
function setDeposit(bool status, uint256 forgeId) external onlyRole(BLACK_SMITH) {
require(forgeId < totalForges, "ERR_NONEXISTENT_FORGE");
ForgeInfo memory forge = forgeInfo[forgeId];
forge.depositEnabled = status;
forgeInfo[forgeId] = forge;
emit ForgeDepositEnabled(status, forgeId);
}
function setDeadline(uint256 newDeadline) external onlyRole(BLACK_SMITH) {
deadline = newDeadline;
}
function upgradeUniswapV2Router(address newUniswapV2Router) external onlyRole(BLACK_SMITH) {
require(newUniswapV2Router != address(0), "ERR_ADDRESS_ZERO");
uniswapV2Router = newUniswapV2Router;
emit RouterUpgraded(newUniswapV2Router);
}
function depositOutput(uint256 forgeId, uint256 amount) public nonReentrant {
ForgeInfo memory forge = forgeInfo[forgeId];
UserInfo storage user = userInfo[forgeId][msg.sender];
require(dynaset.balanceOf(msg.sender) >= amount, "ERR_INSUFFICIENT_DEPOSITOR_BALANCE");
user.dynasetsOwed = user.dynasetsOwed + amount;
userInfo[forgeId][msg.sender] = user;
forge.dynasetLp = forge.dynasetLp + amount;
forgeInfo[forgeId] = forge;
require(dynaset.transferFrom(msg.sender, address(this), amount), "ERR_TRANSFER_FAILED");
emit DepositedLP(msg.sender, forgeId, amount);
}
function withdrawOutput(uint256 forgeId, uint256 amount) external nonReentrant {
ForgeInfo memory forge = forgeInfo[forgeId];
UserInfo storage user = userInfo[forgeId][msg.sender];
require(lpWithdraw, "ERR_WITHDRAW_DISABLED");
require(dynaset.balanceOf(address(this)) >= user.dynasetsOwed, "ERR_INSUFFICIENT_CONTRACT_BALANCE");
require(user.dynasetsOwed >= amount, "ERR_INSUFFICIENT_USER_BALANCE");
user.dynasetsOwed = user.dynasetsOwed - (amount);
userInfo[forgeId][msg.sender] = user;
forge.dynasetLp = forge.dynasetLp - (amount);
forgeInfo[forgeId] = forge;
require(dynaset.transfer(msg.sender, amount), "ERR_TRANSFER_FAILED");
emit Withdraw(msg.sender, amount);
}
function redeemFromWallet(
uint256 forgeId,
uint256 amount,
address redeemToken,
uint256 minimumAmountOut
) external {
depositOutput(forgeId, amount);
redeem(forgeId, amount, redeemToken, minimumAmountOut);
}
function setSlippage(uint256 newSlippage) external onlyRole(BLACK_SMITH) {
require(newSlippage < (SLIPPAGE_FACTOR / 2), "SLIPPAGE_TOO_HIGH");
slippage = newSlippage;
}
function updateOracle(address newDynasetTvlOracle) external onlyRole(BLACK_SMITH) {
dynasetTvlOracle = IDynasetTvlOracle(newDynasetTvlOracle);
emit OracleUpdated(newDynasetTvlOracle);
}
function getUserDynasetsOwned(uint256 forgeId, address user) external view returns (uint256) {
return userInfo[forgeId][user].dynasetsOwed;
}
function getUserContribution(uint256 forgeId, address user) external view returns (uint256) {
return userInfo[forgeId][user].depositAmount;
}
function getForgeBalance(uint256 forgeId) external view returns (uint256) {
return forgeInfo[forgeId].totalContribution;
}
function getContributor(uint256 id, uint256 index) external view returns (address) {
return contributors[id][index].contributorAddress;
}
function calculateContributionUsdc(uint256 forgeId) public view returns (uint256 contrib) {
ForgeInfo memory forge = forgeInfo[forgeId];
uint256 contributionAmount = forge.totalContribution;
address contributionToken = forge.contributionToken;
if (contributionToken == USDC) {
return contributionAmount;
} else {
return dynasetTvlOracle.tokenUsdcValue(contributionToken, contributionAmount);
}
}
function capitalSlash(uint256 amount, uint256 contributionTime) public view returns (uint256) {
uint256 currentTime = block.timestamp;
if ((contributionTime <= currentTime)
&& (currentTime < contributionTime + WITHDRAW_FEE_5_PERCENT_PERIOD)) {
return amount * (WITHDRAW_FEE_FACTOR - WITHDRAW_FEE_5_PERCENT) / WITHDRAW_FEE_FACTOR;
}
if ((contributionTime + WITHDRAW_FEE_5_PERCENT_PERIOD <= currentTime)
&& (currentTime < contributionTime + WITHDRAW_FEE_4_PERCENT_PERIOD)) {
return amount * (WITHDRAW_FEE_FACTOR - WITHDRAW_FEE_4_PERCENT) / WITHDRAW_FEE_FACTOR;
}
if ((contributionTime + WITHDRAW_FEE_4_PERCENT_PERIOD <= currentTime)
&& (currentTime < contributionTime + WITHDRAW_FEE_2_5_PERCENT_PERIOD)) {
return amount * (WITHDRAW_FEE_FACTOR - WITHDRAW_FEE_2_5_PERCENT) / WITHDRAW_FEE_FACTOR;
}
return amount;
}
function getOutputAmount(uint256 forgeId) public view returns (uint256 amount) {
uint256 contributionUsdcValue = calculateContributionUsdc(forgeId);
uint256 output = (contributionUsdcValue * (10**(DYNASET_DECIMALS + DYNASET_DECIMALS - USDC_DECIMALS)))
/ dynasetTvlOracle.dynasetUsdcValuePerShare();
return output;
}
function _mintDynaset(address _contributionToken, uint256 contributionAmount) internal returns (uint256) {
uint256 contributionUsdcValue = dynasetTvlOracle.tokenUsdcValue(_contributionToken, contributionAmount);
address[] memory tokens;
uint256[] memory ratios;
uint256 totalUSDC;
(tokens, ratios, totalUSDC) = dynasetTvlOracle.dynasetTokenUsdcRatios();
for (uint256 i = 0; i < tokens.length; i++) {
address token = tokens[i];
uint256 amountIn = contributionAmount * ratios[i] / 1e18;
uint256 amountOut;
if (token == _contributionToken) {
amountOut = amountIn;
} else {
address contributionToken = _contributionToken;
bool routeOverWeth = (contributionToken != WETH && token != WETH);
uint256 pathLength = routeOverWeth ? 3 : 2;
address[] memory path = new address[](pathLength);
path[0] = contributionToken;
if (routeOverWeth) {
path[1] = WETH;
}
path[pathLength - 1] = token;
uint256[] memory amountsOut = IUniswapV2Router(uniswapV2Router).getAmountsOut(amountIn, path);
amountOut = amountsOut[pathLength - 1];
IERC20(contributionToken).safeIncreaseAllowance(uniswapV2Router, amountIn);
require(
IUniswapV2Router(uniswapV2Router)
.swapExactTokensForTokens(
amountIn,
amountOut * (SLIPPAGE_FACTOR - slippage) / SLIPPAGE_FACTOR,
path,
address(this),
block.timestamp + deadline
)
.length == path.length,
"ERR_SWAP_FAILED"
);
}
IERC20(token).safeIncreaseAllowance(address(dynaset), amountOut);
}
uint256 totalSupply = dynaset.totalSupply();
uint256 sharesToMint = contributionUsdcValue * totalSupply / totalUSDC;
return dynaset.joinDynaset(sharesToMint);
}
function _checkValidToken(address[] memory tokens, address redeemToken) internal pure returns (bool valid) {
for (uint256 i = 0; i < tokens.length; i++) {
if (tokens[i] == redeemToken) {
valid = true;
break;
}
}
}
}
文件 6 的 16:IAccessControl.sol
pragma solidity ^0.8.0;
interface IAccessControl {
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address account) external;
}
文件 7 的 16:IDynaset.sol
pragma solidity 0.8.15;
import "./IERC20.sol";
interface IDynaset is IERC20 {
function joinDynaset(uint256 _amount) external returns (uint256);
function exitDynaset(uint256 _amount) external;
function calcTokensForAmount(uint256 _amount)
external
view
returns (address[] memory tokens, uint256[] memory amounts);
function getTokenAmounts()
external
view
returns (address[] memory tokens, uint256[] memory amounts);
function getCurrentTokens() external view returns (address[] memory tokens);
}
文件 8 的 16:IDynasetTvlOracle.sol
pragma solidity 0.8.15;
interface IDynasetTvlOracle {
function dynasetTvlUsdc() external view returns (uint256 total_usd);
function tokenUsdcValue(address _tokenIn, uint256 _amount) external view returns (uint256);
function dynasetUsdcValuePerShare() external view returns (uint256);
function dynasetTokenUsdcRatios() external view returns (address[] memory, uint256[] memory, uint256);
}
文件 9 的 16:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 10 的 16:IERC20.sol
pragma solidity 0.8.15;
interface IERC20 {
event Approval(address indexed _src, address indexed _dst, uint256 _amount);
function totalSupply() external view returns (uint256);
function balanceOf(address _whom) external view returns (uint256);
function allowance(address _src, address _dst)
external
view
returns (uint256);
function approve(address _dst, uint256 _amount) external returns (bool);
function transfer(address _dst, uint256 _amount) external returns (bool);
function transferFrom(
address _src,
address _dst,
uint256 _amount
) external returns (bool);
}
文件 11 的 16:IUniswapV2Router.sol
pragma solidity 0.8.15;
interface IUniswapV2Router {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
文件 12 的 16:IWETH.sol
pragma solidity 0.8.15;
import "./IERC20.sol";
interface IWETH is IERC20 {
function deposit() external payable;
function withdraw(uint256 wad) external;
}
文件 13 的 16: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() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 14 的 16: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");
}
}
}
文件 15 的 16:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
文件 16 的 16: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/ForgeV1.sol": "ForgeV1"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_blacksmith","type":"address"},{"internalType":"address","name":"_dynaset","type":"address"},{"internalType":"address","name":"_dynasetTvlOracle","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"forgeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositedLP","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"},{"indexed":false,"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"ForgeDepositEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"},{"indexed":false,"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"ForgeWithdrawEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Forged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"forgeId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"nextForgeContributorIndex","type":"uint256"}],"name":"ForgingStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"forgeId","type":"uint256"},{"indexed":true,"internalType":"address","name":"contributionToken","type":"address"}],"name":"LogForgeAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"OracleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Redeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"router","type":"address"}],"name":"RouterUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"lpWithdraw","type":"bool"}],"name":"SetlpWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BLACK_SMITH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DYNASET_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLIPPAGE_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_2_5_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_2_5_PERCENT_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_4_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_4_PERCENT_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_5_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_5_PERCENT_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FEE_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"calculateContributionUsdc","outputs":[{"internalType":"uint256","name":"contrib","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"contributionTime","type":"uint256"}],"name":"capitalSlash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"contributors","outputs":[{"internalType":"address","name":"contributorAddress","type":"address"},{"internalType":"uint256","name":"contributedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isEth","type":"bool"},{"internalType":"address","name":"contributionToken","type":"address"},{"internalType":"uint256","name":"mincontrib","type":"uint256"},{"internalType":"uint256","name":"maxcontrib","type":"uint256"},{"internalType":"uint256","name":"maxcapital","type":"uint256"}],"name":"createForge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositOutput","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dynaset","outputs":[{"internalType":"contract IDynaset","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dynasetTvlOracle","outputs":[{"internalType":"contract IDynasetTvlOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"uint256","name":"contributorsToMint","type":"uint256"},{"internalType":"uint256","name":"minimumAmountOut","type":"uint256"}],"name":"forgeFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"forgeInfo","outputs":[{"internalType":"bool","name":"isEth","type":"bool"},{"internalType":"address","name":"contributionToken","type":"address"},{"internalType":"uint256","name":"dynasetLp","type":"uint256"},{"internalType":"uint256","name":"totalContribution","type":"uint256"},{"internalType":"uint256","name":"minContribution","type":"uint256"},{"internalType":"uint256","name":"maxContribution","type":"uint256"},{"internalType":"uint256","name":"maxCap","type":"uint256"},{"internalType":"uint256","name":"contributionPeriod","type":"uint256"},{"internalType":"bool","name":"withdrawEnabled","type":"bool"},{"internalType":"bool","name":"depositEnabled","type":"bool"},{"internalType":"bool","name":"forging","type":"bool"},{"internalType":"uint256","name":"nextForgeContributorIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getContributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"getForgeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"getOutputAmount","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserContribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserDynasetsOwned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"redeemToken","type":"address"},{"internalType":"uint256","name":"minimumAmountOut","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"redeemToken","type":"address"},{"internalType":"uint256","name":"minimumAmountOut","type":"uint256"}],"name":"redeemFromWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDeadline","type":"uint256"}],"name":"setDeadline","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"},{"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"setDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newSlippage","type":"uint256"}],"name":"setSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"},{"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"setWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"setlpWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"}],"name":"startForging","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalForges","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newDynasetTvlOracle","type":"address"}],"name":"updateOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newUniswapV2Router","type":"address"}],"name":"upgradeUniswapV2Router","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"dynasetsOwed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"forgeId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawOutput","outputs":[],"stateMutability":"nonpayable","type":"function"}]