-
Notifications
You must be signed in to change notification settings - Fork 2
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
adibas03
wants to merge
4
commits into
master
Choose a base branch
from
inescornell-erc20
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
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); | ||
|
||
|
||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
As such, we can just focus our efforts 100% on the repayment router
There was a problem hiding this comment.
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