forked from aurora-is-near/aurora-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix scheduled nightly clippy. (aurora-is-near#160) * Always compile tests with the `mainnet` feature. (aurora-is-near#162) * Move eth-connector tests to under `src/tests`. (aurora-is-near#164) * EIP-2718: Support typed transaction envelopes. (aurora-is-near#165) * Remove deprecated EIP-712 prover implementation. (aurora-is-near#168) * ERC-20: Allow admin to change token metadata. (aurora-is-near#171) Co-authored-by: Evgeny Ukhanov <[email protected]> Co-authored-by: Kirill <[email protected]> Co-authored-by: Michael Birch <[email protected]>
- Loading branch information
1 parent
3787f01
commit d2f2e32
Showing
26 changed files
with
3,216 additions
and
477 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 +1 @@ | ||
1.4.2 | ||
1.4.3 |
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,4 +1,4 @@ | ||
require('@nomiclabs/hardhat-ethers'); | ||
require('@nomiclabs/hardhat-waffle'); | ||
require('solidity-coverage'); | ||
|
||
/** | ||
|
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
const { ethers } = require('hardhat'); | ||
const { expect } = require('chai'); | ||
|
||
describe('EthCustodian contract', () => { | ||
let user1; | ||
let deployerAccount; | ||
let adminAccount; | ||
|
||
let evmErc20Factory; | ||
let evmErc20Contract; | ||
|
||
const metadataName = 'EMPTY_TOKEN'; | ||
const metadataSymbol = 'EMPTY_SYMBOL'; | ||
const metadataDecimals = 0; | ||
|
||
beforeEach(async () => { | ||
[deployerAccount, user1] = await ethers.getSigners(); | ||
|
||
// Make the deployer admin | ||
adminAccount = deployerAccount; | ||
|
||
evmErc20Factory = await ethers.getContractFactory('EvmErc20'); | ||
evmErc20Contract = await evmErc20Factory | ||
.connect(adminAccount) | ||
.deploy( | ||
metadataName, | ||
metadataSymbol, | ||
metadataDecimals, | ||
adminAccount.address, | ||
); | ||
}); | ||
|
||
describe('AdminControlled', () => { | ||
it('Only admin is allowed to update the metadata', async () => { | ||
const newMetadataName = 'NEW_CUSTOM_TOKEN'; | ||
const newMetadataSymbol = 'NEW_CSTM'; | ||
const newMetadataDecimals = 18; | ||
|
||
await expect( | ||
evmErc20Contract | ||
.connect(user1) | ||
.setMetadata( | ||
newMetadataName, | ||
newMetadataSymbol, | ||
newMetadataDecimals, | ||
), | ||
) | ||
.to | ||
.be | ||
.reverted; | ||
|
||
expect(await evmErc20Contract.name()).to.equal(metadataName); | ||
expect(await evmErc20Contract.symbol()).to.equal(metadataSymbol); | ||
expect(await evmErc20Contract.decimals()).to.equal(metadataDecimals); | ||
|
||
await evmErc20Contract | ||
.connect(adminAccount) | ||
.setMetadata( | ||
newMetadataName, | ||
newMetadataSymbol, | ||
newMetadataDecimals, | ||
); | ||
|
||
expect(await evmErc20Contract.name()).to.equal(newMetadataName); | ||
expect(await evmErc20Contract.symbol()).to.equal(newMetadataSymbol); | ||
expect(await evmErc20Contract.decimals()).to.equal(newMetadataDecimals); | ||
}); | ||
}); | ||
|
||
describe('Metadata', () => { | ||
it('Should match the deployed metadata', async () => { | ||
expect(await evmErc20Contract.name()).to.equal(metadataName); | ||
expect(await evmErc20Contract.symbol()).to.equal(metadataSymbol); | ||
expect(await evmErc20Contract.decimals()).to.equal(metadataDecimals); | ||
}); | ||
|
||
it('Should update the metadata', async () => { | ||
const newMetadataName = 'NEW_CUSTOM_TOKEN'; | ||
const newMetadataSymbol = 'NEW_CSTM'; | ||
const newMetadataDecimals = 18; | ||
|
||
await evmErc20Contract | ||
.connect(adminAccount) | ||
.setMetadata( | ||
newMetadataName, | ||
newMetadataSymbol, | ||
newMetadataDecimals, | ||
); | ||
|
||
expect(await evmErc20Contract.name()).to.equal(newMetadataName); | ||
expect(await evmErc20Contract.symbol()).to.equal(newMetadataSymbol); | ||
expect(await evmErc20Contract.decimals()).to.equal(newMetadataDecimals); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.