Skip to content

Commit

Permalink
feat: fix ICO active price
Browse files Browse the repository at this point in the history
  • Loading branch information
harpy-wings committed Sep 24, 2023
1 parent 10a40aa commit 24f622a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions contracts/ICO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ contract ICO is SuperAdmin {
uint256 comStartVol;
}


// Token is the token sell in ICO
address public token;

Expand Down Expand Up @@ -73,8 +74,8 @@ contract ICO is SuperAdmin {

uint256 comVol;
for (uint256 index = 0; index < _prices.length; index++) {
prices.push(Price(_prices[index].amount,_prices[index].volume,comVol));
comVol = comVol + _prices[index].volume;
prices.push(Price(_prices[index].amount,_prices[index].volume,comVol));
}

minAmount = _minAmount;
Expand Down Expand Up @@ -124,10 +125,7 @@ contract ICO is SuperAdmin {
require(_success,"transfering Token failed");
return true;
}

function buy_signaureData(address _from, uint256 _amount, uint256 _exp) public view returns (bytes32) {
return keccak256(abi.encodePacked(address(this),_from, _amount, _exp));
}

// ─── Utils ───────────────────────────────────────────────────────────
function mybalance(address _contract) internal returns (uint256) {
(bool _success,bytes memory _data ) = _contract.call(abi.encodeWithSelector(_balanceOfSelector,address(this)));
Expand All @@ -141,7 +139,7 @@ contract ICO is SuperAdmin {

function getActivePrice() public view returns (Price memory price) {
for (uint256 index = 0; index < prices.length; index++) {
if (prices[index].comStartVol <= filledAmount){
if (prices[index].comStartVol > filledAmount){
return prices[index];
}
}
Expand Down

0 comments on commit 24f622a

Please sign in to comment.