contract_name
stringlengths 1
61
| file_path
stringlengths 5
50.4k
| contract_address
stringlengths 42
42
| language
stringclasses 1
value | class_name
stringlengths 1
61
| class_code
stringlengths 4
330k
| class_documentation
stringlengths 0
29.1k
| class_documentation_type
stringclasses 6
values | func_name
stringlengths 0
62
| func_code
stringlengths 1
303k
| func_documentation
stringlengths 2
14.9k
| func_documentation_type
stringclasses 4
values | compiler_version
stringlengths 15
42
| license_type
stringclasses 14
values | swarm_source
stringlengths 0
71
| meta
dict | __index_level_0__
int64 0
60.4k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DutchAuction | DutchAuction.sol | 0x0ead3984384ba026feb5d2e1022b28abe2f11cb3 | Solidity | IERC1155 | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
} | /**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account, uint256 id) external view returns (uint256);
| /**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | MIT | ipfs://0a6fd78671f82266286c87785c5f9c329dc6715c7ea1d5ebb50323b92528d1fa | {
"func_code_index": [
1463,
1548
]
} | 907 |
DutchAuction | DutchAuction.sol | 0x0ead3984384ba026feb5d2e1022b28abe2f11cb3 | Solidity | IERC1155 | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
} | /**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/ | NatSpecMultiLine | balanceOfBatch | function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
| /**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | MIT | ipfs://0a6fd78671f82266286c87785c5f9c329dc6715c7ea1d5ebb50323b92528d1fa | {
"func_code_index": [
1751,
1901
]
} | 908 |
DutchAuction | DutchAuction.sol | 0x0ead3984384ba026feb5d2e1022b28abe2f11cb3 | Solidity | IERC1155 | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
} | /**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/ | NatSpecMultiLine | setApprovalForAll | function setApprovalForAll(address operator, bool approved) external;
| /**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | MIT | ipfs://0a6fd78671f82266286c87785c5f9c329dc6715c7ea1d5ebb50323b92528d1fa | {
"func_code_index": [
2166,
2240
]
} | 909 |
DutchAuction | DutchAuction.sol | 0x0ead3984384ba026feb5d2e1022b28abe2f11cb3 | Solidity | IERC1155 | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
} | /**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/ | NatSpecMultiLine | isApprovedForAll | function isApprovedForAll(address account, address operator) external view returns (bool);
| /**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | MIT | ipfs://0a6fd78671f82266286c87785c5f9c329dc6715c7ea1d5ebb50323b92528d1fa | {
"func_code_index": [
2388,
2483
]
} | 910 |
DutchAuction | DutchAuction.sol | 0x0ead3984384ba026feb5d2e1022b28abe2f11cb3 | Solidity | IERC1155 | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
} | /**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/ | NatSpecMultiLine | safeTransferFrom | function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
| /**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | MIT | ipfs://0a6fd78671f82266286c87785c5f9c329dc6715c7ea1d5ebb50323b92528d1fa | {
"func_code_index": [
3063,
3230
]
} | 911 |
DutchAuction | DutchAuction.sol | 0x0ead3984384ba026feb5d2e1022b28abe2f11cb3 | Solidity | IERC1155 | interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
} | /**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/ | NatSpecMultiLine | safeBatchTransferFrom | function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
| /**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | MIT | ipfs://0a6fd78671f82266286c87785c5f9c329dc6715c7ea1d5ebb50323b92528d1fa | {
"func_code_index": [
3639,
3835
]
} | 912 |
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | Pausable | contract Pausable is Owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
} | pause | function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
| /**
* @dev called by the owner to pause, triggers stopped state
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
511,
607
]
} | 913 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | Pausable | contract Pausable is Owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
} | unpause | function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
| /**
* @dev called by the owner to unpause, returns to normal state
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
691,
789
]
} | 914 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | TokenERC20 | contract TokenERC20 is Pausable{
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) whenNotPaused public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) whenNotPaused public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) whenNotPaused
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
} | _transfer | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| /**
* Internal transfer, only can be called by this contract
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
881,
1729
]
} | 915 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | TokenERC20 | contract TokenERC20 is Pausable{
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) whenNotPaused public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) whenNotPaused public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) whenNotPaused
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
} | transfer | function transfer(address _to, uint256 _value) whenNotPaused public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
| /**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
1935,
2106
]
} | 916 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | TokenERC20 | contract TokenERC20 is Pausable{
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) whenNotPaused public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) whenNotPaused public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) whenNotPaused
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| /**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
2381,
2696
]
} | 917 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | TokenERC20 | contract TokenERC20 is Pausable{
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) whenNotPaused public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) whenNotPaused public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) whenNotPaused
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
} | approve | function approve(address _spender, uint256 _value) whenNotPaused public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| /**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
2960,
3205
]
} | 918 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | TokenERC20 | contract TokenERC20 is Pausable{
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) whenNotPaused public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) whenNotPaused public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) whenNotPaused
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes _extraData) whenNotPaused
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
| /**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
3599,
3965
]
} | 919 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | MogoToken | contract MogoToken is TokenERC20{
// Public variables of the token
string public name = "Morgan Option";
string public symbol = "mogo";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply = 200000000 * 10 ** uint256(decimals);
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
constructor() public{
balanceOf[msg.sender] = totalSupply;
}
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
require(!frozenAccount[_from]);
// Check if sender is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @param addrs Address array
/// @param balances balance array
function batchTransfer(address[] addrs, uint256[] balances) onlyOwner public {
require(addrs.length == balances.length);
uint totalValue;
for (uint i = 0; i < addrs.length; i++) {
uint value = balances[i];
balanceOf[addrs[i]] += value;
emit Transfer(owner, addrs[i], value);
totalValue = SafeMath.add(value,totalValue);
}
require(balanceOf[owner]>totalValue);
balanceOf[owner] -= totalValue;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
} | freezeAccount | function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
1790,
1956
]
} | 920 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | MogoToken | contract MogoToken is TokenERC20{
// Public variables of the token
string public name = "Morgan Option";
string public symbol = "mogo";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply = 200000000 * 10 ** uint256(decimals);
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
constructor() public{
balanceOf[msg.sender] = totalSupply;
}
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
require(!frozenAccount[_from]);
// Check if sender is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @param addrs Address array
/// @param balances balance array
function batchTransfer(address[] addrs, uint256[] balances) onlyOwner public {
require(addrs.length == balances.length);
uint totalValue;
for (uint i = 0; i < addrs.length; i++) {
uint value = balances[i];
balanceOf[addrs[i]] += value;
emit Transfer(owner, addrs[i], value);
totalValue = SafeMath.add(value,totalValue);
}
require(balanceOf[owner]>totalValue);
balanceOf[owner] -= totalValue;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
} | batchTransfer | function batchTransfer(address[] addrs, uint256[] balances) onlyOwner public {
require(addrs.length == balances.length);
uint totalValue;
for (uint i = 0; i < addrs.length; i++) {
uint value = balances[i];
balanceOf[addrs[i]] += value;
emit Transfer(owner, addrs[i], value);
totalValue = SafeMath.add(value,totalValue);
}
require(balanceOf[owner]>totalValue);
balanceOf[owner] -= totalValue;
}
| /// @param addrs Address array
/// @param balances balance array | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
2039,
2551
]
} | 921 |
|||
MogoToken | MogoToken.sol | 0x472eb1a4c31e4c6557feb00e90987e564ca412af | Solidity | MogoToken | contract MogoToken is TokenERC20{
// Public variables of the token
string public name = "Morgan Option";
string public symbol = "mogo";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply = 200000000 * 10 ** uint256(decimals);
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
constructor() public{
balanceOf[msg.sender] = totalSupply;
}
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
require(!frozenAccount[_from]);
// Check if sender is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @param addrs Address array
/// @param balances balance array
function batchTransfer(address[] addrs, uint256[] balances) onlyOwner public {
require(addrs.length == balances.length);
uint totalValue;
for (uint i = 0; i < addrs.length; i++) {
uint value = balances[i];
balanceOf[addrs[i]] += value;
emit Transfer(owner, addrs[i], value);
totalValue = SafeMath.add(value,totalValue);
}
require(balanceOf[owner]>totalValue);
balanceOf[owner] -= totalValue;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
} | burn | function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
| /**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://47e5a16981385dc8acbf23585f71f568612a3ead1d64f40743ffb827e1f84897 | {
"func_code_index": [
2725,
3114
]
} | 922 |
|||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
251,
437
]
} | 923 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
707,
848
]
} | 924 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
1138,
1335
]
} | 925 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| /**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
1581,
2057
]
} | 926 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
2520,
2657
]
} | 927 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
3140,
3490
]
} | 928 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
3942,
4077
]
} | 929 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
4549,
4720
]
} | 930 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
94,
154
]
} | 931 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
237,
310
]
} | 932 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
534,
616
]
} | 933 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
895,
983
]
} | 934 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
1647,
1726
]
} | 935 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
2039,
2141
]
} | 936 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Initializable | contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
} | /**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying an Initializable contract, as well
* as extending an Initializable contract via inheritance.
* WARNING: When used with inheritance, manual care must be taken to not invoke
* a parent initializer twice, or ensure that all initializers are idempotent,
* because this is not dealt with automatically as with constructors.
*/ | NatSpecMultiLine | isConstructor | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
| /// @dev Returns true if and only if the function is running in the constructor | NatSpecSingleLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
782,
1293
]
} | 937 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | ContextUpgradeSafe | contract ContextUpgradeSafe is Initializable {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
uint256[50] private __gap;
} | /*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/ | Comment | __Context_init | function __Context_init() internal initializer {
__Context_init_unchained();
}
| // Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance. | LineComment | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
206,
303
]
} | 938 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | __Ownable_init | function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
| /**
* @dev Initializes the contract setting the deployer as the initial owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
292,
426
]
} | 939 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
714,
798
]
} | 940 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
1356,
1509
]
} | 941 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
1659,
1908
]
} | 942 |
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | setTokenContract | function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
| /**
* @dev Sets the Plutus ERC-20 token contract address
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
2083,
2202
]
} | 943 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | setTGE | function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
| /**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
2341,
2465
]
} | 944 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | addToWhitelist | function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
| /**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
2645,
2953
]
} | 945 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimSeedTokens | function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
| /**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
3158,
4068
]
} | 946 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimAdvisorsTokens | function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
| /**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
4264,
5762
]
} | 947 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimFoundationTokens | function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
| /**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
5965,
7428
]
} | 948 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimEcosystemTokens | function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
| /**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
7628,
8623
]
} | 949 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimReserveTokens | function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
| /**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
8817,
9792
]
} | 950 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimMarketingTokens | function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
| /**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
9992,
10909
]
} | 951 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | claimEmployeeTokens | function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
| /**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
11054,
12094
]
} | 952 |
||
Bonded | Bonded.sol | 0x1278601db4230d26ac07de0b0f3f2d68bd433311 | Solidity | Bonded | contract Bonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public advisorsAddress;
address public foundationAddress;
address public ecosystemAddress;
address public reserveAddress;
address public marketingAddress;
address public employeesAddress;
uint public constant SEED_POOL = 50000000 * decMul;
uint public constant ADVISORS_POOL = 4800000 * decMul;
uint public constant FOUNDATION_POOL = 12000000 * decMul;
uint public constant ECOSYSTEM_POOL = 12000000 * decMul;
uint public constant RESERVE_POOL = 6000000 * decMul;
uint public constant MARKETING_POOL = 4800000 * decMul;
uint public constant EMPLOYEES_POOL = 8400000 * decMul;
uint public currentSeedPool = SEED_POOL;
uint public currentAdvisorsPool = ADVISORS_POOL;
uint public currentFoundationPool = FOUNDATION_POOL;
uint public currentEcosystemPool = ECOSYSTEM_POOL;
uint public currentReservePool = RESERVE_POOL;
uint public currentMarketingPool = MARKETING_POOL;
uint public currentEmployeesPool = EMPLOYEES_POOL;
IERC20 public token;
mapping(address => uint) public seedWhitelist;
constructor(address _advisorsAddress,
address _foundationAddress,
address _ecosystemAddress,
address _reserveAddress,
address _marketingAddress,
address _employeesAddress) public {
__Ownable_init_unchained();
advisorsAddress = _advisorsAddress;
foundationAddress = _foundationAddress;
ecosystemAddress = _ecosystemAddress;
reserveAddress = _reserveAddress;
marketingAddress = _marketingAddress;
employeesAddress = _employeesAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
seedWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim seed tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimSeedTokens(uint amount) public {
require(seedWhitelist[msg.sender] > 0 || msg.sender == owner(), "Sender is not whitelisted");
require(seedWhitelist[msg.sender] >= amount || msg.sender == owner(), "Exceeded token amount");
require(currentSeedPool >= amount, "Exceeded seedpool");
currentSeedPool = currentSeedPool.sub(amount);
// Bridge fees are not taken off for contract owner
if (msg.sender == owner()) {
token.transfer(msg.sender, amount);
return;
}
seedWhitelist[msg.sender] = seedWhitelist[msg.sender].sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(msg.sender, amount.sub(amountToBurn));
}
/**
* @dev claim advisors tokens from the contract balance.
* Can be used only by an owner or from advisorsAddress.
* Tokens will be send to sender address.
*/
function claimAdvisorsTokens() public {
require(msg.sender == advisorsAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint amount = 0;
if (currentAdvisorsPool == ADVISORS_POOL) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 12*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 18*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.div(2))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
if (now >= TGE + 24*month && currentAdvisorsPool == ADVISORS_POOL.sub(ADVISORS_POOL.mul(3).div(4))) {
currentAdvisorsPool -= ADVISORS_POOL.div(4);
amount += ADVISORS_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(advisorsAddress, amount.sub(amountToBurn));
}
/**
* @dev claim foundation tokens from the contract balance.
* Can be used only by an owner or from foundationAddress.
* Tokens will be send to foundationAddress.
*/
function claimFoundationTokens() public {
require(msg.sender == foundationAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 2.5 years of vestiong period
require(now >= TGE + 30*month, "Vesting period");
uint amount = 0;
if (now >= TGE + 30*month && currentFoundationPool == FOUNDATION_POOL) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 36*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 42*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.div(2))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
if (now >= TGE + 48*month && currentFoundationPool == FOUNDATION_POOL.sub(FOUNDATION_POOL.mul(3).div(4))) {
currentFoundationPool -= FOUNDATION_POOL.div(4);
amount += FOUNDATION_POOL.div(4);
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
// No sense to burn because 2.5 years vestiong period
token.transfer(foundationAddress, amount);
}
/**
* @dev claim ecosystem tokens from the contract balance.
* Can be used only by an owner or from ecosystemAddress.
* Tokens will be send to ecosystemAddress.
*/
function claimEcosystemTokens() public {
require(msg.sender == ecosystemAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = ((now.sub(TGE)).div(month)).sub(5);
// Avoid overflow when releasing 2% each month
if (monthPassed > 50) {
monthPassed = 50;
}
uint amount = currentEcosystemPool.sub(ECOSYSTEM_POOL.sub((ECOSYSTEM_POOL.mul(monthPassed*2)).div(100)));
require(amount > 0, "nothing to claim");
currentEcosystemPool = currentEcosystemPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(ecosystemAddress, amount.sub(amountToBurn));
}
/**
* @dev claim reserve tokens from the contract balance.
* Can be used only by an owner or from reserveAddress.
* Tokens will be send to reserveAddress.
*/
function claimReserveTokens() public {
require(msg.sender == reserveAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
//6 months of vestiong period
require(now >= TGE + 6*month, "Vesting period");
uint monthPassed = now.sub(TGE).div(month).sub(5);
// Avoid overflow when releasing 5% each month
if (monthPassed > 20) {
monthPassed = 20;
}
uint amount = currentReservePool.sub(RESERVE_POOL.sub((RESERVE_POOL.mul(monthPassed*5)).div(100)));
currentReservePool = currentReservePool.sub(amount);
require(amount > 0, "nothing to claim");
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(reserveAddress, amount.sub(amountToBurn));
}
/**
* @dev claim marketing tokens from the contract balance.
* Can be used only by an owner or from marketingAddress.
* Tokens will be send to marketingAddress.
*/
function claimMarketingTokens() public {
require(msg.sender == marketingAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// no vestiong period
uint monthPassed = (now.sub(TGE)).div(month).add(1);
// Avoid overflow when releasing 10% each month
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentMarketingPool.sub(MARKETING_POOL.sub(MARKETING_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentMarketingPool = currentMarketingPool.sub(amount);
uint amountToBurn = amount.mul(getCurrentFee()).div(1000);
if (amountToBurn > 0) {
token.burn(amountToBurn);
}
token.transfer(marketingAddress, amount.sub(amountToBurn));
}
/**
* @dev claim employee tokens from the contract balance.
* Can be used only by an owner or from employeesAddress
*/
function claimEmployeeTokens() public {
require(msg.sender == employeesAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// 1.5 years of vesting period
require(now >= TGE + 18 * month, "Vesting period");
// Get the total months passed after the vesting period of 1.5 years
uint monthPassed = (now.sub(TGE)).div(month).sub(18).add(1);
// Avoid overflow when releasing 10% each month
// If more than 10 months passed without token claim then 100% tokens can be claimed at once.
if (monthPassed > 10) {
monthPassed = 10;
}
uint amount = currentEmployeesPool.sub(EMPLOYEES_POOL.sub(EMPLOYEES_POOL.mul(monthPassed*10).div(100)));
require(amount > 0, "nothing to claim");
currentEmployeesPool = currentEmployeesPool.sub(amount);
//18 month of vesting period, no need to check fee
token.transfer(employeesAddress, amount);
}
/**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/
function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
} | getCurrentFee | function getCurrentFee() public view returns (uint) {
if (now >= TGE + 9 * month) {
return 0;
}
if (now >= TGE + 8 * month) {
return 92;
}
if (now >= TGE + 7 * month) {
return 115;
}
if (now >= TGE + 6 * month) {
return 144;
}
if (now >= TGE + 5 * month) {
return 180;
}
if (now >= TGE + 4 * month) {
return 225;
}
if (now >= TGE + 3 * month) {
return 282;
}
if (now >= TGE + 2 * month) {
return 352;
}
if (now >= TGE + 1 * month) {
return 440;
}
return 550;
}
| /**
* @dev getCurrentFee calculate current fee according to TGE and returns it.
* NOTE: divide result by 1000 to calculate current percent.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://4a31ce0fdbd0a9a82911a33db1848213a8c5f3d00a6440b3697965ffa637ae0c | {
"func_code_index": [
12263,
13022
]
} | 953 |
||
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | Ownable | function Ownable() public {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
253,
313
]
} | 954 |
|||
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | transferOwnership | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
628,
809
]
} | 955 |
|||
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | SafeBasicToken | contract SafeBasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
// Avoid Short Address Attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
401,
773
]
} | 956 |
|
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | SafeBasicToken | contract SafeBasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
// Avoid Short Address Attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
977,
1093
]
} | 957 |
|
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | SafeStandardToken | contract SafeStandardToken is ERC20, SafeBasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
394,
942
]
} | 958 |
|
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | SafeStandardToken | contract SafeStandardToken is ERC20, SafeBasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
1572,
1767
]
} | 959 |
|
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | SafeStandardToken | contract SafeStandardToken is ERC20, SafeBasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | allowance | function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
2089,
2234
]
} | 960 |
|
StpacToken | StpacToken.sol | 0x0814742f841c8a48fcc7fa2b4463e6e5bec3ae8b | Solidity | SafeStandardToken | contract SafeStandardToken is ERC20, SafeBasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://0f936c7586ec407a8f2831601cfcbd2af9340526e37436e9a0ae0ecc909c4654 | {
"func_code_index": [
2477,
2760
]
} | 961 |
|
DNIC | DNIC.sol | 0xe43a3f0dff8e28e34af893a07be36f5b0d54f1b1 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://ddf0456ae74615dd871259c2b61a72f39ecaf405c4154677065b2e8641effbb7 | {
"func_code_index": [
95,
302
]
} | 962 |
|
DNIC | DNIC.sol | 0xe43a3f0dff8e28e34af893a07be36f5b0d54f1b1 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://ddf0456ae74615dd871259c2b61a72f39ecaf405c4154677065b2e8641effbb7 | {
"func_code_index": [
392,
692
]
} | 963 |
|
DNIC | DNIC.sol | 0xe43a3f0dff8e28e34af893a07be36f5b0d54f1b1 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://ddf0456ae74615dd871259c2b61a72f39ecaf405c4154677065b2e8641effbb7 | {
"func_code_index": [
812,
940
]
} | 964 |
|
DNIC | DNIC.sol | 0xe43a3f0dff8e28e34af893a07be36f5b0d54f1b1 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://ddf0456ae74615dd871259c2b61a72f39ecaf405c4154677065b2e8641effbb7 | {
"func_code_index": [
1010,
1156
]
} | 965 |
|
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
92,
152
]
} | 966 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
233,
306
]
} | 967 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
524,
606
]
} | 968 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
879,
967
]
} | 969 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
1618,
1697
]
} | 970 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
2002,
2104
]
} | 971 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | tryAdd | function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
| /**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
157,
384
]
} | 972 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | trySub | function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
| /**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
528,
727
]
} | 973 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | tryMul | function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
| /**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
873,
1381
]
} | 974 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | tryDiv | function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
| /**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
1528,
1728
]
} | 975 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | tryMod | function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
| /**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
1885,
2085
]
} | 976 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
2318,
2421
]
} | 977 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
3193,
3296
]
} | 978 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
3758,
3969
]
} | 979 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
| /**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
4674,
4884
]
} | 980 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
5528,
5738
]
} | 981 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | isContract | function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
| /**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
590,
1017
]
} | 982 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | sendValue | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
| /**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
1932,
2334
]
} | 983 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCall | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| /**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
3073,
3251
]
} | 984 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCall | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
3471,
3671
]
} | 985 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCallWithValue | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
4031,
4262
]
} | 986 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCallWithValue | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
4508,
5043
]
} | 987 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionStaticCall | function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
5218,
5422
]
} | 988 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionStaticCall | function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
5604,
6031
]
} | 989 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionDelegateCall | function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
6208,
6413
]
} | 990 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionDelegateCall | function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
6597,
7025
]
} | 991 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Ownable | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | owner | function owner() public view virtual returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
450,
542
]
} | 992 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Ownable | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
1093,
1246
]
} | 993 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | Ownable | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
1393,
1642
]
} | 994 |
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | AMC | contract AMC is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
uint8 private _decimals = 9;
//
string private _name = "AMC"; // name
string private _symbol = "AMC"; // symbol
uint256 private _tTotal = 1000 * 10**9 * 10**uint256(_decimals);
// % to holders
uint256 public defaultTaxFee = 1;
uint256 public _taxFee = defaultTaxFee;
uint256 private _previousTaxFee = _taxFee;
// % to swap & send to marketing wallet
uint256 public defaultMarketingFee = 14;
uint256 public _marketingFee = defaultMarketingFee;
uint256 private _previousMarketingFee = _marketingFee;
uint256 public _marketingFee4Sellers = 14;
bool public feesOnSellersAndBuyers = true;
uint256 public _maxTxAmount = _tTotal.div(200);
uint256 public numTokensToExchangeForMarketing = _tTotal.div(100).div(100);
address payable public marketingWallet = payable(0x86875f312322fCc05f543C596dEb6D79642bA195);
//
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) public _isBlacklisted;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private _tFeeTotal;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool inSwapAndSend;
bool public SwapAndSendEnabled = true;
event SwapAndSendEnabledUpdated(bool enabled);
modifier lockTheSwap {
inSwapAndSend = true;
_;
inSwapAndSend = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
// require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function excludeFromFee(address account) public onlyOwner() {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner() {
_isExcludedFromFee[account] = false;
}
function removeAllFee() private {
if(_taxFee == 0 && _marketingFee == 0) return;
_previousTaxFee = _taxFee;
_previousMarketingFee = _marketingFee;
_taxFee = 0;
_marketingFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_marketingFee = _previousMarketingFee;
}
//to recieve ETH
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function addToBlackList(address[] calldata addresses) external onlyOwner {
for (uint256 i; i < addresses.length; ++i) {
_isBlacklisted[addresses[i]] = true;
}
}
function removeFromBlackList(address account) external onlyOwner {
_isBlacklisted[account] = false;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tMarketing);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tMarketing = calculateMarketingFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tMarketing);
return (tTransferAmount, tFee, tMarketing);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tMarketing, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rMarketing);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeMarketing(uint256 tMarketing) private {
uint256 currentRate = _getRate();
uint256 rMarketing = tMarketing.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rMarketing);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tMarketing);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateMarketingFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_marketingFee).div(
10**2
);
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBlacklisted[from] && !_isBlacklisted[to], "This address is blacklisted");
if(from != owner() && to != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
// is the token balance of this contract address over the min number of
// tokens that we need to initiate a swap + send lock?
// also, don't get caught in a circular sending event.
// also, don't swap & liquify if sender is uniswap pair.
uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= numTokensToExchangeForMarketing;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (
overMinTokenBalance &&
!inSwapAndSend &&
from != uniswapV2Pair &&
SwapAndSendEnabled
) {
SwapAndSend(contractTokenBalance);
}
if(feesOnSellersAndBuyers) {
setFees(to);
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function setFees(address recipient) private {
_taxFee = defaultTaxFee;
_marketingFee = defaultMarketingFee;
if (recipient == uniswapV2Pair) { // sell
_marketingFee = _marketingFee4Sellers;
}
}
function SwapAndSend(uint256 contractTokenBalance) private lockTheSwap {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), contractTokenBalance);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
contractTokenBalance,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
marketingWallet.transfer(contractETHBalance);
}
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setDefaultMarketingFee(uint256 marketingFee) external onlyOwner() {
defaultMarketingFee = marketingFee;
}
function setMarketingFee4Sellers(uint256 marketingFee4Sellers) external onlyOwner() {
_marketingFee4Sellers = marketingFee4Sellers;
}
function setFeesOnSellersAndBuyers(bool _enabled) public onlyOwner() {
feesOnSellersAndBuyers = _enabled;
}
function setSwapAndSendEnabled(bool _enabled) public onlyOwner() {
SwapAndSendEnabled = _enabled;
emit SwapAndSendEnabledUpdated(_enabled);
}
function setnumTokensToExchangeForMarketing(uint256 _numTokensToExchangeForMarketing) public onlyOwner() {
numTokensToExchangeForMarketing = _numTokensToExchangeForMarketing;
}
function _setMarketingWallet(address payable wallet) external onlyOwner() {
marketingWallet = wallet;
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
_maxTxAmount = maxTxAmount;
}
} | //to recieve ETH | LineComment | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
7085,
7119
]
} | 995 |
||||
AMC | AMC.sol | 0x0027903278b92d68df9a8a179065eecbd4161555 | Solidity | AMC | contract AMC is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
uint8 private _decimals = 9;
//
string private _name = "AMC"; // name
string private _symbol = "AMC"; // symbol
uint256 private _tTotal = 1000 * 10**9 * 10**uint256(_decimals);
// % to holders
uint256 public defaultTaxFee = 1;
uint256 public _taxFee = defaultTaxFee;
uint256 private _previousTaxFee = _taxFee;
// % to swap & send to marketing wallet
uint256 public defaultMarketingFee = 14;
uint256 public _marketingFee = defaultMarketingFee;
uint256 private _previousMarketingFee = _marketingFee;
uint256 public _marketingFee4Sellers = 14;
bool public feesOnSellersAndBuyers = true;
uint256 public _maxTxAmount = _tTotal.div(200);
uint256 public numTokensToExchangeForMarketing = _tTotal.div(100).div(100);
address payable public marketingWallet = payable(0x86875f312322fCc05f543C596dEb6D79642bA195);
//
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) public _isBlacklisted;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private _tFeeTotal;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool inSwapAndSend;
bool public SwapAndSendEnabled = true;
event SwapAndSendEnabledUpdated(bool enabled);
modifier lockTheSwap {
inSwapAndSend = true;
_;
inSwapAndSend = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
// require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function excludeFromFee(address account) public onlyOwner() {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner() {
_isExcludedFromFee[account] = false;
}
function removeAllFee() private {
if(_taxFee == 0 && _marketingFee == 0) return;
_previousTaxFee = _taxFee;
_previousMarketingFee = _marketingFee;
_taxFee = 0;
_marketingFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_marketingFee = _previousMarketingFee;
}
//to recieve ETH
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function addToBlackList(address[] calldata addresses) external onlyOwner {
for (uint256 i; i < addresses.length; ++i) {
_isBlacklisted[addresses[i]] = true;
}
}
function removeFromBlackList(address account) external onlyOwner {
_isBlacklisted[account] = false;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tMarketing);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tMarketing = calculateMarketingFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tMarketing);
return (tTransferAmount, tFee, tMarketing);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tMarketing, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rMarketing);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeMarketing(uint256 tMarketing) private {
uint256 currentRate = _getRate();
uint256 rMarketing = tMarketing.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rMarketing);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tMarketing);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateMarketingFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_marketingFee).div(
10**2
);
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBlacklisted[from] && !_isBlacklisted[to], "This address is blacklisted");
if(from != owner() && to != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
// is the token balance of this contract address over the min number of
// tokens that we need to initiate a swap + send lock?
// also, don't get caught in a circular sending event.
// also, don't swap & liquify if sender is uniswap pair.
uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= numTokensToExchangeForMarketing;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (
overMinTokenBalance &&
!inSwapAndSend &&
from != uniswapV2Pair &&
SwapAndSendEnabled
) {
SwapAndSend(contractTokenBalance);
}
if(feesOnSellersAndBuyers) {
setFees(to);
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function setFees(address recipient) private {
_taxFee = defaultTaxFee;
_marketingFee = defaultMarketingFee;
if (recipient == uniswapV2Pair) { // sell
_marketingFee = _marketingFee4Sellers;
}
}
function SwapAndSend(uint256 contractTokenBalance) private lockTheSwap {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), contractTokenBalance);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
contractTokenBalance,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
marketingWallet.transfer(contractETHBalance);
}
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setDefaultMarketingFee(uint256 marketingFee) external onlyOwner() {
defaultMarketingFee = marketingFee;
}
function setMarketingFee4Sellers(uint256 marketingFee4Sellers) external onlyOwner() {
_marketingFee4Sellers = marketingFee4Sellers;
}
function setFeesOnSellersAndBuyers(bool _enabled) public onlyOwner() {
feesOnSellersAndBuyers = _enabled;
}
function setSwapAndSendEnabled(bool _enabled) public onlyOwner() {
SwapAndSendEnabled = _enabled;
emit SwapAndSendEnabledUpdated(_enabled);
}
function setnumTokensToExchangeForMarketing(uint256 _numTokensToExchangeForMarketing) public onlyOwner() {
numTokensToExchangeForMarketing = _numTokensToExchangeForMarketing;
}
function _setMarketingWallet(address payable wallet) external onlyOwner() {
marketingWallet = wallet;
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
_maxTxAmount = maxTxAmount;
}
} | _tokenTransfer | function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
| //this method is responsible for taking all fee, if takeFee is true | LineComment | v0.8.3+commit.8d00100c | None | ipfs://851a68e80b4b13b3a3524b877e1bad1fd22907a8ac2ec2d36dd542ac2be8cd44 | {
"func_code_index": [
13627,
14450
]
} | 996 |
||
EditionsFactory | contracts/producers/editions/EditionsFactory.sol | 0x6ef0f6be2556cfaff90bf0d572d7e38a13d715ad | Solidity | EditionsFactory | contract EditionsFactory is Ownable, IEditionsFactoryEvents, IEditionsFactory {
/// @notice Address that holds the implementation for Crowdfunds
address public implementation;
/// @notice Mirror tributary registry
address public tributaryRegistry;
constructor(
address owner_,
address implementation_,
address tributaryRegistry_
) Ownable(owner_) {
implementation = implementation_;
tributaryRegistry = tributaryRegistry_;
}
// ======== Admin function =========
function setImplementation(address implementation_)
external
override
onlyOwner
{
require(implementation_ != address(0), "must set implementation");
emit ImplementationSet(implementation, implementation_);
implementation = implementation_;
}
function setTributaryRegistry(address tributaryRegistry_)
external
override
onlyOwner
{
require(
tributaryRegistry_ != address(0),
"must set tributary registry"
);
emit TributaryRegistrySet(tributaryRegistry, tributaryRegistry_);
tributaryRegistry = tributaryRegistry_;
}
// ======== Deploy function =========
/// @notice Deploys a new edition (ERC721) clone, and register tributary.
/// @param owner_ the clone owner
/// @param tributary the tributary receive tokens in behalf of the clone fees
/// @param name_ the name for the edition clone
/// @param symbol_ the symbol for the edition clone
/// @param contentURI_ the contentURI for the edition clone
/// @param contractURI_ the contractURI for the edition clone
/// @param edition_ the parameters for the edition sale
/// @param nonce additional entropy for the clone salt parameter
/// @param paused_ the pause state for the edition sale
function create(
address owner_,
address tributary,
string memory name_,
string memory symbol_,
string memory contentURI_,
string memory contractURI_,
IEditions.Edition memory edition_,
uint256 nonce,
bool paused_
) external override returns (address clone) {
clone = Clones.cloneDeterministic(
implementation,
keccak256(abi.encode(owner_, name_, symbol_, nonce))
);
IEditions(clone).initialize(
owner_,
name_,
symbol_,
contentURI_,
contractURI_,
edition_,
paused_
);
emit EditionsDeployed(owner_, clone, implementation);
if (tributaryRegistry != address(0)) {
ITributaryRegistry(tributaryRegistry).registerTributary(
clone,
tributary
);
}
}
function predictDeterministicAddress(address implementation_, bytes32 salt)
external
view
override
returns (address)
{
return
Clones.predictDeterministicAddress(
implementation_,
salt,
address(this)
);
}
} | /**
* @title EditionsFactory
* @notice The EditionsFactory contract is used to deploy edition clones.
* @author MirrorXYZ
*/ | NatSpecMultiLine | setImplementation | function setImplementation(address implementation_)
external
override
onlyOwner
{
require(implementation_ != address(0), "must set implementation");
emit ImplementationSet(implementation, implementation_);
implementation = implementation_;
}
| // ======== Admin function ========= | LineComment | v0.8.10+commit.fc410830 | {
"func_code_index": [
537,
840
]
} | 997 |
||
EditionsFactory | contracts/producers/editions/EditionsFactory.sol | 0x6ef0f6be2556cfaff90bf0d572d7e38a13d715ad | Solidity | EditionsFactory | contract EditionsFactory is Ownable, IEditionsFactoryEvents, IEditionsFactory {
/// @notice Address that holds the implementation for Crowdfunds
address public implementation;
/// @notice Mirror tributary registry
address public tributaryRegistry;
constructor(
address owner_,
address implementation_,
address tributaryRegistry_
) Ownable(owner_) {
implementation = implementation_;
tributaryRegistry = tributaryRegistry_;
}
// ======== Admin function =========
function setImplementation(address implementation_)
external
override
onlyOwner
{
require(implementation_ != address(0), "must set implementation");
emit ImplementationSet(implementation, implementation_);
implementation = implementation_;
}
function setTributaryRegistry(address tributaryRegistry_)
external
override
onlyOwner
{
require(
tributaryRegistry_ != address(0),
"must set tributary registry"
);
emit TributaryRegistrySet(tributaryRegistry, tributaryRegistry_);
tributaryRegistry = tributaryRegistry_;
}
// ======== Deploy function =========
/// @notice Deploys a new edition (ERC721) clone, and register tributary.
/// @param owner_ the clone owner
/// @param tributary the tributary receive tokens in behalf of the clone fees
/// @param name_ the name for the edition clone
/// @param symbol_ the symbol for the edition clone
/// @param contentURI_ the contentURI for the edition clone
/// @param contractURI_ the contractURI for the edition clone
/// @param edition_ the parameters for the edition sale
/// @param nonce additional entropy for the clone salt parameter
/// @param paused_ the pause state for the edition sale
function create(
address owner_,
address tributary,
string memory name_,
string memory symbol_,
string memory contentURI_,
string memory contractURI_,
IEditions.Edition memory edition_,
uint256 nonce,
bool paused_
) external override returns (address clone) {
clone = Clones.cloneDeterministic(
implementation,
keccak256(abi.encode(owner_, name_, symbol_, nonce))
);
IEditions(clone).initialize(
owner_,
name_,
symbol_,
contentURI_,
contractURI_,
edition_,
paused_
);
emit EditionsDeployed(owner_, clone, implementation);
if (tributaryRegistry != address(0)) {
ITributaryRegistry(tributaryRegistry).registerTributary(
clone,
tributary
);
}
}
function predictDeterministicAddress(address implementation_, bytes32 salt)
external
view
override
returns (address)
{
return
Clones.predictDeterministicAddress(
implementation_,
salt,
address(this)
);
}
} | /**
* @title EditionsFactory
* @notice The EditionsFactory contract is used to deploy edition clones.
* @author MirrorXYZ
*/ | NatSpecMultiLine | create | function create(
address owner_,
address tributary,
string memory name_,
string memory symbol_,
string memory contentURI_,
string memory contractURI_,
IEditions.Edition memory edition_,
uint256 nonce,
bool paused_
) external override returns (address clone) {
clone = Clones.cloneDeterministic(
implementation,
keccak256(abi.encode(owner_, name_, symbol_, nonce))
);
IEditions(clone).initialize(
owner_,
name_,
symbol_,
contentURI_,
contractURI_,
edition_,
paused_
);
emit EditionsDeployed(owner_, clone, implementation);
if (tributaryRegistry != address(0)) {
ITributaryRegistry(tributaryRegistry).registerTributary(
clone,
tributary
);
}
}
| /// @notice Deploys a new edition (ERC721) clone, and register tributary.
/// @param owner_ the clone owner
/// @param tributary the tributary receive tokens in behalf of the clone fees
/// @param name_ the name for the edition clone
/// @param symbol_ the symbol for the edition clone
/// @param contentURI_ the contentURI for the edition clone
/// @param contractURI_ the contractURI for the edition clone
/// @param edition_ the parameters for the edition sale
/// @param nonce additional entropy for the clone salt parameter
/// @param paused_ the pause state for the edition sale | NatSpecSingleLine | v0.8.10+commit.fc410830 | {
"func_code_index": [
1877,
2825
]
} | 998 |
||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | Ownable | function Ownable() public {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
261,
321
]
} | 999 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
644,
820
]
} | 1,000 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | AddressWhitelist | contract AddressWhitelist is Ownable {
// the addresses that are included in the whitelist
mapping (address => bool) whitelisted;
function isWhitelisted(address addr) view public returns (bool) {
return whitelisted[addr];
}
event LogWhitelistAdd(address indexed addr);
// add these addresses to the whitelist
function addToWhitelist(address[] addresses) public onlyOwner returns (bool) {
for (uint i = 0; i < addresses.length; i++) {
if (!whitelisted[addresses[i]]) {
whitelisted[addresses[i]] = true;
LogWhitelistAdd(addresses[i]);
}
}
return true;
}
event LogWhitelistRemove(address indexed addr);
// remove these addresses from the whitelist
function removeFromWhitelist(address[] addresses) public onlyOwner returns (bool) {
for (uint i = 0; i < addresses.length; i++) {
if (whitelisted[addresses[i]]) {
whitelisted[addresses[i]] = false;
LogWhitelistRemove(addresses[i]);
}
}
return true;
}
} | addToWhitelist | function addToWhitelist(address[] addresses) public onlyOwner returns (bool) {
for (uint i = 0; i < addresses.length; i++) {
if (!whitelisted[addresses[i]]) {
whitelisted[addresses[i]] = true;
LogWhitelistAdd(addresses[i]);
}
}
return true;
}
| // add these addresses to the whitelist | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
359,
700
]
} | 1,001 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | AddressWhitelist | contract AddressWhitelist is Ownable {
// the addresses that are included in the whitelist
mapping (address => bool) whitelisted;
function isWhitelisted(address addr) view public returns (bool) {
return whitelisted[addr];
}
event LogWhitelistAdd(address indexed addr);
// add these addresses to the whitelist
function addToWhitelist(address[] addresses) public onlyOwner returns (bool) {
for (uint i = 0; i < addresses.length; i++) {
if (!whitelisted[addresses[i]]) {
whitelisted[addresses[i]] = true;
LogWhitelistAdd(addresses[i]);
}
}
return true;
}
event LogWhitelistRemove(address indexed addr);
// remove these addresses from the whitelist
function removeFromWhitelist(address[] addresses) public onlyOwner returns (bool) {
for (uint i = 0; i < addresses.length; i++) {
if (whitelisted[addresses[i]]) {
whitelisted[addresses[i]] = false;
LogWhitelistRemove(addresses[i]);
}
}
return true;
}
} | removeFromWhitelist | function removeFromWhitelist(address[] addresses) public onlyOwner returns (bool) {
for (uint i = 0; i < addresses.length; i++) {
if (whitelisted[addresses[i]]) {
whitelisted[addresses[i]] = false;
LogWhitelistRemove(addresses[i]);
}
}
return true;
}
| // remove these addresses from the whitelist | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
808,
1157
]
} | 1,002 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | RtcTokenCrowdsale | contract RtcTokenCrowdsale is Ownable, AddressWhitelist {
using SafeMath for uint256;
PausableToken public tokenReward; // address of the token used as reward
// deployment variables for static supply sale
uint256 public initialSupply;
uint256 public tokensRemaining;
uint256 public decimals;
// multi-sig addresses and price variable
address public beneficiaryWallet; // beneficiaryMultiSig (founder group) or wallet account
uint256 public tokensPerEthPrice; // set initial value floating priceVar 10,000 tokens per Eth
// uint256 values for min,max,caps,tracking
uint256 public amountRaisedInWei;
uint256 public fundingMinCapInWei;
// pricing veriable
uint256 public p1_duration;
uint256 public p1_start;
uint256 public p2_start;
uint256 public white_duration;
// loop control, ICO startup and limiters
uint256 public fundingStartTime; // crowdsale start time#
uint256 public fundingEndTime; // crowdsale end time#
bool public isCrowdSaleClosed = false; // crowdsale completion boolean
bool public areFundsReleasedToBeneficiary = false; // boolean for founder to receive Eth or not
bool public isCrowdSaleSetup = false; // boolean for crowdsale setup
// Gas price limit
uint256 maxGasPrice = 50000000000;
event Buy(address indexed _sender, uint256 _eth, uint256 _RTC);
event Refund(address indexed _refunder, uint256 _value);
mapping(address => uint256) fundValue;
// convert tokens to decimals
function toSmallrtc(uint256 amount) public constant returns (uint256) {
return amount.mul(10**decimals);
}
// convert tokens to whole
function toRtc(uint256 amount) public constant returns (uint256) {
return amount.div(10**decimals);
}
function updateMaxGasPrice(uint256 _newGasPrice) public onlyOwner {
require(_newGasPrice != 0);
maxGasPrice = _newGasPrice;
}
// setup the CrowdSale parameters
function setupCrowdsale(uint256 _fundingStartTime) external onlyOwner {
if ((!(isCrowdSaleSetup))
&& (!(beneficiaryWallet > 0))){
// init addresses
tokenReward = PausableToken(0xdb75BFC1ad984c5CeefA8Ec6394596e20d789034);
beneficiaryWallet = 0xf07bd63C5cf404c2f17ab4F9FA1e13fCCEbc5255;
tokensPerEthPrice = 10000; // 1 ETH = 10,000 RTC
// funding targets
fundingMinCapInWei = 350 ether; //350 Eth (min cap) (test = 15) - crowdsale is considered success after this value
// update values
decimals = 18;
amountRaisedInWei = 0;
initialSupply = toSmallrtc(35000000); // 35 million * 18 decimal
tokensRemaining = initialSupply;
fundingStartTime = _fundingStartTime;
white_duration = 2 weeks; // 2 week (test = 2 hour)
p1_duration = 4 weeks; // 4 week (test = 2 hour)
p1_start = fundingStartTime + white_duration;
p2_start = p1_start + p1_duration + 4 weeks; // + 4 week after p1 ends (test = 4 hour)
fundingEndTime = p2_start + 4 weeks; // + 4 week (test = 4 hour)
// configure crowdsale
isCrowdSaleSetup = true;
isCrowdSaleClosed = false;
}
}
function setBonusPrice() public constant returns (uint256 bonus) {
require(isCrowdSaleSetup);
require(p1_start + p1_duration <= p2_start);
if (now >= fundingStartTime && now <= p1_start) { // Private sale Bonus 40% = 4,000 RTC = 1 ETH
bonus = 4000;
} else if (now > p1_start && now <= p1_start + p1_duration) { // Phase-1 Bonus 30% = 3,000 RTC = 1 ETH
bonus = 3000;
} else if (now > p2_start && now <= p2_start + 1 days ) { // Phase-2 1st day Bonus 25% = 2,500 RTC = 1 ETH
bonus = 2500;
} else if (now > p2_start + 1 days && now <= p2_start + 1 weeks ) { // Phase-2 week-1 Bonus 20% = 2,000 RTC = 1 ETH
bonus = 2000;
} else if (now > p2_start + 1 weeks && now <= p2_start + 2 weeks ) { // Phase-2 week-2 Bonus +15% = 1,500 RTC = 1 ETH
bonus = 1500;
} else if (now > p2_start + 2 weeks && now <= p2_start + 3 weeks ) { // Phase-2 week-3 Bonus +10% = 1,000 RTC = 1 ETH
bonus = 1000;
} else if (now > p2_start + 3 weeks && now <= fundingEndTime ) { // Phase-2 final week Bonus 5% = 500 RTC = 1 ETH
bonus = 500;
} else {
revert();
}
}
// p1_duration constant. Only p2 start changes. p2 start cannot be greater than 1 month from p1 end
function updateDuration(uint256 _newP2Start) external onlyOwner { // function to update the duration of phase-1 and adjust the start time of phase-2
require(isCrowdSaleSetup
&& !(p2_start == _newP2Start)
&& !(_newP2Start > p1_start + p1_duration + 30 days)
&& (now < p2_start)
&& (fundingStartTime + p1_duration < _newP2Start));
p2_start = _newP2Start;
fundingEndTime = p2_start.add(4 weeks); // 4 week
}
// default payable function when sending ether to this contract
function () external payable {
require(tx.gasprice <= maxGasPrice);
require(msg.data.length == 0);
BuyRTCtokens();
}
function BuyRTCtokens() public payable {
// conditions (length, crowdsale setup, zero check, exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc)
require(!(msg.value == 0)
&& (isCrowdSaleSetup)
&& (now >= fundingStartTime)
&& (now <= fundingEndTime)
&& (tokensRemaining > 0));
// only whitelisted addresses are allowed during the first day of phase 1
if (now <= p1_start) {
assert(isWhitelisted(msg.sender));
}
uint256 rewardTransferAmount = 0;
uint256 rewardBaseTransferAmount = 0;
uint256 rewardBonusTransferAmount = 0;
uint256 contributionInWei = msg.value;
uint256 refundInWei = 0;
rewardBonusTransferAmount = setBonusPrice();
rewardBaseTransferAmount = (msg.value.mul(tokensPerEthPrice)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardBonusTransferAmount = (msg.value.mul(rewardBonusTransferAmount)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardTransferAmount = rewardBaseTransferAmount.add(rewardBonusTransferAmount);
if (rewardTransferAmount > tokensRemaining) {
uint256 partialPercentage;
partialPercentage = tokensRemaining.mul(10**18).div(rewardTransferAmount);
contributionInWei = contributionInWei.mul(partialPercentage).div(10**18);
rewardBonusTransferAmount = rewardBonusTransferAmount.mul(partialPercentage).div(10**18);
rewardTransferAmount = tokensRemaining;
refundInWei = msg.value.sub(contributionInWei);
}
amountRaisedInWei = amountRaisedInWei.add(contributionInWei);
tokensRemaining = tokensRemaining.sub(rewardTransferAmount); // will cause throw if attempt to purchase over the token limit in one tx or at all once limit reached
fundValue[msg.sender] = fundValue[msg.sender].add(contributionInWei);
assert(tokenReward.increaseFrozen(msg.sender, rewardBonusTransferAmount));
tokenReward.transfer(msg.sender, rewardTransferAmount);
Buy(msg.sender, contributionInWei, rewardTransferAmount);
if (refundInWei > 0) {
msg.sender.transfer(refundInWei);
}
}
function beneficiaryMultiSigWithdraw() external onlyOwner {
checkGoalReached();
require(areFundsReleasedToBeneficiary && (amountRaisedInWei >= fundingMinCapInWei));
beneficiaryWallet.transfer(this.balance);
}
function checkGoalReached() public returns (bytes32 response) { // return crowdfund status to owner for each result case, update public constant
// update state & status variables
require (isCrowdSaleSetup);
if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp <= fundingEndTime && block.timestamp >= fundingStartTime)) { // ICO in progress, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "In progress (Eth < Softcap)";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp < fundingStartTime)) { // ICO has not started
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "Crowdsale is setup";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp > fundingEndTime)) { // ICO ended, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = true;
return "Unsuccessful (Eth < Softcap)";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) { // ICO ended, all tokens gone
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (RTC >= Hardcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.timestamp > fundingEndTime) && (tokensRemaining > 0)) { // ICO ended, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (Eth >= Softcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.timestamp <= fundingEndTime)) { // ICO in progress, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = false;
return "In progress (Eth >= Softcap)!";
}
}
function refund() external { // any contributor can call this to have their Eth returned. user's purchased RTC tokens are burned prior refund of Eth.
checkGoalReached();
//require minCap not reached
require ((amountRaisedInWei < fundingMinCapInWei)
&& (isCrowdSaleClosed)
&& (now > fundingEndTime)
&& (fundValue[msg.sender] > 0));
//refund Eth sent
uint256 ethRefund = fundValue[msg.sender];
fundValue[msg.sender] = 0;
//send Eth back, burn tokens
msg.sender.transfer(ethRefund);
Refund(msg.sender, ethRefund);
}
function burnRemainingTokens() onlyOwner external {
require(now > fundingEndTime);
uint256 tokensToBurn = tokenReward.balanceOf(this);
tokenReward.burn(tokensToBurn);
}
} | toSmallrtc | function toSmallrtc(uint256 amount) public constant returns (uint256) {
return amount.mul(10**decimals);
}
| // convert tokens to decimals | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
1744,
1869
]
} | 1,003 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | RtcTokenCrowdsale | contract RtcTokenCrowdsale is Ownable, AddressWhitelist {
using SafeMath for uint256;
PausableToken public tokenReward; // address of the token used as reward
// deployment variables for static supply sale
uint256 public initialSupply;
uint256 public tokensRemaining;
uint256 public decimals;
// multi-sig addresses and price variable
address public beneficiaryWallet; // beneficiaryMultiSig (founder group) or wallet account
uint256 public tokensPerEthPrice; // set initial value floating priceVar 10,000 tokens per Eth
// uint256 values for min,max,caps,tracking
uint256 public amountRaisedInWei;
uint256 public fundingMinCapInWei;
// pricing veriable
uint256 public p1_duration;
uint256 public p1_start;
uint256 public p2_start;
uint256 public white_duration;
// loop control, ICO startup and limiters
uint256 public fundingStartTime; // crowdsale start time#
uint256 public fundingEndTime; // crowdsale end time#
bool public isCrowdSaleClosed = false; // crowdsale completion boolean
bool public areFundsReleasedToBeneficiary = false; // boolean for founder to receive Eth or not
bool public isCrowdSaleSetup = false; // boolean for crowdsale setup
// Gas price limit
uint256 maxGasPrice = 50000000000;
event Buy(address indexed _sender, uint256 _eth, uint256 _RTC);
event Refund(address indexed _refunder, uint256 _value);
mapping(address => uint256) fundValue;
// convert tokens to decimals
function toSmallrtc(uint256 amount) public constant returns (uint256) {
return amount.mul(10**decimals);
}
// convert tokens to whole
function toRtc(uint256 amount) public constant returns (uint256) {
return amount.div(10**decimals);
}
function updateMaxGasPrice(uint256 _newGasPrice) public onlyOwner {
require(_newGasPrice != 0);
maxGasPrice = _newGasPrice;
}
// setup the CrowdSale parameters
function setupCrowdsale(uint256 _fundingStartTime) external onlyOwner {
if ((!(isCrowdSaleSetup))
&& (!(beneficiaryWallet > 0))){
// init addresses
tokenReward = PausableToken(0xdb75BFC1ad984c5CeefA8Ec6394596e20d789034);
beneficiaryWallet = 0xf07bd63C5cf404c2f17ab4F9FA1e13fCCEbc5255;
tokensPerEthPrice = 10000; // 1 ETH = 10,000 RTC
// funding targets
fundingMinCapInWei = 350 ether; //350 Eth (min cap) (test = 15) - crowdsale is considered success after this value
// update values
decimals = 18;
amountRaisedInWei = 0;
initialSupply = toSmallrtc(35000000); // 35 million * 18 decimal
tokensRemaining = initialSupply;
fundingStartTime = _fundingStartTime;
white_duration = 2 weeks; // 2 week (test = 2 hour)
p1_duration = 4 weeks; // 4 week (test = 2 hour)
p1_start = fundingStartTime + white_duration;
p2_start = p1_start + p1_duration + 4 weeks; // + 4 week after p1 ends (test = 4 hour)
fundingEndTime = p2_start + 4 weeks; // + 4 week (test = 4 hour)
// configure crowdsale
isCrowdSaleSetup = true;
isCrowdSaleClosed = false;
}
}
function setBonusPrice() public constant returns (uint256 bonus) {
require(isCrowdSaleSetup);
require(p1_start + p1_duration <= p2_start);
if (now >= fundingStartTime && now <= p1_start) { // Private sale Bonus 40% = 4,000 RTC = 1 ETH
bonus = 4000;
} else if (now > p1_start && now <= p1_start + p1_duration) { // Phase-1 Bonus 30% = 3,000 RTC = 1 ETH
bonus = 3000;
} else if (now > p2_start && now <= p2_start + 1 days ) { // Phase-2 1st day Bonus 25% = 2,500 RTC = 1 ETH
bonus = 2500;
} else if (now > p2_start + 1 days && now <= p2_start + 1 weeks ) { // Phase-2 week-1 Bonus 20% = 2,000 RTC = 1 ETH
bonus = 2000;
} else if (now > p2_start + 1 weeks && now <= p2_start + 2 weeks ) { // Phase-2 week-2 Bonus +15% = 1,500 RTC = 1 ETH
bonus = 1500;
} else if (now > p2_start + 2 weeks && now <= p2_start + 3 weeks ) { // Phase-2 week-3 Bonus +10% = 1,000 RTC = 1 ETH
bonus = 1000;
} else if (now > p2_start + 3 weeks && now <= fundingEndTime ) { // Phase-2 final week Bonus 5% = 500 RTC = 1 ETH
bonus = 500;
} else {
revert();
}
}
// p1_duration constant. Only p2 start changes. p2 start cannot be greater than 1 month from p1 end
function updateDuration(uint256 _newP2Start) external onlyOwner { // function to update the duration of phase-1 and adjust the start time of phase-2
require(isCrowdSaleSetup
&& !(p2_start == _newP2Start)
&& !(_newP2Start > p1_start + p1_duration + 30 days)
&& (now < p2_start)
&& (fundingStartTime + p1_duration < _newP2Start));
p2_start = _newP2Start;
fundingEndTime = p2_start.add(4 weeks); // 4 week
}
// default payable function when sending ether to this contract
function () external payable {
require(tx.gasprice <= maxGasPrice);
require(msg.data.length == 0);
BuyRTCtokens();
}
function BuyRTCtokens() public payable {
// conditions (length, crowdsale setup, zero check, exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc)
require(!(msg.value == 0)
&& (isCrowdSaleSetup)
&& (now >= fundingStartTime)
&& (now <= fundingEndTime)
&& (tokensRemaining > 0));
// only whitelisted addresses are allowed during the first day of phase 1
if (now <= p1_start) {
assert(isWhitelisted(msg.sender));
}
uint256 rewardTransferAmount = 0;
uint256 rewardBaseTransferAmount = 0;
uint256 rewardBonusTransferAmount = 0;
uint256 contributionInWei = msg.value;
uint256 refundInWei = 0;
rewardBonusTransferAmount = setBonusPrice();
rewardBaseTransferAmount = (msg.value.mul(tokensPerEthPrice)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardBonusTransferAmount = (msg.value.mul(rewardBonusTransferAmount)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardTransferAmount = rewardBaseTransferAmount.add(rewardBonusTransferAmount);
if (rewardTransferAmount > tokensRemaining) {
uint256 partialPercentage;
partialPercentage = tokensRemaining.mul(10**18).div(rewardTransferAmount);
contributionInWei = contributionInWei.mul(partialPercentage).div(10**18);
rewardBonusTransferAmount = rewardBonusTransferAmount.mul(partialPercentage).div(10**18);
rewardTransferAmount = tokensRemaining;
refundInWei = msg.value.sub(contributionInWei);
}
amountRaisedInWei = amountRaisedInWei.add(contributionInWei);
tokensRemaining = tokensRemaining.sub(rewardTransferAmount); // will cause throw if attempt to purchase over the token limit in one tx or at all once limit reached
fundValue[msg.sender] = fundValue[msg.sender].add(contributionInWei);
assert(tokenReward.increaseFrozen(msg.sender, rewardBonusTransferAmount));
tokenReward.transfer(msg.sender, rewardTransferAmount);
Buy(msg.sender, contributionInWei, rewardTransferAmount);
if (refundInWei > 0) {
msg.sender.transfer(refundInWei);
}
}
function beneficiaryMultiSigWithdraw() external onlyOwner {
checkGoalReached();
require(areFundsReleasedToBeneficiary && (amountRaisedInWei >= fundingMinCapInWei));
beneficiaryWallet.transfer(this.balance);
}
function checkGoalReached() public returns (bytes32 response) { // return crowdfund status to owner for each result case, update public constant
// update state & status variables
require (isCrowdSaleSetup);
if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp <= fundingEndTime && block.timestamp >= fundingStartTime)) { // ICO in progress, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "In progress (Eth < Softcap)";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp < fundingStartTime)) { // ICO has not started
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "Crowdsale is setup";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp > fundingEndTime)) { // ICO ended, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = true;
return "Unsuccessful (Eth < Softcap)";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) { // ICO ended, all tokens gone
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (RTC >= Hardcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.timestamp > fundingEndTime) && (tokensRemaining > 0)) { // ICO ended, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (Eth >= Softcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.timestamp <= fundingEndTime)) { // ICO in progress, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = false;
return "In progress (Eth >= Softcap)!";
}
}
function refund() external { // any contributor can call this to have their Eth returned. user's purchased RTC tokens are burned prior refund of Eth.
checkGoalReached();
//require minCap not reached
require ((amountRaisedInWei < fundingMinCapInWei)
&& (isCrowdSaleClosed)
&& (now > fundingEndTime)
&& (fundValue[msg.sender] > 0));
//refund Eth sent
uint256 ethRefund = fundValue[msg.sender];
fundValue[msg.sender] = 0;
//send Eth back, burn tokens
msg.sender.transfer(ethRefund);
Refund(msg.sender, ethRefund);
}
function burnRemainingTokens() onlyOwner external {
require(now > fundingEndTime);
uint256 tokensToBurn = tokenReward.balanceOf(this);
tokenReward.burn(tokensToBurn);
}
} | toRtc | function toRtc(uint256 amount) public constant returns (uint256) {
return amount.div(10**decimals);
}
| // convert tokens to whole | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
1904,
2024
]
} | 1,004 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | RtcTokenCrowdsale | contract RtcTokenCrowdsale is Ownable, AddressWhitelist {
using SafeMath for uint256;
PausableToken public tokenReward; // address of the token used as reward
// deployment variables for static supply sale
uint256 public initialSupply;
uint256 public tokensRemaining;
uint256 public decimals;
// multi-sig addresses and price variable
address public beneficiaryWallet; // beneficiaryMultiSig (founder group) or wallet account
uint256 public tokensPerEthPrice; // set initial value floating priceVar 10,000 tokens per Eth
// uint256 values for min,max,caps,tracking
uint256 public amountRaisedInWei;
uint256 public fundingMinCapInWei;
// pricing veriable
uint256 public p1_duration;
uint256 public p1_start;
uint256 public p2_start;
uint256 public white_duration;
// loop control, ICO startup and limiters
uint256 public fundingStartTime; // crowdsale start time#
uint256 public fundingEndTime; // crowdsale end time#
bool public isCrowdSaleClosed = false; // crowdsale completion boolean
bool public areFundsReleasedToBeneficiary = false; // boolean for founder to receive Eth or not
bool public isCrowdSaleSetup = false; // boolean for crowdsale setup
// Gas price limit
uint256 maxGasPrice = 50000000000;
event Buy(address indexed _sender, uint256 _eth, uint256 _RTC);
event Refund(address indexed _refunder, uint256 _value);
mapping(address => uint256) fundValue;
// convert tokens to decimals
function toSmallrtc(uint256 amount) public constant returns (uint256) {
return amount.mul(10**decimals);
}
// convert tokens to whole
function toRtc(uint256 amount) public constant returns (uint256) {
return amount.div(10**decimals);
}
function updateMaxGasPrice(uint256 _newGasPrice) public onlyOwner {
require(_newGasPrice != 0);
maxGasPrice = _newGasPrice;
}
// setup the CrowdSale parameters
function setupCrowdsale(uint256 _fundingStartTime) external onlyOwner {
if ((!(isCrowdSaleSetup))
&& (!(beneficiaryWallet > 0))){
// init addresses
tokenReward = PausableToken(0xdb75BFC1ad984c5CeefA8Ec6394596e20d789034);
beneficiaryWallet = 0xf07bd63C5cf404c2f17ab4F9FA1e13fCCEbc5255;
tokensPerEthPrice = 10000; // 1 ETH = 10,000 RTC
// funding targets
fundingMinCapInWei = 350 ether; //350 Eth (min cap) (test = 15) - crowdsale is considered success after this value
// update values
decimals = 18;
amountRaisedInWei = 0;
initialSupply = toSmallrtc(35000000); // 35 million * 18 decimal
tokensRemaining = initialSupply;
fundingStartTime = _fundingStartTime;
white_duration = 2 weeks; // 2 week (test = 2 hour)
p1_duration = 4 weeks; // 4 week (test = 2 hour)
p1_start = fundingStartTime + white_duration;
p2_start = p1_start + p1_duration + 4 weeks; // + 4 week after p1 ends (test = 4 hour)
fundingEndTime = p2_start + 4 weeks; // + 4 week (test = 4 hour)
// configure crowdsale
isCrowdSaleSetup = true;
isCrowdSaleClosed = false;
}
}
function setBonusPrice() public constant returns (uint256 bonus) {
require(isCrowdSaleSetup);
require(p1_start + p1_duration <= p2_start);
if (now >= fundingStartTime && now <= p1_start) { // Private sale Bonus 40% = 4,000 RTC = 1 ETH
bonus = 4000;
} else if (now > p1_start && now <= p1_start + p1_duration) { // Phase-1 Bonus 30% = 3,000 RTC = 1 ETH
bonus = 3000;
} else if (now > p2_start && now <= p2_start + 1 days ) { // Phase-2 1st day Bonus 25% = 2,500 RTC = 1 ETH
bonus = 2500;
} else if (now > p2_start + 1 days && now <= p2_start + 1 weeks ) { // Phase-2 week-1 Bonus 20% = 2,000 RTC = 1 ETH
bonus = 2000;
} else if (now > p2_start + 1 weeks && now <= p2_start + 2 weeks ) { // Phase-2 week-2 Bonus +15% = 1,500 RTC = 1 ETH
bonus = 1500;
} else if (now > p2_start + 2 weeks && now <= p2_start + 3 weeks ) { // Phase-2 week-3 Bonus +10% = 1,000 RTC = 1 ETH
bonus = 1000;
} else if (now > p2_start + 3 weeks && now <= fundingEndTime ) { // Phase-2 final week Bonus 5% = 500 RTC = 1 ETH
bonus = 500;
} else {
revert();
}
}
// p1_duration constant. Only p2 start changes. p2 start cannot be greater than 1 month from p1 end
function updateDuration(uint256 _newP2Start) external onlyOwner { // function to update the duration of phase-1 and adjust the start time of phase-2
require(isCrowdSaleSetup
&& !(p2_start == _newP2Start)
&& !(_newP2Start > p1_start + p1_duration + 30 days)
&& (now < p2_start)
&& (fundingStartTime + p1_duration < _newP2Start));
p2_start = _newP2Start;
fundingEndTime = p2_start.add(4 weeks); // 4 week
}
// default payable function when sending ether to this contract
function () external payable {
require(tx.gasprice <= maxGasPrice);
require(msg.data.length == 0);
BuyRTCtokens();
}
function BuyRTCtokens() public payable {
// conditions (length, crowdsale setup, zero check, exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc)
require(!(msg.value == 0)
&& (isCrowdSaleSetup)
&& (now >= fundingStartTime)
&& (now <= fundingEndTime)
&& (tokensRemaining > 0));
// only whitelisted addresses are allowed during the first day of phase 1
if (now <= p1_start) {
assert(isWhitelisted(msg.sender));
}
uint256 rewardTransferAmount = 0;
uint256 rewardBaseTransferAmount = 0;
uint256 rewardBonusTransferAmount = 0;
uint256 contributionInWei = msg.value;
uint256 refundInWei = 0;
rewardBonusTransferAmount = setBonusPrice();
rewardBaseTransferAmount = (msg.value.mul(tokensPerEthPrice)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardBonusTransferAmount = (msg.value.mul(rewardBonusTransferAmount)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardTransferAmount = rewardBaseTransferAmount.add(rewardBonusTransferAmount);
if (rewardTransferAmount > tokensRemaining) {
uint256 partialPercentage;
partialPercentage = tokensRemaining.mul(10**18).div(rewardTransferAmount);
contributionInWei = contributionInWei.mul(partialPercentage).div(10**18);
rewardBonusTransferAmount = rewardBonusTransferAmount.mul(partialPercentage).div(10**18);
rewardTransferAmount = tokensRemaining;
refundInWei = msg.value.sub(contributionInWei);
}
amountRaisedInWei = amountRaisedInWei.add(contributionInWei);
tokensRemaining = tokensRemaining.sub(rewardTransferAmount); // will cause throw if attempt to purchase over the token limit in one tx or at all once limit reached
fundValue[msg.sender] = fundValue[msg.sender].add(contributionInWei);
assert(tokenReward.increaseFrozen(msg.sender, rewardBonusTransferAmount));
tokenReward.transfer(msg.sender, rewardTransferAmount);
Buy(msg.sender, contributionInWei, rewardTransferAmount);
if (refundInWei > 0) {
msg.sender.transfer(refundInWei);
}
}
function beneficiaryMultiSigWithdraw() external onlyOwner {
checkGoalReached();
require(areFundsReleasedToBeneficiary && (amountRaisedInWei >= fundingMinCapInWei));
beneficiaryWallet.transfer(this.balance);
}
function checkGoalReached() public returns (bytes32 response) { // return crowdfund status to owner for each result case, update public constant
// update state & status variables
require (isCrowdSaleSetup);
if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp <= fundingEndTime && block.timestamp >= fundingStartTime)) { // ICO in progress, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "In progress (Eth < Softcap)";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp < fundingStartTime)) { // ICO has not started
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "Crowdsale is setup";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp > fundingEndTime)) { // ICO ended, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = true;
return "Unsuccessful (Eth < Softcap)";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) { // ICO ended, all tokens gone
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (RTC >= Hardcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.timestamp > fundingEndTime) && (tokensRemaining > 0)) { // ICO ended, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (Eth >= Softcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.timestamp <= fundingEndTime)) { // ICO in progress, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = false;
return "In progress (Eth >= Softcap)!";
}
}
function refund() external { // any contributor can call this to have their Eth returned. user's purchased RTC tokens are burned prior refund of Eth.
checkGoalReached();
//require minCap not reached
require ((amountRaisedInWei < fundingMinCapInWei)
&& (isCrowdSaleClosed)
&& (now > fundingEndTime)
&& (fundValue[msg.sender] > 0));
//refund Eth sent
uint256 ethRefund = fundValue[msg.sender];
fundValue[msg.sender] = 0;
//send Eth back, burn tokens
msg.sender.transfer(ethRefund);
Refund(msg.sender, ethRefund);
}
function burnRemainingTokens() onlyOwner external {
require(now > fundingEndTime);
uint256 tokensToBurn = tokenReward.balanceOf(this);
tokenReward.burn(tokensToBurn);
}
} | setupCrowdsale | function setupCrowdsale(uint256 _fundingStartTime) external onlyOwner {
if ((!(isCrowdSaleSetup))
&& (!(beneficiaryWallet > 0))){
// init addresses
tokenReward = PausableToken(0xdb75BFC1ad984c5CeefA8Ec6394596e20d789034);
beneficiaryWallet = 0xf07bd63C5cf404c2f17ab4F9FA1e13fCCEbc5255;
tokensPerEthPrice = 10000; // 1 ETH = 10,000 RTC
// funding targets
fundingMinCapInWei = 350 ether; //350 Eth (min cap) (test = 15) - crowdsale is considered success after this value
// update values
decimals = 18;
amountRaisedInWei = 0;
initialSupply = toSmallrtc(35000000); // 35 million * 18 decimal
tokensRemaining = initialSupply;
fundingStartTime = _fundingStartTime;
white_duration = 2 weeks; // 2 week (test = 2 hour)
p1_duration = 4 weeks; // 4 week (test = 2 hour)
p1_start = fundingStartTime + white_duration;
p2_start = p1_start + p1_duration + 4 weeks; // + 4 week after p1 ends (test = 4 hour)
fundingEndTime = p2_start + 4 weeks; // + 4 week (test = 4 hour)
// configure crowdsale
isCrowdSaleSetup = true;
isCrowdSaleClosed = false;
}
}
| // setup the CrowdSale parameters | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
2222,
4085
]
} | 1,005 |
|||
RtcTokenCrowdsale | RtcTokenCrowdsale.sol | 0xa988a5808f8b839fe65ec75fd5d5a005b59a466d | Solidity | RtcTokenCrowdsale | contract RtcTokenCrowdsale is Ownable, AddressWhitelist {
using SafeMath for uint256;
PausableToken public tokenReward; // address of the token used as reward
// deployment variables for static supply sale
uint256 public initialSupply;
uint256 public tokensRemaining;
uint256 public decimals;
// multi-sig addresses and price variable
address public beneficiaryWallet; // beneficiaryMultiSig (founder group) or wallet account
uint256 public tokensPerEthPrice; // set initial value floating priceVar 10,000 tokens per Eth
// uint256 values for min,max,caps,tracking
uint256 public amountRaisedInWei;
uint256 public fundingMinCapInWei;
// pricing veriable
uint256 public p1_duration;
uint256 public p1_start;
uint256 public p2_start;
uint256 public white_duration;
// loop control, ICO startup and limiters
uint256 public fundingStartTime; // crowdsale start time#
uint256 public fundingEndTime; // crowdsale end time#
bool public isCrowdSaleClosed = false; // crowdsale completion boolean
bool public areFundsReleasedToBeneficiary = false; // boolean for founder to receive Eth or not
bool public isCrowdSaleSetup = false; // boolean for crowdsale setup
// Gas price limit
uint256 maxGasPrice = 50000000000;
event Buy(address indexed _sender, uint256 _eth, uint256 _RTC);
event Refund(address indexed _refunder, uint256 _value);
mapping(address => uint256) fundValue;
// convert tokens to decimals
function toSmallrtc(uint256 amount) public constant returns (uint256) {
return amount.mul(10**decimals);
}
// convert tokens to whole
function toRtc(uint256 amount) public constant returns (uint256) {
return amount.div(10**decimals);
}
function updateMaxGasPrice(uint256 _newGasPrice) public onlyOwner {
require(_newGasPrice != 0);
maxGasPrice = _newGasPrice;
}
// setup the CrowdSale parameters
function setupCrowdsale(uint256 _fundingStartTime) external onlyOwner {
if ((!(isCrowdSaleSetup))
&& (!(beneficiaryWallet > 0))){
// init addresses
tokenReward = PausableToken(0xdb75BFC1ad984c5CeefA8Ec6394596e20d789034);
beneficiaryWallet = 0xf07bd63C5cf404c2f17ab4F9FA1e13fCCEbc5255;
tokensPerEthPrice = 10000; // 1 ETH = 10,000 RTC
// funding targets
fundingMinCapInWei = 350 ether; //350 Eth (min cap) (test = 15) - crowdsale is considered success after this value
// update values
decimals = 18;
amountRaisedInWei = 0;
initialSupply = toSmallrtc(35000000); // 35 million * 18 decimal
tokensRemaining = initialSupply;
fundingStartTime = _fundingStartTime;
white_duration = 2 weeks; // 2 week (test = 2 hour)
p1_duration = 4 weeks; // 4 week (test = 2 hour)
p1_start = fundingStartTime + white_duration;
p2_start = p1_start + p1_duration + 4 weeks; // + 4 week after p1 ends (test = 4 hour)
fundingEndTime = p2_start + 4 weeks; // + 4 week (test = 4 hour)
// configure crowdsale
isCrowdSaleSetup = true;
isCrowdSaleClosed = false;
}
}
function setBonusPrice() public constant returns (uint256 bonus) {
require(isCrowdSaleSetup);
require(p1_start + p1_duration <= p2_start);
if (now >= fundingStartTime && now <= p1_start) { // Private sale Bonus 40% = 4,000 RTC = 1 ETH
bonus = 4000;
} else if (now > p1_start && now <= p1_start + p1_duration) { // Phase-1 Bonus 30% = 3,000 RTC = 1 ETH
bonus = 3000;
} else if (now > p2_start && now <= p2_start + 1 days ) { // Phase-2 1st day Bonus 25% = 2,500 RTC = 1 ETH
bonus = 2500;
} else if (now > p2_start + 1 days && now <= p2_start + 1 weeks ) { // Phase-2 week-1 Bonus 20% = 2,000 RTC = 1 ETH
bonus = 2000;
} else if (now > p2_start + 1 weeks && now <= p2_start + 2 weeks ) { // Phase-2 week-2 Bonus +15% = 1,500 RTC = 1 ETH
bonus = 1500;
} else if (now > p2_start + 2 weeks && now <= p2_start + 3 weeks ) { // Phase-2 week-3 Bonus +10% = 1,000 RTC = 1 ETH
bonus = 1000;
} else if (now > p2_start + 3 weeks && now <= fundingEndTime ) { // Phase-2 final week Bonus 5% = 500 RTC = 1 ETH
bonus = 500;
} else {
revert();
}
}
// p1_duration constant. Only p2 start changes. p2 start cannot be greater than 1 month from p1 end
function updateDuration(uint256 _newP2Start) external onlyOwner { // function to update the duration of phase-1 and adjust the start time of phase-2
require(isCrowdSaleSetup
&& !(p2_start == _newP2Start)
&& !(_newP2Start > p1_start + p1_duration + 30 days)
&& (now < p2_start)
&& (fundingStartTime + p1_duration < _newP2Start));
p2_start = _newP2Start;
fundingEndTime = p2_start.add(4 weeks); // 4 week
}
// default payable function when sending ether to this contract
function () external payable {
require(tx.gasprice <= maxGasPrice);
require(msg.data.length == 0);
BuyRTCtokens();
}
function BuyRTCtokens() public payable {
// conditions (length, crowdsale setup, zero check, exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc)
require(!(msg.value == 0)
&& (isCrowdSaleSetup)
&& (now >= fundingStartTime)
&& (now <= fundingEndTime)
&& (tokensRemaining > 0));
// only whitelisted addresses are allowed during the first day of phase 1
if (now <= p1_start) {
assert(isWhitelisted(msg.sender));
}
uint256 rewardTransferAmount = 0;
uint256 rewardBaseTransferAmount = 0;
uint256 rewardBonusTransferAmount = 0;
uint256 contributionInWei = msg.value;
uint256 refundInWei = 0;
rewardBonusTransferAmount = setBonusPrice();
rewardBaseTransferAmount = (msg.value.mul(tokensPerEthPrice)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardBonusTransferAmount = (msg.value.mul(rewardBonusTransferAmount)); // Since both ether and RTC have 18 decimals, No need of conversion
rewardTransferAmount = rewardBaseTransferAmount.add(rewardBonusTransferAmount);
if (rewardTransferAmount > tokensRemaining) {
uint256 partialPercentage;
partialPercentage = tokensRemaining.mul(10**18).div(rewardTransferAmount);
contributionInWei = contributionInWei.mul(partialPercentage).div(10**18);
rewardBonusTransferAmount = rewardBonusTransferAmount.mul(partialPercentage).div(10**18);
rewardTransferAmount = tokensRemaining;
refundInWei = msg.value.sub(contributionInWei);
}
amountRaisedInWei = amountRaisedInWei.add(contributionInWei);
tokensRemaining = tokensRemaining.sub(rewardTransferAmount); // will cause throw if attempt to purchase over the token limit in one tx or at all once limit reached
fundValue[msg.sender] = fundValue[msg.sender].add(contributionInWei);
assert(tokenReward.increaseFrozen(msg.sender, rewardBonusTransferAmount));
tokenReward.transfer(msg.sender, rewardTransferAmount);
Buy(msg.sender, contributionInWei, rewardTransferAmount);
if (refundInWei > 0) {
msg.sender.transfer(refundInWei);
}
}
function beneficiaryMultiSigWithdraw() external onlyOwner {
checkGoalReached();
require(areFundsReleasedToBeneficiary && (amountRaisedInWei >= fundingMinCapInWei));
beneficiaryWallet.transfer(this.balance);
}
function checkGoalReached() public returns (bytes32 response) { // return crowdfund status to owner for each result case, update public constant
// update state & status variables
require (isCrowdSaleSetup);
if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp <= fundingEndTime && block.timestamp >= fundingStartTime)) { // ICO in progress, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "In progress (Eth < Softcap)";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp < fundingStartTime)) { // ICO has not started
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "Crowdsale is setup";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp > fundingEndTime)) { // ICO ended, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = true;
return "Unsuccessful (Eth < Softcap)";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) { // ICO ended, all tokens gone
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (RTC >= Hardcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.timestamp > fundingEndTime) && (tokensRemaining > 0)) { // ICO ended, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (Eth >= Softcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.timestamp <= fundingEndTime)) { // ICO in progress, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = false;
return "In progress (Eth >= Softcap)!";
}
}
function refund() external { // any contributor can call this to have their Eth returned. user's purchased RTC tokens are burned prior refund of Eth.
checkGoalReached();
//require minCap not reached
require ((amountRaisedInWei < fundingMinCapInWei)
&& (isCrowdSaleClosed)
&& (now > fundingEndTime)
&& (fundValue[msg.sender] > 0));
//refund Eth sent
uint256 ethRefund = fundValue[msg.sender];
fundValue[msg.sender] = 0;
//send Eth back, burn tokens
msg.sender.transfer(ethRefund);
Refund(msg.sender, ethRefund);
}
function burnRemainingTokens() onlyOwner external {
require(now > fundingEndTime);
uint256 tokensToBurn = tokenReward.balanceOf(this);
tokenReward.burn(tokensToBurn);
}
} | updateDuration | function updateDuration(uint256 _newP2Start) external onlyOwner { // function to update the duration of phase-1 and adjust the start time of phase-2
require(isCrowdSaleSetup
&& !(p2_start == _newP2Start)
&& !(_newP2Start > p1_start + p1_duration + 30 days)
&& (now < p2_start)
&& (fundingStartTime + p1_duration < _newP2Start));
p2_start = _newP2Start;
fundingEndTime = p2_start.add(4 weeks); // 4 week
}
| // p1_duration constant. Only p2 start changes. p2 start cannot be greater than 1 month from p1 end | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa | {
"func_code_index": [
5441,
5936
]
} | 1,006 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.