Skip to content

Commit

Permalink
Merge pull request #16 from AugustoL/feat/add-migrateFromMany
Browse files Browse the repository at this point in the history
Add migrateFromMany function in ERC827Migratable
  • Loading branch information
AugustoL authored May 6, 2019
2 parents 3f08dfb + 85df6a8 commit 5a6a5ec
Show file tree
Hide file tree
Showing 9 changed files with 2,272 additions and 3,711 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ build/
.node-xmlhttprequest-*

.zos.session

keys.json
2 changes: 1 addition & 1 deletion contracts/ERC827/ERC827.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* solium-disable security/no-low-level-calls */

pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "./ERC827Proxy.sol";
Expand Down
15 changes: 14 additions & 1 deletion contracts/ERC827/ERC827Migratable.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* solium-disable security/no-low-level-calls */

pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
Expand All @@ -22,6 +22,7 @@ contract ERC827Migratable is ERC827, Ownable {
* @dev Constructor
* @param _erc20Token The address of the erc20 token where the balances will
* be migrated.
* @param _erc20Token The address of the erc20 token to be migrated
*/
constructor(address _erc20Token) public {
require(_erc20Token != address(0), "Incorrect ERC20 token address");
Expand All @@ -41,6 +42,7 @@ contract ERC827Migratable is ERC827, Ownable {
/**
* @dev Migrates the approved balance from the ERC20 token * to this contract
* and adds the new balance to the _from address
* @param _from The address which you want to migrate the tokens
*/
function migrateFrom(address _from) public onlyOwner {
require(_from != address(0), "Cant migrate burned tokens");
Expand All @@ -51,4 +53,15 @@ contract ERC827Migratable is ERC827, Ownable {
_mint(_from, erc20Token.balanceOf(_from));
}

/**
* @dev Migrates the approved balance from the ERC20 token * to this contract
* and adds the new balances to the _from addressese
* @param _from The addresses which you want to migrate the tokens
*/
function migrateFromMany(address[] memory _from) public onlyOwner {
for (uint i = 0; i < _from.length; i++) {
migrateFrom(_from[i]);
}
}

}
2 changes: 1 addition & 1 deletion contracts/ERC827/ERC827Proxy.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* solium-disable security/no-low-level-calls */

pragma solidity ^0.5.0;
pragma solidity ^0.5.2;


/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/ERC827/IERC827.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;


import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
Expand Down
Loading

0 comments on commit 5a6a5ec

Please sign in to comment.