diff --git a/bca-token-solidity/contracts/BCA_ERC20_nf.sol b/bca-token-solidity/contracts/BCA_ERC20_nf.sol index c49eec8..97ecb99 100644 --- a/bca-token-solidity/contracts/BCA_ERC20_nf.sol +++ b/bca-token-solidity/contracts/BCA_ERC20_nf.sol @@ -13,20 +13,20 @@ contract BCAServiceToken is ERC20, AccessControl { /** * @dev Constructor that sets up roles and gives the deployer the default admin role. - * @param name The name of the token. - * @param symbol The symbol of the token. - * @param minter The address that will be granted the minter role. - * @param burner The address that will be granted the burner role. + * @param setName The name of the token. + * @param setSymbol The symbol of the token. + * @param setMinter The address that will be granted the minter role. + * @param setBurner The address that will be granted the burner role. */ - constructor(string memory name, string memory symbol, address minter, address burner) - ERC20(name, symbol) + constructor(string memory setName, string memory setSymbol, address setMinter, address setBurner) + ERC20(setName, setSymbol) { serviceAddress = msg.sender; - minterAddress = minter; - burnerAddress = burner; + minterAddress = setMinter; + burnerAddress = setBurner; _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); - _grantRole(MINTER_ROLE, minter); - _grantRole(BURNER_ROLE, burner); + _grantRole(MINTER_ROLE, setMinter); + _grantRole(BURNER_ROLE, setBurner); } /** diff --git a/bca-token-solidity/contracts/BCA_Funding24.sol b/bca-token-solidity/contracts/BCA_Funding24.sol index 4d97e67..923781b 100644 --- a/bca-token-solidity/contracts/BCA_Funding24.sol +++ b/bca-token-solidity/contracts/BCA_Funding24.sol @@ -49,6 +49,9 @@ contract BCAServiceFunding24 is IFunding24, Ownable { "Insufficient allowance from owner" ); + // set new state + lastDepositTime = block.timestamp; + // Transfer tokens from owner to this contract token.safeTransferFrom(owner(), address(this), dailyAmount); @@ -56,7 +59,6 @@ contract BCAServiceFunding24 is IFunding24, Ownable { token.approve(targetContract, dailyAmount); try IServiceInstance(targetContract).makeDeposit(dailyAmount) { - lastDepositTime = block.timestamp; emit DepositMade(targetContract, dailyAmount, block.timestamp); } catch Error(string memory reason) { revert(reason); diff --git a/bca-token-solidity/contracts/BCA_ServiceInstance.sol b/bca-token-solidity/contracts/BCA_ServiceInstance.sol index ae869f2..c6f394d 100644 --- a/bca-token-solidity/contracts/BCA_ServiceInstance.sol +++ b/bca-token-solidity/contracts/BCA_ServiceInstance.sol @@ -128,9 +128,14 @@ contract BCAServiceInstance is IServiceInstance, ReentrancyGuard { revert InsufficientBalance(balance); } - tokToken.transfer(msg.sender, amount); + // set new state deposit -= amount; - emit Withdrawn(msg.sender, amount); + + if (tokToken.transfer(msg.sender, amount)) { + emit Withdrawn(msg.sender, amount); + } else { + revert("transfer failed"); + } // stop service? if (balance - amount <= dayPrice / 24 / 3600) { @@ -153,8 +158,13 @@ contract BCAServiceInstance is IServiceInstance, ReentrancyGuard { _stop(msg.sender); } - tokToken.transfer(msg.sender, amount); + // set new state retracted += amount; - emit Retracted(msg.sender, amount); + + if (tokToken.transfer(msg.sender, amount)) { + emit Retracted(msg.sender, amount); + } else { + revert("transfer failed"); + } } } \ No newline at end of file