Skip to content

Commit

Permalink
Merge branch 'develop' into NDEV-3491-update-eip1559-tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	integration/tests/conftest.py
  • Loading branch information
IvanAdamovNeon committed Feb 21, 2025
2 parents 0b81b44 + fc33dec commit 19e0c9c
Show file tree
Hide file tree
Showing 26 changed files with 3,281 additions and 42 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ jobs:
- name: Run basic proxy tests
timeout-minutes: 60
run: |
CMD="python3 ./clickfile.py run basic --network ${{ env.NETWORK }} --numprocesses ${{ env.NUMPROCESSES }} --case \"${{ github.event.inputs.pytest_k}}\" --marker \"${{ github.event.inputs.pytest_m}}\""
if [ "${{ github.event.schedule }}" == "0 1 * * 0,1,2,3,4" ]; then
CMD="python3 ./clickfile.py run basic_extended --network ${{ env.NETWORK }} --numprocesses ${{ env.NUMPROCESSES }} --case \"${{ github.event.inputs.pytest_k}}\" --marker \"${{ github.event.inputs.pytest_m}}\""
else
CMD="python3 ./clickfile.py run basic --network ${{ env.NETWORK }} --numprocesses ${{ env.NUMPROCESSES }} --case \"${{ github.event.inputs.pytest_k}}\" --marker \"${{ github.event.inputs.pytest_m}}\""
fi
if [[ "${{ env.GENERATE_COST_REPORT }}" == "true" ]]; then
CMD="$CMD --cost_reports_dir reports/cost_reports"
Expand Down Expand Up @@ -317,4 +321,4 @@ jobs:
evm_tests="${{ needs.run-evm-tests.outputs.test-group }}"
FAILED_TEST_GROUP="${proxy_tests:-evm_tests}"
python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \
-b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group $FAILED_TEST_GROUP
-b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group $FAILED_TEST_GROUP
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
- id: trailing-whitespace
- id: check-yaml
args: [ --allow-multiple-documents ]
- id: detect-private-key

# Formatter
- repo: https://github.com/psf/black
Expand All @@ -21,4 +22,3 @@ repos:

# TODO
# Add .lock file
# Add detect-private-key (now it has one)
22 changes: 18 additions & 4 deletions clickfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,12 @@ def update_contracts(branch):
update_contracts_from_git(HOODIES_CHAINLINK_GITHUB_URL, "hoodies_chainlink", "main")

# uncomment for new version of erc20ForSpl
# update_contracts_from_git(
# f"https://github.com/{DOCKER_HUB_ORG_NAME}/neon-contracts.git", "neon-contracts", "main", update_npm=False
# )
# subprocess.check_call(f'npm ci --prefix {EXTERNAL_CONTRACT_PATH / "neon-contracts" / "ERC20ForSPL"}', shell=True)
update_contracts_from_git(
"https://github.com/neonevm/neon-contracts.git",
"neon-contracts",
"update/erc20forspl-solana-native",
update_npm=True,
)


