Skip to content

Commit

Permalink
Add details about token deployment.
Browse files Browse the repository at this point in the history
  • Loading branch information
FiveMovesAhead committed Apr 24, 2024
1 parent d56356e commit 9d64458
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tig-token/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# TIG-Token

## Deployed ERC20

* Base [0x0C03Ce270B4826Ec62e7DD007f0B716068639F7B](https://basescan.org/token/0x0C03Ce270B4826Ec62e7DD007f0B716068639F7B)
* Sepolia Base [0x3366feee9bbe5b830df9e1fa743828732b13959a](https://sepolia.basescan.org/token/0x3366feee9bbe5b830df9e1fa743828732b13959a)

## Deployment Process

1. Copy TIGToken.sol to [Remix](https://remix.ethereum.org/)

2. Right click file and flatten

3. Right click file and compile (note solidity compiler version)

4. Deploy, copying in ABI and Bytecode
```python3
from web3 import Web3
from web3.gas_strategies.rpc import rpc_gas_price_strategy
import json

RPC_URL = "FIXME"
BYTECODE = "FIXME"
ABI = json.loads("""FIXME""")

w3 = Web3(Web3.HTTPProvider(RPC_URL))

TIGToken = w3.eth.contract(abi=ABI, bytecode=BYTECODE)
account = w3.eth.default_account

gas_price = rpc_gas_price_strategy(w3)
if (temp := input(f"Rpc gas price {gas_price}. Press enter to continue or provide an amount: ")) != "":
gas_price = int(temp)
tx = TIGToken.constructor().build_transaction({
'from': account.address,
'nonce': w3.eth.get_transaction_count(account.address),
'gasPrice': gas_price,
})
tx.update({'gas': w3.eth.estimate_gas(tx)})
input(f"Will cost {tx['gas']} ETH (ctrl+c to cancel)")
signed_tx = account.sign_transaction(tx)
print(f"Sending transaction...")
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
print(f"Transaction sent: {tx_hash.hex()}")
print(f"Waiting for transaction to be confirmed...")
w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"Transaction confirmed")
```

5. Goto relevant etherscan site and verify contract using flattened code
15 changes: 15 additions & 0 deletions tig-token/TIGToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/access/Ownable.sol";

contract TIGToken is ERC20, ERC20Burnable, Ownable {
constructor() ERC20("The Innovation Game", "TIG") {
}

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}

0 comments on commit 9d64458

Please sign in to comment.