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

[FEATURE] INESCORNELL ERC20 #87

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
key: v1-{{ .Branch }}-dependencies-{{ checksum "package.json" }}
- run: npx truffle compile --all
- run: npx zos push --network development
- run: npx zos publish --network development
Expand Down
34 changes: 34 additions & 0 deletions contracts/crowdloan/CrowdloanToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pragma solidity 0.5.11;

import "openzeppelin-eth/contracts/math/SafeMath.sol";
import "openzeppelin-eth/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-eth/contracts/token/ERC20/StandaloneERC20.sol";
import "./ICrowdloan.sol";

contract CrowdloanToken is StandaloneERC20 {
using SafeMath for uint256;

ICrowdloan crowdloan;
mapping(address => uint256) claimedTokens;

function initialize(
string memory name,
string memory symbol,
uint256 decimals,
address loanAddress,

) public {
address[] memory emptyAdressArray = new address[](0);
crowdloan = ICrowdloan(loanAddress);

StandaloneERC20.initialize( name, symbol, uint8(decimals), crowdloan.principalRequested(), address(this),
emptyAdressArray, emptyAdressArray );
}

function claimTokens (address claimant) public {
uint256 addressClaimed = claimedTokens[claimant];
uint256 tokensDue = crowdloan.amountContributed(claimant).sub(addressClaimed);
require(tokensDue > 0, 'No tokens to Claim');
IERC20(address(this)).transfer(claimant, tokensDue);
}
}
32 changes: 32 additions & 0 deletions contracts/crowdloan/ICrowdloan.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pragma solidity 0.5.11;

contract ICrowdloan {
function amountRepaid () external returns (uint256);
function borrower () external returns (uint256);
function crowdfundStart () external returns (uint256);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adibas03 I think we should remove the Crowdloan completely

  • Ines "mints" 60,000 ERC20
  • "Sells" them on Uniswap (i.e. this replaces the Crowdloan)

As such, we can just focus our efforts 100% on the repayment router

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
So, simplest implementation possible

function crowdfundEnd () external returns (uint256);
function crowdfundDuration () external returns (uint256);
function principalRequested () external returns (uint256);
function repaymentCap () external returns (uint256);
function totalRepaymentWithdrawn () external returns (uint256);
function loanMetadataUrl () external returns (string);

function amountContributed (address) external returns (uint256);
function repaymentWithdrawn (address) external returns (uint256);

function fund (uint256) external;
function repay (uint256) external;
function withdrawPrincipal (uint256) external;
function withdrawRepayment () external;
function startCrowdfund () external;

// Events
event Fund(address sender, uint256 amount);
event WithdrawPrincipal(address borrower, uint256 amount);
event WithdrawRepayment(address lender, uint256 amount);
event Repay(uint256 amount);
event StartCrowdfund(uint256 crowdfundStart);



}