Vault app #145

Closed
haythem96 wants to merge 10 commits from features/app-vault into master
12 changed files with 9632 additions and 0 deletions

7
apps/vault/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Dependencies
node_modules
# Build dirs
.cache/
build/
dist/

0
apps/vault/.ipfsignore Normal file
View File

1
apps/vault/README.md Normal file
View File

@ -0,0 +1 @@
# Kredits Vault

28
apps/vault/arapp.json Normal file
View File

@ -0,0 +1,28 @@
{
"roles": [
{
"name": "Dummy role",
"id": "DUMMY_ROLE",
"params": []
}
],
"environments": {
"default": {
"network": "development",
"appName": "kredits-vault.open.aragonpm.eth"
},
"rinkeby": {
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
"appName": "kredits-vault.open.aragonpm.eth",
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
"network": "rinkeby"
},
"mainnet": {
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
"appName": "kredits-vault.open.aragonpm.eth",
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
"network": "mainnet"
}
},
"path": "contracts/App.sol"
}

View File

@ -0,0 +1,158 @@
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
pragma solidity ^0.4.24;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
import "@aragon/os/contracts/apps/AragonApp.sol";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
import "@aragon/os/contracts/kernel/IKernel.sol";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
import "@aragon/os/contracts/common/DepositableStorage.sol";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
import "@aragon/os/contracts/common/EtherTokenConstant.sol";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
import "@aragon/os/contracts/common/SafeERC20.sol";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
import "@aragon/os/contracts/lib/token/ERC20.sol";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
interface IContributor {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function getContributorAddressById(uint32 id) view public returns (address);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function contributorsCount() view public returns (uint32);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
interface IToken {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function balanceOf(address owner) public view returns (uint256);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function totalSupply() public view returns (uint256);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
contract Vault is EtherTokenConstant, AragonApp, DepositableStorage {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
using SafeERC20 for ERC20;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
bytes32 public constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE");
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_NOT_DEPOSITABLE = "VAULT_NOT_DEPOSITABLE";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_DEPOSIT_VALUE_ZERO = "VAULT_DEPOSIT_VALUE_ZERO";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_VALUE_MISMATCH = "VAULT_VALUE_MISMATCH";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_TOKEN_TRANSFER_FROM_REVERTED = "VAULT_TOKEN_TRANSFER_FROM_REVERT";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_TRANSFER_VALUE_ZERO = "VAULT_TRANSFER_VALUE_ZERO";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_SEND_REVERTED = "VAULT_SEND_REVERTED";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
string private constant ERROR_TOKEN_TRANSFER_REVERTED = "VAULT_TOKEN_TRANSFER_REVERTED";
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
uint256 private _snapshotTotalSupply;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
mapping (address => uint256) private _snapshotBalances;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
// ensure alphabetic order
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
enum Apps { Contribution, Contributor, Proposal, Token }
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
bytes32[4] public appIds;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
event VaultDeposit(address indexed token, address indexed sender, uint256 amount);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
event VaultTransfer(address indexed token, address indexed to, uint256 amount);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function () external payable isInitialized {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
_deposit(ETH, msg.value);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
/**
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @notice Initialize Vault app
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @dev As an AragonApp it needs to be initialized in order for roles (`auth` and `authP`) to work
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
*/
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function initialize(bytes32[4] _appIds) external onlyInit {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
initialized();
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
appIds = _appIds;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
setDepositable(true);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function getContract(uint8 appId) public view returns (address) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
IKernel k = IKernel(kernel());
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return k.getApp(KERNEL_APP_ADDR_NAMESPACE, appIds[appId]);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function getContributorAddressById(uint32 contributorId) public view returns (address) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
address contributor = getContract(uint8(Apps.Contributor));
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return IContributor(contributor).getContributorAddressById(contributorId);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function getContributorsAddresses() internal view returns (address[]) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
address contributor = getContract(uint8(Apps.Contributor));
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
uint32 contributorsCount = IContributor(contributor).contributorsCount();
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
address[] memory contributorsAddresses = new address[](contributorsCount);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
for(uint32 i = 1; i <= contributorsCount; i++) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
address contributorAddress = IContributor(contributor).getContributorAddressById(i);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
contributorsAddresses[i-1] = contributorAddress;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return contributorsAddresses;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function balanceOf(address owner) public view returns (uint256) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
address token = getContract(uint8(Apps.Token));
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return IToken(token).balanceOf(owner);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function totalSupply() public view returns (uint256) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
address token = getContract(uint8(Apps.Token));
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return IToken(token).totalSupply();
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
/**
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @notice Deposit `_value` `_token` to the vault
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @param _token Address of the token being transferred
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @param _value Amount of tokens being transferred
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
*/
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function deposit(address _token, uint256 _value) external payable isInitialized {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
_deposit(_token, _value);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function balance(address _token) public view returns (uint256) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
if (_token == ETH) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return address(this).balance;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
} else {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return ERC20(_token).staticBalanceOf(address(this));
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
/**
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @dev Disable recovery escape hatch, as it could be used
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* maliciously to transfer funds away from the vault
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
*/
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function allowRecoverability(address) public view returns (bool) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
return false;
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function _deposit(address _token, uint256 _value) internal {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(isDepositable(), ERROR_NOT_DEPOSITABLE);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(_value > 0, ERROR_DEPOSIT_VALUE_ZERO);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
if (_token == ETH) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
// Deposit is implicit in this case
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(msg.value == _value, ERROR_VALUE_MISMATCH);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
} else {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
ERC20(_token).safeTransferFrom(msg.sender, address(this), _value),
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
ERROR_TOKEN_TRANSFER_FROM_REVERTED
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
emit VaultDeposit(_token, msg.sender, _value);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
/**
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @notice Transfer `_value` `_token` from the Vault to `_to`
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @param _token Address of the token being transferred
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @param _to Address of the recipient of tokens
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
* @param _value Amount of tokens being transferred
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
*/
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
/* solium-disable-next-line function-order */
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
function transfer(address _token, address _to, uint256 _value)
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
external
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
authP(TRANSFER_ROLE, arr(_token, _to, _value))
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
{
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(_value > 0, ERROR_TRANSFER_VALUE_ZERO);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
if (_token == ETH) {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(_to.send(_value), ERROR_SEND_REVERTED);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
} else {
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
require(ERC20(_token).safeTransfer(_to, _value), ERROR_TOKEN_TRANSFER_REVERTED);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
emit VaultTransfer(_token, _to, _value);
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?
}
haythem96 commented 2019-07-26 15:31:11 +00:00 (Migrated from github.com)
Review

@bumi we should burn the tokens here for the contributor that withdraw, right ?

@bumi we should burn the tokens here for the contributor that withdraw, right ?

View File

@ -0,0 +1,23 @@
pragma solidity ^0.4.4;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
function Migrations() {
owner = msg.sender;
}
function setCompleted(uint completed) restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}

10
apps/vault/manifest.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "Application",
"description": "An application for Aragon",
"icons": [{
"src": "/dist/images/icon.png",
"sizes": "192x192"
}],
"start_url": "/dist/index.html",
"script": "/dist/script.js"
}

View File

@ -0,0 +1,5 @@
var Migrations = artifacts.require('./Migrations.sol')
module.exports = function (deployer) {
deployer.deploy(Migrations)
}

View File

@ -0,0 +1,5 @@
var App = artifacts.require('./App.sol')
module.exports = function (deployer) {
deployer.deploy(App)
}

9364
apps/vault/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

30
apps/vault/package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "kredits-vault",
"version": "1.0.0",
"description": "",
"dependencies": {
"@aragon/client": "^1.1.0",
"@aragon/os": "^4.0.1"
},
"devDependencies": {
"@aragon/cli": "^5.4.0",
"parcel-bundler": "^1.11.0"
},
"scripts": {
"start": "npm run start:aragon:ipfs",
"start:aragon:ipfs": "aragon run",
"start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist",
"start:app": "",
"test": "aragon contracts test",
"compile": "aragon contracts compile",
"sync-assets": "",
"build:app": "",
"build:script": "",
"build": "",
"publish:patch": "aragon apm publish patch",
"publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major",
"versions": "aragon apm versions"
},
"keywords": []
}

1
apps/vault/truffle.js Normal file
View File

@ -0,0 +1 @@
module.exports = require("../../truffle.js");