Comments (8)
Yes. See https://docs.openzeppelin.com/nile/0.14.0/cli#deploy.
from nile.
Hellonile deploy ACCOUNT_1 MyToken --alias mytoken_abc --network goerli mytoken_n mytoken_s 0x0468b7AdAE55BE128D1e10D13075A0FFF7e1941014F1C0aC780a35D51658965E
. However, I encountered an error as shown in pic1. Additionally, I have included the constructor of my contract in pic2. Could you please check if there is any issue with my usage? I am new to Cairo and not very familiar with it.
from nile.
Before using the nile deploy
command, I think it might be necessary to convert the string 'mytoken_n' for constructor to an integer
type. However, I'm unsure about the exact method to do so and haven't been able to find any helpful documentation
from nile.
Short strings should be automatically converted, see: https://docs.openzeppelin.com/nile/0.14.0/strings#nile_integration
Alternatively you can use the str_to_felt
utility.
from nile.
but it doesn't automatically converted:
from nile.
what version are you using? nile version
from nile.
from nile.
Hey @Alpha2J! My apologies, string arguments are unfortunately not supported in the latest release. Since we're no longer maintaining Nile, here's a script tailored to your project to help you deploy:
#scripts/my_token.py
from nile.utils import *
ALIAS = "mytoken_abc"
decimals = 18
async def run(nre):
accounts = await nre.get_accounts()
account = accounts[0]
name = str_to_felt("mytoken_n")
symbol = str_to_felt("mytoken_s")
admin = 0x0468b7AdAE55BE128D1e10D13075A0FFF7e1941014F1C0aC780a35D51658965E
arguments = [
name,
symbol,
admin
]
tx = await account.deploy_contract(
"MyToken",
salt=0,
unique=0,
calldata=arguments,
alias=ALIAS
)
out = await tx.execute()
print("MyToken deployed at", hex(out[1]))
supply = await nre.call(ALIAS, "totalSupply")
print("total supply:", from_decimals(supply))
name = await nre.call(ALIAS, "name")
print("token name:", int_to_str(name))
symbol = await nre.call(ALIAS, "symbol")
print("token symbol:", int_to_str(symbol))
def from_decimals(x):
split_str = x.split()
y = from_uint([int(item, 16) for item in split_str])
return y / (10 ** decimals)
def to_decimals(x):
return x * (10 ** decimals)
def from_hex(x):
return int(x, 16)
def int_to_str(x):
return felt_to_str(x)
Run this with nile run scripts/my_token.py
. I hope this helps :)
from nile.
Related Issues (20)
- artifacts/ folder missing in base project .gitignore
- nile deploy command doesn't accept hex arguments in calldata
- Handle Exceptions in CLI scope
- update goerli2 chain id
- Registering duplicate deployment address will delete deployment from json HOT 2
- Remove accounts.json from nile init (never used)
- Add tests for accounts.py
- nile setup failed HOT 1
- Add nile utils documentation to the docsite HOT 1
- Declaring a contract causes "Requested contract address is not deployed" HOT 2
- Refactor `call_or_invoke` method to `call` HOT 1
- Update docs from transaction flow refactor
- `nile run` doesn't bubble up script exceptions
- Support `EthAccount` signer and account type
- add transaction API/lifecycle to docs
- Declare transaction fails when the declarations file contains an empty line
- Increase max_fee above estimated amount
- Add EthAccount support as plugin
- Bump cairo-lang dependency to 0.11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nile.