Skip to content

Commit

Permalink
zeriontech#60 - remade the interpretation of EthInteger, added bytes …
Browse files Browse the repository at this point in the history
…to int coversion, added ternary scalars, added And gate, added simple mathematical operations on IntegerScalar.
  • Loading branch information
abdulowork committed May 23, 2018
1 parent 15d30cf commit 2420200
Show file tree
Hide file tree
Showing 111 changed files with 2,904 additions and 789 deletions.
8 changes: 4 additions & 4 deletions Example/Tests/ABI/Decoding/ABIDecodingIT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ABIDecodingIT: XCTestCase {
message: EncodedABITuple(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: arguments.0
)
),
Expand All @@ -34,7 +34,7 @@ final class ABIDecodingIT: XCTestCase {
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: arguments.2
)
)
Expand All @@ -43,7 +43,7 @@ final class ABIDecodingIT: XCTestCase {
)
)
expect{
try NaturalInteger(
try EthInteger(
hex: DecodedABINumber(
abiMessage: message,
index: 0
Expand All @@ -63,7 +63,7 @@ final class ABIDecodingIT: XCTestCase {
description: "Encoded argument \(arguments.1) is expected to persist"
)
expect{
try NaturalInteger(
try EthInteger(
hex: DecodedABINumber(
abiMessage: message,
index: 2
Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/ABI/Decoding/DecodedABINumberTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class DecodedABINumberTests: XCTestCase {

func testPlainNumberIsDecodedCorrectly() {
expect{
try NaturalInteger(
try EthInteger(
hex: DecodedABINumber(
abiMessage: ABIMessage(
message: "000000000000000000000000000000000000000000000000000000000000002a"
Expand All @@ -34,7 +34,7 @@ final class DecodedABINumberTests: XCTestCase {

func testNumberAtSecondPositionIsDecodedCorrectly() {
expect{
try NaturalInteger(
try EthInteger(
hex: DecodedABINumber(
abiMessage: ABIMessage(
message: [
Expand Down
26 changes: 13 additions & 13 deletions Example/Tests/ABI/EncodedABIFunctionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ final class EncodedABIFunctionTests: XCTestCase {
),
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 5
)
),
Expand All @@ -388,7 +388,7 @@ final class EncodedABIFunctionTests: XCTestCase {
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 3
)
),
Expand Down Expand Up @@ -427,7 +427,7 @@ final class EncodedABIFunctionTests: XCTestCase {
),
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 1
)
),
Expand All @@ -437,34 +437,34 @@ final class EncodedABIFunctionTests: XCTestCase {
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 2
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 3
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 4
)
),
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 5
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 6
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 7
)
)
Expand Down Expand Up @@ -504,12 +504,12 @@ final class EncodedABIFunctionTests: XCTestCase {
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 1
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 2
)
)
Expand All @@ -518,12 +518,12 @@ final class EncodedABIFunctionTests: XCTestCase {
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 3
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 4
)
)
Expand Down
22 changes: 11 additions & 11 deletions Example/Tests/ABI/EncodedABITupleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class EncodedABITupleTests: XCTestCase {
try EncodedABITuple(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 1
)
),
Expand All @@ -74,34 +74,34 @@ final class EncodedABITupleTests: XCTestCase {
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 2
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 3
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 4
)
),
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 5
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 6
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 7
)
)
Expand Down Expand Up @@ -137,12 +137,12 @@ final class EncodedABITupleTests: XCTestCase {
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 1
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 2
)
)
Expand All @@ -151,12 +151,12 @@ final class EncodedABITupleTests: XCTestCase {
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 3
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 4
)
)
Expand Down
10 changes: 5 additions & 5 deletions Example/Tests/ABI/EncodedContractTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class EncodedContractTests: XCTestCase {
),
arguments: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 1
)
)
Expand All @@ -49,22 +49,22 @@ final class EncodedContractTests: XCTestCase {
ABIDynamicCollection(
parameters: [
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 1
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 2
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 3
)
),
ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
value: 4
)
)
Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/ABI/Parameters/ABIUnsignedNumberTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class ABIUnsignedNumberTests: XCTestCase {
expect{
try ConcatenatedBytes(
bytes: ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
hex: BytesFromHexString(
hex: "12345678"
)
Expand All @@ -39,7 +39,7 @@ final class ABIUnsignedNumberTests: XCTestCase {
func testEncodesTailsCorrectly() {
expect{
try ABIUnsignedNumber(
origin: EthNaturalNumber(
origin: EthNumber(
hex: BytesFromHexString(
hex: "12345678"
)
Expand Down
6 changes: 3 additions & 3 deletions Example/Tests/Account/EthAutoAccountIT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class EthAutoAccountIT: XCTestCase {
privateKey: recipientKey
)
expect{
try NaturalInteger(
try EthInteger(
hex: recipient.balance()
).value()
}.to(
Expand All @@ -43,7 +43,7 @@ final class EthAutoAccountIT: XCTestCase {
)
expect{
try sender.send(
weiAmount: EthNaturalNumber(
weiAmount: EthNumber(
value: 100
),
to: recipientKey.address()
Expand All @@ -53,7 +53,7 @@ final class EthAutoAccountIT: XCTestCase {
description: "Transaction sending is not expected to throw"
)
expect{
try NaturalInteger(
try EthInteger(
hex: recipient.balance()
).value()
}.to(
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/Address/ComputedContractAddressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class ComputedContractAddressTests: XCTestCase {
expect{
try ComputedContractAddress(
ownerAddress: owner.address(),
transactionNonce: EthNaturalNumber(
transactionNonce: EthNumber(
hex: nonce
)
).value().toHexString()
Expand Down
Loading

0 comments on commit 2420200

Please sign in to comment.