Add bancor interfaces

This commit is contained in:
nolash 2020-12-11 10:20:56 +01:00
parent 02a0494f12
commit 4301c41ca6
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
8 changed files with 91 additions and 38 deletions

View File

@ -2,18 +2,17 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 // Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1 // File-version: 2
abstract contract AccountsIndex { interface AccountsIndex {
address[] public accounts;
mapping(address => uint256) public accountsIndex;
uint256 public count;
event AccountAdded(address indexed addedAccount, uint256 indexed accountIndex); event AccountAdded(address indexed addedAccount, uint256 indexed accountIndex);
function addWriter(address _writer) public virtual returns (bool); function accounts(uint256 _idx) external view returns (address);
function deleteWriter(address _writer) public virtual returns (bool); function accountsIndex(address _account) external view returns (uint256);
function add(address _account) external virtual returns (bool); function count() external view returns (uint256);
function have(address _account) external virtual view returns (bool); function addWriter(address _writer) external returns (bool);
function deleteWriter(address _writer) external returns (bool);
function add(address _account) external returns (bool);
function have(address _account) external view returns (bool);
} }

17
Converter.sol Normal file
View File

@ -0,0 +1,17 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface Converter {
function reserveBalance(address _reserveToken) external view returns (uint256);
function reserveWeight(address _reserveToken) external view returns (uint32);
function reserveTokens() external view returns (address[] memory);
function reserveRatio() external view returns (uint32);
function reserveTokenCount() external view returns (uint16);
function setConversionFee(uint32 _conversionFee) external;
function owner() external view returns (address);
function acceptOwnership() external;
}

11
ConverterRegistry.sol Normal file
View File

@ -0,0 +1,11 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface ConverterRegistry {
function getConvertibleTokens() external view returns (address[] memory);
function newConverter(uint16 _type, string memory _name, string memory _symbol, uint8 _decimals, uint32 _maxConversionFee, address[] memory _reserveTokens, uint32[] memory _reserveWeights) external returns(address);
}

View File

@ -2,22 +2,21 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 // Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1 // File-version: 2
// Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312) // Description: The ERC20 standard interface as specified in EIP20 (sha256:9f843cbb25a737c9351b0b6a6f54b86864490d0d5284f6877b4929d481d34312)
abstract contract ERC20Core { interface ERC20 {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _value) public virtual returns (bool); function name() external view returns(string memory);
function transferFrom(address _from, address _to, uint256 _value) public virtual returns (bool); function symbol() external view returns(string memory);
function approve(address _spender, uint256 _value) public virtual returns (bool); function decimals() external view returns(uint8);
function totalSupply() external view returns(uint256);
function balanceOf(address) external view returns(uint256);
function allowance(address _owner, address _spender) external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
} }

View File

@ -2,16 +2,15 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 // Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1 // File-version: 2
abstract contract Faucet { interface Faucet {
uint256 public amount;
address public token;
event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _value); event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _value);
event FaucetFail(address indexed _recipient, address indexed _token, uint256 _value); event FaucetFail(address indexed _recipient, address indexed _token, uint256 _value);
function setAmount(uint256 _amount) public virtual returns (bool); function amount() external view returns (uint256);
function giveTo(address _recipient) public virtual returns (bool); function token() external view returns (address);
function setAmount(uint256 _amount) external returns (bool);
function giveTo(address _recipient) external returns (bool);
} }

19
Network.sol Normal file
View File

@ -0,0 +1,19 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface Network {
event Conversion(
address indexed _smartToken,
address indexed _fromToken,
address indexed _toToken,
uint256 _fromAmount,
uint256 _toAmount,
address _trader
);
function convert(address) external view returns (address);
function rateByPath(address,uint256) external view returns (uint256);
}

10
Registry.sol Normal file
View File

@ -0,0 +1,10 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
interface Registry {
function addressOf(address) external view returns (address);
}

View File

@ -2,19 +2,18 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 // Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1 // File-version: 2
abstract contract TransferApproval { interface TransferApproval {
uint256 public serial;
mapping(uint256 => address) public requests;
mapping(address => bool) public approvers;
event NewRequest(address indexed _sender, address indexed _recipient, address indexed _token, uint256 _value, uint256 _serial); event NewRequest(address indexed _sender, address indexed _recipient, address indexed _token, uint256 _value, uint256 _serial);
event NewExecution(uint256 serial); event NewExecution(uint256 serial);
event NewRejection(uint256 serial); event NewRejection(uint256 serial);
function request(address _recipient, address _token, uint256 _value) public virtual returns (uint256); function serial() external view returns (uint256);
function execute(uint256 _serial) public virtual returns (bool); function requests(uint256) external view returns (address);
function reject(uint256 _serial) public virtual returns (bool); function approvers(address) external view returns(bool);
function request(address _recipient, address _token, uint256 _value) external returns (uint256);
function execute(uint256 _serial) external returns (bool);
function reject(uint256 _serial) external returns (bool);
} }