Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Vault: ETH native support and arbitrary connectors for managing different token standards #129

Merged
merged 39 commits into from Mar 20, 2018
Merged
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
67071c6
Start work on new vault
izqui Mar 13, 2018
17650ce
Scaffold connectors
izqui Mar 14, 2018
eac5bf4
Add ETHConnector
izqui Mar 14, 2018
d9d0314
ERC20, ERC777, ERC721 connectors
izqui Mar 14, 2018
ba342f9
Add ETH connector fallback function for easy eth deposits
izqui Mar 14, 2018
734d61b
Start implementing automated interface detection
izqui Mar 14, 2018
e09a5a1
Implement token standard detection
izqui Mar 14, 2018
d433367
Publish 1.1.3
izqui Mar 14, 2018
b074337
Merge
izqui Mar 14, 2018
7c56659
Merge branch 'master' into good-vault
izqui Mar 14, 2018
acc1157
Improve style
izqui Mar 14, 2018
d01b101
Get new vault to almost compile
izqui Mar 14, 2018
d5cc2f7
It compiles, note for the future, avoid passing around structs
izqui Mar 14, 2018
270a636
Protect transfer and register standard behind roles
izqui Mar 15, 2018
d43d49a
Scaffold tests
izqui Mar 15, 2018
22844bd
Fix eth fallback
izqui Mar 15, 2018
ea70fd8
Test
izqui Mar 15, 2018
0bca179
finance: Adapt to new Vault
bingen Mar 15, 2018
5b83a0c
Make tests pass
izqui Mar 16, 2018
41d164d
Merge branch 'good-vault-finance-2' of github.com:aragon/aragon-apps …
izqui Mar 16, 2018
7b45dba
vault: deploy connectors on constructor to simplify templates
izqui Mar 16, 2018
e2b17de
Adapt templates to new vault and remove all ethertoken references
izqui Mar 16, 2018
191d312
finance: Adapt to new Vault (#135)
bingen Mar 16, 2018
dd666f6
Merge master
izqui Mar 16, 2018
aba830f
Merge branch 'master' of github.com:aragon/aragon-apps into new-vault…
izqui Mar 16, 2018
835ae33
Merge branch 'good-vault' of github.com:aragon/aragon-apps into good-…
izqui Mar 16, 2018
abf72d7
Update to aOs v3.1.1
izqui Mar 16, 2018
13fc00d
Fix devtemplate
izqui Mar 16, 2018
6117167
Fix lint errors
bingen Mar 16, 2018
b787a5d
vault: fix coverage and tests
bingen Mar 17, 2018
4cf0a69
finance: fix tests
bingen Mar 17, 2018
db70f08
tmp
bingen Mar 16, 2018
ef13ad5
Remove abis file
izqui Mar 17, 2018
e450209
vault: Fix lint warnings
bingen Mar 17, 2018
869ad3a
vault: Remove redundant variables
bingen Mar 17, 2018
c503098
vault: Remove constructor, refactor initialize
bingen Mar 17, 2018
dfb3ad7
templates: Remove EtherToken from tests
bingen Mar 16, 2018
d8dac5a
[wip] vault: Try to increase coverage
bingen Mar 18, 2018
42c954d
Merge branch 'beta_test_remove_ethertoken' of github.com:aragon/arago…
izqui Mar 18, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+7,945 −5,480
Diff settings

Always

Just for now

@@ -15,6 +15,7 @@ contract Finance is AragonApp {
using SafeMath for uint256;
using SafeMath64 for uint64;

address constant public ETH = address(0);
uint64 constant public MAX_PAYMENTS_PER_TX = 20;
uint64 constant public MAX_PERIOD_TRANSITIONS_PER_TX = 10;
uint64 constant public MAX_UINT64 = uint64(-1);
@@ -101,8 +102,8 @@ contract Finance is AragonApp {
* to Vault.
* @notice Allows to send ETH from this contract to Vault, to avoid locking them in contract forever.
*/
function escapeHatch() public payable {
vault.deposit.value(msg.value)(address(0), msg.sender, 0, new bytes(0));
function () public payable {
vault.deposit.value(this.balance)(ETH, msg.sender, this.balance, new bytes(0));
}

/**
@@ -140,34 +141,8 @@ contract Finance is AragonApp {
_amount,
_reference
);
vault.deposit(_token, msg.sender, _amount, new bytes(0));
}

/**
* @dev Deposit for ERC20 tokens using approveAndCall
* @param _from Address sending the tokens
* @param _amount Amount of tokens sent
* @param _token Token being deposited
* @param _data Data payload being executed (payment reference)
*/
function receiveApproval(
address _from,
uint256 _amount,
address _token,
bytes _data
)
transitionsPeriod
external
{
require(msg.sender == _token);
_recordIncomingTransaction(
_token,
_from,
_amount,
string(_data)
);
// first we need to get the tokens to Finance
ERC20(_token).transferFrom(_from, this, _amount);
ERC20(_token).transferFrom(msg.sender, this, _amount);
// and then approve them to vault
ERC20(_token).approve(address(vault), _amount);
// finally we can deposit them
@@ -176,20 +151,25 @@ contract Finance is AragonApp {

/**
* @dev Deposit for ERC777 tokens
* @param _from Address sending the tokens
* @param _amount Amount of tokens sent
* @param _userData Data payload being executed (payment reference)
* @param _operatorData Data payload
* @param _operator Address who triggered the transfer, either sender for a direct send or an authorized operator for operatorSend
* @param _from Token holder (sender or 0x for minting)
* @param _to Tokens recipient (or 0x for burning)
* @param _amount Number of tokens transferred, minted or burned
* @param _userData Information attached to the transaction by the sender
* @param _operatorData Information attached to the transaction by the operator
*/
function tokenReceived(address _from, uint256 _amount, bytes _userData, bytes _operatorData) transitionsPeriod external {
/*
function tokensReceived(address _operator, address _from, address _to, uint _amount, bytes _userData, bytes _operatorData) transitionsPeriod external {
_recordIncomingTransaction(
msg.sender,
_from,
_amount,
string(_userData)
);
vault.deposit(msg.sender, _from, _amount, _userData);
//ERC777(msg.sender).send(adress(vault), _amount, _userData);
//vault.deposit(msg.sender, this, _amount, _userData);
}
*/

/**
* @notice New payment
@@ -317,8 +297,7 @@ contract Finance is AragonApp {
* @param _token Token whose balance is going to be transferred.
*/
function depositToVault(address _token) public {
ERC20 token = ERC20(_token);
uint256 value = token.balanceOf(this);
uint256 value = ERC20(_token).balanceOf(this);
require(value > 0);

_recordIncomingTransaction(
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.