-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding solc tests and replication in Rust of TS test for slang
- Loading branch information
1 parent
45d7b65
commit 23382e6
Showing
120 changed files
with
88,155 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...sts/src/compilation/inputs/0x00e50FAB64eBB37b87df06Aa46b8B35d5f1A4e1A/contracts/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"./misc/UiPoolDataProviderV2V3.sol": { | ||
"urls": [ | ||
"./misc/UiPoolDataProviderV2V3.sol" | ||
] | ||
} | ||
}, | ||
"settings": { | ||
"outputSelection": { | ||
"*": { | ||
"": [ | ||
"ast" | ||
] | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...tests/src/compilation/inputs/0x015E220901014BAE4f7e168925CD74e725e23692/sources/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"DoodledBears.sol": { | ||
"urls": [ | ||
"DoodledBears.sol" | ||
] | ||
} | ||
}, | ||
"settings": { | ||
"outputSelection": { | ||
"*": { | ||
"": [ | ||
"ast" | ||
] | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ts/src/compilation/inputs/0x01665987bC6725070e56d160d75AA19d8B73273e/constructor-args.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0x000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000006e25cfa7e590b0d2a86c3f3d60c78e2816b74df0000000000000000000000000d5e73559b01163199c0176231bae64795b4bb70200000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004544553540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045445535400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c68747470733a2f2f6173736574732e77656e6d696e742e636f6d2f6d657461646174612f77656e6d696e742f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000098ee85e7cc2665261d9fd3ea53f2db4491c547e3000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dab1a1854214684ace522439684a145e625052330000000000000000000000000000000000000000000000000000000000000000 |
1 change: 1 addition & 0 deletions
1
...sts/src/compilation/inputs/0x01665987bC6725070e56d160d75AA19d8B73273e/creator-tx-hash.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0xddc6b7c1f88710f2d0e2807428ab2909a0553ac69b77a8c9e4afceef6689de3c |
1 change: 1 addition & 0 deletions
1
...npm/tests/src/compilation/inputs/0x01665987bC6725070e56d160d75AA19d8B73273e/metadata.json
Large diffs are not rendered by default.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
...665987bC6725070e56d160d75AA19d8B73273e/sources/@openzeppelin/contracts/access/Ownable.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../utils/Context.sol"; | ||
|
||
/** | ||
* @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. | ||
*/ | ||
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() { | ||
_transferOwnership(_msgSender()); | ||
} | ||
|
||
/** | ||
* @dev Throws if called by any account other than the owner. | ||
*/ | ||
modifier onlyOwner() { | ||
_checkOwner(); | ||
_; | ||
} | ||
|
||
/** | ||
* @dev Returns the address of the current owner. | ||
*/ | ||
function owner() public view virtual returns (address) { | ||
return _owner; | ||
} | ||
|
||
/** | ||
* @dev Throws if the sender is not the owner. | ||
*/ | ||
function _checkOwner() internal view virtual { | ||
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 { | ||
_transferOwnership(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"); | ||
_transferOwnership(newOwner); | ||
} | ||
|
||
/** | ||
* @dev Transfers ownership of the contract to a new account (`newOwner`). | ||
* Internal function without access restriction. | ||
*/ | ||
function _transferOwnership(address newOwner) internal virtual { | ||
address oldOwner = _owner; | ||
_owner = newOwner; | ||
emit OwnershipTransferred(oldOwner, newOwner); | ||
} | ||
} |
214 changes: 214 additions & 0 deletions
214
...725070e56d160d75AA19d8B73273e/sources/@openzeppelin/contracts/finance/PaymentSplitter.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../token/ERC20/utils/SafeERC20.sol"; | ||
import "../utils/Address.sol"; | ||
import "../utils/Context.sol"; | ||
|
||
/** | ||
* @title PaymentSplitter | ||
* @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware | ||
* that the Ether will be split in this way, since it is handled transparently by the contract. | ||
* | ||
* The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each | ||
* account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim | ||
* an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the | ||
* time of contract deployment and can't be updated thereafter. | ||
* | ||
* `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the | ||
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} | ||
* function. | ||
* | ||
* NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and | ||
* tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you | ||
* to run tests before sending real value to this contract. | ||
*/ | ||
contract PaymentSplitter is Context { | ||
event PayeeAdded(address account, uint256 shares); | ||
event PaymentReleased(address to, uint256 amount); | ||
event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); | ||
event PaymentReceived(address from, uint256 amount); | ||
|
||
uint256 private _totalShares; | ||
uint256 private _totalReleased; | ||
|
||
mapping(address => uint256) private _shares; | ||
mapping(address => uint256) private _released; | ||
address[] private _payees; | ||
|
||
mapping(IERC20 => uint256) private _erc20TotalReleased; | ||
mapping(IERC20 => mapping(address => uint256)) private _erc20Released; | ||
|
||
/** | ||
* @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at | ||
* the matching position in the `shares` array. | ||
* | ||
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no | ||
* duplicates in `payees`. | ||
*/ | ||
constructor(address[] memory payees, uint256[] memory shares_) payable { | ||
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); | ||
require(payees.length > 0, "PaymentSplitter: no payees"); | ||
|
||
for (uint256 i = 0; i < payees.length; i++) { | ||
_addPayee(payees[i], shares_[i]); | ||
} | ||
} | ||
|
||
/** | ||
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully | ||
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the | ||
* reliability of the events, and not the actual splitting of Ether. | ||
* | ||
* To learn more about this see the Solidity documentation for | ||
* https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback | ||
* functions]. | ||
*/ | ||
receive() external payable virtual { | ||
emit PaymentReceived(_msgSender(), msg.value); | ||
} | ||
|
||
/** | ||
* @dev Getter for the total shares held by payees. | ||
*/ | ||
function totalShares() public view returns (uint256) { | ||
return _totalShares; | ||
} | ||
|
||
/** | ||
* @dev Getter for the total amount of Ether already released. | ||
*/ | ||
function totalReleased() public view returns (uint256) { | ||
return _totalReleased; | ||
} | ||
|
||
/** | ||
* @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 | ||
* contract. | ||
*/ | ||
function totalReleased(IERC20 token) public view returns (uint256) { | ||
return _erc20TotalReleased[token]; | ||
} | ||
|
||
/** | ||
* @dev Getter for the amount of shares held by an account. | ||
*/ | ||
function shares(address account) public view returns (uint256) { | ||
return _shares[account]; | ||
} | ||
|
||
/** | ||
* @dev Getter for the amount of Ether already released to a payee. | ||
*/ | ||
function released(address account) public view returns (uint256) { | ||
return _released[account]; | ||
} | ||
|
||
/** | ||
* @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an | ||
* IERC20 contract. | ||
*/ | ||
function released(IERC20 token, address account) public view returns (uint256) { | ||
return _erc20Released[token][account]; | ||
} | ||
|
||
/** | ||
* @dev Getter for the address of the payee number `index`. | ||
*/ | ||
function payee(uint256 index) public view returns (address) { | ||
return _payees[index]; | ||
} | ||
|
||
/** | ||
* @dev Getter for the amount of payee's releasable Ether. | ||
*/ | ||
function releasable(address account) public view returns (uint256) { | ||
uint256 totalReceived = address(this).balance + totalReleased(); | ||
return _pendingPayment(account, totalReceived, released(account)); | ||
} | ||
|
||
/** | ||
* @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an | ||
* IERC20 contract. | ||
*/ | ||
function releasable(IERC20 token, address account) public view returns (uint256) { | ||
uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); | ||
return _pendingPayment(account, totalReceived, released(token, account)); | ||
} | ||
|
||
/** | ||
* @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the | ||
* total shares and their previous withdrawals. | ||
*/ | ||
function release(address payable account) public virtual { | ||
require(_shares[account] > 0, "PaymentSplitter: account has no shares"); | ||
|
||
uint256 payment = releasable(account); | ||
|
||
require(payment != 0, "PaymentSplitter: account is not due payment"); | ||
|
||
// _totalReleased is the sum of all values in _released. | ||
// If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. | ||
_totalReleased += payment; | ||
unchecked { | ||
_released[account] += payment; | ||
} | ||
|
||
Address.sendValue(account, payment); | ||
emit PaymentReleased(account, payment); | ||
} | ||
|
||
/** | ||
* @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their | ||
* percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 | ||
* contract. | ||
*/ | ||
function release(IERC20 token, address account) public virtual { | ||
require(_shares[account] > 0, "PaymentSplitter: account has no shares"); | ||
|
||
uint256 payment = releasable(token, account); | ||
|
||
require(payment != 0, "PaymentSplitter: account is not due payment"); | ||
|
||
// _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. | ||
// If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment" | ||
// cannot overflow. | ||
_erc20TotalReleased[token] += payment; | ||
unchecked { | ||
_erc20Released[token][account] += payment; | ||
} | ||
|
||
SafeERC20.safeTransfer(token, account, payment); | ||
emit ERC20PaymentReleased(token, account, payment); | ||
} | ||
|
||
/** | ||
* @dev internal logic for computing the pending payment of an `account` given the token historical balances and | ||
* already released amounts. | ||
*/ | ||
function _pendingPayment( | ||
address account, | ||
uint256 totalReceived, | ||
uint256 alreadyReleased | ||
) private view returns (uint256) { | ||
return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; | ||
} | ||
|
||
/** | ||
* @dev Add a new payee to the contract. | ||
* @param account The address of the payee to add. | ||
* @param shares_ The number of shares owned by the payee. | ||
*/ | ||
function _addPayee(address account, uint256 shares_) private { | ||
require(account != address(0), "PaymentSplitter: account is the zero address"); | ||
require(shares_ > 0, "PaymentSplitter: shares are 0"); | ||
require(_shares[account] == 0, "PaymentSplitter: account already has shares"); | ||
|
||
_payees.push(account); | ||
_shares[account] = shares_; | ||
_totalShares = _totalShares + shares_; | ||
emit PayeeAdded(account, shares_); | ||
} | ||
} |
Oops, something went wrong.