View Source: contracts/libraries/NTransferUtilV2.sol
NTransferUtilV2
- ensureTransfer(IERC20 malicious, address recipient, uint256 amount)
- ensureTransferFrom(IERC20 malicious, address sender, address recipient, uint256 amount)
function ensureTransfer(IERC20 malicious, address recipient, uint256 amount) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
malicious | IERC20 | |
recipient | address | |
amount | uint256 |
Source Code
function ensureTransfer(
IERC20 malicious,
address recipient,
uint256 amount
) external {
require(recipient != address(0), "Invalid recipient");
require(amount > 0, "Invalid transfer amount");
uint256 pre = malicious.balanceOf(recipient);
malicious.safeTransfer(recipient, amount);
uint256 post = malicious.balanceOf(recipient);
// slither-disable-next-line incorrect-equality
require(post.sub(pre) == amount, "Invalid transfer");
}
function ensureTransferFrom(IERC20 malicious, address sender, address recipient, uint256 amount) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
malicious | IERC20 | |
sender | address | |
recipient | address | |
amount | uint256 |
Source Code
function ensureTransferFrom(
IERC20 malicious,
address sender,
address recipient,
uint256 amount
) external {
require(recipient != address(0), "Invalid recipient");
require(amount > 0, "Invalid transfer amount");
uint256 pre = malicious.balanceOf(recipient);
malicious.safeTransferFrom(sender, recipient, amount);
uint256 post = malicious.balanceOf(recipient);
// slither-disable-next-line incorrect-equality
require(post.sub(pre) == amount, "Invalid transfer");
}
- Address
- BokkyPooBahsDateTimeLibrary
- Commission
- Context
- Controller
- Cover
- CoverAssurance
- CoverBase
- CoverProvision
- CoverStake
- CoverUtilV1
- cToken
- cTokenFactory
- Destroyable
- ERC20
- FakeStore
- FakeToken
- Governance
- GovernanceUtilV1
- ICommission
- ICover
- ICoverAssurance
- ICoverProvision
- ICoverStake
- ICToken
- ICTokenFactory
- IERC20
- IERC20Metadata
- IGovernance
- IMember
- IPolicy
- IPolicyAdmin
- IPriceDiscovery
- IProtocol
- IReporter
- IStore
- IVault
- IVaultFactory
- IWitness
- MaliciousToken
- Migrations
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyManager
- PriceDiscovery
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- Reporter
- SafeERC20
- SafeMath
- Store
- StoreBase
- StoreKeyUtil
- Vault
- VaultFactory
- VaultPod
- Witness