Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪲 Fix MyOFT test in OFT example #399

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/kind-meals-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@layerzerolabs/oft-example": patch
---

Fix OFT example tests
18 changes: 18 additions & 0 deletions examples/oft/contracts/mocks/MyOFTMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;

import { MyOFT } from "../MyOFT.sol";

// @dev WARNING: This is for testing purposes only
contract MyOFTMock is MyOFT {
constructor(
string memory _name,
string memory _symbol,
address _lzEndpoint,
address _delegate
) MyOFT(_name, _symbol, _lzEndpoint, _delegate) {}

function mint(address _to, uint256 _amount) public {
_mint(_to, _amount);
}
}
60 changes: 0 additions & 60 deletions examples/oft/contracts/mocks/OFTMock.sol

This file was deleted.

4 changes: 3 additions & 1 deletion examples/oft/test/hardhat/MyOFT.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
// Before hook for setup that runs once before all tests in the block
before(async function () {
// Contract factory for our tested contract
MyOFT = await ethers.getContractFactory('OFTMock')
//
// We are using a derived contract that exposes a mint() function for testing purposes
MyOFT = await ethers.getContractFactory('MyOFTMock')

// Fetching the first three signers (accounts) from Hardhat's local Ethereum network
const signers = await ethers.getSigners()

ownerA = signers.at(0)!

Check warning on line 33 in examples/oft/test/hardhat/MyOFT.test.ts

View workflow job for this annotation

GitHub Actions / Check code / Build & Lint

Forbidden non-null assertion
ownerB = signers.at(1)!

Check warning on line 34 in examples/oft/test/hardhat/MyOFT.test.ts

View workflow job for this annotation

GitHub Actions / Check code / Build & Lint

Forbidden non-null assertion
endpointOwner = signers.at(2)!

Check warning on line 35 in examples/oft/test/hardhat/MyOFT.test.ts

View workflow job for this annotation

GitHub Actions / Check code / Build & Lint

Forbidden non-null assertion

// The EndpointV2Mock contract comes from @layerzerolabs/test-devtools-evm-hardhat package
// and its artifacts are connected as external artifacts to this project
Expand Down
Loading