Vault app #145
7
apps/vault/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Build dirs
|
||||||
|
.cache/
|
||||||
|
build/
|
||||||
|
dist/
|
0
apps/vault/.ipfsignore
Normal file
1
apps/vault/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Kredits Vault
|
28
apps/vault/arapp.json
Normal 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"
|
||||||
|
}
|
158
apps/vault/contracts/Vault.sol
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
|||||||
|
pragma solidity ^0.4.24;
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 {
|
||||||
![]() @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);
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 {
|
||||||
![]() @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);
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 {
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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");
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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";
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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
|
||||||
![]() @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 }
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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);
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 {
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 ?
|
|||||||
|
/**
|
||||||
![]() @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
|
||||||
![]() @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
|
||||||
![]() @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 ?
|
|||||||
|
*/
|
||||||
![]() @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 {
|
||||||
![]() @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();
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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;
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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());
|
||||||
![]() @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]);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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));
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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[]) {
|
||||||
![]() @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));
|
||||||
![]() @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();
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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++) {
|
||||||
![]() @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);
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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));
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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));
|
||||||
![]() @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();
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 ?
|
|||||||
|
/**
|
||||||
![]() @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
|
||||||
![]() @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
|
||||||
![]() @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
|
||||||
![]() @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 ?
|
|||||||
|
*/
|
||||||
![]() @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 {
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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) {
|
||||||
![]() @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;
|
||||||
![]() @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 {
|
||||||
![]() @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));
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 ?
|
|||||||
|
/**
|
||||||
![]() @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
|
||||||
![]() @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
|
||||||
![]() @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 ?
|
|||||||
|
*/
|
||||||
![]() @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) {
|
||||||
![]() @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;
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 {
|
||||||
![]() @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);
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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
|
||||||
![]() @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);
|
||||||
![]() @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 {
|
||||||
![]() @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(
|
||||||
![]() @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),
|
||||||
![]() @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
|
||||||
![]() @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 ?
|
|||||||
|
);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 ?
|
|||||||
|
/**
|
||||||
![]() @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`
|
||||||
![]() @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
|
||||||
![]() @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
|
||||||
![]() @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
|
||||||
![]() @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 ?
|
|||||||
|
*/
|
||||||
![]() @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 */
|
||||||
![]() @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)
|
||||||
![]() @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
|
||||||
![]() @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))
|
||||||
![]() @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 ?
|
|||||||
|
{
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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) {
|
||||||
![]() @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);
|
||||||
![]() @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 {
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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);
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 ?
|
|||||||
|
|
||||||
![]() @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 ?
|
|||||||
|
}
|
||||||
![]() @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 ?
|
23
apps/vault/contracts/misc/Migrations.sol
Normal 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
@ -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"
|
||||||
|
}
|
5
apps/vault/migrations/1_initial_migration.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
var Migrations = artifacts.require('./Migrations.sol')
|
||||||
|
|
||||||
|
module.exports = function (deployer) {
|
||||||
|
deployer.deploy(Migrations)
|
||||||
|
}
|
5
apps/vault/migrations/2_deploy_contracts.js
Normal 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
30
apps/vault/package.json
Normal 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
@ -0,0 +1 @@
|
|||||||
|
module.exports = require("../../truffle.js");
|
@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 ?