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

Name and symbol added to DAIMock #186

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion byol.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from web3.middleware import SignAndSendRawMiddlewareBuilder
import time

rust_token_hex = open('.build/erc20/rust-token.bin').read().rstrip()
rust_token_hex = open('tests/ulm-contracts/DAIMock.kore.bin').read().rstrip()

w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
sender = w3.eth.account.create()
Expand Down Expand Up @@ -122,3 +122,35 @@
print('endpoint not found hash:', tx_hash)
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print('mint receipt:', receipt)

# name
name_token_data = '06fdde03'
name_token_tx = {
'from': sender.address,
'data': name_token_data,
'to': token_address,
'value': 0,
'gas': 11000000,
'maxFeePerGas': 2000000000,
'maxPriorityFeePerGas': 1000000000,
}

name = w3.eth.call(name_token_tx)
name = w3.to_text(name)
print("Name:", name)

# symbol
symbol_token_data = '95d89b41'
symbol_token_tx = {
'from': sender.address,
'data': symbol_token_data,
'to': token_address,
'value': 0,
'gas': 11000000,
'maxFeePerGas': 2000000000,
'maxPriorityFeePerGas': 1000000000,
}

symbol = w3.eth.call(symbol_token_tx)
symbol = w3.to_text(symbol)
print("Symbol:", symbol)
10 changes: 10 additions & 0 deletions tests/ulm-contracts/DAIMock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ pub trait DAIMock {
18
}

#[endpoint(name)]
fn name(&self) -> str {
"Dai Stablecoin"
}

#[endpoint(symbol)]
fn symbol(&self) -> str {
"DAI"
}

#[endpoint(mint)]
fn mint(&self, account: u160, value: u256) {
self.s_balances(account).set(self.s_balances(account).get() + value);
Expand Down
10 changes: 10 additions & 0 deletions tests/ulm-contracts/DAIMockWBTC.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ pub trait DAIMock {
18
}

#[endpoint(name)]
fn name(&self) -> str {
"Wrapped Bitcoin"
}

#[endpoint(symbol)]
fn symbol(&self) -> str {
"WBTC"
}

#[endpoint(mint)]
fn mint(&self, account: u160, value: u256) {
self.s_balances(account).set(self.s_balances(account).get() + value);
Expand Down
Loading