Deploying the contracts
PS: The following steps assums Drogon daemon is already up and running!
You need to optimize your jar bundle before you deploy it to local or ICON networks. This involves some pre-processing to ensure the actual deployment is successful.
drogon optimize -h
_ .-') _ _ .-') .-') _ ,---.
( ( OO) )( \( -O ) ( OO ) )| |
\ .'_ ,------. .-'),-----. ,----. .-'),-----. ,--./ ,--,' | |
,`'--..._)| /`. '( OO' .-. ' ' .-./-') ( OO' .-. '| \ | |\ | |
| | \ '| / | |/ | | | | | |_( O- )/ | | | || \| | )| |
| | ' || |_.' |\_) | |\| | | | .--, \\_) | |\| || . |/ | .'
| | / :| . '.' \ | | | |(| | '. (_/ \ | | | || |\ | `--'
| '--' /| |\ \ `' '-' ' | '--' | `' '-' '| | \ | .--.
`-------' `--' '--' `-----' `------' `-----' `--' `--' '--'
Usage: Drogon optimize [options]
Optmize contracts from the Drogon project
Options:
-p, --path [string] Path of your Drogon Project (default: "./")
-h, --help display help for command
Run drogon optimize
to automate the process of generating the optimized jar bundle.
drogon optimize
With the contracts optimized, now you are ready to deploy. The networks configuration is inside the deployJar
section of your build.gradle
settings.
drogon deploy -h
Usage: Drogon deploy [options]
Deploy contracts from the Drogon project
Options:
-p, --path [string] Path of your Drogon Project (default: "./")
-l, --local Deploy contracts to local node
-s, --lisbon Deploy contracts to lisbon node
-c, --custom [node] Deploy contracts to Custom node
-d, --config [file] Drogon config file. (default: "drogon-config.json")
-k, --password [string] Password for the keystore (default: "gochain")
-h, --help display help for command
To deploy to local sandbox (assumes, sandbox is running)
drogon deploy --local --uri http://localhost:9080/api/v3
If you have a different password for the keystore:
drogon deploy --local -k passwordHere --uri http://localhost:9080/api/v3
If you want to deploy to lisbon and have configured lisbon in
drogon deploy --lisbon -k passwordHere --uri 'https://lisbon.net.solidwallet.io/api/v3'
For example, you want to deploy to mainnet. This is how you do it.
1) add the network under deployJar
inside build.gradle
.
deployJar {
endpoints {
main {
uri = 'https://ctz.solidwallet.io/api/v3'
nid = 0x1
}
}
parameters {
arg('name', 'Alice')
}
}
2) Now run the deploy command:
drogon deploy --main --uri 'https://ctz.solidwallet.io/api/v3'
If you have a different password for the keystore:
drogon deploy --local -k passwordHere --uri http://localhost:9080/api/v3
For upgrading the contract, please add to
parameter to the respective contracts build.gradle
file as described in https://github.com/icon-project/gradle-javaee-plugin/blob/master/README.md
deployJar {
endpoints {
local {
uri = 'http://localhost:9082/api/v3'
nid = 0x3
to = 'cxe3d5237f13530bce0b936df320c0308885d062e9'
}
}
parameters {
arg('name', 'Alice')
}
}
Currently available targets:
- local
- lisbon
- berlin
- main
- custom
Sample endpoint configurations for these networks:
deployJar {
endpoints {
local {
uri = 'http://localhost:9082/api/v3'
nid = 0x3
to = 'cxe3d5237f13530bce0b936df320c0308885d062e9'
}
lisbon {
uri = 'https://lisbon.net.solidwallet.io/api/v3'
nid = 0x2
}
berlin {
uri = 'https://berlin.net.solidwallet.io/api/v3'
nid = 0x7
}
main {
uri = 'https://ctz.solidwallet.io/api/v3'
nid = 0x1
}
custom {
uri = 'http://localhost:9082/api/v3'
nid = 0x1337
}
}
parameters {
arg('name', 'Alice')
}
}