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

EVM ERC20 Template Contract #1146

Merged
merged 10 commits into from
Nov 28, 2023
Merged

EVM ERC20 Template Contract #1146

merged 10 commits into from
Nov 28, 2023

Conversation

jewei1997
Copy link
Contributor

@jewei1997 jewei1997 commented Nov 16, 2023

Describe your changes and provide context

Created ERC20 Template contract to allow native sei tokens to be used as ERC20s

Testing performed to validate your change

foundry unit tests + manual testing.

@jewei1997 jewei1997 changed the base branch from main to evm November 16, 2023 21:59
@jewei1997 jewei1997 marked this pull request as ready for review November 17, 2023 01:51
@jewei1997 jewei1997 changed the title Evm erc20 template contract EVM ERC20 Template Contract Nov 17, 2023
Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Merging #1146 (fb51956) into evm (716a0b2) will increase coverage by 0.03%.
The diff coverage is n/a.

❗ Current head fb51956 differs from pull request most recent head 453d618. Consider uploading reports for the commit 453d618 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              evm    #1146      +/-   ##
==========================================
+ Coverage   65.49%   65.53%   +0.03%     
==========================================
  Files         328      328              
  Lines       21001    21001              
==========================================
+ Hits        13754    13762       +8     
+ Misses       6540     6533       -7     
+ Partials      707      706       -1     

see 2 files with indirect coverage changes

Copy link
Collaborator

@codchen codchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good. We can test it on a local sei before merging:

  1. create a tokenfactory denom: seid tx tokenfactory create-denom test
  2. mint some tokens for an account: seid tx tokenfactory mint
  3. instantiate an ERC-20 contract for the denom
  4. send tokens from the minted account to another account via ERC-20
  5. verify the receiver received the tokens

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

contract Counter {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this counter contract?

Copy link
Contributor Author

@jewei1997 jewei1997 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, removed.

IBank public BankPrecompile;

constructor(string memory denom_) ERC20("", "") {
BankPrecompile = IBank(BANK_PRECOMPILE_ADDRESS);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: how much space would it take to store BankPrecompile as a state? Is it just an address?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it should just be an address.

import {IBank} from "./precompiles/IBank.sol";
import {console2} from "forge-std/Test.sol";

contract NativeSeiTokensERC20 is ERC20 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is ERC20 gives us the sending and approval functionalities i suppose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is the syntax to do inheritance.

@jewei1997 jewei1997 merged commit 0b024d7 into evm Nov 28, 2023
@jewei1997 jewei1997 deleted the evm-erc20-template-contract branch November 28, 2023 13:49
codchen pushed a commit that referenced this pull request Jan 5, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
codchen pushed a commit that referenced this pull request Jan 8, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Jan 31, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Feb 28, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Feb 28, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Feb 28, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Mar 4, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Mar 4, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Mar 11, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Mar 26, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Apr 17, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Apr 17, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Apr 17, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Apr 18, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Apr 19, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
udpatil pushed a commit that referenced this pull request Apr 19, 2024
* chore: forge init

* forge install: forge-std

v1.7.2

* moved foundry.toml and github workflows to top level

* forge install: openzeppelin-contracts

v5.0.0

* added impl + tests for native sei tokens as erc20s

* fix

* fix

* remove Counter boilerplate code

* minor fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants