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

v0.16 rc2 #3286

Merged
merged 10 commits into from
Aug 8, 2024
1 change: 1 addition & 0 deletions .env-template
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ YAGNA_DATADIR="."
#HOLESKY_GETH_ADDR=https://rpc.ankr.com/eth_holesky
#POLYGON_GETH_ADDR=https://bor.golem.network,https://polygon-rpc.com
#MUMBAI_GETH_ADDR=https://matic-mumbai.chainstacklabs.com
#AMOY_GETH_ADDR=https://rpc-amoy.polygon.technology

## T/GLM contract addresses
#HOLESKY_TGLM_CONTRACT_ADDRESS=0xd94e3DC39d4Cad1DAd634e7eb585A57A19dC7EFE
Expand Down
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ members = [
# diesel 1.4.* supports up to 0.23.0, but sqlx 0.5.9 requires 0.22.0
# sqlx 0.5.10 need 0.23.2, so 0.5.9 is last version possible
derive_more = "0.99.11"
erc20_payment_lib = { git = "https://github.com/golemfactory/erc20_payment_lib", rev = "594d8a93b820b177ec267ccec5de61d8a9a45203" }
erc20_processor = { git = "https://github.com/golemfactory/erc20_payment_lib", rev = "594d8a93b820b177ec267ccec5de61d8a9a45203" }
erc20_payment_lib = { git = "https://github.com/golemfactory/erc20_payment_lib", rev = "79955d735f64467b01f04abfc70da39e4ba4be3c" }
erc20_processor = { git = "https://github.com/golemfactory/erc20_payment_lib", rev = "79955d735f64467b01f04abfc70da39e4ba4be3c" }
#erc20_payment_lib = { path = "../../payments/erc20_payment_lib/crates/erc20_payment_lib" }
#erc20_processor = { path = "../../payments/erc20_payment_lib" }
#erc20_payment_lib = { version = "=0.4.1" }
Expand Down
13 changes: 13 additions & 0 deletions core/identity/src/cli/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ pub enum IdentityCommand {
/// password for keystore
#[structopt(long = "no-password")]
no_password: bool,

/// Set the newly created identity as the default, requires deamon restart
#[structopt(long = "set-default")]
set_default: bool,
},
/// Update given identity
Update {
Expand All @@ -151,6 +155,8 @@ pub enum IdentityCommand {
alias_or_id: NodeOrAlias,
#[structopt(long)]
alias: Option<String>,

/// Set the identity as the default, requires deamon restart
#[structopt(long = "set-default")]
set_default: bool,
},
Expand Down Expand Up @@ -314,6 +320,7 @@ impl IdentityCommand {
from_private_key,
password,
no_password,
set_default,
} => {
if from_keystore.is_some() && from_private_key.is_some() {
anyhow::bail!("Only one of --from-keystore or --from-private-key can be used")
Expand Down Expand Up @@ -364,7 +371,13 @@ impl IdentityCommand {
from_keystore: Some(key_file),
})
.await
.map_err(anyhow::Error::msg)??;

let id = bus::service(identity::BUS_ID)
.send(identity::Update::with_id(id.node_id).with_default(*set_default))
.await
.map_err(anyhow::Error::msg)?;

CommandOutput::object(id)
}
IdentityCommand::Lock {
Expand Down
6 changes: 3 additions & 3 deletions core/identity/src/cli/identity/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ pub async fn list() -> Result<CommandOutput> {
.into_iter()
.map(|identity| {
serde_json::json! {[
if identity.is_default { "X" } else { "" },
if identity.is_locked { "X" } else { "" },
if identity.deleted { "X" } else { "" },
identity.is_default,
identity.is_locked,
identity.deleted,
identity.alias,
identity.node_id
]}
Expand Down
12 changes: 11 additions & 1 deletion core/model/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,21 @@ pub struct Fund {
address: String,
network: Option<String>,
token: Option<String>,
mint_only: bool,
}

impl Fund {
pub fn new(address: String, network: Option<String>, token: Option<String>) -> Self {
pub fn new(
address: String,
network: Option<String>,
token: Option<String>,
mint_only: bool,
) -> Self {
Self {
address,
network,
token,
mint_only,
}
}
pub fn address(&self) -> String {
Expand All @@ -235,6 +242,9 @@ impl Fund {
pub fn token(&self) -> Option<String> {
self.token.clone()
}
pub fn mint_only(&self) -> bool {
self.mint_only
}
}

impl RpcMessage for Fund {
Expand Down
6 changes: 5 additions & 1 deletion core/model/src/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ pub mod local {
#[strum(props(token = "GLM"))]
Mainnet,
#[strum(props(token = "tGLM"))]
Sepolia,
#[strum(props(token = "tGLM"))]
Rinkeby,
#[strum(props(token = "tGLM"))]
Goerli,
Expand All @@ -568,6 +570,8 @@ pub mod local {
Polygon,
#[strum(props(token = "tGLM"))]
Mumbai,
#[strum(props(token = "tGLM"))]
Amoy,
}

impl NetworkName {
Expand All @@ -585,7 +589,7 @@ pub mod local {
impl NetworkName {
pub fn is_fundable(&self) -> bool {
use NetworkName::*;
matches!(self, Goerli | Holesky)
matches!(self, Sepolia | Goerli | Holesky | Amoy)
}

pub fn all_fundable() -> Vec<NetworkName> {
Expand Down
18 changes: 12 additions & 6 deletions core/payment-driver/base/src/db/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ pub struct PaymentEntity {
)]
#[sql_type = "Integer"]
pub enum Network {
Mainnet = 1, //Main Ethereum chain
Rinkeby = 4, //Rinkeby is Ethereum testnet
Goerli = 5, //Goerli is another Ethereum testnet
Mainnet = 1, //Main Ethereum chain
Rinkeby = 4, //Rinkeby is an Ethereum testnet
Goerli = 5, //Goerli is an Ethereum testnet
Sepolia = 11155111, //Sepolia is an Ethereum testnet
#[default]
Holesky = 17000, //Holesky is testnet for Holesky network
Mumbai = 80001, //Mumbai is testnet for Polygon network
Polygon = 137, //Polygon is Polygon production network
Polygon = 137, //Polygon is Polygon production network
Mumbai = 80001, //Mumbai is the legacy testnet for Polygon network
Amoy = 80002, //Amoy is the new testnet for Polygon network
}

impl FromStr for Network {
Expand All @@ -127,11 +129,13 @@ impl FromStr for Network {
fn from_str(s: &str) -> DbResult<Self> {
match s.to_lowercase().as_str() {
"mainnet" => Ok(Network::Mainnet),
"sepolia" => Ok(Network::Sepolia),
"rinkeby" => Ok(Network::Rinkeby),
"goerli" => Ok(Network::Goerli),
"holesky" => Ok(Network::Holesky),
"polygon" => Ok(Network::Polygon),
"mumbai" => Ok(Network::Mumbai),
"amoy" => Ok(Network::Amoy),
_ => Err(DbError::InvalidData(format!("Invalid network: {}", s))),
}
}
Expand All @@ -141,11 +145,13 @@ impl Display for Network {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
match *self {
Network::Mainnet => f.write_str("mainnet"),
Network::Sepolia => f.write_str("sepolia"),
Network::Rinkeby => f.write_str("rinkeby"),
Network::Goerli => f.write_str("goerli"),
Network::Holesky => f.write_str("holesky"),
Network::Mumbai => f.write_str("mumbai"),
Network::Polygon => f.write_str("polygon"),
Network::Mumbai => f.write_str("mumbai"),
Network::Amoy => f.write_str("amoy"),
}
}
}
Expand Down
99 changes: 63 additions & 36 deletions core/payment-driver/erc20/config-payments.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,13 @@ confirmation-blocks = 1
block-explorer-url = "https://etherscan.io"
external-source-check-interval = 300

[[chain.mainnet.rpc-endpoints]]
names = """
geth.golem.network,
"""
endpoints = """
https://geth.golem.network:55555,
"""
priority = 0
max-timeout-ms = 5000
verify-interval-secs = 300
allowed-head-behind-secs = 60

[[chain.mainnet.rpc-endpoints]]
priority = 0
max-timeout-ms = 5000
verify-interval-secs = 300
allowed-head-behind-secs = 60
dns-source = "mainnet.rpc-node.dev.golem.network."


[chain.goerli]
chain-name = "Goerli"
chain-id = 5
Expand Down Expand Up @@ -114,19 +101,6 @@ confirmation-blocks = 0
block-explorer-url = "https://holesky.etherscan.io"
external-source-check-interval = 300

[[chain.holesky.rpc-endpoints]]
names = """
holesky.rpc-node.dev.golem.network
"""

endpoints = """
https://holesky.rpc-node.dev.golem.network,
"""
priority = 0
max-timeout-ms = 5000
verify-interval-secs = 300
allowed-head-behind-secs = 60

[[chain.holesky.rpc-endpoints]]
priority = 0
max-timeout-ms = 5000
Expand Down Expand Up @@ -182,20 +156,73 @@ block-explorer-url = "https://polygonscan.com"
external-source-check-interval = 300

[[chain.polygon.rpc-endpoints]]
names = """
bor.golem.network,
"""
endpoints = """
https://bor.golem.network,
"""
priority = 0
max-timeout-ms = 5000
verify-interval-secs = 300
allowed-head-behind-secs = 60
dns-source = "polygon.rpc-node.dev.golem.network."

[[chain.polygon.rpc-endpoints]]
[chain.amoy]
chain-name = "Amoy testnet"
chain-id = 80002
currency-symbol = "tMATIC"
priority-fee = 30.111
max-fee-per-gas = 500.0
transaction-timeout = 100
token = { address = "0x2b60e60d3fb0b36a7ccb388f9e71570da4c4594f", symbol = "tGLM" }
mint-contract = { address = "0xf29ff8a13211ac33861986e407190ae5c773d53c", max-glm-allowed = 400 }
wrapper-contract = { address = "0xa7b4447c1447edeb40ebbb1943e90b169ff44560" }
multi-contract = { address = "0xa0a51642a594763d78091bf03ee6bf8e8d663bba", max-at-once = 10 }
confirmation-blocks = 1
block-explorer-url = "https://amoy.polygonscan.com"
external-source-check-interval = 300

[[chain.amoy.rpc-endpoints]]
names = """
rpc-amoy.polygon.technology,
"""
endpoints = """
https://rpc-amoy.polygon.technology,
"""
-priority = 0
-max-timeout-ms = 5000
-verify-interval-secs = 300
-allowed-head-behind-secs = 60

[chain.sepolia]
chain-name = "Sepolia"
chain-id = 11155111
currency-symbol = "tETH"
priority-fee = 0.000001
max-fee-per-gas = 20.0
transaction-timeout = 100
token = { address = "0x167b15ada84c63427c6c813B915a42eFC72E7175", symbol = "tGLM" }
mint-contract = { address = "0x31A2a20956a40c2F358Fa5cec59D55a9C5d6fF9A", max-glm-allowed = 400 }
attestation-contract = { address = "0xC2679fBD37d54388Ce493F1DB75320D236e1815e" }
schema-registry-contract = { address = "0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0" }
confirmation-blocks = 0
block-explorer-url = "https://sepolia.etherscan.io"
external-source-check-interval = 300

[[chain.sepolia.rpc-endpoints]]
names = """
endpoints.omniatech.io/v1/eth/sepolia/public
ethereum-sepolia.blockpi.network/v1/rpc/public
eth-sepolia.public.blastapi.io
eth-sepolia-public.unifra.io
sepolia.gateway.tenderly.co
gateway.tenderly.co/public/sepolia
"""

endpoints = """
https://endpoints.omniatech.io/v1/eth/sepolia/public
https://ethereum-sepolia.blockpi.network/v1/rpc/public
https://eth-sepolia.public.blastapi.io
https://eth-sepolia-public.unifra.io
https://sepolia.gateway.tenderly.co
https://gateway.tenderly.co/public/sepolia
"""
priority = 0
max-timeout-ms = 5000
verify-interval-secs = 300
allowed-head-behind-secs = 60
dns-source = "polygon.rpc-node.dev.golem.network."
verify-interval-secs = 60
allowed-head-behind-secs = 120
Loading
Loading