1396字约5分钟
2024-05-22
pragma solidity >=0.6.12;
pragma experimental ABIEncoderV2;
interface ICheque {
/**
@dev 【事件】 分发创建事件
*/
event NewChequeCreated(address indexed user, uint256 chequeId);
/**
@dev 【事件】 领取分发资金
*/
event NewChequeWithdraw(address indexed user, uint256 amount);
/**
@dev 【事件】 用户check
*/
event NewCheck(
address indexed user,
uint8 typeId,
uint256 chequeId,
uint256 targetId,
uint256 amount
);
/**
@dev 【事件】 用户取消check
*/
event NewCancelCheck(
address indexed user,
uint8 typeId,
uint256 chequeId,
uint256 targetId,
uint256 amount
);
/**
@dev 根据支票Id获取支票详情
*/
function cheques(uint256) external view returns (uint256);
/**
@dev 根据支票Id获取创建时间
*/
function cheque2Time(uint256) external view returns (uint32);
/**
@dev 根据支票Id获取对应已经领取的金额
*/
function cheque2Claimed(uint256) external view returns (uint256);
/**
@dev 创建支票
@notice 注意创建,支付 SYT 代币作为手续费
@param _indexer 支票编码所引器
*/
function createCheque(uint256 _indexer) external;
/**
@dev 取款
@notice todo 确认取款的条件
@param _chequeId 分发ID
@param _acceptAddress 资产接收地址,可以是用户地址或者是合约地址
*/
function withdraw(uint256 _chequeId, address _acceptAddress) external;
/**
@dev 获取当前可以领取的金额
@param _chequeId 分发ID
@return _pending 可领取资金
@return _progress 分发进度
*/
function getPending(
uint256 _chequeId
) external view returns (uint256 _pending, uint8 _progress);
/**
@dev 获取代币的价格
*/
function getPrice()
external
view
returns (uint256 _tokenPrice, uint256 _token2ETH);
/**
@dev 用户对支票进行 check,使用 PT 进行,1eth=2000pt
- 额外收取0.3%的syt手续费流入farm2
- 金额大于300的时间,需要钱包SYT*10>checking
- 增加做多和做空
- 创建时间+3天<可以参与<创建时间+10天
@param _typeId 参与类型,1做多-增加项目进度(0.3%额外syt手续费),2做空-不增加项目进度
@param _chequeId id
@param _amount 金额,用户希望参与的eth价值
*/
function check(uint8 _typeId, uint256 _chequeId, uint256 _amount) external;
/**
@dev 用户取消 check,退回资产,应该只退回本金,不包含手续费
@param _typeId 退出类型,1做多-过程中可以退出,2做空-项目结束之后可以退出
@param _chequeId 分发id
@param _amount 取消的eth价值,返回 _amount*2000的 pt
*/
function cancelCheck(
uint8 _typeId,
uint256 _chequeId,
uint256 _amount
) external;
/**
@dev 根据编码数据获取 对应的targetId
*/
function getTargetIdFromCheque(
uint256 _data
) external pure returns (uint256);
/**
@dev 根据支票的Id获取支票的聚合信息
@notice 这里涉及到的金额都是ETH价值(项目募资标的)
@param _user 用户地址
@param _chequeId 支票id
@return _isExpert 是否是专家地址
@return _createTime 创建时间
@return _chequeEncodeData 支票编码信息
@return _claimed 已经领取的融资金额
@return _checkAmount 累计做多check金额
@return _checkEmptyAmount 累计做空check金额
@return _owner 支票所有者
@return _userCheck2Cheque 用户对支票check金额-做多,pt
@return _userCheck2ChequeEmpty 用户对支票check金额-做空,pt
*/
function getArgInfo2ChequeId(
address _user,
uint256 _chequeId
)
external
view
returns (
bool _isExpert,
uint32 _createTime,
uint256 _chequeEncodeData,
uint256 _claimed,
uint256 _checkAmount,
uint256 _checkEmptyAmount,
address _owner,
uint256 _userCheck2Cheque,
uint256 _userCheck2ChequeEmpty
);
/**
@dev 设置指定地址为专家号,暂时没有限制
@param _user 用户地址
@param _isBool 状态 true/false
*/
function setExpertUser(address _user, bool _isBool) external;
/**
@dev 获取指定地址是否是专家号
*/
function expertUser(address _user) external view returns (bool);
/**
@dev 获取支票id所有者
*/
function cheque2Owner(uint256 _chequeId) external view returns (address);
/**
@dev 获取用户所有的支票id列表
*/
function getUserChequeIds(
address _user
) external view returns (uint256[] memory);
/**
@dev 获取指定用户的所有分发
@param _user 用户地址
*/
function getUserAllCheque(
address _user
)
external
view
returns (
uint256[] memory _ids,
uint256[] memory _infos,
uint256 _length
);
}
{
"_format": "hh-sol-artifact-1",
"contractName": "ICheque",
"sourceName": "contracts/interface/IChequ.sol",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint8",
"name": "typeId",
"type": "uint8"
},
{
"indexed": false,
"internalType": "uint256",
"name": "chequeId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "targetId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "NewCancelCheck",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint8",
"name": "typeId",
"type": "uint8"
},
{
"indexed": false,
"internalType": "uint256",
"name": "chequeId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "targetId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "NewCheck",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "chequeId",
"type": "uint256"
}
],
"name": "NewChequeCreated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "NewChequeWithdraw",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "_typeId",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "_chequeId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "cancelCheck",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "_typeId",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "_chequeId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "check",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "cheque2Claimed",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_chequeId",
"type": "uint256"
}
],
"name": "cheque2Owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "cheque2Time",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "cheques",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_indexer",
"type": "uint256"
}
],
"name": "createCheque",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
}
],
"name": "expertUser",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
},
{
"internalType": "uint256",
"name": "_chequeId",
"type": "uint256"
}
],
"name": "getArgInfo2ChequeId",
"outputs": [
{
"internalType": "bool",
"name": "_isExpert",
"type": "bool"
},
{
"internalType": "uint32",
"name": "_createTime",
"type": "uint32"
},
{
"internalType": "uint256",
"name": "_chequeEncodeData",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_claimed",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_checkAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_checkEmptyAmount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_userCheck2Cheque",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_userCheck2ChequeEmpty",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_chequeId",
"type": "uint256"
}
],
"name": "getPending",
"outputs": [
{
"internalType": "uint256",
"name": "_pending",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "_progress",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getPrice",
"outputs": [
{
"internalType": "uint256",
"name": "_tokenPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_token2ETH",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_data",
"type": "uint256"
}
],
"name": "getTargetIdFromCheque",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
}
],
"name": "getUserAllCheque",
"outputs": [
{
"internalType": "uint256[]",
"name": "_ids",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "_infos",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "_length",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
}
],
"name": "getUserChequeIds",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
},
{
"internalType": "bool",
"name": "_isBool",
"type": "bool"
}
],
"name": "setExpertUser",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_chequeId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_acceptAddress",
"type": "address"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x",
"deployedBytecode": "0x",
"linkReferences": {},
"deployedLinkReferences": {}
}