@cli.command(help="Run any type of tests")
Expand Down Expand Up @@ -574,6 +576,18 @@ def run(
if name == "economy":
command = "py.test integration/tests/economy/test_economics.py"
elif name == "basic":
# run basic excluding tests for ERC20SPLNew contract
if network == "mainnet":
command = (
"py.test integration/tests/basic -m mainnet --ignore=integration/tests/basic/erc/test_ERC20SPLnew.py"
)
else:
command = "py.test integration/tests/basic --ignore=integration/tests/basic/erc/test_ERC20SPLnew.py"
if numprocesses:
command = f"{command} --numprocesses {numprocesses} --dist loadgroup"

elif name == "basic_extended":
# run basic excluding tests for ERC20SPLNew contract
if network == "mainnet":
command = "py.test integration/tests/basic -m mainnet"
else:
Expand Down
479 changes: 479 additions & 0 deletions contracts/EIPs/ERC20/ERC20ForSplBackbone.sol

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions contracts/EIPs/ERC20/MultipleActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ contract MultipleActionsERC20 {
erc20.transfer(transfer_to, transfer_amount);
}


function transferReadBalanceTransfer(
uint256 transfer_amount,
address transfer_to
Expand Down Expand Up @@ -151,6 +150,37 @@ contract MultipleActionsERC20 {
erc20.transfer(transfer_to, mint_amount2);
}


function mintMintTransferTransferBurn(
address transfer_to,
uint256 mint_amount1,
uint256 mint_amount2,
uint256 transfer_amount_1,
uint256 transfer_amount_2,
uint256 burn_amount
) public {
erc20.mint(address(this), mint_amount1);
erc20.mint(address(this), mint_amount2);
erc20.transfer(transfer_to, transfer_amount_1);
erc20.transfer(transfer_to, transfer_amount_2);
erc20.burn(burn_amount);
}

function transferFiveTimes(
address transfer_to,
uint256 transfer_amount_1,
uint256 transfer_amount_2,
uint256 transfer_amount_3,
uint256 transfer_amount_4,
uint256 transfer_amount_5
) public {
erc20.transfer(transfer_to, transfer_amount_1);
erc20.transfer(transfer_to, transfer_amount_2);
erc20.transfer(transfer_to, transfer_amount_3);
erc20.transfer(transfer_to, transfer_amount_4);
erc20.transfer(transfer_to, transfer_amount_5);
}

function mintMintTransferTransferMintMintTransferTransfer( // 17 Solana transactions
uint256 mint_amount1,
uint256 mint_amount2,
Expand All @@ -165,4 +195,5 @@ contract MultipleActionsERC20 {
erc20.transfer(transfer_to, mint_amount1);
erc20.transfer(transfer_to, mint_amount2);
}
}

}
199 changes: 199 additions & 0 deletions contracts/EIPs/ERC20/MultipleActionsNew.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
pragma solidity >=0.7.0;

import {ERC20ForSplMintable} from "../../external/neon-contracts/contracts/token/ERC20ForSpl/erc20_for_spl.sol";

pragma abicoder v2;

contract MultipleActionsERC20New {
uint256 data;
ERC20ForSplMintable erc20;

constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
erc20 = new ERC20ForSplMintable(
_name,
_symbol,
_decimals,
address(this)
);
}

function balance(address who) public view returns (uint256) {
return erc20.balanceOf(who);
}

function contractBalance() public view returns (uint256) {
return erc20.balanceOf(address(this));
}

function mintTransferBurn(
uint256 mint_amount,
address transfer_to,
uint256 transfer_amount,
uint256 burn_amount
) public {
erc20.mint(address(this), mint_amount);
erc20.transfer(transfer_to, transfer_amount);
erc20.burn(burn_amount);
}

function mintBurnTransfer(
uint256 mint_amount,
uint256 burn_amount,
address transfer_to,
uint256 transfer_amount
) public {
erc20.mint(address(this), mint_amount);
erc20.burn(burn_amount);
erc20.transfer(transfer_to, transfer_amount);
}

function mintTransferTransfer(
uint256 mint_amount,
address transfer_to_1,
uint256 transfer_amount_1,
address transfer_to_2,
uint256 transfer_amount_2
) public {
erc20.mint(address(this), mint_amount);
erc20.transfer(transfer_to_1, transfer_amount_1);
erc20.transfer(transfer_to_2, transfer_amount_2);
}

function transferMintBurn(
address transfer_to,
uint256 transfer_amount,
uint256 mint_amount,
uint256 burn_amount
) public {
erc20.transfer(transfer_to, transfer_amount);
erc20.mint(address(this), mint_amount);
erc20.burn(burn_amount);
}

function transferMintTransferBurn(
address transfer_to,
uint256 transfer_amount_1,
uint256 mint_amount,
uint256 transfer_amount_2,
uint256 burn_amount
) public {
erc20.transfer(transfer_to, transfer_amount_1);
erc20.mint(address(this), mint_amount);
erc20.transfer(transfer_to, transfer_amount_2);
erc20.burn(burn_amount);
}

function burnTransferBurnTransfer(
uint256 burn_amount_1,
address transfer_to_1,
uint256 transfer_amount_1,
uint256 burn_amount_2,
address transfer_to_2,
uint256 transfer_amount_2
) public {
erc20.burn(burn_amount_1);
erc20.transfer(transfer_to_1, transfer_amount_1);
erc20.burn(burn_amount_2);
erc20.transfer(transfer_to_2, transfer_amount_2);
}

function mint(uint256 amount) public {
erc20.mint(address(this), amount);
}

function burnMintTransfer(
uint256 burn_amount,
uint256 mint_amount,
address transfer_to,
uint256 transfer_amount
) public {
erc20.burn(burn_amount);
erc20.mint(address(this), mint_amount);
erc20.transfer(transfer_to, transfer_amount);
}

function transferReadBalanceTransfer(
uint256 transfer_amount,
address transfer_to
) public {
uint current_balance;
uint balance_before = erc20.balanceOf(address(this));
uint expected_balance = balance_before - transfer_amount;
erc20.transfer(transfer_to, transfer_amount);
for (uint256 i = 0; i < 50; i++) {
current_balance = erc20.balanceOf(address(this));
require(current_balance == expected_balance, "balance not updated");
}
erc20.transfer(transfer_to, transfer_amount);
}

function mintMint(
uint256 mint_amount1,
uint256 mint_amount2
) public {
erc20.mint(address(this), mint_amount1);
erc20.mint(address(this), mint_amount2);
}

function mintMintTransferTransfer(
uint256 mint_amount1,
uint256 mint_amount2,
address transfer_to
) public {
erc20.mint(address(this), mint_amount1);
erc20.mint(address(this), mint_amount2);
erc20.transfer(transfer_to, mint_amount1);
erc20.transfer(transfer_to, mint_amount2);
}


function mintMintTransferTransferBurn(
address transfer_to,
uint256 mint_amount1,
uint256 mint_amount2,
uint256 transfer_amount_1,
uint256 transfer_amount_2,
uint256 burn_amount
) public {
erc20.mint(address(this), mint_amount1);
erc20.mint(address(this), mint_amount2);
erc20.transfer(transfer_to, transfer_amount_1);
erc20.transfer(transfer_to, transfer_amount_2);
erc20.burn(burn_amount);
}

function transferFiveTimes(
address transfer_to,
uint256 transfer_amount_1,
uint256 transfer_amount_2,
uint256 transfer_amount_3,
uint256 transfer_amount_4,
uint256 transfer_amount_5
) public {
erc20.transfer(transfer_to, transfer_amount_1);
erc20.transfer(transfer_to, transfer_amount_2);
erc20.transfer(transfer_to, transfer_amount_3);
erc20.transfer(transfer_to, transfer_amount_4);
erc20.transfer(transfer_to, transfer_amount_5);
}

function mintMintTransferTransferMintMintTransferTransfer( // 17 Solana transactions
uint256 mint_amount1,
uint256 mint_amount2,
address transfer_to
) public {
erc20.mint(address(this), mint_amount1);
erc20.mint(address(this), mint_amount2);
erc20.transfer(transfer_to, mint_amount1);
erc20.transfer(transfer_to, mint_amount2);
erc20.mint(address(this), mint_amount1);
erc20.mint(address(this), mint_amount2);
erc20.transfer(transfer_to, mint_amount1);
erc20.transfer(transfer_to, mint_amount2);
}

}
Loading

0 comments on commit 19e0c9c

Please sign in to comment.