-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: fuel optimizations * feat: fuel mainnet
- Loading branch information
1 parent
9868789
commit dedce33
Showing
14 changed files
with
121 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[project] | ||
authors = ["Łukasz Kalbarczyk"] | ||
entry = "lib.sw" | ||
forc-version = "0.63.1" | ||
forc-version = "0.63.6" | ||
license = "BUSL" | ||
name = "redstone" | ||
organization = "RedStone" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
channel = "testnet" | ||
|
||
[components] | ||
fuel-core = "0.34.0" | ||
forc = "0.63.1" | ||
fuel-core = "0.35.0" | ||
forc = "0.63.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
library; | ||
|
||
pub mod numbers; | ||
pub mod from_bytes_convertible; | ||
pub mod from_bytes; | ||
pub mod test_helpers; | ||
pub mod vec; | ||
pub mod bytes; | ||
pub mod sample; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
library; | ||
|
||
impl u256 { | ||
pub fn avg_with(self, other: Self) -> Self { | ||
self.rsh(1) + other.rsh(1) + (self % 2 + other % 2) / 2 | ||
} | ||
} | ||
|
||
#[test] | ||
fn test_avg_with() { | ||
assert(0x444u256.avg_with(0x222u256) == 0x333u256); | ||
assert(0x444u256.avg_with(0x444u256) == 0x444u256); | ||
assert(0x444u256.avg_with(0x0u256) == 0x222u256); | ||
assert(0x333u256.avg_with(0x222u256) == 0x2aau256); | ||
assert(0x333u256.avg_with(0x333u256) == 0x333u256); | ||
assert(0x0u256.avg_with(0x0u256) == 0x0u256); | ||
assert(u256::max().avg_with(u256::max()) == u256::max()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
library; | ||
|
||
use std::{bytes::*, vec::*}; | ||
|
||
pub trait With<T> { | ||
fn with(self, value: T) -> Self; | ||
} | ||
|
||
impl<T> With<T> for Vec<T> { | ||
fn with(self, value: T) -> Self { | ||
let mut vec = self; | ||
vec.push(value); | ||
|
||
vec | ||
} | ||
} | ||
|
||
impl With<u8> for Bytes { | ||
fn with(self, byte: u8) -> Bytes { | ||
let mut bytes = self; | ||
bytes.push(byte); | ||
|
||
bytes | ||
} | ||
} | ||
|
||
impl Vec<u256> { | ||
pub fn log(self) { | ||
let mut i = 0; | ||
while (i < self.len()) { | ||
log(self.get(i).unwrap()); | ||
i += 1; | ||
} | ||
} | ||
} | ||
|
||
impl<T> Eq for Vec<T> | ||
where | ||
T: Eq, | ||
{ | ||
fn eq(self, other: Self) -> bool { | ||
if (self.len() != other.len()) { | ||
return false; | ||
} | ||
|
||
let mut i = 0; | ||
while (i < self.len()) { | ||
if self.get(i).unwrap() != other.get(i).unwrap() { | ||
return false; | ||
} | ||
|
||
i += 1; | ||
} | ||
|
||
true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters