Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit cdf781e

Browse files
committed
Create Core Interface.
1 parent cadf640 commit cdf781e

File tree

1 file changed

+183
-0
lines changed

1 file changed

+183
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
/*
2+
Copyright 2018 Set Labs Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
pragma solidity 0.4.24;
18+
19+
/**
20+
* @title IVault
21+
* @author Set Protocol
22+
*
23+
* The IVault interface provides a light-weight, structured way to interact with the Vault
24+
* contract from another contract.
25+
*/
26+
27+
interface ICore {
28+
29+
/**
30+
* Set vaultAddress. Can only be set by owner of Core.
31+
*
32+
* @param _vaultAddress The address of the Vault
33+
*/
34+
function setVaultAddress(
35+
address _vaultAddress
36+
)
37+
external;
38+
39+
/**
40+
* Set transferProxyAddress. Can only be set by owner of Core.
41+
*
42+
* @param _transferProxyAddress The address of the TransferProxy
43+
*/
44+
function setTransferProxyAddress(
45+
address _transferProxyAddress
46+
)
47+
external;
48+
49+
/**
50+
* Add a factory to the mapping of tracked factories.
51+
*
52+
* @param _factoryAddress The address of the SetTokenFactory to enable
53+
*/
54+
function enableFactory(
55+
address _factoryAddress
56+
)
57+
external;
58+
59+
/**
60+
* Disable a factory in the mapping of tracked factories.
61+
*
62+
* @param _factoryAddress The address of the SetTokenFactory to disable
63+
*/
64+
function disableFactory(
65+
address _factoryAddress
66+
)
67+
external;
68+
69+
/**
70+
* Disable a set token in the mapping of tracked set tokens.
71+
*
72+
* @param _setAddress The address of the SetToken to remove
73+
*/
74+
function disableSet(
75+
address _setAddress
76+
)
77+
external;
78+
79+
/**
80+
* Issue
81+
*
82+
* @param _setAddress Address of set to issue
83+
* @param _quantity Quantity of set to issue
84+
*/
85+
function issue(
86+
address _setAddress,
87+
uint _quantity
88+
)
89+
public;
90+
91+
/**
92+
* Function to convert Set Tokens into underlying components
93+
*
94+
* @param _setAddress The address of the Set token
95+
* @param _quantity The number of tokens to redeem
96+
*/
97+
function redeem(
98+
address _setAddress,
99+
uint _quantity
100+
)
101+
public;
102+
103+
/**
104+
* Deposit multiple tokens to the vault. Quantities should be in the
105+
* order of the addresses of the tokens being deposited.
106+
*
107+
* @param _tokenAddresses Array of the addresses of the ERC20 tokens
108+
* @param _quantities Array of the number of tokens to deposit
109+
*/
110+
function batchDeposit(
111+
address[] _tokenAddresses,
112+
uint[] _quantities
113+
)
114+
public;
115+
116+
/**
117+
* Withdraw multiple tokens from the vault. Quantities should be in the
118+
* order of the addresses of the tokens being withdrawn.
119+
*
120+
* @param _tokenAddresses Array of the addresses of the ERC20 tokens
121+
* @param _quantities Array of the number of tokens to withdraw
122+
*/
123+
function batchWithdraw(
124+
address[] _tokenAddresses,
125+
uint[] _quantities
126+
)
127+
public;
128+
129+
/**
130+
* Deposit any quantity of tokens into the vault.
131+
*
132+
* @param _tokenAddress The address of the ERC20 token
133+
* @param _quantity The number of tokens to deposit
134+
*/
135+
function deposit(
136+
address _tokenAddress,
137+
uint _quantity
138+
)
139+
public;
140+
141+
/**
142+
* Withdraw a quantity of tokens from the vault.
143+
*
144+
* @param _tokenAddress The address of the ERC20 token
145+
* @param _quantity The number of tokens to withdraw
146+
*/
147+
function withdraw(
148+
address _tokenAddress,
149+
uint _quantity
150+
)
151+
public;
152+
153+
/**
154+
* Deploys a new Set Token and adds it to the valid list of SetTokens
155+
*
156+
* @param _factoryAddress address The address of the Factory to create from
157+
* @param _components address[] The address of component tokens
158+
* @param _units uint[] The units of each component token
159+
* @param _naturalUnit uint The minimum unit to be issued or redeemed
160+
* @param _name string The name of the new Set
161+
* @param _symbol string The symbol of the new Set
162+
* @return setTokenAddress address The address of the new Set
163+
*/
164+
function create(
165+
address _factoryAddress,
166+
address[] _components,
167+
uint[] _units,
168+
uint _naturalUnit,
169+
string _name,
170+
string _symbol
171+
)
172+
public
173+
returns(address);
174+
175+
function calculateTransferValue(
176+
uint _componentUnits,
177+
uint _naturalUnit,
178+
uint _quantity
179+
)
180+
pure
181+
internal
182+
returns(uint);
183+
}

0 commit comments

Comments
 (0)