-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: remove redundant JSON unmarshalling * chore: remove HardhatOutput * chore: remove byte array pointer * refactor(evm): remove SmartContractFixture * refactor: privatize embed functions * refactor: move contract files into subdirectory and recompile * chore: add TestERC20.sol * test: move TestERC20 contract to embeds test * refactor: remove embeds FixtureType * fix: embed load function * refactor: remove HexString * chore: remove parseCompiledJson * test(evm): use TestERC20.sol in integration tests * Update CHANGELOG.md * fix: small import merge conflict --------- Co-authored-by: Unique Divine <[email protected]> Co-authored-by: Unique-Divine <[email protected]>
- Loading branch information
1 parent
7dd9dd4
commit d71d67d
Showing
28 changed files
with
8,333 additions
and
303 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
# Sample Hardhat Project | ||
|
||
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract. | ||
|
||
Try running some of the following tasks: | ||
# Nibiru Contract Embeds | ||
|
||
```shell | ||
npx hardhat help | ||
npx hardhat test | ||
REPORT_GAS=true npx hardhat test | ||
npx hardhat node | ||
npx hardhat ignition deploy ./ignition/modules/Lock.js | ||
npm install | ||
npx hardhat compile | ||
``` |
12 changes: 6 additions & 6 deletions
12
x/evm/embeds/ERC20MinterCompiled.json → ...ontracts/ERC20Minter.sol/ERC20Minter.json
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
286 changes: 286 additions & 0 deletions
286
x/evm/embeds/artifacts/contracts/TestERC20.sol/TestERC20.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
x/evm/embeds/ERC20Minter.sol → x/evm/embeds/contracts/ERC20Minter.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
File renamed without changes.
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,16 @@ | ||
// contracts/TestERC20.sol | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract TestERC20 is ERC20 { | ||
|
||
// Define the supply of TestERC20: 1,000,000 | ||
uint256 constant initialSupply = 1000000 * (10**18); | ||
|
||
// Constructor will be called on contract creation | ||
constructor() ERC20("TestERC20", "FOO") { | ||
_mint(msg.sender, initialSupply); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
package embeds_test | ||
|
||
import ( | ||
_ "embed" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/NibiruChain/nibiru/x/evm/embeds" | ||
) | ||
|
||
func TestLoadContracts(t *testing.T) { | ||
for _, tc := range []embeds.SmartContractFixture{ | ||
embeds.SmartContract_TestERC20, | ||
embeds.SmartContract_ERC20Minter, | ||
embeds.SmartContract_FunToken, | ||
} { | ||
t.Run(tc.Name, func(t *testing.T) { | ||
_, err := tc.Load() | ||
assert.NoError(t, err) | ||
}) | ||
} | ||
require.NotPanics(t, func() { | ||
embeds.SmartContract_ERC20Minter.MustLoad() | ||
embeds.SmartContract_FunToken.MustLoad() | ||
embeds.SmartContract_TestERC20.MustLoad() | ||
}) | ||
} |
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
Oops, something went wrong.