change WUSD payment to USDC
This commit is contained in:
@@ -46,7 +46,7 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
event VaultImplementationUpdated(address indexed newImplementation);
|
||||
event DefaultHardCapSet(uint256 newDefaultHardCap);
|
||||
event HardCapSet(address indexed vault, uint256 newHardCap);
|
||||
event PricesUpdated(address indexed vault, uint256 wusdPrice, uint256 ytPrice);
|
||||
event PricesUpdated(address indexed vault, uint256 ytPrice);
|
||||
event NextRedemptionTimeSet(address indexed vault, uint256 redemptionTime);
|
||||
|
||||
/**
|
||||
@@ -98,10 +98,10 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
* @param _symbol YT代币符号
|
||||
* @param _manager 管理员地址
|
||||
* @param _hardCap 硬顶限制(0表示使用默认值)
|
||||
* @param _wusd WUSD代币地址(传0使用默认地址)
|
||||
* @param _usdc USDC代币地址(传0使用默认地址)
|
||||
* @param _redemptionTime 赎回时间(Unix时间戳)
|
||||
* @param _initialWusdPrice 初始WUSD价格(精度1e30,传0则使用默认值1.0)
|
||||
* @param _initialYtPrice 初始YT价格(精度1e30,传0则使用默认值1.0)
|
||||
* @param _usdcPriceFeed Chainlink USDC价格Feed地址
|
||||
* @return vault 新创建的vault地址
|
||||
*/
|
||||
function createVault(
|
||||
@@ -109,10 +109,10 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
string memory _symbol,
|
||||
address _manager,
|
||||
uint256 _hardCap,
|
||||
address _wusd,
|
||||
address _usdc,
|
||||
uint256 _redemptionTime,
|
||||
uint256 _initialWusdPrice,
|
||||
uint256 _initialYtPrice
|
||||
uint256 _initialYtPrice,
|
||||
address _usdcPriceFeed
|
||||
) external onlyOwner returns (address vault) {
|
||||
if (_manager == address(0)) revert InvalidAddress();
|
||||
|
||||
@@ -126,10 +126,10 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
_symbol,
|
||||
_manager,
|
||||
actualHardCap,
|
||||
_wusd,
|
||||
_usdc,
|
||||
_redemptionTime,
|
||||
_initialWusdPrice,
|
||||
_initialYtPrice
|
||||
_initialYtPrice,
|
||||
_usdcPriceFeed
|
||||
);
|
||||
|
||||
// 部署代理合约
|
||||
@@ -155,10 +155,10 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
* @param _symbols YT代币符号数组
|
||||
* @param _managers 管理员地址数组
|
||||
* @param _hardCaps 硬顶数组
|
||||
* @param _wusd WUSD代币地址(传0使用默认地址)
|
||||
* @param _usdc USDC代币地址(传0使用默认地址)
|
||||
* @param _redemptionTimes 赎回时间数组(Unix时间戳)
|
||||
* @param _initialWusdPrices 初始WUSD价格数组(精度1e30)
|
||||
* @param _initialYtPrices 初始YT价格数组(精度1e30)
|
||||
* @param _usdcPriceFeed Chainlink USDC价格Feed地址
|
||||
* @return vaults 创建的vault地址数组
|
||||
*/
|
||||
function createVaultBatch(
|
||||
@@ -166,17 +166,16 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
string[] memory _symbols,
|
||||
address[] memory _managers,
|
||||
uint256[] memory _hardCaps,
|
||||
address _wusd,
|
||||
address _usdc,
|
||||
uint256[] memory _redemptionTimes,
|
||||
uint256[] memory _initialWusdPrices,
|
||||
uint256[] memory _initialYtPrices
|
||||
uint256[] memory _initialYtPrices,
|
||||
address _usdcPriceFeed
|
||||
) external returns (address[] memory vaults) {
|
||||
require(
|
||||
_names.length == _symbols.length &&
|
||||
_names.length == _managers.length &&
|
||||
_names.length == _hardCaps.length &&
|
||||
_names.length == _redemptionTimes.length &&
|
||||
_names.length == _initialWusdPrices.length &&
|
||||
_names.length == _initialYtPrices.length,
|
||||
"Length mismatch"
|
||||
);
|
||||
@@ -189,10 +188,10 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
_symbols[i],
|
||||
_managers[i],
|
||||
_hardCaps[i],
|
||||
_wusd,
|
||||
_usdc,
|
||||
_redemptionTimes[i],
|
||||
_initialWusdPrices[i],
|
||||
_initialYtPrices[i]
|
||||
_initialYtPrices[i],
|
||||
_usdcPriceFeed
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -312,41 +311,33 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
/**
|
||||
* @notice 更新vault价格
|
||||
* @param _vault vault地址
|
||||
* @param _wusdPrice WUSD价格(精度1e30)
|
||||
* @param _ytPrice YT价格(精度1e30)
|
||||
*/
|
||||
function updateVaultPrices(
|
||||
address _vault,
|
||||
uint256 _wusdPrice,
|
||||
address _vault,
|
||||
uint256 _ytPrice
|
||||
) external onlyOwner {
|
||||
if (!isVault[_vault]) revert VaultNotExists();
|
||||
|
||||
YTAssetVault(_vault).updatePrices(_wusdPrice, _ytPrice);
|
||||
emit PricesUpdated(_vault, _wusdPrice, _ytPrice);
|
||||
YTAssetVault(_vault).updatePrices(_ytPrice);
|
||||
emit PricesUpdated(_vault, _ytPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice 批量更新价格
|
||||
* @param _vaults vault地址数组
|
||||
* @param _wusdPrices WUSD价格数组(精度1e30)
|
||||
* @param _ytPrices YT价格数组(精度1e30)
|
||||
*/
|
||||
function updateVaultPricesBatch(
|
||||
address[] memory _vaults,
|
||||
uint256[] memory _wusdPrices,
|
||||
uint256[] memory _ytPrices
|
||||
) external onlyOwner {
|
||||
require(
|
||||
_vaults.length == _wusdPrices.length &&
|
||||
_vaults.length == _ytPrices.length,
|
||||
"Length mismatch"
|
||||
);
|
||||
require(_vaults.length == _ytPrices.length, "Length mismatch");
|
||||
|
||||
for (uint256 i = 0; i < _vaults.length; i++) {
|
||||
if (!isVault[_vaults[i]]) revert VaultNotExists();
|
||||
YTAssetVault(_vaults[i]).updatePrices(_wusdPrices[i], _ytPrices[i]);
|
||||
emit PricesUpdated(_vaults[i], _wusdPrices[i], _ytPrices[i]);
|
||||
YTAssetVault(_vaults[i]).updatePrices(_ytPrices[i]);
|
||||
emit PricesUpdated(_vaults[i], _ytPrices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +413,7 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
uint256 managedAssets,
|
||||
uint256 totalSupply,
|
||||
uint256 hardCap,
|
||||
uint256 wusdPrice,
|
||||
uint256 usdcPrice,
|
||||
uint256 ytPrice,
|
||||
uint256 nextRedemptionTime
|
||||
) {
|
||||
@@ -434,7 +425,7 @@ contract YTAssetFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
||||
managedAssets,
|
||||
totalSupply,
|
||||
hardCap,
|
||||
wusdPrice,
|
||||
usdcPrice,
|
||||
ytPrice,
|
||||
nextRedemptionTime
|
||||
) = YTAssetVault(_vault).getVaultInfo();
|
||||
|
||||
Reference in New Issue
Block a user