Skip to content

Commit

Permalink
Merge pull request #816 from oceanprotocol/feature/check_paused_at_bu…
Browse files Browse the repository at this point in the history
…yFrom

check if contract is paused at buy
  • Loading branch information
alexcos20 authored Sep 26, 2023
2 parents c3b1b87 + f16c5f0 commit 5167361
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions contracts/templates/ERC20Template3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import "../utils/ERC20Roles.sol";
* - creation of additional fixed rates is not allowed (only one can be created)
*/
contract ERC20Template3 is
ERC20("test", "testSymbol"),
ERC20("t", "t"),
ERC20Roles,
ERC20Burnable,
ReentrancyGuard
Expand Down Expand Up @@ -123,10 +123,9 @@ contract ERC20Template3 is
// -------------------------- PREDICTOOR --------------------------

// EIP 2612 SUPPORT
bytes32 public DOMAIN_SEPARATOR;
//bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH =
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
//bytes32 public constant PERMIT_TYPEHASH =0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;

mapping(address => uint256) public nonces;
address public router;
Expand Down Expand Up @@ -344,23 +343,6 @@ contract ERC20Template3 is
publishMarketFeeToken,
publishMarketFeeAmount
);
uint256 chainId;
assembly {
chainId := chainid()
}
/*DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(_name)),
keccak256(bytes("1")), // version, could be any other value
chainId,
address(this)
)
);
*/

stakeToken = addresses_[4];
_updateSeconds(uints_[2], uints_[3], uints_[4]);
return initialized;
Expand Down Expand Up @@ -535,7 +517,7 @@ contract ERC20Template3 is
function cleanFrom721() external {
require(
msg.sender == _erc721Address,
"ERC20Template: NOT 721 Contract"
"NOT 721 Contract"
);
_internalCleanPermissions();
}
Expand Down Expand Up @@ -856,6 +838,7 @@ contract ERC20Template3 is
OrderParams calldata _orderParams,

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

FreParams calldata _freParams

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

) external nonReentrant{
require(paused == false, "paused");
//first buy 1.0 DT
buyFromFre(_freParams);
//we need the following because startOrder expects msg.sender to have dt
Expand Down Expand Up @@ -1116,16 +1099,8 @@ contract ERC20Template3 is
function pausePredictions() external onlyERC20Deployer {
paused = !paused;
emit Paused(paused);
// we cannot pause FixedRate as well, so be aware when triggering this function
/* keeping code here until we decide
if (fixedRateExchanges.length>0){
IFixedRateExchange fre = IFixedRateExchange(fixedRateExchanges[0].contractAddress);
bool freActive = fre.isActive(fixedRateExchanges[0].id);
if ((paused && freActive) || (!paused && !freActive)){
fre.toggleExchangeState(fixedRateExchanges[0].id);
}
}
*/
// we don't need to pause FixedRateExchanges, cause nobody else can swap (allowedSwapper is this contract)
// and we check if contract is paused during buyFromFre

}

Expand Down

0 comments on commit 5167361

Please sign in to comment.