tests: add eip1559 solidity test (#656)

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Yijia Su
2021-10-22 17:35:48 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent 1fe07edbf9
commit 5ff2a2c45f
4 changed files with 98 additions and 1 deletions
@@ -0,0 +1,16 @@
{
"name": "eip1559",
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"scripts": {
"test-ganache": "yarn truffle test",
"test-ethermint": "yarn truffle test --network ethermint"
},
"devDependencies": {
"truffle": "^5.4.14",
"truffle-assertions": "^0.9.2"
},
"dependencies": {
"@truffle/hdwallet-provider": "^1.5.1-alpha.1"
}
}
@@ -0,0 +1,20 @@
contract('Transaction', async function(accounts) {
it('should send a transaction with EIP-1559 flag', async function() {
console.log(`Accounts: `, accounts);
console.log(web3.version);
const tx = await web3.eth.sendTransaction({
from: accounts[0],
to: !!accounts[1] ? accounts[1] : "0x0000000000000000000000000000000000000000",
value: '10000000',
gas: '21000',
type: "0x2",
common: {
hardfork: 'london'
}
});
console.log(tx);
assert.equal(tx.type, '0x2', 'Tx type should be 0x2');
});
});
@@ -0,0 +1,19 @@
// const HDWalletProvider = require('@truffle/hdwallet-provider');
module.exports = {
networks: {
// Development network is just left as truffle's default settings
ethermint: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
gas: 5000000, // Gas sent with each transaction
gasPrice: 1000000000, // 1 gwei (in wei)
},
},
compilers: {
solc: {
version: "0.5.17",
},
},
}