// SPDX-License-Identifier: CC0-1.0
import"./ERC4626.sol";interfaceTokenReserveisERC4626{/**
* @dev Event emitted after a new policy is created
* @dev 创建新策略后发出的事件
*/eventpolicies(addressindexedtoken,uint256indexedpolicyNum,uint256indexedamount,addressrecipient);/**
* @dev Event emitted after a new deposit is made by the owner
* @dev 所有者进行新的存款后发出的事件
*/eventdepositR(addressindexedtoken,uint256indexedamount,uint256indexedtime,uint256count);/**
* @dev Get time a deposit/withdrawal was made by the owner
* @dev 获取所有者进行存款/取款的时间
* @param count Number for deposit count
* @param count 存款计数的数字
* @return block.timestamp format
* @return block.timestamp 格式
*/functionownerTime(uint256count)externalviewreturns(uint256)/**
* @dev Get amount deposited to reserve by owner
* @dev 获取所有者存入储备金的金额
* @param count Number for deposit count
* @param count 存款计数的数字
* @param policy The policy number to deposit to
* @param policy 要存入的策略编号
* @return uint256 Amount of an asset that was deposited
* @return uint256 存入的资产数量
*/functionownerDeposit(uint256count,uint256policy)externalviewreturns(uint256)/**
* @dev Amount withdrawn for a opened policy by the owner
* @dev 所有者为已开启的策略提取的金额
* @param policy The policy number
* @param policy 策略编号
* @return Amount of ERC20
* @return ERC20 的数量
*/functionownerWithdrawals(uint256policy)externalviewreturns(uint256)/**
* @dev Token type deposited to reserve by owner
* @dev 所有者存入储备金的代币类型
* - MUST be an address of ERC20 token
* - 必须是 ERC20 代币的地址
* @param count Number of deposit count
* @param count 存款计数的数字
* @return address Address of ERC20 token
* @return address ERC20 代币的地址
*/functiontokenDeposit(uint256count)externalviewreturns(address)/**
* @dev Amount deposited to a policy for shares
* @dev 存入策略以换取份额的金额
* - MUST be an ERC20 token
* - 必须是 ERC20 代币
* @param user Address of user
* @param user 用户的地址
* @param policy The policy number the user deposited to
* @param policy 用户存入的策略编号
* @return uint256 Amount of ERC20 deposited
* @return uint256 存入的 ERC20 数量
*/functionuserDeposit(addressuser,uint256policy)externalviewreturns(uint256)/**
* @dev Amount withdrawn from a policy by the user
* @dev 用户从策略中提取的金额
* @param user The address of user
* @param user 用户的地址
* @param policy The policy number for user withdrawal
* @param policy 用户提款的策略编号
* @param uint256 Amount of ERC20
* @param uint256 ERC20 的数量
*/functionuserWithdrawals(addressuser,uint256policy)publicviewreturns(uint256)/**
* @dev Token type withdrawn for an opened policy by the owner
* @dev 所有者为已开启的策略提取的代币类型
* - MUST be ERC20 address
* - 必须是 ERC20 地址
* @param policy The policy number for the token used
* @param policy 所用代币的策略编号
* @return Token ERC20 address
* @return Token ERC20 地址
*/functionpolicyToken(uint256policy)externalviewreturns(address)/**
* @dev Make a deposit to a policy creating new shares using deposit function from ERC4626
* @dev 使用 ERC4626 中的存款功能,存款到策略以创建新的份额
* - MUST be opened policy
* - 必须是已开启的策略
* - MUST NOT be opened policy that was closed
* - 不得是已关闭的已开启策略
* - SHOULD be only method to deposit to ERC4626 vault
* - 应该是存入 ERC4626 金库的唯一方法
* NOTE: using the deposit() will cause assets to not be accounted for in a policy (see Security Considerations section)
* 注意:使用 deposit() 将导致资产无法在策略中进行核算(请参阅“安全注意事项”部分)
* @param assets Amount being deposited
* @param assets 存入的金额
* @param receiver Address of depositor
* @param receiver 存款人的地址
* @param policy The number associated policy
* @param policy 与策略关联的编号
* @return Amount of shares minted
* @return 铸造的份额数量
*/functionpolicyDeposit(uint256assets,addressreceiver,uint256policy)externalvirtualreturns(uint256)/**
* @dev Burn shares, receive 1 to 1 value of shares using withdraw function from ERC4626
* @dev 销毁份额,使用 ERC4626 中的提款功能接收 1 比 1 的份额价值
* - MUST have userDeposit greater than or equal to userWithdrawal
* - 必须有 userDeposit 大于或等于 userWithdrawal
* - SHOULD be only method for withdrawing from ERC4626 vault
* - 应该是从 ERC4626 金库提款的唯一方法
* @param assets Amount being deposited
* @param assets 存入的金额
* @param receiver Address of receiver
* @param receiver 接收者的地址
* @param owner Address of token owner
* @param owner 代币所有者的地址
* @param policy Number associated policy
* @param policy 与策略关联的编号
* @return Amount of the asset
* @return 资产数量
*/functionwithdrawPolicy(uint256assets,addressreceiver,addressowner,uint256policy)externalvirtualreturns(uint256)/**
* @dev Issue new policy
* @dev 发布新策略
* - MUST create new policy number
* - 必须创建新的策略编号
* - MUST account for amount withdrawn
* - 必须核算提款金额
* - MUST be only method to withdraw ERC20 tokens (excluding underlying ERC4626 token)
* - 必须是提取 ERC20 代币的唯一方法(不包括 underlying ERC4626 代币)
* - MUST be owner
* - 必须是所有者
* - SHOULD emit policies event
* - 应该发出策略事件
* @param token Address of ERC-20 token
* @param token ERC-20 代币的地址
* @param amount Token amount being withdrawn
* @param amount 提取的代币数量
* @param receiver Address of token recipient
* @param receiver 代币接收者的地址
* @return The policy number
* @return 策略编号
*/functionopenPolicy(addresstoken,uint256amount,addressreceiver)externalvirtualreturns(uint256)/**
* @dev Make a deposit and/or close an opened policy
* @dev 存款和/或关闭已开启的策略
* - MUST be owner
* - 必须是所有者
* - MUST account for amount received
* - 必须核算收到的金额
* - SHOULD emit policies event
* - 应该发出策略事件
* @param token Address of ERC-20 token
* @param token ERC-20 代币的地址
* @param policy Number of the desired policy
* @param policy 所需策略的编号
* @param amount Token amount being deposited to the reserve
* @param amount 存入储备金的代币数量
* @param close Choose to close the policy
* @param close 选择关闭策略
* @return True for closed policy
* @return 如果策略已关闭,则为 True
*/functionclosePolicy(addresstoken,uint256policy,uint256amount,boolclose)externalvirtualreturns(bool)/**
* @dev Accounting for tokens deposited by owner
* @dev 核算所有者存入的代币
* - MUST be reserve owner
* - 必须是储备金所有者
* - SHOULD emit depositR event
* - 应该发出 depositR 事件
* NOTE: No shares are issued, funds can not be redeemed and no policy is opened. Withdrawnal made with openPolicy function.
* 注意:不发行份额,资金无法赎回,并且不开启策略。使用 openPolicy 函数进行提款。
* @param token Address of ERC-20 token being deposited
* @param token 存入的 ERC-20 代币的地址
* @param sender Address of token sender
* @param sender 代币发送者的地址
* @param amount Token amount being deposited
* @param amount 存入的代币数量
*/functiondepositReserve(addresstoken,addresssender,uint256amount)externalvirtual}