From aa516e189aaa717f3a9765cbd986a598d106a57a Mon Sep 17 00:00:00 2001 From: fainashalts Date: Fri, 18 Sep 2020 10:47:26 -0700 Subject: [PATCH 1/9] Change imports to use new compile-commomn types and shim exports --- packages/db/package.json | 2 +- packages/db/src/artifacts/json/resolvers.ts | 6 +++--- packages/db/src/artifacts/test/index.ts | 11 +++++----- packages/db/src/data/schema.ts | 21 +++++++++---------- packages/db/src/db.ts | 6 ++---- packages/db/src/loaders/commands/compile.ts | 4 ++-- .../db/src/loaders/schema/artifactsLoader.ts | 4 ++-- packages/db/src/loaders/schema/test/index.ts | 17 +++++++-------- packages/db/src/loaders/test/index.ts | 4 ++-- packages/db/src/loaders/types.ts | 15 +------------ .../db/src/workspace/test/bytecode.spec.ts | 4 ++-- .../db/src/workspace/test/contract.spec.ts | 5 ++--- .../workspace/test/contractInstance.spec.ts | 4 ++-- 13 files changed, 43 insertions(+), 60 deletions(-) diff --git a/packages/db/package.json b/packages/db/package.json index d4a61d5734e..6d4e7a4597e 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -57,7 +57,7 @@ "@gnd/graphql-tools": "^4.0.5-fix.0", "@gnd/jsonschema2graphql": "^1.0.15", "@truffle/artifactor": "^4.0.74", - "@truffle/workflow-compile": "^2.1.48", + "@truffle/compile-common": "^0.3.9", "apollo-server": "^2.3.1", "fse": "^4.0.1", "graphql": "^14.0.2", diff --git a/packages/db/src/artifacts/json/resolvers.ts b/packages/db/src/artifacts/json/resolvers.ts index fa5256509c3..df3c995a73d 100644 --- a/packages/db/src/artifacts/json/resolvers.ts +++ b/packages/db/src/artifacts/json/resolvers.ts @@ -1,5 +1,5 @@ import * as fse from "fs-extra"; -import { shimBytecode } from "@truffle/workflow-compile/shims"; +import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; const TruffleResolver = require("@truffle/resolver"); @@ -23,8 +23,8 @@ export const resolvers = { const artifact = truffleResolver.require(name)._json; - const linkedBytecodeCreate = shimBytecode(artifact.bytecode); - const linkedBytecodeCall = shimBytecode(artifact.deployedBytecode); + const linkedBytecodeCreate = forBytecode(artifact.bytecode); + const linkedBytecodeCall = forBytecode(artifact.deployedBytecode); const result = { ...artifact, diff --git a/packages/db/src/artifacts/test/index.ts b/packages/db/src/artifacts/test/index.ts index 33ae1cc7772..5514fc52f99 100644 --- a/packages/db/src/artifacts/test/index.ts +++ b/packages/db/src/artifacts/test/index.ts @@ -1,6 +1,6 @@ import path from "path"; import { TruffleDB } from "@truffle/db"; -import { shimBytecode } from "@truffle/workflow-compile/shims"; +import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import tmp from "tmp"; const fixturesDirectory = path.join( @@ -94,6 +94,7 @@ afterAll(() => { describe("Artifacts queries", () => { it("lists artifact contract names", async () => { const result = await db.query(GetContractNames); + console.debug("contract names result " + JSON.stringify(result)); expect(result).toHaveProperty("data"); const { data } = result; @@ -159,8 +160,8 @@ describe("Artifacts queries", () => { callBytecode } = contract; expect(name).toEqual(Migrations.contractName); - expect(createBytecode).toEqual(shimBytecode(Migrations.bytecode)); - expect(callBytecode).toEqual(shimBytecode(Migrations.deployedBytecode)); + expect(createBytecode).toEqual(forBytecode(Migrations.bytecode)); + expect(callBytecode).toEqual(forBytecode(Migrations.deployedBytecode)); expect(processedSource).toHaveProperty("source"); const { source } = processedSource; @@ -236,9 +237,9 @@ describe("Artifacts queries", () => { const { bytecode } = callBytecode; const { bytes, linkReferences } = bytecode; - expect(bytes).toEqual(shimBytecode(Migrations.deployedBytecode).bytes); + expect(bytes).toEqual(forBytecode(Migrations.deployedBytecode).bytes); expect(linkReferences).toEqual( - shimBytecode(Migrations.deployedBytecode).linkReferences + forBytecode(Migrations.deployedBytecode).linkReferences ); }); }); diff --git a/packages/db/src/data/schema.ts b/packages/db/src/data/schema.ts index 0723a46b643..d8f3f939d14 100644 --- a/packages/db/src/data/schema.ts +++ b/packages/db/src/data/schema.ts @@ -2,7 +2,7 @@ import { transformSchema, FilterRootFields } from "@gnd/graphql-tools"; import { scopeSchemas } from "./utils"; -import { abiSchema, schema as artifactsSchema } from "@truffle/db/artifacts"; +// import { abiSchema, schema as artifactsSchema } from "@truffle/db/artifacts"; import { schema as workspaceSchema } from "@truffle/db/workspace"; import { loaderSchema } from "@truffle/db/loaders"; @@ -10,13 +10,12 @@ import { readInstructions } from "./bytecode"; export const schema = scopeSchemas({ subschemas: { - artifacts: artifactsSchema, workspace: workspaceSchema, loaders: loaderSchema }, typeDefs: [ // add types from abi schema - transformSchema(abiSchema, [new FilterRootFields(() => false)]) + transformSchema(workspaceSchema, [new FilterRootFields(() => false)]) ], resolvers: { Bytecode: { @@ -40,14 +39,14 @@ export const schema = scopeSchemas({ return "NormalFunction"; } } - }, - - NormalFunction: { - type: { - resolve(value) { - return "function"; - } - } } + + // NormalFunction: { + // type: { + // resolve(value) { + // return "function"; + // } + // } + // } } }); diff --git a/packages/db/src/db.ts b/packages/db/src/db.ts index 3c6e830f9ff..25e018f515e 100644 --- a/packages/db/src/db.ts +++ b/packages/db/src/db.ts @@ -2,10 +2,8 @@ import { GraphQLSchema, DocumentNode, parse, execute } from "graphql"; import { schema } from "@truffle/db/data"; import { generateCompileLoad } from "@truffle/db/loaders/commands"; -import { - WorkflowCompileResult, - WorkspaceRequest -} from "@truffle/db/loaders/types"; +import { WorkspaceRequest } from "@truffle/db/loaders/types"; +import { WorkflowCompileResult } from "@truffle/compile-common/src/types"; import { Workspace } from "@truffle/db/workspace"; interface IConfig { diff --git a/packages/db/src/loaders/commands/compile.ts b/packages/db/src/loaders/commands/compile.ts index 9b2f8f51f8f..68226d2fbcb 100644 --- a/packages/db/src/loaders/commands/compile.ts +++ b/packages/db/src/loaders/commands/compile.ts @@ -1,11 +1,11 @@ import { - WorkflowCompileResult, CompilationData, CompiledContract, toIdObject, WorkspaceRequest, WorkspaceResponse } from "@truffle/db/loaders/types"; +import { WorkflowCompileResult } from "@truffle/compile-common/src/types"; import { generateBytecodesLoad } from "@truffle/db/loaders/resources/bytecodes"; import { generateCompilationsLoad } from "@truffle/db/loaders/resources/compilations"; @@ -33,7 +33,7 @@ export function* generateCompileLoad( // start by adding loading the project resource const project = yield* generateProjectLoad(directory); - const getCurrent = function*(name, type) { + const getCurrent = function* (name, type) { return yield* generateProjectNameResolve(toIdObject(project), name, type); }; diff --git a/packages/db/src/loaders/schema/artifactsLoader.ts b/packages/db/src/loaders/schema/artifactsLoader.ts index 9026506df6c..7f883e81ef3 100644 --- a/packages/db/src/loaders/schema/artifactsLoader.ts +++ b/packages/db/src/loaders/schema/artifactsLoader.ts @@ -1,5 +1,5 @@ import { TruffleDB } from "@truffle/db/db"; -import * as Contracts from "@truffle/workflow-compile/new"; +import { WorkflowCompile } from "@truffle/workflow-compile"; import { ContractObject } from "@truffle/contract-schema/spec"; import * as fse from "fs-extra"; import path from "path"; @@ -84,7 +84,7 @@ export class ArtifactsLoader { } async load(): Promise { - const result = await Contracts.compile(this.config); + const result = await WorkflowCompile.compile(this.config); const { project, compilations } = await this.db.loadCompilations(result); diff --git a/packages/db/src/loaders/schema/test/index.ts b/packages/db/src/loaders/schema/test/index.ts index 165dc817e6a..da962ff288c 100644 --- a/packages/db/src/loaders/schema/test/index.ts +++ b/packages/db/src/loaders/schema/test/index.ts @@ -10,14 +10,13 @@ import { ResolveProjectName } from "@truffle/db/loaders/resources/projects"; import { generateId } from "@truffle/db/helpers"; -import * as Contracts from "@truffle/workflow-compile/new"; import Migrate from "@truffle/migrate"; import { Environment } from "@truffle/environment"; import Config from "@truffle/config"; import Ganache from "ganache-core"; import Web3 from "web3"; import * as fse from "fs-extra"; -import { shimBytecode } from "@truffle/workflow-compile/shims"; +import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import * as tmp from "tmp"; let server; @@ -35,8 +34,8 @@ afterAll(async done => { // mocking the truffle-workflow-compile to avoid jest timing issues // and also to keep from adding more time to Travis testing -jest.mock("@truffle/workflow-compile/new", () => ({ - compile: function(config, callback) { +jest.mock("@truffle/workflow-compile", () => ({ + compile: function (config, callback) { return require(path.join( __dirname, "workflowCompileOutputMock", @@ -350,8 +349,8 @@ describe("Compilation", () => { sourcePath: contract["sourcePath"] }); sourceIds.push({ id: sourceId }); - const shimBytecodeObject = shimBytecode(contract["bytecode"]); - const shimCallBytecodeObject = shimBytecode( + const shimBytecodeObject = forBytecode(contract["bytecode"]); + const shimCallBytecodeObject = forBytecode( contract["deployedBytecode"] ); let bytecodeId = generateId(shimBytecodeObject); @@ -620,7 +619,7 @@ describe("Compilation", () => { } } = await db.query(GetWorkspaceBytecode, bytecodeIds[index]); - let shimmedBytecode = shimBytecode(artifacts[index].bytecode); + let shimmedBytecode = forBytecode(artifacts[index].bytecode); expect(bytes).toEqual(shimmedBytecode.bytes); } }); @@ -684,10 +683,10 @@ describe("Compilation", () => { } } = await db.query(GetWorkspaceContract, contractIds[index]); - const artifactsCreateBytecode = shimBytecode(artifacts[index].bytecode); + const artifactsCreateBytecode = forBytecode(artifacts[index].bytecode); expect(createBytecode.bytes).toEqual(artifactsCreateBytecode.bytes); - const artifactsCallBytecode = shimBytecode( + const artifactsCallBytecode = forBytecode( artifacts[index].deployedBytecode ); expect(callBytecode.bytes).toEqual(artifactsCallBytecode.bytes); diff --git a/packages/db/src/loaders/test/index.ts b/packages/db/src/loaders/test/index.ts index efe7762cca9..8d521fee696 100644 --- a/packages/db/src/loaders/test/index.ts +++ b/packages/db/src/loaders/test/index.ts @@ -3,8 +3,8 @@ import gql from "graphql-tag"; import { TruffleDB } from "@truffle/db"; import tmp from "tmp"; -jest.mock("@truffle/workflow-compile/new", () => ({ - compile: function(config, callback) { +jest.mock("@truffle/workflow-compile", () => ({ + compile: function (config, callback) { return require(path.join( __dirname, "..", diff --git a/packages/db/src/loaders/types.ts b/packages/db/src/loaders/types.ts index 18054215414..276f89533f4 100644 --- a/packages/db/src/loaders/types.ts +++ b/packages/db/src/loaders/types.ts @@ -55,7 +55,7 @@ type Resource = { }; export type IdObject = { - [N in keyof R]: N extends "id" ? string : never + [N in keyof R]: N extends "id" ? string : never; }; export const toIdObject = ({ id }: R): IdObject => @@ -75,16 +75,3 @@ export type WorkspaceResponse = { workspace: { [RequestName in N]: R }; }; }; - -/** - * Output format of @truffle/workflow-compile/new - */ -export interface WorkflowCompileResult { - compilations: { - [compilerName: string]: { - sourceIndexes: string[]; - contracts: CompiledContract[]; - }; - }; - contracts: { [contractName: string]: ContractObject }; -} diff --git a/packages/db/src/workspace/test/bytecode.spec.ts b/packages/db/src/workspace/test/bytecode.spec.ts index 62aa3ffb74a..a4ae87c1b87 100644 --- a/packages/db/src/workspace/test/bytecode.spec.ts +++ b/packages/db/src/workspace/test/bytecode.spec.ts @@ -1,6 +1,6 @@ import { generateId, Migrations, WorkspaceClient } from "./utils"; import { AddBytecode, GetAllBytecodes, GetBytecode } from "./bytecode.graphql"; -import { shimBytecode } from "@truffle/workflow-compile/shims"; +import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; describe("Bytecode", () => { let wsClient; @@ -9,7 +9,7 @@ describe("Bytecode", () => { beforeEach(async () => { wsClient = new WorkspaceClient(); - shimmedBytecode = shimBytecode(Migrations.bytecode); + shimmedBytecode = forBytecode(Migrations.bytecode); expectedId = generateId(shimmedBytecode); addBytecodeResult = await wsClient.execute(AddBytecode, shimmedBytecode); }); diff --git a/packages/db/src/workspace/test/contract.spec.ts b/packages/db/src/workspace/test/contract.spec.ts index 7e2864f33b4..f2aded4ab13 100644 --- a/packages/db/src/workspace/test/contract.spec.ts +++ b/packages/db/src/workspace/test/contract.spec.ts @@ -1,6 +1,5 @@ import { generateId, Migrations, WorkspaceClient } from "./utils"; -import { shimBytecode } from "@truffle/workflow-compile/shims"; - +import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import { AddSource } from "./source.graphql"; import { AddBytecode } from "./bytecode.graphql"; import { @@ -29,7 +28,7 @@ describe("Contract", () => { sourceId = sourceResult.sourcesAdd.sources[0].id; //add bytecode and get id - const shimmedBytecode = shimBytecode(Migrations.bytecode); + const shimmedBytecode = forBytecode(Migrations.bytecode); const bytecodeResult = await wsClient.execute(AddBytecode, shimmedBytecode); bytecodeId = bytecodeResult.bytecodesAdd.bytecodes[0].id; diff --git a/packages/db/src/workspace/test/contractInstance.spec.ts b/packages/db/src/workspace/test/contractInstance.spec.ts index c1740e095c5..0ead1242eaa 100644 --- a/packages/db/src/workspace/test/contractInstance.spec.ts +++ b/packages/db/src/workspace/test/contractInstance.spec.ts @@ -1,5 +1,5 @@ import { generateId, Migrations, WorkspaceClient } from "./utils"; -import { shimBytecode } from "@truffle/workflow-compile/shims"; +import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import { AddNetworks } from "./network.graphql"; import { AddContractInstances, @@ -26,7 +26,7 @@ describe("Contract Instance", () => { address: address, network: { id: addNetworkResult.networksAdd.networks[0].id } }); - let shimmedBytecode = shimBytecode(Migrations.bytecode); + let shimmedBytecode = forBytecode(Migrations.bytecode); variables = [ { From aa278c33209eea6a34f58b4130623edec911249e Mon Sep 17 00:00:00 2001 From: fainashalts Date: Mon, 21 Sep 2020 17:52:33 -0700 Subject: [PATCH 2/9] Put workflow-compile back as a dependency --- packages/db/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/db/package.json b/packages/db/package.json index 6d4e7a4597e..0cad6c15474 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -57,6 +57,7 @@ "@gnd/graphql-tools": "^4.0.5-fix.0", "@gnd/jsonschema2graphql": "^1.0.15", "@truffle/artifactor": "^4.0.74", + "@truffle/workflow-compile": "^2.1.48", "@truffle/compile-common": "^0.3.9", "apollo-server": "^2.3.1", "fse": "^4.0.1", From 8e64e58888fb4b30b13847d003a0abe90c8823be Mon Sep 17 00:00:00 2001 From: fainashalts Date: Tue, 22 Sep 2020 21:12:49 -0700 Subject: [PATCH 3/9] Update package.json to reflect comple-common and workflow compile changes --- packages/db/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/db/package.json b/packages/db/package.json index 0cad6c15474..698afc28bba 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -57,8 +57,8 @@ "@gnd/graphql-tools": "^4.0.5-fix.0", "@gnd/jsonschema2graphql": "^1.0.15", "@truffle/artifactor": "^4.0.74", - "@truffle/workflow-compile": "^2.1.48", - "@truffle/compile-common": "^0.3.9", + "@truffle/compile-common": "^0.3.10", + "@truffle/workflow-compile": "^3.0.0", "apollo-server": "^2.3.1", "fse": "^4.0.1", "graphql": "^14.0.2", From 6f6a4f6e046390c9899e9c2fbbfe7c84c2ad847f Mon Sep 17 00:00:00 2001 From: fainashalts Date: Tue, 22 Sep 2020 21:22:35 -0700 Subject: [PATCH 4/9] Put schema.ts file back to normal --- packages/db/src/data/schema.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/db/src/data/schema.ts b/packages/db/src/data/schema.ts index d8f3f939d14..0723a46b643 100644 --- a/packages/db/src/data/schema.ts +++ b/packages/db/src/data/schema.ts @@ -2,7 +2,7 @@ import { transformSchema, FilterRootFields } from "@gnd/graphql-tools"; import { scopeSchemas } from "./utils"; -// import { abiSchema, schema as artifactsSchema } from "@truffle/db/artifacts"; +import { abiSchema, schema as artifactsSchema } from "@truffle/db/artifacts"; import { schema as workspaceSchema } from "@truffle/db/workspace"; import { loaderSchema } from "@truffle/db/loaders"; @@ -10,12 +10,13 @@ import { readInstructions } from "./bytecode"; export const schema = scopeSchemas({ subschemas: { + artifacts: artifactsSchema, workspace: workspaceSchema, loaders: loaderSchema }, typeDefs: [ // add types from abi schema - transformSchema(workspaceSchema, [new FilterRootFields(() => false)]) + transformSchema(abiSchema, [new FilterRootFields(() => false)]) ], resolvers: { Bytecode: { @@ -39,14 +40,14 @@ export const schema = scopeSchemas({ return "NormalFunction"; } } - } + }, - // NormalFunction: { - // type: { - // resolve(value) { - // return "function"; - // } - // } - // } + NormalFunction: { + type: { + resolve(value) { + return "function"; + } + } + } } }); From c2df0d5fe29e140ee84372dfcb631898c5e0a741 Mon Sep 17 00:00:00 2001 From: fainashalts Date: Wed, 23 Sep 2020 08:29:00 -0700 Subject: [PATCH 5/9] Reformat compilation output mock --- .../compilationOutput.json | 37743 ++++++++++------ 1 file changed, 24035 insertions(+), 13708 deletions(-) diff --git a/packages/db/src/loaders/schema/test/workflowCompileOutputMock/compilationOutput.json b/packages/db/src/loaders/schema/test/workflowCompileOutputMock/compilationOutput.json index 29d2f9e06de..0c28f5722e0 100644 --- a/packages/db/src/loaders/schema/test/workflowCompileOutputMock/compilationOutput.json +++ b/packages/db/src/loaders/schema/test/workflowCompileOutputMock/compilationOutput.json @@ -1,6667 +1,10655 @@ -{"compilations": { - "solc": { - "sourceIndexes": [ - "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", - "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", - "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol" +{ "contracts": [ + { + "contractName": "MagicSquare", + "abi": [ + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "n", + "type": "uint256" + } ], - "contracts": [ + "name": "generateMagicSquare", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getSquare", + "outputs": [ { - "contractName": "MagicSquare", - "abi": [ + "components": [ { - "constant": false, - "inputs": [ - { - "name": "n", - "type": "uint256" - } - ], - "name": "generateMagicSquare", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" + "internalType": "uint256[][]", + "name": "rows", + "type": "uint256[][]" + }, + { + "internalType": "uint256", + "name": "n", + "type": "uint256" + } + ], + "internalType": "struct SquareLib.MagicSquare", + "name": "square", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "components": [ + { + "internalType": "uint256[][]", + "name": "rows", + "type": "uint256[][]" }, { - "constant": true, - "inputs": [ + "internalType": "uint256", + "name": "n", + "type": "uint256" + } + ], + "internalType": "struct SquareLib.MagicSquare", + "name": "square", + "type": "tuple" + } + ], + "name": "save", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"generateMagicSquare\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSquare\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256[][]\",\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"internalType\":\"struct SquareLib.MagicSquare\",\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"components\":[{\"internalType\":\"uint256[][]\",\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"internalType\":\"struct SquareLib.MagicSquare\",\"name\":\"square\",\"type\":\"tuple\"}],\"name\":\"save\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol\":\"MagicSquare\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol\":{\"keccak256\":\"0xa54bcd478244f9ed78d698db9e513ef0ef4aeb77874f264e1956770898f00943\",\"urls\":[\"bzz-raw://35dab3c4919cd4c8e44e7e02670edb35be4bc5d6012301f387eeee41401572ec\",\"dweb:/ipfs/QmRcsZoEpPwVzy647M1vWsyj9vRZULPo55R4soXQL9eMUp\"]},\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":{\"keccak256\":\"0xfdd57b714a8ab00ba37fb6875091322e9b014a4ee1df170527a75d3ee8d54add\",\"urls\":[\"bzz-raw://02aaee76f3428cd626ef0732372c6d89d635f2b4de3ee1c9f3865af352dd9989\",\"dweb:/ipfs/QmP8re1b4ne2PHZqMDvQeWAKR37mmftN3dtXfxzsZr3Wc2\"]}},\"version\":1}", + "devdoc": { "methods": {} }, + "userdoc": { "methods": {} }, + "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "source": "pragma solidity >=0.5.6;\n\npragma experimental ABIEncoderV2;\n\nimport \"./SquareLib.sol\";\n\ncontract MagicSquare {\n using SquareLib for SquareLib.MagicSquare;\n\n SquareLib.MagicSquare storedSquare;\n string storedGreeting;\n\n function generateMagicSquare(uint n)\n public\n {\n string memory greeting;\n SquareLib.MagicSquare memory square;\n uint256 x;\n uint256 y;\n uint256 i;\n\n greeting = \"let us construct a magic square:\";\n square = SquareLib.initialize(n);\n\n x = 0;\n y = n / 2;\n for (i = 1; i <= n * n; i++) {\n (x, y, i) = square.step(x, y, i);\n }\n\n this.save(square);\n storedGreeting = \"finally, a decentralized magic square service!\";\n }\n\n function getSquare()\n public\n view\n returns (SquareLib.MagicSquare memory square)\n {\n return storedSquare;\n }\n\n function save(SquareLib.MagicSquare memory square)\n public\n {\n uint256 x;\n uint256 y;\n\n storedSquare.n = square.n;\n storedSquare.rows.length = square.n;\n\n for (x = 0; x < square.n; x++) {\n storedSquare.rows[x].length = square.n;\n\n for (y = 0; y < square.n; y++) {\n storedSquare.rows[x][y] = square.rows[x][y];\n }\n }\n }\n}\n", + "sourceMap": "88:1093:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;88:1093:0;;;;;;;", + "deployedSourceMap": "88:1093:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;88:1093:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;816:363;;;;;;;;;;;;;;;;:::i;:::-;;689:123;;;:::i;:::-;;;;;;;;;;;;;;;;223:462;;;;;;;;;;;;;;;;:::i;:::-;;816:363;886:9;901;934:6;:8;;;917:12;:14;;:25;;;;975:6;:8;;;948:12;:17;;:35;;;;;:::i;:::-;;999:1;995:5;;990:185;1006:6;:8;;;1002:1;:12;990:185;;;1059:6;:8;;;1029:12;:17;;1047:1;1029:20;;;;;;;;;;;;;;;:38;;;;;:::i;:::-;;1085:1;1081:5;;1076:93;1092:6;:8;;;1088:1;:12;1076:93;;;1143:6;:11;;;1155:1;1143:14;;;;;;;;;;;;;;1158:1;1143:17;;;;;;;;;;;;;;1117:12;:17;;1135:1;1117:20;;;;;;;;;;;;;;;1138:1;1117:23;;;;;;;;;;;;;;;:43;;;;1102:3;;;;;;;1076:93;;;1016:3;;;;;;;990:185;;;816:363;;;:::o;689:123::-;743:35;;:::i;:::-;795:12;788:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;689:123;:::o;223:462::-;279:22;307:35;;:::i;:::-;348:9;363;378;394:45;;;;;;;;;;;;;;;;;;;454:9;:20;475:1;454:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;454:23:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;454:23:0;;;;;;39:16:-1;36:1;17:17;2:54;454:23:0;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;454:23:0;;;;;;;;;445:32;;488:1;484:5;;503:1;499;:5;;;;;;495:9;;519:1;515:5;;510:76;531:1;527;:5;522:1;:10;510:76;;559:20;571:1;574;577;559:6;:11;;:20;;;;;;:::i;:::-;547:32;;;;;;;;;;;;534:3;;;;;;;510:76;;;592:4;:9;;;602:6;592:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;592:17:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;592:17:0;;;;615:65;;;;;;;;;;;;;;;;;:14;:65;;;;;;;;;;;;:::i;:::-;;223:462;;;;;;:::o;423:523:2:-;559:12;579;599:13;652:1;631:6;:11;;;643:1;631:14;;;;;;;;;;;;;;646:1;631:17;;;;;;;;;;;;;;:22;627:167;;680:6;:8;;;675:1;671;:5;670:18;;;;;;663:25;;724:6;:8;;;719:1;715;704:6;:8;;;:12;:16;703:29;;;;;;696:36;;752:1;748;:5;740:13;;769:4;775;781:5;761:26;;;;;;;;627:167;820:1;800:6;:11;;;812:1;800:14;;;;;;;;;;;;;;815:1;800:17;;;;;;;;;;;;;:21;;;;;855:6;:8;;;850:1;846;835:6;:8;;;:12;:16;834:29;;;;;;827:36;;886:6;:8;;;881:1;877;:5;876:18;;;;;;869:25;;908:1;900:9;;923:4;929;935:5;915:26;;;;;;423:523;;;;;;;;;:::o;88:1093:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;25:733:-1:-;;159:3;152:4;144:6;140:17;136:27;126:2;;177:1;174;167:12;126:2;214:6;201:20;236:97;251:81;325:6;251:81;;;236:97;;;227:106;;350:5;375:6;368:5;361:21;405:4;397:6;393:17;383:27;;427:4;422:3;418:14;411:21;;480:6;513:1;498:254;523:6;520:1;517:13;498:254;;;606:3;593:17;585:6;581:30;630:58;684:3;672:10;630:58;;;625:3;618:71;712:4;707:3;703:14;696:21;;740:4;735:3;731:14;724:21;;555:197;545:1;542;538:9;533:14;;498:254;;;502:14;119:639;;;;;;;;786:741;;931:3;924:4;916:6;912:17;908:27;898:2;;949:1;946;939:12;898:2;979:6;973:13;1001:97;1016:81;1090:6;1016:81;;;1001:97;;;992:106;;1115:5;1140:6;1133:5;1126:21;1170:4;1162:6;1158:17;1148:27;;1192:4;1187:3;1183:14;1176:21;;1245:6;1278:1;1263:258;1288:6;1285:1;1282:13;1263:258;;;1364:3;1358:10;1350:6;1346:23;1388:69;1453:3;1441:10;1388:69;;;1383:3;1376:82;1481:4;1476:3;1472:14;1465:21;;1509:4;1504:3;1500:14;1493:21;;1320:201;1310:1;1307;1303:9;1298:14;;1263:258;;;1267:14;891:636;;;;;;;;1553:699;;1666:3;1659:4;1651:6;1647:17;1643:27;1633:2;;1684:1;1681;1674:12;1633:2;1721:6;1708:20;1743:76;1758:60;1811:6;1758:60;;;1743:76;;;1734:85;;1836:5;1861:6;1854:5;1847:21;1891:4;1883:6;1879:17;1869:27;;1913:4;1908:3;1904:14;1897:21;;1966:6;2013:3;2005:4;1997:6;1993:17;1988:3;1984:27;1981:36;1978:2;;;2030:1;2027;2020:12;1978:2;2055:1;2040:206;2065:6;2062:1;2059:13;2040:206;;;2123:3;2145:37;2178:3;2166:10;2145:37;;;2140:3;2133:50;2206:4;2201:3;2197:14;2190:21;;2234:4;2229:3;2225:14;2218:21;;2097:149;2087:1;2084;2080:9;2075:14;;2040:206;;;2044:14;1626:626;;;;;;;;2278:714;;2402:3;2395:4;2387:6;2383:17;2379:27;2369:2;;2420:1;2417;2410:12;2369:2;2450:6;2444:13;2472:76;2487:60;2540:6;2487:60;;;2472:76;;;2463:85;;2565:5;2590:6;2583:5;2576:21;2620:4;2612:6;2608:17;2598:27;;2642:4;2637:3;2633:14;2626:21;;2695:6;2742:3;2734:4;2726:6;2722:17;2717:3;2713:27;2710:36;2707:2;;;2759:1;2756;2749:12;2707:2;2784:1;2769:217;2794:6;2791:1;2788:13;2769:217;;;2852:3;2874:48;2918:3;2906:10;2874:48;;;2869:3;2862:61;2946:4;2941:3;2937:14;2930:21;;2974:4;2969:3;2965:14;2958:21;;2826:160;2816:1;2813;2809:9;2804:14;;2769:217;;;2773:14;2362:630;;;;;;;;3035:595;;3152:4;3140:9;3135:3;3131:19;3127:30;3124:2;;;3170:1;3167;3160:12;3124:2;3188:20;3203:4;3188:20;;;3179:29;;3286:1;3275:9;3271:17;3258:31;3309:18;3301:6;3298:30;3295:2;;;3341:1;3338;3331:12;3295:2;3376:91;3463:3;3454:6;3443:9;3439:22;3376:91;;;3369:4;3362:5;3358:16;3351:117;3218:261;3526:2;3559:49;3604:3;3595:6;3584:9;3580:22;3559:49;;;3552:4;3545:5;3541:16;3534:75;3489:131;3118:512;;;;;3672:621;;3800:4;3788:9;3783:3;3779:19;3775:30;3772:2;;;3818:1;3815;3808:12;3772:2;3836:20;3851:4;3836:20;;;3827:29;;3927:1;3916:9;3912:17;3906:24;3950:18;3942:6;3939:30;3936:2;;;3982:1;3979;3972:12;3936:2;4017:102;4115:3;4106:6;4095:9;4091:22;4017:102;;;4010:4;4003:5;3999:16;3992:128;3866:265;4178:2;4211:60;4267:3;4258:6;4247:9;4243:22;4211:60;;;4204:4;4197:5;4193:16;4186:86;4141:142;3766:527;;;;;4300:130;;4380:6;4367:20;4358:29;;4392:33;4419:5;4392:33;;;4352:78;;;;;4437:134;;4521:6;4515:13;4506:22;;4533:33;4560:5;4533:33;;;4500:71;;;;;4578:383;;4710:2;4698:9;4689:7;4685:23;4681:32;4678:2;;;4726:1;4723;4716:12;4678:2;4789:1;4778:9;4774:17;4761:31;4812:18;4804:6;4801:30;4798:2;;;4844:1;4841;4834:12;4798:2;4864:81;4937:7;4928:6;4917:9;4913:22;4864:81;;;4854:91;;4740:211;4672:289;;;;;4968:398;;5111:2;5099:9;5090:7;5086:23;5082:32;5079:2;;;5127:1;5124;5117:12;5079:2;5183:1;5172:9;5168:17;5162:24;5206:18;5198:6;5195:30;5192:2;;;5238:1;5235;5228:12;5192:2;5258:92;5342:7;5333:6;5322:9;5318:22;5258:92;;;5248:102;;5141:215;5073:293;;;;;5373:241;;5477:2;5465:9;5456:7;5452:23;5448:32;5445:2;;;5493:1;5490;5483:12;5445:2;5528:1;5545:53;5590:7;5581:6;5570:9;5566:22;5545:53;;;5535:63;;5507:97;5439:175;;;;;5622:241;;5765:92;5853:3;5845:6;5765:92;;;5751:106;;5744:119;;;;;5872:173;;5959:46;6001:3;5993:6;5959:46;;;6034:4;6029:3;6025:14;6011:28;;5952:93;;;;;6088:980;;6261:71;6326:5;6261:71;;;6345:97;6435:6;6430:3;6345:97;;;6338:104;;6465:3;6507:4;6499:6;6495:17;6490:3;6486:27;6534:73;6601:5;6534:73;;;6627:7;6655:1;6640:389;6665:6;6662:1;6659:13;6640:389;;;6727:9;6721:4;6717:20;6712:3;6705:33;6772:6;6766:13;6794:106;6895:4;6880:13;6794:106;;;6786:114;;6917:77;6987:6;6917:77;;;6907:87;;7017:4;7012:3;7008:14;7001:21;;6697:332;6687:1;6684;6680:9;6675:14;;6640:389;;;6644:14;7042:4;7035:11;;7059:3;7052:10;;6240:828;;;;;;;;;;7107:654;;7238:50;7282:5;7238:50;;;7301:76;7370:6;7365:3;7301:76;;;7294:83;;7398:52;7444:5;7398:52;;;7470:7;7498:1;7483:256;7508:6;7505:1;7502:13;7483:256;;;7575:6;7569:13;7596:63;7655:3;7640:13;7596:63;;;7589:70;;7676:56;7725:6;7676:56;;;7666:66;;7540:199;7530:1;7527;7523:9;7518:14;;7483:256;;;7487:14;7752:3;7745:10;;7217:544;;;;;;;;7836:642;;7993:4;7988:3;7984:14;8076:4;8069:5;8065:16;8059:23;8128:3;8122:4;8118:14;8111:4;8106:3;8102:14;8095:38;8148:141;8284:4;8270:12;8148:141;;;8140:149;;8013:288;8371:4;8364:5;8360:16;8354:23;8383:63;8440:4;8435:3;8431:14;8417:12;8383:63;;;8311:141;8469:4;8462:11;;7966:512;;;;;;8485:103;8558:24;8576:5;8558:24;;;8553:3;8546:37;8540:48;;;8595:121;8686:24;8704:5;8686:24;;;8681:3;8674:37;8668:48;;;8723:373;;8897:2;8886:9;8882:18;8874:26;;8947:9;8941:4;8937:20;8933:1;8922:9;8918:17;8911:47;8972:114;9081:4;9072:6;8972:114;;;8964:122;;8868:228;;;;;9103:229;;9229:2;9218:9;9214:18;9206:26;;9243:79;9319:1;9308:9;9304:17;9295:6;9243:79;;;9200:132;;;;;9339:256;;9401:2;9395:9;9385:19;;9439:4;9431:6;9427:17;9538:6;9526:10;9523:22;9502:18;9490:10;9487:34;9484:62;9481:2;;;9559:1;9556;9549:12;9481:2;9579:10;9575:2;9568:22;9379:216;;;;;9602:321;;9778:18;9770:6;9767:30;9764:2;;;9810:1;9807;9800:12;9764:2;9845:4;9837:6;9833:17;9825:25;;9908:4;9902;9898:15;9890:23;;9701:222;;;;9930:300;;10085:18;10077:6;10074:30;10071:2;;;10117:1;10114;10107:12;10071:2;10152:4;10144:6;10140:17;10132:25;;10215:4;10209;10205:15;10197:23;;10008:222;;;;10237:168;;10340:3;10332:11;;10378:4;10373:3;10369:14;10361:22;;10326:79;;;;10412:147;;10494:3;10486:11;;10532:4;10527:3;10523:14;10515:22;;10480:79;;;;10566:154;;10692:5;10686:12;10676:22;;10657:63;;;;10727:133;;10832:5;10826:12;10816:22;;10797:63;;;;10867:125;;10982:4;10977:3;10973:14;10965:22;;10959:33;;;;10999:104;;11093:4;11088:3;11084:14;11076:22;;11070:33;;;;11111:189;;11252:6;11247:3;11240:19;11289:4;11284:3;11280:14;11265:29;;11233:67;;;;;11309:168;;11429:6;11424:3;11417:19;11466:4;11461:3;11457:14;11442:29;;11410:67;;;;;11485:72;;11547:5;11536:16;;11530:27;;;;11564:117;11633:24;11651:5;11633:24;;;11626:5;11623:35;11613:2;;11672:1;11669;11662:12;11613:2;11607:74;", + "ast": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "exportedSymbols": { "MagicSquare": [178] }, + "id": 179, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": ["solidity", ">=", "0.5", ".6"], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "id": 2, + "literals": ["experimental", "ABIEncoderV2"], + "nodeType": "PragmaDirective", + "src": "26:33:0" + }, + { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "file": "./SquareLib.sol", + "id": 3, + "nodeType": "ImportDirective", + "scope": 179, + "sourceUnit": 398, + "src": "61:25:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 178, + "linearizedBaseContracts": [178], + "name": "MagicSquare", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 6, + "libraryName": { + "contractScope": null, + "id": 4, + "name": "SquareLib", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 397, + "src": "119:9:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SquareLib_$397", + "typeString": "library SquareLib" + } + }, + "nodeType": "UsingForDirective", + "src": "113:42:0", + "typeName": { + "contractScope": null, + "id": 5, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "133:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + } + }, + { + "constant": false, + "id": 8, + "name": "storedSquare", + "nodeType": "VariableDeclaration", + "scope": 178, + "src": "159:34:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 7, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "159:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 10, + "name": "storedGreeting", + "nodeType": "VariableDeclaration", + "scope": 178, + "src": "197:21:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "197:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 89, + "nodeType": "Block", + "src": "273:412:0", + "statements": [ { - "components": [ - { - "name": "rows", - "type": "uint256[][]" - }, + "assignments": [16], + "declarations": [ { - "name": "n", - "type": "uint256" + "constant": false, + "id": 16, + "name": "greeting", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "279:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 15, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "279:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" } ], - "name": "square", - "type": "tuple" - } - ], - "name": "getSquare", - "outputs": [ + "id": 17, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "279:22:0" + }, { - "components": [ + "assignments": [21], + "declarations": [ { - "name": "rows", - "type": "uint256[][]" - }, + "constant": false, + "id": 21, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "307:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 20, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "307:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 22, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "307:35:0" + }, + { + "assignments": [24], + "declarations": [ { - "name": "n", - "type": "uint256" + "constant": false, + "id": 24, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "348:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "348:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" } ], - "name": "square", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ + "id": 25, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "348:9:0" + }, { - "components": [ + "assignments": [27], + "declarations": [ { - "name": "rows", - "type": "uint256[][]" - }, + "constant": false, + "id": 27, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "363:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 26, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "363:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 28, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "363:9:0" + }, + { + "assignments": [30], + "declarations": [ { - "name": "n", - "type": "uint256" + "constant": false, + "id": 30, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "378:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 29, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "378:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" } ], - "name": "square", - "type": "tuple" - } - ], - "name": "save", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"name\":\"save\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSquare\",\"outputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"generateMagicSquare\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol\":\"MagicSquare\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol\":{\"keccak256\":\"0xa54bcd478244f9ed78d698db9e513ef0ef4aeb77874f264e1956770898f00943\",\"urls\":[\"bzzr://49e6ec033a29d3530da13ec679f8854ff9efcb4543f72fa32e93cd176b44a231\"]},\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":{\"keccak256\":\"0xfdd57b714a8ab00ba37fb6875091322e9b014a4ee1df170527a75d3ee8d54add\",\"urls\":[\"bzzr://b62f57a3f7326bfc9025f266d1f9d4e52947adc0e25927b6ea790b5dbae75713\"]}},\"version\":1}", - "bytecode": { - "bytes": "608060405234801561001057600080fd5b50610cf4806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80638b213ffc146100465780638dbbe62514610062578063f117a19314610080575b600080fd5b610060600480360361005b9190810190610940565b61009c565b005b61006a61018a565b6040516100779190610b45565b60405180910390f35b61009a600480360361009591908101906109c2565b61024d565b005b6000808260200151600060010181905550826020015160008001816100c191906104fc565b50600091505b82602001518210156101855782602001516000800183815481106100e757fe5b90600052602060002001816100fc9190610528565b50600090505b8260200151811015610178578260000151828151811061011e57fe5b6020026020010151818151811061013157fe5b602002602001015160008001838154811061014857fe5b90600052602060002001828154811061015d57fe5b90600052602060002001819055508080600101915050610102565b81806001019250506100c7565b505050565b610192610554565b600060405180604001604052908160008201805480602002602001604051908101604052809291908181526020016000905b828210156102365783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561022257602002820191906000526020600020905b81548152602001906001019080831161020e575b5050505050815260200190600101906101c4565b505050508152602001600182015481525050905090565b6060610257610554565b60008060006040518060400160405280602081526020017f6c657420757320636f6e7374727563742061206d61676963207371756172653a815250945073000000000000000000000000000000000000000063fe4b84df876040518263ffffffff1660e01b81526004016102cb9190610b67565b60006040518083038186803b1580156102e357600080fd5b505af41580156102f7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506103209190810190610981565b9350600092506002868161033057fe5b049150600190505b85860281116103715761035883838387610413909392919063ffffffff16565b8093508194508295505050508080600101915050610338565b3073ffffffffffffffffffffffffffffffffffffffff16638b213ffc856040518263ffffffff1660e01b81526004016103aa9190610b45565b600060405180830381600087803b1580156103c457600080fd5b505af11580156103d8573d6000803e3d6000fd5b505050506040518060600160405280602e8152602001610c8d602e91396002908051906020019061040a92919061056e565b50505050505050565b6000806000808760000151878151811061042957fe5b6020026020010151868151811061043c57fe5b602002602001015114610489578660200151600287018161045957fe5b0692508660200151600186896020015101038161047257fe5b0691506001840390508282829250925092506104f2565b838760000151878151811061049a57fe5b602002602001015186815181106104ad57fe5b602002602001018181525050866020015160018789602001510103816104cf57fe5b069250866020015160018601816104e257fe5b0691508390508282829250925092505b9450945094915050565b8154818355818111156105235781836000526020600020918201910161052291906105ee565b5b505050565b81548183558181111561054f5781836000526020600020918201910161054e919061061a565b5b505050565b604051806040016040528060608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105af57805160ff19168380011785556105dd565b828001600101855582156105dd579182015b828111156105dc5782518255916020019190600101906105c1565b5b5090506105ea919061061a565b5090565b61061791905b80821115610613576000818161060a919061063f565b506001016105f4565b5090565b90565b61063c91905b80821115610638576000816000905550600101610620565b5090565b90565b508054600082559060005260206000209081019061065d919061061a565b50565b600082601f83011261067157600080fd5b813561068461067f82610baf565b610b82565b9150818183526020840193506020810190508360005b838110156106ca57813586016106b08882610748565b84526020840193506020830192505060018101905061069a565b5050505092915050565b600082601f8301126106e557600080fd5b81516106f86106f382610baf565b610b82565b9150818183526020840193506020810190508360005b8381101561073e578151860161072488826107cb565b84526020840193506020830192505060018101905061070e565b5050505092915050565b600082601f83011261075957600080fd5b813561076c61076782610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561079157600080fd5b60005b838110156107c157816107a78882610916565b845260208401935060208301925050600181019050610794565b5050505092915050565b600082601f8301126107dc57600080fd5b81516107ef6107ea82610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561081457600080fd5b60005b83811015610844578161082a888261092b565b845260208401935060208301925050600181019050610817565b5050505092915050565b60006040828403121561086057600080fd5b61086a6040610b82565b9050600082013567ffffffffffffffff81111561088657600080fd5b61089284828501610660565b60008301525060206108a684828501610916565b60208301525092915050565b6000604082840312156108c457600080fd5b6108ce6040610b82565b9050600082015167ffffffffffffffff8111156108ea57600080fd5b6108f6848285016106d4565b600083015250602061090a8482850161092b565b60208301525092915050565b60008135905061092581610c75565b92915050565b60008151905061093a81610c75565b92915050565b60006020828403121561095257600080fd5b600082013567ffffffffffffffff81111561096c57600080fd5b6109788482850161084e565b91505092915050565b60006020828403121561099357600080fd5b600082015167ffffffffffffffff8111156109ad57600080fd5b6109b9848285016108b2565b91505092915050565b6000602082840312156109d457600080fd5b60006109e284828501610916565b91505092915050565b60006109f78383610a8c565b905092915050565b6000610a0b8383610b27565b60208301905092915050565b6000610a2282610c19565b610a2c8185610c49565b935083602082028501610a3e85610bff565b8060005b85811015610a7a5784840389528151610a5b85826109eb565b9450610a6683610c2f565b925060208a01995050600181019050610a42565b50829750879550505050505092915050565b6000610a9782610c24565b610aa18185610c5a565b9350610aac83610c0c565b8060005b83811015610add578151610ac488826109ff565b9750610acf83610c3c565b925050600181019050610ab0565b5085935050505092915050565b60006040830160008301518482036000860152610b078282610a17565b9150506020830151610b1c6020860182610b27565b508091505092915050565b610b3081610c6b565b82525050565b610b3f81610c6b565b82525050565b60006020820190508181036000830152610b5f8184610aea565b905092915050565b6000602082019050610b7c6000830184610b36565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610ba557600080fd5b8060405250919050565b600067ffffffffffffffff821115610bc657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610bee57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b610c7e81610c6b565b8114610c8957600080fd5b5056fe66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521a265627a7a723058200f0c3e8fe5a3a1acd916506bf818127749632aa46170ba992760d7e667cbd4c76c6578706572696d656e74616cf50037", - "linkReferences": [{ "offsets": [694], "name": "SquareLib", "length": 20 }] - }, - "deployedBytecode": { - "bytes": "608060405234801561001057600080fd5b50600436106100415760003560e01c80638b213ffc146100465780638dbbe62514610062578063f117a19314610080575b600080fd5b610060600480360361005b9190810190610940565b61009c565b005b61006a61018a565b6040516100779190610b45565b60405180910390f35b61009a600480360361009591908101906109c2565b61024d565b005b6000808260200151600060010181905550826020015160008001816100c191906104fc565b50600091505b82602001518210156101855782602001516000800183815481106100e757fe5b90600052602060002001816100fc9190610528565b50600090505b8260200151811015610178578260000151828151811061011e57fe5b6020026020010151818151811061013157fe5b602002602001015160008001838154811061014857fe5b90600052602060002001828154811061015d57fe5b90600052602060002001819055508080600101915050610102565b81806001019250506100c7565b505050565b610192610554565b600060405180604001604052908160008201805480602002602001604051908101604052809291908181526020016000905b828210156102365783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561022257602002820191906000526020600020905b81548152602001906001019080831161020e575b5050505050815260200190600101906101c4565b505050508152602001600182015481525050905090565b6060610257610554565b60008060006040518060400160405280602081526020017f6c657420757320636f6e7374727563742061206d61676963207371756172653a815250945073000000000000000000000000000000000000000063fe4b84df876040518263ffffffff1660e01b81526004016102cb9190610b67565b60006040518083038186803b1580156102e357600080fd5b505af41580156102f7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506103209190810190610981565b9350600092506002868161033057fe5b049150600190505b85860281116103715761035883838387610413909392919063ffffffff16565b8093508194508295505050508080600101915050610338565b3073ffffffffffffffffffffffffffffffffffffffff16638b213ffc856040518263ffffffff1660e01b81526004016103aa9190610b45565b600060405180830381600087803b1580156103c457600080fd5b505af11580156103d8573d6000803e3d6000fd5b505050506040518060600160405280602e8152602001610c8d602e91396002908051906020019061040a92919061056e565b50505050505050565b6000806000808760000151878151811061042957fe5b6020026020010151868151811061043c57fe5b602002602001015114610489578660200151600287018161045957fe5b0692508660200151600186896020015101038161047257fe5b0691506001840390508282829250925092506104f2565b838760000151878151811061049a57fe5b602002602001015186815181106104ad57fe5b602002602001018181525050866020015160018789602001510103816104cf57fe5b069250866020015160018601816104e257fe5b0691508390508282829250925092505b9450945094915050565b8154818355818111156105235781836000526020600020918201910161052291906105ee565b5b505050565b81548183558181111561054f5781836000526020600020918201910161054e919061061a565b5b505050565b604051806040016040528060608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105af57805160ff19168380011785556105dd565b828001600101855582156105dd579182015b828111156105dc5782518255916020019190600101906105c1565b5b5090506105ea919061061a565b5090565b61061791905b80821115610613576000818161060a919061063f565b506001016105f4565b5090565b90565b61063c91905b80821115610638576000816000905550600101610620565b5090565b90565b508054600082559060005260206000209081019061065d919061061a565b50565b600082601f83011261067157600080fd5b813561068461067f82610baf565b610b82565b9150818183526020840193506020810190508360005b838110156106ca57813586016106b08882610748565b84526020840193506020830192505060018101905061069a565b5050505092915050565b600082601f8301126106e557600080fd5b81516106f86106f382610baf565b610b82565b9150818183526020840193506020810190508360005b8381101561073e578151860161072488826107cb565b84526020840193506020830192505060018101905061070e565b5050505092915050565b600082601f83011261075957600080fd5b813561076c61076782610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561079157600080fd5b60005b838110156107c157816107a78882610916565b845260208401935060208301925050600181019050610794565b5050505092915050565b600082601f8301126107dc57600080fd5b81516107ef6107ea82610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561081457600080fd5b60005b83811015610844578161082a888261092b565b845260208401935060208301925050600181019050610817565b5050505092915050565b60006040828403121561086057600080fd5b61086a6040610b82565b9050600082013567ffffffffffffffff81111561088657600080fd5b61089284828501610660565b60008301525060206108a684828501610916565b60208301525092915050565b6000604082840312156108c457600080fd5b6108ce6040610b82565b9050600082015167ffffffffffffffff8111156108ea57600080fd5b6108f6848285016106d4565b600083015250602061090a8482850161092b565b60208301525092915050565b60008135905061092581610c75565b92915050565b60008151905061093a81610c75565b92915050565b60006020828403121561095257600080fd5b600082013567ffffffffffffffff81111561096c57600080fd5b6109788482850161084e565b91505092915050565b60006020828403121561099357600080fd5b600082015167ffffffffffffffff8111156109ad57600080fd5b6109b9848285016108b2565b91505092915050565b6000602082840312156109d457600080fd5b60006109e284828501610916565b91505092915050565b60006109f78383610a8c565b905092915050565b6000610a0b8383610b27565b60208301905092915050565b6000610a2282610c19565b610a2c8185610c49565b935083602082028501610a3e85610bff565b8060005b85811015610a7a5784840389528151610a5b85826109eb565b9450610a6683610c2f565b925060208a01995050600181019050610a42565b50829750879550505050505092915050565b6000610a9782610c24565b610aa18185610c5a565b9350610aac83610c0c565b8060005b83811015610add578151610ac488826109ff565b9750610acf83610c3c565b925050600181019050610ab0565b5085935050505092915050565b60006040830160008301518482036000860152610b078282610a17565b9150506020830151610b1c6020860182610b27565b508091505092915050565b610b3081610c6b565b82525050565b610b3f81610c6b565b82525050565b60006020820190508181036000830152610b5f8184610aea565b905092915050565b6000602082019050610b7c6000830184610b36565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610ba557600080fd5b8060405250919050565b600067ffffffffffffffff821115610bc657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610bee57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b610c7e81610c6b565b8114610c8957600080fd5b5056fe66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521a265627a7a723058200f0c3e8fe5a3a1acd916506bf818127749632aa46170ba992760d7e667cbd4c76c6578706572696d656e74616cf50037", - "linkReferences": [ { "offsets": [662], "name": "SquareLib", "length": 20 }] - }, - "sourceMap": "88:1093:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;88:1093:0;;;;;;;", - "deployedSourceMap": "88:1093:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;88:1093:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;816:363;;;;;;;;;;;;;;;;:::i;:::-;;689:123;;;:::i;:::-;;;;;;;;;;;;;;;;223:462;;;;;;;;;;;;;;;;:::i;:::-;;816:363;886:9;901;934:6;:8;;;917:12;:14;;:25;;;;975:6;:8;;;948:12;:17;;:35;;;;;:::i;:::-;;999:1;995:5;;990:185;1006:6;:8;;;1002:1;:12;990:185;;;1059:6;:8;;;1029:12;:17;;1047:1;1029:20;;;;;;;;;;;;;;;:38;;;;;:::i;:::-;;1085:1;1081:5;;1076:93;1092:6;:8;;;1088:1;:12;1076:93;;;1143:6;:11;;;1155:1;1143:14;;;;;;;;;;;;;;1158:1;1143:17;;;;;;;;;;;;;;1117:12;:17;;1135:1;1117:20;;;;;;;;;;;;;;;1138:1;1117:23;;;;;;;;;;;;;;;:43;;;;1102:3;;;;;;;1076:93;;;1016:3;;;;;;;990:185;;;816:363;;;:::o;689:123::-;743:35;;:::i;:::-;795:12;788:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;689:123;:::o;223:462::-;279:22;307:35;;:::i;:::-;348:9;363;378;394:45;;;;;;;;;;;;;;;;;;;454:9;:20;475:1;454:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;454:23:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;454:23:0;;;;;;39:16:-1;36:1;17:17;2:54;454:23:0;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;454:23:0;;;;;;;;;445:32;;488:1;484:5;;503:1;499;:5;;;;;;495:9;;519:1;515:5;;510:76;531:1;527;:5;522:1;:10;510:76;;559:20;571:1;574;577;559:6;:11;;:20;;;;;;:::i;:::-;547:32;;;;;;;;;;;;534:3;;;;;;;510:76;;;592:4;:9;;;602:6;592:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;592:17:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;592:17:0;;;;615:65;;;;;;;;;;;;;;;;;:14;:65;;;;;;;;;;;;:::i;:::-;;223:462;;;;;;:::o;423:523:2:-;559:12;579;599:13;652:1;631:6;:11;;;643:1;631:14;;;;;;;;;;;;;;646:1;631:17;;;;;;;;;;;;;;:22;627:167;;680:6;:8;;;675:1;671;:5;670:18;;;;;;663:25;;724:6;:8;;;719:1;715;704:6;:8;;;:12;:16;703:29;;;;;;696:36;;752:1;748;:5;740:13;;769:4;775;781:5;761:26;;;;;;;;627:167;820:1;800:6;:11;;;812:1;800:14;;;;;;;;;;;;;;815:1;800:17;;;;;;;;;;;;;:21;;;;;855:6;:8;;;850:1;846;835:6;:8;;;:12;:16;834:29;;;;;;827:36;;886:6;:8;;;881:1;877;:5;876:18;;;;;;869:25;;908:1;900:9;;923:4;929;935:5;915:26;;;;;;423:523;;;;;;;;;:::o;88:1093:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;25:733:-1:-;;159:3;152:4;144:6;140:17;136:27;126:2;;177:1;174;167:12;126:2;214:6;201:20;236:97;251:81;325:6;251:81;;;236:97;;;227:106;;350:5;375:6;368:5;361:21;405:4;397:6;393:17;383:27;;427:4;422:3;418:14;411:21;;480:6;513:1;498:254;523:6;520:1;517:13;498:254;;;606:3;593:17;585:6;581:30;630:58;684:3;672:10;630:58;;;625:3;618:71;712:4;707:3;703:14;696:21;;740:4;735:3;731:14;724:21;;555:197;545:1;542;538:9;533:14;;498:254;;;502:14;119:639;;;;;;;;786:741;;931:3;924:4;916:6;912:17;908:27;898:2;;949:1;946;939:12;898:2;979:6;973:13;1001:97;1016:81;1090:6;1016:81;;;1001:97;;;992:106;;1115:5;1140:6;1133:5;1126:21;1170:4;1162:6;1158:17;1148:27;;1192:4;1187:3;1183:14;1176:21;;1245:6;1278:1;1263:258;1288:6;1285:1;1282:13;1263:258;;;1364:3;1358:10;1350:6;1346:23;1388:69;1453:3;1441:10;1388:69;;;1383:3;1376:82;1481:4;1476:3;1472:14;1465:21;;1509:4;1504:3;1500:14;1493:21;;1320:201;1310:1;1307;1303:9;1298:14;;1263:258;;;1267:14;891:636;;;;;;;;1553:699;;1666:3;1659:4;1651:6;1647:17;1643:27;1633:2;;1684:1;1681;1674:12;1633:2;1721:6;1708:20;1743:76;1758:60;1811:6;1758:60;;;1743:76;;;1734:85;;1836:5;1861:6;1854:5;1847:21;1891:4;1883:6;1879:17;1869:27;;1913:4;1908:3;1904:14;1897:21;;1966:6;2013:3;2005:4;1997:6;1993:17;1988:3;1984:27;1981:36;1978:2;;;2030:1;2027;2020:12;1978:2;2055:1;2040:206;2065:6;2062:1;2059:13;2040:206;;;2123:3;2145:37;2178:3;2166:10;2145:37;;;2140:3;2133:50;2206:4;2201:3;2197:14;2190:21;;2234:4;2229:3;2225:14;2218:21;;2097:149;2087:1;2084;2080:9;2075:14;;2040:206;;;2044:14;1626:626;;;;;;;;2278:714;;2402:3;2395:4;2387:6;2383:17;2379:27;2369:2;;2420:1;2417;2410:12;2369:2;2450:6;2444:13;2472:76;2487:60;2540:6;2487:60;;;2472:76;;;2463:85;;2565:5;2590:6;2583:5;2576:21;2620:4;2612:6;2608:17;2598:27;;2642:4;2637:3;2633:14;2626:21;;2695:6;2742:3;2734:4;2726:6;2722:17;2717:3;2713:27;2710:36;2707:2;;;2759:1;2756;2749:12;2707:2;2784:1;2769:217;2794:6;2791:1;2788:13;2769:217;;;2852:3;2874:48;2918:3;2906:10;2874:48;;;2869:3;2862:61;2946:4;2941:3;2937:14;2930:21;;2974:4;2969:3;2965:14;2958:21;;2826:160;2816:1;2813;2809:9;2804:14;;2769:217;;;2773:14;2362:630;;;;;;;;3035:594;;3152:4;3140:9;3135:3;3131:19;3127:30;3124:2;;;3170:1;3167;3160:12;3124:2;3188:20;3203:4;3188:20;;;3179:29;;3286:1;3275:9;3271:17;3258:31;3309:18;3301:6;3298:30;3295:2;;;3341:1;3338;3331:12;3295:2;3375:91;3462:3;3453:6;3442:9;3438:22;3375:91;;;3369:3;3362:5;3358:15;3351:116;3218:260;3525:2;3558:49;3603:3;3594:6;3583:9;3579:22;3558:49;;;3551:4;3544:5;3540:16;3533:75;3488:131;3118:511;;;;;3671:620;;3799:4;3787:9;3782:3;3778:19;3774:30;3771:2;;;3817:1;3814;3807:12;3771:2;3835:20;3850:4;3835:20;;;3826:29;;3926:1;3915:9;3911:17;3905:24;3949:18;3941:6;3938:30;3935:2;;;3981:1;3978;3971:12;3935:2;4015:102;4113:3;4104:6;4093:9;4089:22;4015:102;;;4009:3;4002:5;3998:15;3991:127;3865:264;4176:2;4209:60;4265:3;4256:6;4245:9;4241:22;4209:60;;;4202:4;4195:5;4191:16;4184:86;4139:142;3765:526;;;;;4298:130;;4378:6;4365:20;4356:29;;4390:33;4417:5;4390:33;;;4350:78;;;;;4435:134;;4519:6;4513:13;4504:22;;4531:33;4558:5;4531:33;;;4498:71;;;;;4576:383;;4708:2;4696:9;4687:7;4683:23;4679:32;4676:2;;;4724:1;4721;4714:12;4676:2;4787:1;4776:9;4772:17;4759:31;4810:18;4802:6;4799:30;4796:2;;;4842:1;4839;4832:12;4796:2;4862:81;4935:7;4926:6;4915:9;4911:22;4862:81;;;4852:91;;4738:211;4670:289;;;;;4966:398;;5109:2;5097:9;5088:7;5084:23;5080:32;5077:2;;;5125:1;5122;5115:12;5077:2;5181:1;5170:9;5166:17;5160:24;5204:18;5196:6;5193:30;5190:2;;;5236:1;5233;5226:12;5190:2;5256:92;5340:7;5331:6;5320:9;5316:22;5256:92;;;5246:102;;5139:215;5071:293;;;;;5371:241;;5475:2;5463:9;5454:7;5450:23;5446:32;5443:2;;;5491:1;5488;5481:12;5443:2;5526:1;5543:53;5588:7;5579:6;5568:9;5564:22;5543:53;;;5533:63;;5505:97;5437:175;;;;;5620:241;;5763:92;5851:3;5843:6;5763:92;;;5749:106;;5742:119;;;;;5870:173;;5957:46;5999:3;5991:6;5957:46;;;6032:4;6027:3;6023:14;6009:28;;5950:93;;;;;6086:980;;6259:71;6324:5;6259:71;;;6343:97;6433:6;6428:3;6343:97;;;6336:104;;6463:3;6505:4;6497:6;6493:17;6488:3;6484:27;6532:73;6599:5;6532:73;;;6625:7;6653:1;6638:389;6663:6;6660:1;6657:13;6638:389;;;6725:9;6719:4;6715:20;6710:3;6703:33;6770:6;6764:13;6792:106;6893:4;6878:13;6792:106;;;6784:114;;6915:77;6985:6;6915:77;;;6905:87;;7015:4;7010:3;7006:14;6999:21;;6695:332;6685:1;6682;6678:9;6673:14;;6638:389;;;6642:14;7040:4;7033:11;;7057:3;7050:10;;6238:828;;;;;;;;;;7105:654;;7236:50;7280:5;7236:50;;;7299:76;7368:6;7363:3;7299:76;;;7292:83;;7396:52;7442:5;7396:52;;;7468:7;7496:1;7481:256;7506:6;7503:1;7500:13;7481:256;;;7573:6;7567:13;7594:63;7653:3;7638:13;7594:63;;;7587:70;;7674:56;7723:6;7674:56;;;7664:66;;7538:199;7528:1;7525;7521:9;7516:14;;7481:256;;;7485:14;7750:3;7743:10;;7215:544;;;;;;;;7834:640;;7991:4;7986:3;7982:14;8074:3;8067:5;8063:15;8057:22;8124:3;8118:4;8114:14;8108:3;8103;8099:13;8092:37;8144:141;8280:4;8266:12;8144:141;;;8136:149;;8011:286;8367:4;8360:5;8356:16;8350:23;8379:63;8436:4;8431:3;8427:14;8413:12;8379:63;;;8307:141;8465:4;8458:11;;7964:510;;;;;;8481:103;8554:24;8572:5;8554:24;;;8549:3;8542:37;8536:48;;;8591:121;8682:24;8700:5;8682:24;;;8677:3;8670:37;8664:48;;;8719:373;;8893:2;8882:9;8878:18;8870:26;;8943:9;8937:4;8933:20;8929:1;8918:9;8914:17;8907:47;8968:114;9077:4;9068:6;8968:114;;;8960:122;;8864:228;;;;;9099:229;;9225:2;9214:9;9210:18;9202:26;;9239:79;9315:1;9304:9;9300:17;9291:6;9239:79;;;9196:132;;;;;9335:256;;9397:2;9391:9;9381:19;;9435:4;9427:6;9423:17;9534:6;9522:10;9519:22;9498:18;9486:10;9483:34;9480:62;9477:2;;;9555:1;9552;9545:12;9477:2;9575:10;9571:2;9564:22;9375:216;;;;;9598:275;;9774:18;9766:6;9763:30;9760:2;;;9806:1;9803;9796:12;9760:2;9835:4;9827:6;9823:17;9815:25;;9863:4;9857;9853:15;9845:23;;9697:176;;;;9880:254;;10035:18;10027:6;10024:30;10021:2;;;10067:1;10064;10057:12;10021:2;10096:4;10088:6;10084:17;10076:25;;10124:4;10118;10114:15;10106:23;;9958:176;;;;10144:140;;10271:4;10263:6;10259:17;10248:28;;10239:45;;;;10297:119;;10403:4;10395:6;10391:17;10380:28;;10371:45;;;;10426:124;;10539:5;10533:12;10523:22;;10517:33;;;;10557:103;;10649:5;10643:12;10633:22;;10627:33;;;;10669:141;;10798:4;10790:6;10786:17;10775:28;;10767:43;;;;10821:120;;10929:4;10921:6;10917:17;10906:28;;10898:43;;;;10951:189;;11092:6;11087:3;11080:19;11129:4;11124:3;11120:14;11105:29;;11073:67;;;;;11149:168;;11269:6;11264:3;11257:19;11306:4;11301:3;11297:14;11282:29;;11250:67;;;;;11325:72;;11387:5;11376:16;;11370:27;;;;11404:117;11473:24;11491:5;11473:24;;;11466:5;11463:35;11453:2;;11512:1;11509;11502:12;11453:2;11447:74;", - "source": "pragma solidity >=0.5.6;\n\npragma experimental ABIEncoderV2;\n\nimport \"./SquareLib.sol\";\n\ncontract MagicSquare {\n using SquareLib for SquareLib.MagicSquare;\n\n SquareLib.MagicSquare storedSquare;\n string storedGreeting;\n\n function generateMagicSquare(uint n)\n public\n {\n string memory greeting;\n SquareLib.MagicSquare memory square;\n uint256 x;\n uint256 y;\n uint256 i;\n\n greeting = \"let us construct a magic square:\";\n square = SquareLib.initialize(n);\n\n x = 0;\n y = n / 2;\n for (i = 1; i <= n * n; i++) {\n (x, y, i) = square.step(x, y, i);\n }\n\n this.save(square);\n storedGreeting = \"finally, a decentralized magic square service!\";\n }\n\n function getSquare()\n public\n view\n returns (SquareLib.MagicSquare memory square)\n {\n return storedSquare;\n }\n\n function save(SquareLib.MagicSquare memory square)\n public\n {\n uint256 x;\n uint256 y;\n\n storedSquare.n = square.n;\n storedSquare.rows.length = square.n;\n\n for (x = 0; x < square.n; x++) {\n storedSquare.rows[x].length = square.n;\n\n for (y = 0; y < square.n; y++) {\n storedSquare.rows[x][y] = square.rows[x][y];\n }\n }\n }\n}\n", - "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", - "ast": { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", - "exportedSymbols": { - "MagicSquare": [ - 178 - ] - }, - "id": 179, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - ">=", - "0.5", - ".6" - ], - "nodeType": "PragmaDirective", - "src": "0:24:0" - }, - { - "id": 2, - "literals": [ - "experimental", - "ABIEncoderV2" - ], - "nodeType": "PragmaDirective", - "src": "26:33:0" - }, - { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", - "file": "./SquareLib.sol", - "id": 3, - "nodeType": "ImportDirective", - "scope": 179, - "sourceUnit": 398, - "src": "61:25:0", - "symbolAliases": [], - "unitAlias": "" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 178, - "linearizedBaseContracts": [ - 178 - ], - "name": "MagicSquare", - "nodeType": "ContractDefinition", - "nodes": [ - { - "id": 6, - "libraryName": { - "contractScope": null, - "id": 4, - "name": "SquareLib", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 397, - "src": "119:9:0", + "id": 31, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "378:9:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 32, + "name": "greeting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 16, + "src": "394:8:0", "typeDescriptions": { - "typeIdentifier": "t_contract$_SquareLib_$397", - "typeString": "library SquareLib" + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } }, - "nodeType": "UsingForDirective", - "src": "113:42:0", - "typeName": { - "contractScope": null, - "id": 5, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "133:21:0", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "6c657420757320636f6e7374727563742061206d61676963207371756172653a", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "405:34:0", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } + "typeIdentifier": "t_stringliteral_6489d3e23108083aeb90c3b69347cd3e9158d4240c395bd3f538f5847904d59c", + "typeString": "literal_string \"let us construct a magic square:\"" + }, + "value": "let us construct a magic square:" + }, + "src": "394:45:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } }, - { - "constant": false, - "id": 8, - "name": "storedSquare", - "nodeType": "VariableDeclaration", - "scope": 178, - "src": "159:34:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare" + "id": 35, + "nodeType": "ExpressionStatement", + "src": "394:45:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 36, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "445:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - "typeName": { - "contractScope": null, - "id": 7, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "159:21:0", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 39, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "475:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 37, + "name": "SquareLib", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 397, + "src": "454:9:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SquareLib_$397_$", + "typeString": "type(library SquareLib)" + } + }, + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "initialize", + "nodeType": "MemberAccess", + "referencedDeclaration": 292, + "src": "454:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_struct$_MagicSquare_$245_memory_ptr_$", + "typeString": "function (uint256) pure returns (struct SquareLib.MagicSquare memory)" + } + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "454:23:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "value": null, - "visibility": "internal" + "src": "445:32:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - { - "constant": false, - "id": 10, - "name": "storedGreeting", - "nodeType": "VariableDeclaration", - "scope": 178, - "src": "197:21:0", - "stateVariable": true, - "storageLocation": "default", + "id": 42, + "nodeType": "ExpressionStatement", + "src": "445:32:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 45, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 43, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "484:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 44, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "488:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "484:5:0", "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 46, + "nodeType": "ExpressionStatement", + "src": "484:5:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 47, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "495:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "typeName": { - "id": 9, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "197:6:0", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 48, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "499:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 49, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "503:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "499:5:0", "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "value": null, - "visibility": "internal" + "src": "495:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "body": { - "id": 89, - "nodeType": "Block", - "src": "273:412:0", - "statements": [ - { - "assignments": [ - 16 - ], - "declarations": [ - { - "constant": false, - "id": 16, - "name": "greeting", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "279:22:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" + "id": 52, + "nodeType": "ExpressionStatement", + "src": "495:9:0" + }, + { + "body": { + "id": 77, + "nodeType": "Block", + "src": "539:47:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 75, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 65, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "548:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "typeName": { - "id": 15, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "279:6:0", + { + "argumentTypes": null, + "id": 66, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "551:1:0", "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "id": 17, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "279:22:0" - }, - { - "assignments": [ - 21 - ], - "declarations": [ - { - "constant": false, - "id": 21, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "307:35:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 20, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "307:21:0", + { + "argumentTypes": null, + "id": 67, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "554:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - }, - "value": null, - "visibility": "internal" + } + ], + "id": 68, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "547:9:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" } - ], - "id": 22, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "307:35:0" - }, - { - "assignments": [ - 24 - ], - "declarations": [ - { - "constant": false, - "id": 24, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "348:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 23, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "348:7:0", + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 71, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "571:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "id": 25, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "348:9:0" - }, - { - "assignments": [ - 27 - ], - "declarations": [ - { - "constant": false, - "id": 27, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "363:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 26, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "363:7:0", + { + "argumentTypes": null, + "id": 72, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "574:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "id": 28, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "363:9:0" - }, - { - "assignments": [ - 30 - ], - "declarations": [ - { - "constant": false, - "id": 30, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "378:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 29, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "378:7:0", + { + "argumentTypes": null, + "id": 73, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "577:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 31, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "378:9:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 34, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 32, - "name": "greeting", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 16, - "src": "394:8:0", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "6c657420757320636f6e7374727563742061206d61676963207371756172653a", - "id": 33, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "405:34:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_6489d3e23108083aeb90c3b69347cd3e9158d4240c395bd3f538f5847904d59c", - "typeString": "literal_string \"let us construct a magic square:\"" - }, - "value": "let us construct a magic square:" - }, - "src": "394:45:0", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "id": 35, - "nodeType": "ExpressionStatement", - "src": "394:45:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 41, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 36, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "445:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "arguments": [ + ], + "expression": { + "argumentTypes": [ { - "argumentTypes": null, - "id": 39, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "475:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } ], "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 37, - "name": "SquareLib", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 397, - "src": "454:9:0", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_SquareLib_$397_$", - "typeString": "type(library SquareLib)" - } - }, - "id": 38, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "initialize", - "nodeType": "MemberAccess", - "referencedDeclaration": 292, - "src": "454:20:0", + "argumentTypes": null, + "id": 69, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "559:6:0", "typeDescriptions": { - "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_struct$_MagicSquare_$245_memory_ptr_$", - "typeString": "function (uint256) pure returns (struct SquareLib.MagicSquare memory)" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 40, + "id": 70, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "454:23:0", + "memberName": "step", + "nodeType": "MemberAccess", + "referencedDeclaration": 396, + "src": "559:11:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_function_internal_pure$_t_struct$_MagicSquare_$245_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$bound_to$_t_struct$_MagicSquare_$245_memory_ptr_$", + "typeString": "function (struct SquareLib.MagicSquare memory,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" } }, - "src": "445:32:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 42, - "nodeType": "ExpressionStatement", - "src": "445:32:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 45, + "id": 74, "isConstant": false, "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 43, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 24, - "src": "484:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 44, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "488:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "484:5:0", + "names": [], + "nodeType": "FunctionCall", + "src": "559:20:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" } }, - "id": 46, - "nodeType": "ExpressionStatement", - "src": "484:5:0" + "src": "547:32:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "expression": { - "argumentTypes": null, - "id": 51, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 47, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 27, - "src": "495:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 76, + "nodeType": "ExpressionStatement", + "src": "547:32:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 57, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "522:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 58, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "527:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "id": 59, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "531:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "527:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "522:10:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 78, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 55, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 53, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "515:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "31", + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "519:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "515:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 56, + "nodeType": "ExpressionStatement", + "src": "515:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "534:3:0", + "subExpression": { + "argumentTypes": null, + "id": 62, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "534:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 64, + "nodeType": "ExpressionStatement", + "src": "534:3:0" + }, + "nodeType": "ForStatement", + "src": "510:76:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 82, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "602:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 79, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 428, + "src": "592:4:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_MagicSquare_$178", + "typeString": "contract MagicSquare" + } + }, + "id": 81, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "save", + "nodeType": "MemberAccess", + "referencedDeclaration": 177, + "src": "592:9:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_struct$_MagicSquare_$245_memory_ptr_$returns$__$", + "typeString": "function (struct SquareLib.MagicSquare memory) external" + } + }, + "id": 83, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "592:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 84, + "nodeType": "ExpressionStatement", + "src": "592:17:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 87, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 85, + "name": "storedGreeting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10, + "src": "615:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521", + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "632:48:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_661078515cdf36a6c513369103f7a6474ac7bb28ddc3e305eb9bb79e1cb8e423", + "typeString": "literal_string \"finally, a decentralized magic square service!\"" + }, + "value": "finally, a decentralized magic square service!" + }, + "src": "615:65:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 88, + "nodeType": "ExpressionStatement", + "src": "615:65:0" + } + ] + }, + "documentation": null, + "id": 90, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "generateMagicSquare", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 13, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 12, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 90, + "src": "252:6:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 11, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "252:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "251:8:0" + }, + "returnParameters": { + "id": 14, + "nodeType": "ParameterList", + "parameters": [], + "src": "273:0:0" + }, + "scope": 178, + "src": "223:462:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "782:30:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 95, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "795:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "functionReturnParameters": 94, + "id": 96, + "nodeType": "Return", + "src": "788:19:0" + } + ] + }, + "documentation": null, + "id": 98, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getSquare", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [], + "src": "707:2:0" + }, + "returnParameters": { + "id": 94, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 93, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 98, + "src": "743:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 92, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "743:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "742:37:0" + }, + "scope": 178, + "src": "689:123:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 176, + "nodeType": "Block", + "src": "880:299:0", + "statements": [ + { + "assignments": [104], + "declarations": [ + { + "constant": false, + "id": 104, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 176, + "src": "886:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 103, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "886:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 105, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "886:9:0" + }, + { + "assignments": [107], + "declarations": [ + { + "constant": false, + "id": 107, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 176, + "src": "901:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 106, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "901:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 108, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "901:9:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 109, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "917:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 111, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "917:14:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 112, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "934:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 113, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "934:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "917:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 115, + "nodeType": "ExpressionStatement", + "src": "917:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 116, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "948:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 119, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "948:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 120, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "948:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 121, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "975:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 122, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "975:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "948:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 124, + "nodeType": "ExpressionStatement", + "src": "948:35:0" + }, + { + "body": { + "id": 174, + "nodeType": "Block", + "src": "1021:154:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 136, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1029:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 139, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1029:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } }, - "id": 50, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "id": 140, + "indexExpression": { "argumentTypes": null, - "id": 48, - "name": "n", + "id": 138, + "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "499:1:0", + "referencedDeclaration": 104, + "src": "1047:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "/", - "rightExpression": { - "argumentTypes": null, - "hexValue": "32", - "id": 49, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "503:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" - }, - "value": "2" - }, - "src": "499:5:0", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1029:20:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } }, - "src": "495:9:0", + "id": 141, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1029:27:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 52, - "nodeType": "ExpressionStatement", - "src": "495:9:0" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 142, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1059:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 143, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1059:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1029:38:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "body": { - "id": 77, - "nodeType": "Block", - "src": "539:47:0", - "statements": [ - { - "expression": { + "id": 145, + "nodeType": "ExpressionStatement", + "src": "1029:38:0" + }, + { + "body": { + "id": 172, + "nodeType": "Block", + "src": "1107:62:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 170, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "id": 75, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "baseExpression": { "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 65, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 24, - "src": "548:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { + "baseExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 66, - "name": "y", + "id": 157, + "name": "storedSquare", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 27, - "src": "551:1:0", + "referencedDeclaration": 8, + "src": "1117:12:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } }, - { - "argumentTypes": null, - "id": 67, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "554:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 161, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1117:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" } - ], - "id": 68, + }, + "id": 162, + "indexExpression": { + "argumentTypes": null, + "id": 159, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1135:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "isConstant": false, - "isInlineArray": false, "isLValue": true, "isPure": false, - "lValueRequested": true, - "nodeType": "TupleExpression", - "src": "547:9:0", + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1117:20:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 163, + "indexExpression": { "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 71, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 24, - "src": "571:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 72, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 27, - "src": "574:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 73, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "577:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], + "id": 160, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1138:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1117:23:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 69, + "id": 164, "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "559:6:0", + "referencedDeclaration": 100, + "src": "1143:6:0", "typeDescriptions": { "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 70, + "id": 165, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "step", + "memberName": "rows", "nodeType": "MemberAccess", - "referencedDeclaration": 396, - "src": "559:11:0", + "referencedDeclaration": 242, + "src": "1143:11:0", "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_struct$_MagicSquare_$245_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$bound_to$_t_struct$_MagicSquare_$245_memory_ptr_$", - "typeString": "function (struct SquareLib.MagicSquare memory,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 167, + "indexExpression": { + "argumentTypes": null, + "id": 166, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1155:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 74, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "559:20:0", + "nodeType": "IndexAccess", + "src": "1143:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 169, + "indexExpression": { + "argumentTypes": null, + "id": 168, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1158:1:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "547:32:0", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1143:17:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 76, - "nodeType": "ExpressionStatement", - "src": "547:32:0" - } - ] + "src": "1117:43:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 171, + "nodeType": "ExpressionStatement", + "src": "1117:43:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "condition": { + "id": 153, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "commonType": { + "id": 150, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1088:1:0", + "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "id": 61, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 57, - "name": "i", + "id": 151, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "522:1:0", + "referencedDeclaration": 100, + "src": "1092:6:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 60, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 58, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "527:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "*", - "rightExpression": { - "argumentTypes": null, - "id": 59, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "531:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "527:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "522:10:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 78, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 55, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 53, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "515:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "31", - "id": 54, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "519:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "515:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 56, - "nodeType": "ExpressionStatement", - "src": "515:5:0" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 63, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "534:3:0", - "subExpression": { - "argumentTypes": null, - "id": 62, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "534:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 64, - "nodeType": "ExpressionStatement", - "src": "534:3:0" - }, - "nodeType": "ForStatement", - "src": "510:76:0" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 82, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "602:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - ], - "expression": { - "argumentTypes": null, - "id": 79, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 428, - "src": "592:4:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_MagicSquare_$178", - "typeString": "contract MagicSquare" - } - }, - "id": 81, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "save", - "nodeType": "MemberAccess", - "referencedDeclaration": 177, - "src": "592:9:0", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_struct$_MagicSquare_$245_memory_ptr_$returns$__$", - "typeString": "function (struct SquareLib.MagicSquare memory) external" - }, - "name": "save", - "overloadedDeclarations": [] - }, - "id": 83, + "id": 152, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "592:17:0", + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1092:8:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 84, - "nodeType": "ExpressionStatement", - "src": "592:17:0" + "src": "1088:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { + "id": 173, + "initializationExpression": { "expression": { "argumentTypes": null, - "id": 87, + "id": 148, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 85, - "name": "storedGreeting", + "id": 146, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 10, - "src": "615:14:0", + "referencedDeclaration": 107, + "src": "1081:1:0", "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, - "hexValue": "66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521", - "id": 86, + "hexValue": "30", + "id": 147, "isConstant": false, "isLValue": false, "isPure": true, - "kind": "string", + "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "632:48:0", + "src": "1085:1:0", "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_stringliteral_661078515cdf36a6c513369103f7a6474ac7bb28ddc3e305eb9bb79e1cb8e423", - "typeString": "literal_string \"finally, a decentralized magic square service!\"" + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "value": "finally, a decentralized magic square service!" + "value": "0" }, - "src": "615:65:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" - } - }, - "id": 88, - "nodeType": "ExpressionStatement", - "src": "615:65:0" - } - ] - }, - "documentation": null, - "id": 90, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "generateMagicSquare", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 13, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 12, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 90, - "src": "252:6:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 11, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "252:4:0", + "src": "1081:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "src": "251:8:0" - }, - "returnParameters": { - "id": 14, - "nodeType": "ParameterList", - "parameters": [], - "src": "273:0:0" - }, - "scope": 178, - "src": "223:462:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 97, - "nodeType": "Block", - "src": "782:30:0", - "statements": [ - { - "assignments": [ - 96 - ], - "declarations": [ - { - "constant": false, - "id": 96, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 168, - "src": "758:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 95, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "758:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 96, - "initialValue": null, - "nodeType": "Return", - "src": "788:19:0", - "expression": { - "argumentTypes": null, - "id": 95, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "795:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "functionReturnParameters": 94 - }, - { - "assignments": [ - 99 - ], - "declarations": [ - { - "constant": false, - "id": 99, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 168, - "src": "773:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 98, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "773:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 100, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "773:9:0" + "id": 149, + "nodeType": "ExpressionStatement", + "src": "1081:5:0" }, - { + "loopExpression": { "expression": { "argumentTypes": null, - "id": 106, + "id": 155, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1102:3:0", + "subExpression": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 101, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "789:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 103, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "789:14:0", + "id": 154, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1102:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 104, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "806:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 105, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "806:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "789:25:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 107, + "id": 156, "nodeType": "ExpressionStatement", - "src": "789:25:0" + "src": "1102:3:0" }, - { - "expression": { - "argumentTypes": null, - "id": 115, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "nodeType": "ForStatement", + "src": "1076:93:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 132, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 129, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1002:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 130, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1006:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 131, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1006:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1002:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 175, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "995:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "999:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "995:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "995:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1016:3:0", + "subExpression": { + "argumentTypes": null, + "id": 133, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1016:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 135, + "nodeType": "ExpressionStatement", + "src": "1016:3:0" + }, + "nodeType": "ForStatement", + "src": "990:185:0" + } + ] + }, + "documentation": null, + "id": 177, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "save", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 101, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 100, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 177, + "src": "830:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 99, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "830:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "829:37:0" + }, + "returnParameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [], + "src": "880:0:0" + }, + "scope": 178, + "src": "816:363:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 179, + "src": "88:1093:0" + } + ], + "src": "0:1182:0" + }, + "legacyAST": { + "attributes": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "exportedSymbols": { "MagicSquare": [178] } + }, + "children": [ + { + "attributes": { + "literals": ["solidity", ">=", "0.5", ".6"] + }, + "id": 1, + "name": "PragmaDirective", + "src": "0:24:0" + }, + { + "attributes": { + "literals": ["experimental", "ABIEncoderV2"] + }, + "id": 2, + "name": "PragmaDirective", + "src": "26:33:0" + }, + { + "attributes": { + "SourceUnit": 398, + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "file": "./SquareLib.sol", + "scope": 179, + "symbolAliases": [null], + "unitAlias": "" + }, + "id": 3, + "name": "ImportDirective", + "src": "61:25:0" + }, + { + "attributes": { + "baseContracts": [null], + "contractDependencies": [null], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "linearizedBaseContracts": [178], + "name": "MagicSquare", + "scope": 179 + }, + "children": [ + { + "children": [ + { + "attributes": { + "contractScope": null, + "name": "SquareLib", + "referencedDeclaration": 397, + "type": "library SquareLib" + }, + "id": 4, + "name": "UserDefinedTypeName", + "src": "119:9:0" + }, + { + "attributes": { + "contractScope": null, + "name": "SquareLib.MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 5, + "name": "UserDefinedTypeName", + "src": "133:21:0" + } + ], + "id": 6, + "name": "UsingForDirective", + "src": "113:42:0" + }, + { + "attributes": { + "constant": false, + "name": "storedSquare", + "scope": 178, + "stateVariable": true, + "storageLocation": "default", + "type": "struct SquareLib.MagicSquare", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "SquareLib.MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 7, + "name": "UserDefinedTypeName", + "src": "159:21:0" + } + ], + "id": 8, + "name": "VariableDeclaration", + "src": "159:34:0" + }, + { + "attributes": { + "constant": false, + "name": "storedGreeting", + "scope": 178, + "stateVariable": true, + "storageLocation": "default", + "type": "string", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "string", + "type": "string" + }, + "id": 9, + "name": "ElementaryTypeName", + "src": "197:6:0" + } + ], + "id": 10, + "name": "VariableDeclaration", + "src": "197:21:0" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": [null], + "name": "generateMagicSquare", + "scope": 178, + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "n", + "scope": 90, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint", + "type": "uint256" + }, + "id": 11, + "name": "ElementaryTypeName", + "src": "252:4:0" + } + ], + "id": 12, + "name": "VariableDeclaration", + "src": "252:6:0" + } + ], + "id": 13, + "name": "ParameterList", + "src": "251:8:0" + }, + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 14, + "name": "ParameterList", + "src": "273:0:0" + }, + { + "children": [ + { + "attributes": { + "assignments": [16], + "initialValue": null + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "greeting", + "scope": 89, + "stateVariable": false, + "storageLocation": "memory", + "type": "string", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "string", + "type": "string" + }, + "id": 15, + "name": "ElementaryTypeName", + "src": "279:6:0" + } + ], + "id": 16, + "name": "VariableDeclaration", + "src": "279:22:0" + } + ], + "id": 17, + "name": "VariableDeclarationStatement", + "src": "279:22:0" + }, + { + "attributes": { + "assignments": [21], + "initialValue": null + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "square", + "scope": 89, + "stateVariable": false, + "storageLocation": "memory", + "type": "struct SquareLib.MagicSquare", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "SquareLib.MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 20, + "name": "UserDefinedTypeName", + "src": "307:21:0" + } + ], + "id": 21, + "name": "VariableDeclaration", + "src": "307:35:0" + } + ], + "id": 22, + "name": "VariableDeclarationStatement", + "src": "307:35:0" + }, + { + "attributes": { + "assignments": [24], + "initialValue": null + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "x", + "scope": 89, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 23, + "name": "ElementaryTypeName", + "src": "348:7:0" + } + ], + "id": 24, + "name": "VariableDeclaration", + "src": "348:9:0" + } + ], + "id": 25, + "name": "VariableDeclarationStatement", + "src": "348:9:0" + }, + { + "attributes": { + "assignments": [27], + "initialValue": null + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "y", + "scope": 89, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 26, + "name": "ElementaryTypeName", + "src": "363:7:0" + } + ], + "id": 27, + "name": "VariableDeclaration", + "src": "363:9:0" + } + ], + "id": 28, + "name": "VariableDeclarationStatement", + "src": "363:9:0" + }, + { + "attributes": { + "assignments": [30], + "initialValue": null + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "i", + "scope": 89, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 29, + "name": "ElementaryTypeName", + "src": "378:7:0" + } + ], + "id": 30, + "name": "VariableDeclaration", + "src": "378:9:0" + } + ], + "id": 31, + "name": "VariableDeclarationStatement", + "src": "378:9:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "string memory" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 108, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "820:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 111, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "820:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 112, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "820:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "overloadedDeclarations": [null], + "referencedDeclaration": 16, + "type": "string memory", + "value": "greeting" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 32, + "name": "Identifier", + "src": "394:8:0" + }, + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 113, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "847:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 114, + "hexvalue": "6c657420757320636f6e7374727563742061206d61676963207371756172653a", "isConstant": false, - "isLValue": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "string", + "type": "literal_string \"let us construct a magic square:\"", + "value": "let us construct a magic square:" + }, + "id": 33, + "name": "Literal", + "src": "405:34:0" + } + ], + "id": 34, + "name": "Assignment", + "src": "394:45:0" + } + ], + "id": 35, + "name": "ExpressionStatement", + "src": "394:45:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "struct SquareLib.MagicSquare memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 21, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 36, + "name": "Identifier", + "src": "445:6:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, "isPure": false, + "isStructConstructorCall": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "847:8:0", - "typeDescriptions": { + "names": [null], + "type": "struct SquareLib.MagicSquare memory", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "initialize", + "referencedDeclaration": 292, + "type": "function (uint256) pure returns (struct SquareLib.MagicSquare memory)" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 397, + "type": "type(library SquareLib)", + "value": "SquareLib" + }, + "id": 37, + "name": "Identifier", + "src": "454:9:0" + } + ], + "id": 38, + "name": "MemberAccess", + "src": "454:20:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 12, + "type": "uint256", + "value": "n" + }, + "id": 39, + "name": "Identifier", + "src": "475:1:0" + } + ], + "id": 40, + "name": "FunctionCall", + "src": "454:23:0" + } + ], + "id": 41, + "name": "Assignment", + "src": "445:32:0" + } + ], + "id": 42, + "name": "ExpressionStatement", + "src": "445:32:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 24, + "type": "uint256", + "value": "x" + }, + "id": 43, + "name": "Identifier", + "src": "484:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "30", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 0", + "value": "0" + }, + "id": 44, + "name": "Literal", + "src": "488:1:0" + } + ], + "id": 45, + "name": "Assignment", + "src": "484:5:0" + } + ], + "id": 46, + "name": "ExpressionStatement", + "src": "484:5:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 27, + "type": "uint256", + "value": "y" + }, + "id": 47, + "name": "Identifier", + "src": "495:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "/", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 12, + "type": "uint256", + "value": "n" + }, + "id": 48, + "name": "Identifier", + "src": "499:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "32", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 2", + "value": "2" + }, + "id": 49, + "name": "Literal", + "src": "503:1:0" } + ], + "id": 50, + "name": "BinaryOperation", + "src": "499:5:0" + } + ], + "id": 51, + "name": "Assignment", + "src": "495:9:0" + } + ], + "id": 52, + "name": "ExpressionStatement", + "src": "495:9:0" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" }, - "src": "820:35:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 30, + "type": "uint256", + "value": "i" + }, + "id": 53, + "name": "Identifier", + "src": "515:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "31", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 1", + "value": "1" + }, + "id": 54, + "name": "Literal", + "src": "519:1:0" + } + ], + "id": 55, + "name": "Assignment", + "src": "515:5:0" + } + ], + "id": 56, + "name": "ExpressionStatement", + "src": "515:5:0" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "id": 116, - "nodeType": "ExpressionStatement", - "src": "820:35:0" + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "<=", + "type": "bool" }, - { - "body": { - "id": 166, - "nodeType": "Block", - "src": "893:154:0", - "statements": [ + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 30, + "type": "uint256", + "value": "i" + }, + "id": 57, + "name": "Identifier", + "src": "522:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "*", + "type": "uint256" + }, + "children": [ { - "expression": { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 12, + "type": "uint256", + "value": "n" + }, + "id": 58, + "name": "Identifier", + "src": "527:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 12, + "type": "uint256", + "value": "n" + }, + "id": 59, + "name": "Identifier", + "src": "531:1:0" + } + ], + "id": 60, + "name": "BinaryOperation", + "src": "527:5:0" + } + ], + "id": 61, + "name": "BinaryOperation", + "src": "522:10:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "++", + "prefix": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 30, + "type": "uint256", + "value": "i" + }, + "id": 62, + "name": "Identifier", + "src": "534:1:0" + } + ], + "id": 63, + "name": "UnaryOperation", + "src": "534:3:0" + } + ], + "id": 64, + "name": "ExpressionStatement", + "src": "534:3:0" + }, + { + "children": [ + { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 136, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { + "operator": "=", + "type": "tuple()" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "type": "tuple(uint256,uint256,uint256)" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 128, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "901:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 24, + "type": "uint256", + "value": "x" }, - "id": 131, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "901:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } + "id": 65, + "name": "Identifier", + "src": "548:1:0" }, - "id": 132, - "indexExpression": { - "argumentTypes": null, - "id": 130, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "919:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 27, + "type": "uint256", + "value": "y" + }, + "id": 66, + "name": "Identifier", + "src": "551:1:0" }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 30, + "type": "uint256", + "value": "i" + }, + "id": 67, + "name": "Identifier", + "src": "554:1:0" + } + ], + "id": 68, + "name": "TupleExpression", + "src": "547:9:0" + }, + { + "attributes": { + "argumentTypes": null, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, + "isStructConstructorCall": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "901:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } + "names": [null], + "type": "tuple(uint256,uint256,uint256)", + "type_conversion": false }, - "id": 133, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "901:27:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 134, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "931:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 135, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "931:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "901:38:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 137, - "nodeType": "ExpressionStatement", - "src": "901:38:0" - }, - { - "body": { - "id": 164, - "nodeType": "Block", - "src": "979:62:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 162, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 149, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "989:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 153, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "989:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 154, - "indexExpression": { - "argumentTypes": null, - "id": 151, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "1007:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "989:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 155, - "indexExpression": { - "argumentTypes": null, - "id": 152, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "1010:1:0", - "typeDescriptions": { + "children": [ + { + "attributes": { + "argumentTypes": [ + { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "989:23:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 156, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "1015:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 157, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "1015:11:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } }, - "id": 159, - "indexExpression": { - "argumentTypes": null, - "id": 158, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "1027:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1015:14:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 161, - "indexExpression": { - "argumentTypes": null, - "id": 160, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "1030:1:0", - "typeDescriptions": { + { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, + ], "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1015:17:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "member_name": "step", + "referencedDeclaration": 396, + "type": "function (struct SquareLib.MagicSquare memory,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 21, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 69, + "name": "Identifier", + "src": "559:6:0" } + ], + "id": 70, + "name": "MemberAccess", + "src": "559:11:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 24, + "type": "uint256", + "value": "x" }, - "src": "989:43:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 71, + "name": "Identifier", + "src": "571:1:0" }, - "id": 163, - "nodeType": "ExpressionStatement", - "src": "989:43:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 145, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 142, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "960:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 143, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "964:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 144, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "964:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "960:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 165, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 140, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 138, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "953:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 139, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "957:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 27, + "type": "uint256", + "value": "y" + }, + "id": 72, + "name": "Identifier", + "src": "574:1:0" }, - "value": "0" - }, - "src": "953:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 141, - "nodeType": "ExpressionStatement", - "src": "953:5:0" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 147, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "974:3:0", - "subExpression": { - "argumentTypes": null, - "id": 146, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "974:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 30, + "type": "uint256", + "value": "i" + }, + "id": 73, + "name": "Identifier", + "src": "577:1:0" } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 148, - "nodeType": "ExpressionStatement", - "src": "974:3:0" - }, - "nodeType": "ForStatement", - "src": "948:93:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 124, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 121, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "874:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + ], + "id": 74, + "name": "FunctionCall", + "src": "559:20:0" + } + ], + "id": 75, + "name": "Assignment", + "src": "547:32:0" } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 122, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "878:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + ], + "id": 76, + "name": "ExpressionStatement", + "src": "547:32:0" + } + ], + "id": 77, + "name": "Block", + "src": "539:47:0" + } + ], + "id": 78, + "name": "ForStatement", + "src": "510:76:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [null], + "type": "tuple()", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", "typeString": "struct SquareLib.MagicSquare memory" } - }, - "id": 123, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "878:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "874:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 167, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 119, + ], "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 117, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "867:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 118, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "871:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + "member_name": "save", + "referencedDeclaration": 177, + "type": "function (struct SquareLib.MagicSquare memory) external" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 428, + "type": "contract MagicSquare", + "value": "this" }, - "value": "0" - }, - "src": "867:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 79, + "name": "Identifier", + "src": "592:4:0" } + ], + "id": 81, + "name": "MemberAccess", + "src": "592:9:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 21, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" }, - "id": 120, - "nodeType": "ExpressionStatement", - "src": "867:5:0" + "id": 82, + "name": "Identifier", + "src": "602:6:0" + } + ], + "id": 83, + "name": "FunctionCall", + "src": "592:17:0" + } + ], + "id": 84, + "name": "ExpressionStatement", + "src": "592:17:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "string storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 10, + "type": "string storage ref", + "value": "storedGreeting" + }, + "id": 85, + "name": "Identifier", + "src": "615:14:0" }, - "loopExpression": { - "expression": { + { + "attributes": { "argumentTypes": null, - "id": 126, + "hexvalue": "66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521", "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "888:3:0", - "subExpression": { - "argumentTypes": null, - "id": 125, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "888:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "subdenomination": null, + "token": "string", + "type": "literal_string \"finally, a decentralized magic square service!\"", + "value": "finally, a decentralized magic square service!" }, - "id": 127, - "nodeType": "ExpressionStatement", - "src": "888:3:0" - }, - "nodeType": "ForStatement", - "src": "862:185:0" - } - ] - }, - "documentation": null, - "id": 98, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "getSquare", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 91, - "nodeType": "ParameterList", - "parameters": [ - { + "id": 86, + "name": "Literal", + "src": "632:48:0" + } + ], + "id": 87, + "name": "Assignment", + "src": "615:65:0" + } + ], + "id": 88, + "name": "ExpressionStatement", + "src": "615:65:0" + } + ], + "id": 89, + "name": "Block", + "src": "273:412:0" + } + ], + "id": 90, + "name": "FunctionDefinition", + "src": "223:462:0" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": [null], + "name": "getSquare", + "scope": 178, + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 91, + "name": "ParameterList", + "src": "707:2:0" + }, + { + "children": [ + { + "attributes": { + "constant": false, + "name": "square", + "scope": 98, + "stateVariable": false, + "storageLocation": "memory", + "type": "struct SquareLib.MagicSquare", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "SquareLib.MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 92, + "name": "UserDefinedTypeName", + "src": "743:21:0" + } + ], + "id": 93, + "name": "VariableDeclaration", + "src": "743:35:0" + } + ], + "id": 94, + "name": "ParameterList", + "src": "742:37:0" + }, + { + "children": [ + { + "attributes": { + "functionReturnParameters": 94 + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 8, + "type": "struct SquareLib.MagicSquare storage ref", + "value": "storedSquare" + }, + "id": 95, + "name": "Identifier", + "src": "795:12:0" + } + ], + "id": 96, + "name": "Return", + "src": "788:19:0" + } + ], + "id": 97, + "name": "Block", + "src": "782:30:0" + } + ], + "id": 98, + "name": "FunctionDefinition", + "src": "689:123:0" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": [null], + "name": "save", + "scope": 178, + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "square", + "scope": 177, + "stateVariable": false, + "storageLocation": "memory", + "type": "struct SquareLib.MagicSquare", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "SquareLib.MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 99, + "name": "UserDefinedTypeName", + "src": "830:21:0" + } + ], + "id": 100, + "name": "VariableDeclaration", + "src": "830:35:0" + } + ], + "id": 101, + "name": "ParameterList", + "src": "829:37:0" + }, + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 102, + "name": "ParameterList", + "src": "880:0:0" + }, + { + "children": [ + { + "attributes": { + "assignments": [104], + "initialValue": null + }, + "children": [ + { + "attributes": { "constant": false, - "id": 92, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 169, - "src": "702:35:0", + "name": "x", + "scope": 176, "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 91, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 237, - "src": "702:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, + "storageLocation": "default", + "type": "uint256", "value": null, "visibility": "internal" - } - ], - "src": "707:2:0" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 103, + "name": "ElementaryTypeName", + "src": "886:7:0" + } + ], + "id": 104, + "name": "VariableDeclaration", + "src": "886:9:0" + } + ], + "id": 105, + "name": "VariableDeclarationStatement", + "src": "886:9:0" + }, + { + "attributes": { + "assignments": [107], + "initialValue": null }, - "returnParameters": { - "id": 94, - "nodeType": "ParameterList", - "parameters": [ - { + "children": [ + { + "attributes": { "constant": false, - "id": 93, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 98, - "src": "743:35:0", + "name": "y", + "scope": 176, "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 92, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "743:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, + "storageLocation": "default", + "type": "uint256", "value": null, "visibility": "internal" - } - ], - "src": "742:37:0" - }, - "scope": 178, - "src": "689:123:0", - "stateMutability": "view", - "superFunction": null, - "visibility": "public" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 106, + "name": "ElementaryTypeName", + "src": "901:7:0" + } + ], + "id": 107, + "name": "VariableDeclaration", + "src": "901:9:0" + } + ], + "id": 108, + "name": "VariableDeclarationStatement", + "src": "901:9:0" }, { - "body": { - "id": 176, - "nodeType": "Block", - "src": "880:299:0", - "statements": [ - { - "assignments": [ - 104 - ], - "declarations": [ - { - "constant": false, - "id": 104, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 176, - "src": "886:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 103, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "886:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 105, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "886:9:0" - }, - { - "assignments": [ - 107 - ], - "declarations": [ - { - "constant": false, - "id": 107, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 176, - "src": "901:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 106, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "901:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 108, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "901:9:0" + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" }, - { - "expression": { - "argumentTypes": null, - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 109, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "917:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 111, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberName": "n", - "nodeType": "MemberAccess", + "member_name": "n", "referencedDeclaration": 244, - "src": "917:14:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "type": "uint256" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 8, + "type": "struct SquareLib.MagicSquare storage ref", + "value": "storedSquare" + }, + "id": 109, + "name": "Identifier", + "src": "917:12:0" + } + ], + "id": 111, + "name": "MemberAccess", + "src": "917:14:0" + }, + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 112, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "934:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 113, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", + "member_name": "n", "referencedDeclaration": 244, - "src": "934:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "type": "uint256" }, - "src": "917:25:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 115, - "nodeType": "ExpressionStatement", - "src": "917:25:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 123, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "expression": { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 116, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "948:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 100, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" }, - "id": 119, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "948:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 120, + "id": 112, + "name": "Identifier", + "src": "934:6:0" + } + ], + "id": 113, + "name": "MemberAccess", + "src": "934:8:0" + } + ], + "id": 114, + "name": "Assignment", + "src": "917:25:0" + } + ], + "id": 115, + "name": "ExpressionStatement", + "src": "917:25:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", + "member_name": "length", "referencedDeclaration": null, - "src": "948:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "type": "uint256" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "rows", + "referencedDeclaration": 242, + "type": "uint256[] storage ref[] storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 8, + "type": "struct SquareLib.MagicSquare storage ref", + "value": "storedSquare" + }, + "id": 116, + "name": "Identifier", + "src": "948:12:0" + } + ], + "id": 119, + "name": "MemberAccess", + "src": "948:17:0" + } + ], + "id": 120, + "name": "MemberAccess", + "src": "948:24:0" + }, + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 121, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "975:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 122, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", + "member_name": "n", "referencedDeclaration": 244, - "src": "975:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 100, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 121, + "name": "Identifier", + "src": "975:6:0" } + ], + "id": 122, + "name": "MemberAccess", + "src": "975:8:0" + } + ], + "id": 123, + "name": "Assignment", + "src": "948:35:0" + } + ], + "id": 124, + "name": "ExpressionStatement", + "src": "948:35:0" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" }, - "src": "948:35:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 104, + "type": "uint256", + "value": "x" + }, + "id": 125, + "name": "Identifier", + "src": "995:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "30", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 0", + "value": "0" + }, + "id": 126, + "name": "Literal", + "src": "999:1:0" + } + ], + "id": 127, + "name": "Assignment", + "src": "995:5:0" + } + ], + "id": 128, + "name": "ExpressionStatement", + "src": "995:5:0" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "id": 124, - "nodeType": "ExpressionStatement", - "src": "948:35:0" + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "<", + "type": "bool" }, - { - "body": { - "id": 174, - "nodeType": "Block", - "src": "1021:154:0", - "statements": [ + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 104, + "type": "uint256", + "value": "x" + }, + "id": 129, + "name": "Identifier", + "src": "1002:1:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" + }, + "children": [ { - "expression": { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 100, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 130, + "name": "Identifier", + "src": "1006:6:0" + } + ], + "id": 131, + "name": "MemberAccess", + "src": "1006:8:0" + } + ], + "id": 132, + "name": "BinaryOperation", + "src": "1002:12:0" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "++", + "prefix": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 104, + "type": "uint256", + "value": "x" + }, + "id": 133, + "name": "Identifier", + "src": "1016:1:0" + } + ], + "id": 134, + "name": "UnaryOperation", + "src": "1016:3:0" + } + ], + "id": 135, + "name": "ExpressionStatement", + "src": "1016:3:0" + }, + { + "children": [ + { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 144, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "member_name": "length", + "referencedDeclaration": null, + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 136, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "1029:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "uint256[] storage ref" }, - "id": 139, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "1029:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 140, - "indexExpression": { - "argumentTypes": null, - "id": 138, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1047:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1029:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 141, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1029:27:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 142, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1059:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 143, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "1059:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1029:38:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 145, - "nodeType": "ExpressionStatement", - "src": "1029:38:0" - }, - { - "body": { - "id": 172, - "nodeType": "Block", - "src": "1107:62:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 170, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 157, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "1117:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 161, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", + "member_name": "rows", "referencedDeclaration": 242, - "src": "1117:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } + "type": "uint256[] storage ref[] storage ref" }, - "id": 162, - "indexExpression": { + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 8, + "type": "struct SquareLib.MagicSquare storage ref", + "value": "storedSquare" + }, + "id": 136, + "name": "Identifier", + "src": "1029:12:0" + } + ], + "id": 139, + "name": "MemberAccess", + "src": "1029:17:0" + }, + { + "attributes": { "argumentTypes": null, - "id": 159, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], + "overloadedDeclarations": [ + null + ], "referencedDeclaration": 104, - "src": "1135:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "type": "uint256", + "value": "x" }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1117:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 163, - "indexExpression": { - "argumentTypes": null, - "id": 160, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1138:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1117:23:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 138, + "name": "Identifier", + "src": "1047:1:0" } + ], + "id": 140, + "name": "IndexAccess", + "src": "1029:20:0" + } + ], + "id": 141, + "name": "MemberAccess", + "src": "1029:27:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 100, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 142, + "name": "Identifier", + "src": "1059:6:0" + } + ], + "id": 143, + "name": "MemberAccess", + "src": "1059:8:0" + } + ], + "id": 144, + "name": "Assignment", + "src": "1029:38:0" + } + ], + "id": 145, + "name": "ExpressionStatement", + "src": "1029:38:0" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 107, + "type": "uint256", + "value": "y" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 146, + "name": "Identifier", + "src": "1081:1:0" + }, + { + "attributes": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 164, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1143:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 165, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "1143:11:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 167, - "indexExpression": { - "argumentTypes": null, - "id": 166, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1155:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1143:14:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 169, - "indexExpression": { - "argumentTypes": null, - "id": 168, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1158:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, + "hexvalue": "30", "isConstant": false, - "isLValue": true, - "isPure": false, + "isLValue": false, + "isPure": true, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1143:17:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "subdenomination": null, + "token": "number", + "type": "int_const 0", + "value": "0" }, - "src": "1117:43:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 171, - "nodeType": "ExpressionStatement", - "src": "1117:43:0" - } - ] - }, - "condition": { + "id": 147, + "name": "Literal", + "src": "1085:1:0" + } + ], + "id": 148, + "name": "Assignment", + "src": "1081:5:0" + } + ], + "id": 149, + "name": "ExpressionStatement", + "src": "1081:5:0" + }, + { + "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 153, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 150, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1088:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 151, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1092:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 152, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "1092:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1088:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } + "type": "bool" }, - "id": 173, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 148, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 146, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], + "overloadedDeclarations": [ + null + ], "referencedDeclaration": 107, - "src": "1081:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "type": "uint256", + "value": "y" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 150, + "name": "Identifier", + "src": "1088:1:0" + }, + { + "attributes": { "argumentTypes": null, - "hexValue": "30", - "id": 147, "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", + "isLValue": true, + "isPure": false, "lValueRequested": false, - "nodeType": "Literal", - "src": "1085:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" }, - "src": "1081:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 149, - "nodeType": "ExpressionStatement", - "src": "1081:5:0" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 155, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "1102:3:0", - "subExpression": { - "argumentTypes": null, - "id": 154, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1102:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 100, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 151, + "name": "Identifier", + "src": "1092:6:0" } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 156, - "nodeType": "ExpressionStatement", - "src": "1102:3:0" - }, - "nodeType": "ForStatement", - "src": "1076:93:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 132, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 129, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1002:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 130, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1006:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 131, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "1006:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1002:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 175, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 127, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 125, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "995:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 126, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "999:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" + ], + "id": 152, + "name": "MemberAccess", + "src": "1092:8:0" + } + ], + "id": 153, + "name": "BinaryOperation", + "src": "1088:12:0" }, - "src": "995:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 128, - "nodeType": "ExpressionStatement", - "src": "995:5:0" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 134, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "1016:3:0", - "subExpression": { - "argumentTypes": null, - "id": 133, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1016:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "++", + "prefix": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 107, + "type": "uint256", + "value": "y" + }, + "id": 154, + "name": "Identifier", + "src": "1102:1:0" + } + ], + "id": 155, + "name": "UnaryOperation", + "src": "1102:3:0" + } + ], + "id": 156, + "name": "ExpressionStatement", + "src": "1102:3:0" }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "uint256[] storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "rows", + "referencedDeclaration": 242, + "type": "uint256[] storage ref[] storage ref" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 8, + "type": "struct SquareLib.MagicSquare storage ref", + "value": "storedSquare" + }, + "id": 157, + "name": "Identifier", + "src": "1117:12:0" + } + ], + "id": 161, + "name": "MemberAccess", + "src": "1117:17:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 104, + "type": "uint256", + "value": "x" + }, + "id": 159, + "name": "Identifier", + "src": "1135:1:0" + } + ], + "id": 162, + "name": "IndexAccess", + "src": "1117:20:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 107, + "type": "uint256", + "value": "y" + }, + "id": 160, + "name": "Identifier", + "src": "1138:1:0" + } + ], + "id": 163, + "name": "IndexAccess", + "src": "1117:23:0" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "uint256[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "rows", + "referencedDeclaration": 242, + "type": "uint256[] memory[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 100, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 164, + "name": "Identifier", + "src": "1143:6:0" + } + ], + "id": 165, + "name": "MemberAccess", + "src": "1143:11:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 104, + "type": "uint256", + "value": "x" + }, + "id": 166, + "name": "Identifier", + "src": "1155:1:0" + } + ], + "id": 167, + "name": "IndexAccess", + "src": "1143:14:0" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 107, + "type": "uint256", + "value": "y" + }, + "id": 168, + "name": "Identifier", + "src": "1158:1:0" + } + ], + "id": 169, + "name": "IndexAccess", + "src": "1143:17:0" + } + ], + "id": 170, + "name": "Assignment", + "src": "1117:43:0" + } + ], + "id": 171, + "name": "ExpressionStatement", + "src": "1117:43:0" + } + ], + "id": 172, + "name": "Block", + "src": "1107:62:0" } - }, - "id": 135, - "nodeType": "ExpressionStatement", - "src": "1016:3:0" - }, - "nodeType": "ForStatement", - "src": "990:185:0" - } - ] - }, - "documentation": null, - "id": 177, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "save", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 101, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 100, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 177, - "src": "830:35:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 99, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "830:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "829:37:0" - }, - "returnParameters": { - "id": 102, - "nodeType": "ParameterList", - "parameters": [], - "src": "880:0:0" - }, - "scope": 178, - "src": "816:363:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" + ], + "id": 173, + "name": "ForStatement", + "src": "1076:93:0" + } + ], + "id": 174, + "name": "Block", + "src": "1021:154:0" + } + ], + "id": 175, + "name": "ForStatement", + "src": "990:185:0" } ], - "scope": 179, - "src": "88:1093:0" + "id": 176, + "name": "Block", + "src": "880:299:0" } ], - "src": "0:1182:0" + "id": 177, + "name": "FunctionDefinition", + "src": "816:363:0" + } + ], + "id": 178, + "name": "ContractDefinition", + "src": "88:1093:0" + } + ], + "id": 179, + "name": "SourceUnit", + "src": "0:1182:0" + }, + "bytecode": { + "bytes": "608060405234801561001057600080fd5b50610d03806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80638b213ffc146100465780638dbbe62514610062578063f117a19314610080575b600080fd5b610060600480360361005b9190810190610940565b61009c565b005b61006a61018a565b6040516100779190610b45565b60405180910390f35b61009a600480360361009591908101906109c2565b61024d565b005b6000808260200151600060010181905550826020015160008001816100c191906104fc565b50600091505b82602001518210156101855782602001516000800183815481106100e757fe5b90600052602060002001816100fc9190610528565b50600090505b8260200151811015610178578260000151828151811061011e57fe5b6020026020010151818151811061013157fe5b602002602001015160008001838154811061014857fe5b90600052602060002001828154811061015d57fe5b90600052602060002001819055508080600101915050610102565b81806001019250506100c7565b505050565b610192610554565b600060405180604001604052908160008201805480602002602001604051908101604052809291908181526020016000905b828210156102365783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561022257602002820191906000526020600020905b81548152602001906001019080831161020e575b5050505050815260200190600101906101c4565b505050508152602001600182015481525050905090565b6060610257610554565b60008060006040518060400160405280602081526020017f6c657420757320636f6e7374727563742061206d61676963207371756172653a815250945073000000000000000000000000000000000000000063fe4b84df876040518263ffffffff1660e01b81526004016102cb9190610b67565b60006040518083038186803b1580156102e357600080fd5b505af41580156102f7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506103209190810190610981565b9350600092506002868161033057fe5b049150600190505b85860281116103715761035883838387610413909392919063ffffffff16565b8093508194508295505050508080600101915050610338565b3073ffffffffffffffffffffffffffffffffffffffff16638b213ffc856040518263ffffffff1660e01b81526004016103aa9190610b45565b600060405180830381600087803b1580156103c457600080fd5b505af11580156103d8573d6000803e3d6000fd5b505050506040518060600160405280602e8152602001610c93602e91396002908051906020019061040a92919061056e565b50505050505050565b6000806000808760000151878151811061042957fe5b6020026020010151868151811061043c57fe5b602002602001015114610489578660200151600287018161045957fe5b0692508660200151600186896020015101038161047257fe5b0691506001840390508282829250925092506104f2565b838760000151878151811061049a57fe5b602002602001015186815181106104ad57fe5b602002602001018181525050866020015160018789602001510103816104cf57fe5b069250866020015160018601816104e257fe5b0691508390508282829250925092505b9450945094915050565b8154818355818111156105235781836000526020600020918201910161052291906105ee565b5b505050565b81548183558181111561054f5781836000526020600020918201910161054e919061061a565b5b505050565b604051806040016040528060608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105af57805160ff19168380011785556105dd565b828001600101855582156105dd579182015b828111156105dc5782518255916020019190600101906105c1565b5b5090506105ea919061061a565b5090565b61061791905b80821115610613576000818161060a919061063f565b506001016105f4565b5090565b90565b61063c91905b80821115610638576000816000905550600101610620565b5090565b90565b508054600082559060005260206000209081019061065d919061061a565b50565b600082601f83011261067157600080fd5b813561068461067f82610baf565b610b82565b9150818183526020840193506020810190508360005b838110156106ca57813586016106b08882610748565b84526020840193506020830192505060018101905061069a565b5050505092915050565b600082601f8301126106e557600080fd5b81516106f86106f382610baf565b610b82565b9150818183526020840193506020810190508360005b8381101561073e578151860161072488826107cb565b84526020840193506020830192505060018101905061070e565b5050505092915050565b600082601f83011261075957600080fd5b813561076c61076782610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561079157600080fd5b60005b838110156107c157816107a78882610916565b845260208401935060208301925050600181019050610794565b5050505092915050565b600082601f8301126107dc57600080fd5b81516107ef6107ea82610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561081457600080fd5b60005b83811015610844578161082a888261092b565b845260208401935060208301925050600181019050610817565b5050505092915050565b60006040828403121561086057600080fd5b61086a6040610b82565b9050600082013567ffffffffffffffff81111561088657600080fd5b61089284828501610660565b60008301525060206108a684828501610916565b60208301525092915050565b6000604082840312156108c457600080fd5b6108ce6040610b82565b9050600082015167ffffffffffffffff8111156108ea57600080fd5b6108f6848285016106d4565b600083015250602061090a8482850161092b565b60208301525092915050565b60008135905061092581610c7b565b92915050565b60008151905061093a81610c7b565b92915050565b60006020828403121561095257600080fd5b600082013567ffffffffffffffff81111561096c57600080fd5b6109788482850161084e565b91505092915050565b60006020828403121561099357600080fd5b600082015167ffffffffffffffff8111156109ad57600080fd5b6109b9848285016108b2565b91505092915050565b6000602082840312156109d457600080fd5b60006109e284828501610916565b91505092915050565b60006109f78383610a8c565b905092915050565b6000610a0b8383610b27565b60208301905092915050565b6000610a2282610c1f565b610a2c8185610c4f565b935083602082028501610a3e85610bff565b8060005b85811015610a7a5784840389528151610a5b85826109eb565b9450610a6683610c35565b925060208a01995050600181019050610a42565b50829750879550505050505092915050565b6000610a9782610c2a565b610aa18185610c60565b9350610aac83610c0f565b8060005b83811015610add578151610ac488826109ff565b9750610acf83610c42565b925050600181019050610ab0565b5085935050505092915050565b60006040830160008301518482036000860152610b078282610a17565b9150506020830151610b1c6020860182610b27565b508091505092915050565b610b3081610c71565b82525050565b610b3f81610c71565b82525050565b60006020820190508181036000830152610b5f8184610aea565b905092915050565b6000602082019050610b7c6000830184610b36565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610ba557600080fd5b8060405250919050565b600067ffffffffffffffff821115610bc657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610bee57600080fd5b602082029050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b610c8481610c71565b8114610c8f57600080fd5b5056fe66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521a365627a7a72315820698956d7e32a2fe35a6a3472fb6bd9549f62fac29f001fd691060a9a500a9ecd6c6578706572696d656e74616cf564736f6c63430005100040", + "linkReferences": [ + { "offsets": [694], "length": 20, "name": "SquareLib" } + ] + }, + "deployedBytecode": { + "bytes": "608060405234801561001057600080fd5b50600436106100415760003560e01c80638b213ffc146100465780638dbbe62514610062578063f117a19314610080575b600080fd5b610060600480360361005b9190810190610940565b61009c565b005b61006a61018a565b6040516100779190610b45565b60405180910390f35b61009a600480360361009591908101906109c2565b61024d565b005b6000808260200151600060010181905550826020015160008001816100c191906104fc565b50600091505b82602001518210156101855782602001516000800183815481106100e757fe5b90600052602060002001816100fc9190610528565b50600090505b8260200151811015610178578260000151828151811061011e57fe5b6020026020010151818151811061013157fe5b602002602001015160008001838154811061014857fe5b90600052602060002001828154811061015d57fe5b90600052602060002001819055508080600101915050610102565b81806001019250506100c7565b505050565b610192610554565b600060405180604001604052908160008201805480602002602001604051908101604052809291908181526020016000905b828210156102365783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561022257602002820191906000526020600020905b81548152602001906001019080831161020e575b5050505050815260200190600101906101c4565b505050508152602001600182015481525050905090565b6060610257610554565b60008060006040518060400160405280602081526020017f6c657420757320636f6e7374727563742061206d61676963207371756172653a815250945073000000000000000000000000000000000000000063fe4b84df876040518263ffffffff1660e01b81526004016102cb9190610b67565b60006040518083038186803b1580156102e357600080fd5b505af41580156102f7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506103209190810190610981565b9350600092506002868161033057fe5b049150600190505b85860281116103715761035883838387610413909392919063ffffffff16565b8093508194508295505050508080600101915050610338565b3073ffffffffffffffffffffffffffffffffffffffff16638b213ffc856040518263ffffffff1660e01b81526004016103aa9190610b45565b600060405180830381600087803b1580156103c457600080fd5b505af11580156103d8573d6000803e3d6000fd5b505050506040518060600160405280602e8152602001610c93602e91396002908051906020019061040a92919061056e565b50505050505050565b6000806000808760000151878151811061042957fe5b6020026020010151868151811061043c57fe5b602002602001015114610489578660200151600287018161045957fe5b0692508660200151600186896020015101038161047257fe5b0691506001840390508282829250925092506104f2565b838760000151878151811061049a57fe5b602002602001015186815181106104ad57fe5b602002602001018181525050866020015160018789602001510103816104cf57fe5b069250866020015160018601816104e257fe5b0691508390508282829250925092505b9450945094915050565b8154818355818111156105235781836000526020600020918201910161052291906105ee565b5b505050565b81548183558181111561054f5781836000526020600020918201910161054e919061061a565b5b505050565b604051806040016040528060608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105af57805160ff19168380011785556105dd565b828001600101855582156105dd579182015b828111156105dc5782518255916020019190600101906105c1565b5b5090506105ea919061061a565b5090565b61061791905b80821115610613576000818161060a919061063f565b506001016105f4565b5090565b90565b61063c91905b80821115610638576000816000905550600101610620565b5090565b90565b508054600082559060005260206000209081019061065d919061061a565b50565b600082601f83011261067157600080fd5b813561068461067f82610baf565b610b82565b9150818183526020840193506020810190508360005b838110156106ca57813586016106b08882610748565b84526020840193506020830192505060018101905061069a565b5050505092915050565b600082601f8301126106e557600080fd5b81516106f86106f382610baf565b610b82565b9150818183526020840193506020810190508360005b8381101561073e578151860161072488826107cb565b84526020840193506020830192505060018101905061070e565b5050505092915050565b600082601f83011261075957600080fd5b813561076c61076782610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561079157600080fd5b60005b838110156107c157816107a78882610916565b845260208401935060208301925050600181019050610794565b5050505092915050565b600082601f8301126107dc57600080fd5b81516107ef6107ea82610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561081457600080fd5b60005b83811015610844578161082a888261092b565b845260208401935060208301925050600181019050610817565b5050505092915050565b60006040828403121561086057600080fd5b61086a6040610b82565b9050600082013567ffffffffffffffff81111561088657600080fd5b61089284828501610660565b60008301525060206108a684828501610916565b60208301525092915050565b6000604082840312156108c457600080fd5b6108ce6040610b82565b9050600082015167ffffffffffffffff8111156108ea57600080fd5b6108f6848285016106d4565b600083015250602061090a8482850161092b565b60208301525092915050565b60008135905061092581610c7b565b92915050565b60008151905061093a81610c7b565b92915050565b60006020828403121561095257600080fd5b600082013567ffffffffffffffff81111561096c57600080fd5b6109788482850161084e565b91505092915050565b60006020828403121561099357600080fd5b600082015167ffffffffffffffff8111156109ad57600080fd5b6109b9848285016108b2565b91505092915050565b6000602082840312156109d457600080fd5b60006109e284828501610916565b91505092915050565b60006109f78383610a8c565b905092915050565b6000610a0b8383610b27565b60208301905092915050565b6000610a2282610c1f565b610a2c8185610c4f565b935083602082028501610a3e85610bff565b8060005b85811015610a7a5784840389528151610a5b85826109eb565b9450610a6683610c35565b925060208a01995050600181019050610a42565b50829750879550505050505092915050565b6000610a9782610c2a565b610aa18185610c60565b9350610aac83610c0f565b8060005b83811015610add578151610ac488826109ff565b9750610acf83610c42565b925050600181019050610ab0565b5085935050505092915050565b60006040830160008301518482036000860152610b078282610a17565b9150506020830151610b1c6020860182610b27565b508091505092915050565b610b3081610c71565b82525050565b610b3f81610c71565b82525050565b60006020820190508181036000830152610b5f8184610aea565b905092915050565b6000602082019050610b7c6000830184610b36565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610ba557600080fd5b8060405250919050565b600067ffffffffffffffff821115610bc657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610bee57600080fd5b602082029050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b610c8481610c71565b8114610c8f57600080fd5b5056fe66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521a365627a7a72315820698956d7e32a2fe35a6a3472fb6bd9549f62fac29f001fd691060a9a500a9ecd6c6578706572696d656e74616cf564736f6c63430005100040", + "linkReferences": [ + { "offsets": [662], "length": 20, "name": "SquareLib" } + ] + }, + "compiler": { + "name": "solc", + "version": "0.5.16+commit.9c3226ce.Emscripten.clang" + } + }, + { + "contractName": "Migrations", + "abi": [ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": true, + "inputs": [], + "name": "last_completed_migration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "completed", + "type": "uint256" + } + ], + "name": "setCompleted", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol\":{\"keccak256\":\"0xc167df84a157f070489992ba46387a783249b5c46b23194e98c379bb13d57d12\",\"urls\":[\"bzz-raw://544166d03bfd125f7adec7f4d5daf19790b04145ab4096a00f84f04846f34258\",\"dweb:/ipfs/QmZ4V2pwz5VFTog9zRKqcKCEaNF7qE9wjMyPj7gskfb21N\"]}},\"version\":1}", + "devdoc": { "methods": {} }, + "userdoc": { "methods": {} }, + "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "source": "pragma solidity >=0.5.6;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", + "sourceMap": "26:480:1:-;;;178:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;178:50:1;213:10;205:5;;:18;;;;;;;;;;;;;;;;;;26:480;;;;;;", + "deployedSourceMap": "26:480:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26:480:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;339:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;339:165:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;74:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;50:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;232:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;232:103:1;;;;;;;;;;;;;;;;;:::i;:::-;;339:165;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;401:19;434:11;401:45;;452:8;:21;;;474:24;;452:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;452:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;452:47:1;;;;168:1;143:26;339:165;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;232:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;321:9;294:24;:36;;;;143:26;232:103;:::o", + "ast": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "exportedSymbols": { "Migrations": [235] }, + "id": 236, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 180, + "literals": ["solidity", ">=", "0.5", ".6"], + "nodeType": "PragmaDirective", + "src": "0:24:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 235, + "linearizedBaseContracts": [235], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 182, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 235, + "src": "50:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 181, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "50:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" }, - "legacyAST": { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", - "exportedSymbols": { - "MagicSquare": [ - 178 - ] + { + "constant": false, + "id": 184, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 235, + "src": "74:36:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "id": 179, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - ">=", - "0.5", - ".6" - ], - "nodeType": "PragmaDirective", - "src": "0:24:0" - }, - { - "id": 2, - "literals": [ - "experimental", - "ABIEncoderV2" - ], - "nodeType": "PragmaDirective", - "src": "26:33:0" - }, - { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", - "file": "./SquareLib.sol", - "id": 3, - "nodeType": "ImportDirective", - "scope": 179, - "sourceUnit": 398, - "src": "61:25:0", - "symbolAliases": [], - "unitAlias": "" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 178, - "linearizedBaseContracts": [ - 178 - ], - "name": "MagicSquare", - "nodeType": "ContractDefinition", - "nodes": [ - { - "id": 6, - "libraryName": { - "contractScope": null, - "id": 4, - "name": "SquareLib", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 397, - "src": "119:9:0", + "typeName": { + "id": 183, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "74:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 192, + "nodeType": "Block", + "src": "137:37:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 186, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 412, + "src": "147:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "147:10:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_SquareLib_$397", - "typeString": "library SquareLib" + "typeIdentifier": "t_address_payable", + "typeString": "address payable" } }, - "nodeType": "UsingForDirective", - "src": "113:42:0", - "typeName": { - "contractScope": null, - "id": 5, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "133:21:0", + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 188, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 182, + "src": "161:5:1", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_address", + "typeString": "address" } + }, + "src": "147:19:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } }, - { - "constant": false, - "id": 8, - "name": "storedSquare", - "nodeType": "VariableDeclaration", - "scope": 178, - "src": "159:34:0", - "stateVariable": true, - "storageLocation": "default", + "falseBody": null, + "id": 191, + "nodeType": "IfStatement", + "src": "143:26:1", + "trueBody": { + "id": 190, + "nodeType": "PlaceholderStatement", + "src": "168:1:1" + } + } + ] + }, + "documentation": null, + "id": 193, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 185, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:1" + }, + "src": "115:59:1", + "visibility": "internal" + }, + { + "body": { + "id": 201, + "nodeType": "Block", + "src": "199:29:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 196, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 182, + "src": "205:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 197, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 412, + "src": "213:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "213:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "205:18:1", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 200, + "nodeType": "ExpressionStatement", + "src": "205:18:1" + } + ] + }, + "documentation": null, + "id": 202, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 194, + "nodeType": "ParameterList", + "parameters": [], + "src": "189:2:1" + }, + "returnParameters": { + "id": 195, + "nodeType": "ParameterList", + "parameters": [], + "src": "199:0:1" + }, + "scope": 235, + "src": "178:50:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 213, + "nodeType": "Block", + "src": "288:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 211, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 209, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "294:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "typeName": { - "contractScope": null, - "id": 7, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "159:21:0", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 210, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 204, + "src": "321:9:1", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "value": null, - "visibility": "internal" + "src": "294:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "constant": false, - "id": 10, - "name": "storedGreeting", - "nodeType": "VariableDeclaration", - "scope": 178, - "src": "197:21:0", - "stateVariable": true, - "storageLocation": "default", + "id": 212, + "nodeType": "ExpressionStatement", + "src": "294:36:1" + } + ] + }, + "documentation": null, + "id": 214, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 207, + "modifierName": { + "argumentTypes": null, + "id": 206, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "277:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "277:10:1" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 204, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 214, + "src": "254:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 203, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "254:4:1", "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "253:16:1" + }, + "returnParameters": { + "id": 208, + "nodeType": "ParameterList", + "parameters": [], + "src": "288:0:1" + }, + "scope": 235, + "src": "232:103:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 233, + "nodeType": "Block", + "src": "395:109:1", + "statements": [ + { + "assignments": [222], + "declarations": [ + { + "constant": false, + "id": 222, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 233, + "src": "401:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 221, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 235, + "src": "401:10:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 226, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 224, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "434:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 223, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 235, + "src": "423:10:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$235_$", + "typeString": "type(contract Migrations)" + } }, - "typeName": { - "id": 9, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "197:6:0", + "id": 225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "423:23:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "401:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 230, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "474:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 227, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 222, + "src": "452:8:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } + }, + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 214, + "src": "452:21:1", "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" } }, - "value": null, - "visibility": "internal" + "id": 231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "452:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 232, + "nodeType": "ExpressionStatement", + "src": "452:47:1" + } + ] + }, + "documentation": null, + "id": 234, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 219, + "modifierName": { + "argumentTypes": null, + "id": 218, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "384:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "384:10:1" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 216, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 234, + "src": "356:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 215, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "356:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, + "value": null, + "visibility": "internal" + } + ], + "src": "355:21:1" + }, + "returnParameters": { + "id": 220, + "nodeType": "ParameterList", + "parameters": [], + "src": "395:0:1" + }, + "scope": 235, + "src": "339:165:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 236, + "src": "26:480:1" + } + ], + "src": "0:507:1" + }, + "legacyAST": { + "attributes": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "exportedSymbols": { "Migrations": [235] } + }, + "children": [ + { + "attributes": { + "literals": ["solidity", ">=", "0.5", ".6"] + }, + "id": 180, + "name": "PragmaDirective", + "src": "0:24:1" + }, + { + "attributes": { + "baseContracts": [null], + "contractDependencies": [null], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "linearizedBaseContracts": [235], + "name": "Migrations", + "scope": 236 + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "owner", + "scope": 235, + "stateVariable": true, + "storageLocation": "default", + "type": "address", + "value": null, + "visibility": "public" + }, + "children": [ + { + "attributes": { + "name": "address", + "stateMutability": "nonpayable", + "type": "address" + }, + "id": 181, + "name": "ElementaryTypeName", + "src": "50:7:1" + } + ], + "id": 182, + "name": "VariableDeclaration", + "src": "50:20:1" + }, + { + "attributes": { + "constant": false, + "name": "last_completed_migration", + "scope": 235, + "stateVariable": true, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "public" + }, + "children": [ + { + "attributes": { + "name": "uint", + "type": "uint256" + }, + "id": 183, + "name": "ElementaryTypeName", + "src": "74:4:1" + } + ], + "id": 184, + "name": "VariableDeclaration", + "src": "74:36:1" + }, + { + "attributes": { + "documentation": null, + "name": "restricted", + "visibility": "internal" + }, + "children": [ + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 185, + "name": "ParameterList", + "src": "134:2:1" + }, + { + "children": [ { - "body": { - "id": 89, - "nodeType": "Block", - "src": "273:412:0", - "statements": [ - { - "assignments": [ - 16 - ], - "declarations": [ - { - "constant": false, - "id": 16, - "name": "greeting", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "279:22:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" - }, - "typeName": { - "id": 15, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "279:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 17, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "279:22:0" + "attributes": { "falseBody": null }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "==", + "type": "bool" }, - { - "assignments": [ - 21 - ], - "declarations": [ - { - "constant": false, - "id": 21, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "307:35:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 20, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "307:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 22, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "307:35:0" + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "member_name": "sender", + "referencedDeclaration": null, + "type": "address payable" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 412, + "type": "msg", + "value": "msg" + }, + "id": 186, + "name": "Identifier", + "src": "147:3:1" + } + ], + "id": 187, + "name": "MemberAccess", + "src": "147:10:1" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 182, + "type": "address", + "value": "owner" + }, + "id": 188, + "name": "Identifier", + "src": "161:5:1" + } + ], + "id": 189, + "name": "BinaryOperation", + "src": "147:19:1" + }, + { + "id": 190, + "name": "PlaceholderStatement", + "src": "168:1:1" + } + ], + "id": 191, + "name": "IfStatement", + "src": "143:26:1" + } + ], + "id": 192, + "name": "Block", + "src": "137:37:1" + } + ], + "id": 193, + "name": "ModifierDefinition", + "src": "115:59:1" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": true, + "kind": "constructor", + "modifiers": [null], + "name": "", + "scope": 235, + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 194, + "name": "ParameterList", + "src": "189:2:1" + }, + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 195, + "name": "ParameterList", + "src": "199:0:1" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "address" }, - { - "assignments": [ - 24 - ], - "declarations": [ - { - "constant": false, - "id": 24, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "348:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 23, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "348:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 25, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "348:9:0" - }, - { - "assignments": [ - 27 - ], - "declarations": [ - { - "constant": false, - "id": 27, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "363:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 26, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "363:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 28, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "363:9:0" - }, - { - "assignments": [ - 30 - ], - "declarations": [ - { - "constant": false, - "id": 30, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 89, - "src": "378:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 29, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "378:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 31, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "378:9:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 34, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 32, - "name": "greeting", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 16, - "src": "394:8:0", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } + "overloadedDeclarations": [null], + "referencedDeclaration": 182, + "type": "address", + "value": "owner" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 196, + "name": "Identifier", + "src": "205:5:1" + }, + { + "attributes": { "argumentTypes": null, - "hexValue": "6c657420757320636f6e7374727563742061206d61676963207371756172653a", - "id": 33, "isConstant": false, "isLValue": false, - "isPure": true, - "kind": "string", + "isPure": false, "lValueRequested": false, - "nodeType": "Literal", - "src": "405:34:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_6489d3e23108083aeb90c3b69347cd3e9158d4240c395bd3f538f5847904d59c", - "typeString": "literal_string \"let us construct a magic square:\"" - }, - "value": "let us construct a magic square:" + "member_name": "sender", + "referencedDeclaration": null, + "type": "address payable" }, - "src": "394:45:0", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "id": 35, - "nodeType": "ExpressionStatement", - "src": "394:45:0" + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 412, + "type": "msg", + "value": "msg" + }, + "id": 197, + "name": "Identifier", + "src": "213:3:1" + } + ], + "id": 198, + "name": "MemberAccess", + "src": "213:10:1" + } + ], + "id": 199, + "name": "Assignment", + "src": "205:18:1" + } + ], + "id": 200, + "name": "ExpressionStatement", + "src": "205:18:1" + } + ], + "id": 201, + "name": "Block", + "src": "199:29:1" + } + ], + "id": 202, + "name": "FunctionDefinition", + "src": "178:50:1" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "name": "setCompleted", + "scope": 235, + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "completed", + "scope": 214, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint", + "type": "uint256" }, - { - "expression": { - "argumentTypes": null, - "id": 41, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "id": 203, + "name": "ElementaryTypeName", + "src": "254:4:1" + } + ], + "id": 204, + "name": "VariableDeclaration", + "src": "254:14:1" + } + ], + "id": 205, + "name": "ParameterList", + "src": "253:16:1" + }, + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 208, + "name": "ParameterList", + "src": "288:0:1" + }, + { + "attributes": { "arguments": null }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 193, + "type": "modifier ()", + "value": "restricted" + }, + "id": 206, + "name": "Identifier", + "src": "277:10:1" + } + ], + "id": 207, + "name": "ModifierInvocation", + "src": "277:10:1" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 36, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "445:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "overloadedDeclarations": [null], + "referencedDeclaration": 184, + "type": "uint256", + "value": "last_completed_migration" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 209, + "name": "Identifier", + "src": "294:24:1" + }, + { + "attributes": { "argumentTypes": null, - "arguments": [ + "overloadedDeclarations": [null], + "referencedDeclaration": 204, + "type": "uint256", + "value": "completed" + }, + "id": 210, + "name": "Identifier", + "src": "321:9:1" + } + ], + "id": 211, + "name": "Assignment", + "src": "294:36:1" + } + ], + "id": 212, + "name": "ExpressionStatement", + "src": "294:36:1" + } + ], + "id": 213, + "name": "Block", + "src": "288:47:1" + } + ], + "id": 214, + "name": "FunctionDefinition", + "src": "232:103:1" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "name": "upgrade", + "scope": 235, + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "new_address", + "scope": 234, + "stateVariable": false, + "storageLocation": "default", + "type": "address", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "address", + "stateMutability": "nonpayable", + "type": "address" + }, + "id": 215, + "name": "ElementaryTypeName", + "src": "356:7:1" + } + ], + "id": 216, + "name": "VariableDeclaration", + "src": "356:19:1" + } + ], + "id": 217, + "name": "ParameterList", + "src": "355:21:1" + }, + { + "attributes": { "parameters": [null] }, + "children": [], + "id": 220, + "name": "ParameterList", + "src": "395:0:1" + }, + { + "attributes": { "arguments": null }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 193, + "type": "modifier ()", + "value": "restricted" + }, + "id": 218, + "name": "Identifier", + "src": "384:10:1" + } + ], + "id": 219, + "name": "ModifierInvocation", + "src": "384:10:1" + }, + { + "children": [ + { + "attributes": { "assignments": [222] }, + "children": [ + { + "attributes": { + "constant": false, + "name": "upgraded", + "scope": 233, + "stateVariable": false, + "storageLocation": "default", + "type": "contract Migrations", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "Migrations", + "referencedDeclaration": 235, + "type": "contract Migrations" + }, + "id": 221, + "name": "UserDefinedTypeName", + "src": "401:10:1" + } + ], + "id": 222, + "name": "VariableDeclaration", + "src": "401:19:1" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [null], + "type": "contract Migrations", + "type_conversion": true + }, + "children": [ + { + "attributes": { + "argumentTypes": [ { - "argumentTypes": null, - "id": 39, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "475:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_address", + "typeString": "address" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 37, - "name": "SquareLib", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 397, - "src": "454:9:0", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_SquareLib_$397_$", - "typeString": "type(library SquareLib)" - } - }, - "id": 38, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "initialize", - "nodeType": "MemberAccess", - "referencedDeclaration": 292, - "src": "454:20:0", - "typeDescriptions": { - "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_struct$_MagicSquare_$245_memory_ptr_$", - "typeString": "function (uint256) pure returns (struct SquareLib.MagicSquare memory)" + "overloadedDeclarations": [null], + "referencedDeclaration": 235, + "type": "type(contract Migrations)", + "value": "Migrations" + }, + "id": 223, + "name": "Identifier", + "src": "423:10:1" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 216, + "type": "address", + "value": "new_address" + }, + "id": 224, + "name": "Identifier", + "src": "434:11:1" + } + ], + "id": 225, + "name": "FunctionCall", + "src": "423:23:1" + } + ], + "id": 226, + "name": "VariableDeclarationStatement", + "src": "401:45:1" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [null], + "type": "tuple()", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - }, - "id": 40, + ], "isConstant": false, "isLValue": false, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "454:23:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "member_name": "setCompleted", + "referencedDeclaration": 214, + "type": "function (uint256) external" }, - "src": "445:32:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 42, - "nodeType": "ExpressionStatement", - "src": "445:32:0" - }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 222, + "type": "contract Migrations", + "value": "upgraded" + }, + "id": 227, + "name": "Identifier", + "src": "452:8:1" + } + ], + "id": 229, + "name": "MemberAccess", + "src": "452:21:1" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 184, + "type": "uint256", + "value": "last_completed_migration" + }, + "id": 230, + "name": "Identifier", + "src": "474:24:1" + } + ], + "id": 231, + "name": "FunctionCall", + "src": "452:47:1" + } + ], + "id": 232, + "name": "ExpressionStatement", + "src": "452:47:1" + } + ], + "id": 233, + "name": "Block", + "src": "395:109:1" + } + ], + "id": 234, + "name": "FunctionDefinition", + "src": "339:165:1" + } + ], + "id": 235, + "name": "ContractDefinition", + "src": "26:480:1" + } + ], + "id": 236, + "name": "SourceUnit", + "src": "0:507:1" + }, + "bytecode": { + "bytes": "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102b7806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea265627a7a72315820a3490ab4bee3e65964a919e1ad4e428b663b2dc1c3663754a267b82ff3a3378f64736f6c63430005100032", + "linkReferences": [] + }, + "deployedBytecode": { + "bytes": "608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea265627a7a72315820a3490ab4bee3e65964a919e1ad4e428b663b2dc1c3663754a267b82ff3a3378f64736f6c63430005100032", + "linkReferences": [] + }, + "compiler": { + "name": "solc", + "version": "0.5.16+commit.9c3226ce.Emscripten.clang" + } + }, + { + "contractName": "SquareLib", + "abi": [ + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "n", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [ + { + "components": [ + { + "internalType": "uint256[][]", + "name": "rows", + "type": "uint256[][]" + }, + { + "internalType": "uint256", + "name": "n", + "type": "uint256" + } + ], + "internalType": "struct SquareLib.MagicSquare", + "name": "square", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256[][]\",\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"internalType\":\"struct SquareLib.MagicSquare\",\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":\"SquareLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":{\"keccak256\":\"0xfdd57b714a8ab00ba37fb6875091322e9b014a4ee1df170527a75d3ee8d54add\",\"urls\":[\"bzz-raw://02aaee76f3428cd626ef0732372c6d89d635f2b4de3ee1c9f3865af352dd9989\",\"dweb:/ipfs/QmP8re1b4ne2PHZqMDvQeWAKR37mmftN3dtXfxzsZr3Wc2\"]}},\"version\":1}", + "devdoc": { "methods": {} }, + "userdoc": { "methods": {} }, + "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "source": "pragma solidity >=0.5.6;\npragma experimental ABIEncoderV2;\n\nlibrary SquareLib {\n struct MagicSquare {\n uint256[][] rows;\n uint256 n;\n }\n\n function initialize(uint256 n)\n external\n pure\n returns (MagicSquare memory square)\n {\n uint256 i;\n\n square = MagicSquare({\n rows: new uint256[][](n),\n n: n\n });\n\n for (i = 0; i < n; i++) {\n square.rows[i] = new uint256[](n);\n }\n }\n\n function step(\n MagicSquare memory square,\n uint256 x,\n uint256 y,\n uint256 i\n )\n internal\n pure\n returns (\n uint256 newX,\n uint256 newY,\n uint256 lastI\n )\n {\n if (square.rows[x][y] != 0) {\n newX = (x + 2) % square.n;\n newY = (square.n + y - 1) % square.n;\n lastI = i - 1;\n return (newX, newY, lastI);\n }\n\n square.rows[x][y] = i;\n newX = (square.n + x - 1) % square.n;\n newY = (y + 1) % square.n;\n lastI = i;\n return (newX, newY, lastI);\n }\n}\n\n", + "sourceMap": "60:888:2:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", + "deployedSourceMap": "60:888:2:-;;;;;;;;;;;;;;;;;;;;;;;;147:272;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;213:25;;:::i;:::-;248:9;273:63;;;;;;;;315:1;299:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;273:63;;;;328:1;273:63;;;264:72;;352:1;348:5;;343:72;359:1;355;:5;343:72;;;406:1;392:16;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;392:16:2;;;;375:6;:11;;;387:1;375:14;;;;;;;;;;;;;:33;;;;362:3;;;;;;;343:72;;;147:272;;;;:::o;60:888::-;;;;;;;;;;;;;;;;;;;:::o;5:130:-1:-;;85:6;72:20;63:29;;97:33;124:5;97:33;;;57:78;;;;;142:241;;246:2;234:9;225:7;221:23;217:32;214:2;;;262:1;259;252:12;214:2;297:1;314:53;359:7;350:6;339:9;335:22;314:53;;;304:63;;276:97;208:175;;;;;391:257;;542:100;638:3;630:6;542:100;;;528:114;;521:127;;;;;657:189;;752:54;802:3;794:6;752:54;;;835:4;830:3;826:14;812:28;;745:101;;;;;889:1004;;1070:71;1135:5;1070:71;;;1154:105;1252:6;1247:3;1154:105;;;1147:112;;1282:3;1324:4;1316:6;1312:17;1307:3;1303:27;1351:73;1418:5;1351:73;;;1444:7;1472:1;1457:397;1482:6;1479:1;1476:13;1457:397;;;1544:9;1538:4;1534:20;1529:3;1522:33;1589:6;1583:13;1611:114;1720:4;1705:13;1611:114;;;1603:122;;1742:77;1812:6;1742:77;;;1732:87;;1842:4;1837:3;1833:14;1826:21;;1514:340;1504:1;1501;1497:9;1492:14;;1457:397;;;1461:14;1867:4;1860:11;;1884:3;1877:10;;1049:844;;;;;;;;;;1932:678;;2071:50;2115:5;2071:50;;;2134:84;2211:6;2206:3;2134:84;;;2127:91;;2239:52;2285:5;2239:52;;;2311:7;2339:1;2324:264;2349:6;2346:1;2343:13;2324:264;;;2416:6;2410:13;2437:71;2504:3;2489:13;2437:71;;;2430:78;;2525:56;2574:6;2525:56;;;2515:66;;2381:207;2371:1;2368;2364:9;2359:14;;2324:264;;;2328:14;2601:3;2594:10;;2050:560;;;;;;;;2685:666;;2850:4;2845:3;2841:14;2933:4;2926:5;2922:16;2916:23;2985:3;2979:4;2975:14;2968:4;2963:3;2959:14;2952:38;3005:149;3149:4;3135:12;3005:149;;;2997:157;;2870:296;3236:4;3229:5;3225:16;3219:23;3248:71;3313:4;3308:3;3304:14;3290:12;3248:71;;;3176:149;3342:4;3335:11;;2823:528;;;;;;3358:111;3439:24;3457:5;3439:24;;;3434:3;3427:37;3421:48;;;3476:389;;3658:2;3647:9;3643:18;3635:26;;3708:9;3702:4;3698:20;3694:1;3683:9;3679:17;3672:47;3733:122;3850:4;3841:6;3733:122;;;3725:130;;3629:236;;;;;3872:168;;3975:3;3967:11;;4013:4;4008:3;4004:14;3996:22;;3961:79;;;;4047:147;;4129:3;4121:11;;4167:4;4162:3;4158:14;4150:22;;4115:79;;;;4201:154;;4327:5;4321:12;4311:22;;4292:63;;;;4362:133;;4467:5;4461:12;4451:22;;4432:63;;;;4502:125;;4617:4;4612:3;4608:14;4600:22;;4594:33;;;;4634:104;;4728:4;4723:3;4719:14;4711:22;;4705:33;;;;4746:197;;4895:6;4890:3;4883:19;4932:4;4927:3;4923:14;4908:29;;4876:67;;;;;4952:176;;5080:6;5075:3;5068:19;5117:4;5112:3;5108:14;5093:29;;5061:67;;;;;5136:72;;5198:5;5187:16;;5181:27;;;;5215:117;5284:24;5302:5;5284:24;;;5277:5;5274:35;5264:2;;5323:1;5320;5313:12;5264:2;5258:74;", + "ast": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "exportedSymbols": { "SquareLib": [397] }, + "id": 398, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 237, + "literals": ["solidity", ">=", "0.5", ".6"], + "nodeType": "PragmaDirective", + "src": "0:24:2" + }, + { + "id": 238, + "literals": ["experimental", "ABIEncoderV2"], + "nodeType": "PragmaDirective", + "src": "25:33:2" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 397, + "linearizedBaseContracts": [397], + "name": "SquareLib", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "SquareLib.MagicSquare", + "id": 245, + "members": [ + { + "constant": false, + "id": 242, + "name": "rows", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "107:16:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 239, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "107:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 240, + "length": null, + "nodeType": "ArrayTypeName", + "src": "107:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "id": 241, + "length": null, + "nodeType": "ArrayTypeName", + "src": "107:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 244, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "129:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 243, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "129:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "MagicSquare", + "nodeType": "StructDefinition", + "scope": 397, + "src": "82:61:2", + "visibility": "public" + }, + { + "body": { + "id": 291, + "nodeType": "Block", + "src": "242:177:2", + "statements": [ + { + "assignments": [253], + "declarations": [ + { + "constant": false, + "id": 253, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 291, + "src": "248:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 252, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "248:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 254, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "248:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 255, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "264:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ { - "expression": { - "argumentTypes": null, - "id": 45, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "id": 43, - "name": "x", + "id": 261, + "name": "n", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 24, - "src": "484:1:0", + "referencedDeclaration": 247, + "src": "315:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "299:15:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 44, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "488:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + "typeName": { + "baseType": { + "baseType": { + "id": 257, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "303:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 258, + "length": null, + "nodeType": "ArrayTypeName", + "src": "303:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } }, - "value": "0" - }, - "src": "484:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 259, + "length": null, + "nodeType": "ArrayTypeName", + "src": "303:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } } }, - "id": 46, - "nodeType": "ExpressionStatement", - "src": "484:5:0" + "id": 262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "299:18:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } }, { - "expression": { + "argumentTypes": null, + "id": 263, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "328:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 256, + "name": "MagicSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 245, + "src": "273:11:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_MagicSquare_$245_storage_ptr_$", + "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": ["rows", "n"], + "nodeType": "FunctionCall", + "src": "273:63:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "src": "264:72:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 266, + "nodeType": "ExpressionStatement", + "src": "264:72:2" + }, + { + "body": { + "id": 289, + "nodeType": "Block", + "src": "367:48:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "id": 51, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "baseExpression": { "argumentTypes": null, - "id": 47, - "name": "y", + "expression": { + "argumentTypes": null, + "id": 277, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "375:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 280, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "375:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 281, + "indexExpression": { + "argumentTypes": null, + "id": 279, + "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 27, - "src": "495:1:0", + "referencedDeclaration": 253, + "src": "387:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 50, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "375:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "id": 48, + "id": 285, "name": "n", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "499:1:0", + "referencedDeclaration": 247, + "src": "406:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "392:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" }, - "nodeType": "BinaryOperation", - "operator": "/", - "rightExpression": { - "argumentTypes": null, - "hexValue": "32", - "id": 49, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "503:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" + "typeName": { + "baseType": { + "id": 282, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "396:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "value": "2" - }, - "src": "499:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 283, + "length": null, + "nodeType": "ArrayTypeName", + "src": "396:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } } }, - "src": "495:9:0", + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "392:16:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" } }, - "id": 52, - "nodeType": "ExpressionStatement", - "src": "495:9:0" + "src": "375:33:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } }, - { - "body": { - "id": 77, - "nodeType": "Block", - "src": "539:47:0", - "statements": [ - { - "expression": { + "id": 288, + "nodeType": "ExpressionStatement", + "src": "375:33:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 271, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "355:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 272, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "359:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "355:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 290, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 267, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "348:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 268, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "352:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "348:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "348:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "362:3:2", + "subExpression": { + "argumentTypes": null, + "id": 274, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "362:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 276, + "nodeType": "ExpressionStatement", + "src": "362:3:2" + }, + "nodeType": "ForStatement", + "src": "343:72:2" + } + ] + }, + "documentation": null, + "id": 292, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "initialize", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 248, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 247, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 292, + "src": "167:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 246, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "167:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "166:11:2" + }, + "returnParameters": { + "id": 251, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 250, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 292, + "src": "213:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 249, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "213:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "212:27:2" + }, + "scope": 397, + "src": "147:272:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "external" + }, + { + "body": { + "id": 395, + "nodeType": "Block", + "src": "621:325:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 309, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "631:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 310, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "631:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 312, + "indexExpression": { + "argumentTypes": null, + "id": 311, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "643:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "631:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 314, + "indexExpression": { + "argumentTypes": null, + "id": 313, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "646:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "631:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 315, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "652:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "631:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 352, + "nodeType": "IfStatement", + "src": "627:167:2", + "trueBody": { + "id": 351, + "nodeType": "Block", + "src": "655:139:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 317, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "663:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { "argumentTypes": null, - "id": 75, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 320, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 65, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 24, - "src": "548:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 66, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 27, - "src": "551:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 67, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "554:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 68, - "isConstant": false, - "isInlineArray": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "TupleExpression", - "src": "547:9:0", + "id": 318, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "671:1:2", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 71, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 24, - "src": "571:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 72, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 27, - "src": "574:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 73, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "577:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 69, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "559:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 70, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "step", - "nodeType": "MemberAccess", - "referencedDeclaration": 396, - "src": "559:11:0", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_struct$_MagicSquare_$245_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$bound_to$_t_struct$_MagicSquare_$245_memory_ptr_$", - "typeString": "function (struct SquareLib.MagicSquare memory,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" - } - }, - "id": 74, + "hexValue": "32", + "id": 319, "isConstant": false, "isLValue": false, - "isPure": false, - "kind": "functionCall", + "isPure": true, + "kind": "number", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "559:20:0", + "nodeType": "Literal", + "src": "675:1:2", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" - } + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" }, - "src": "547:32:0", + "src": "671:5:2", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - }, - "id": 76, - "nodeType": "ExpressionStatement", - "src": "547:32:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 61, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 57, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "522:1:0", + } + ], + "id": 321, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "670:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", - "operator": "<=", + "operator": "%", "rightExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 60, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 58, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "527:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "*", - "rightExpression": { + "expression": { "argumentTypes": null, - "id": 59, - "name": "n", + "id": 322, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 12, - "src": "531:1:0", + "referencedDeclaration": 294, + "src": "680:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "527:5:0", + "id": 323, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "680:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "522:10:0", + "src": "670:18:2", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 78, - "initializationExpression": { - "expression": { + "src": "663:25:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 326, + "nodeType": "ExpressionStatement", + "src": "663:25:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 338, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 327, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "696:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "id": 55, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 328, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "704:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 329, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "704:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 330, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "715:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "704:12:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "719:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "704:16:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 334, "isConstant": false, + "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 53, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "515:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "31", - "id": 54, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "519:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "515:5:0", + "nodeType": "TupleExpression", + "src": "703:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 56, - "nodeType": "ExpressionStatement", - "src": "515:5:0" - }, - "loopExpression": { - "expression": { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, - "id": 63, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "534:3:0", - "subExpression": { + "expression": { "argumentTypes": null, - "id": 62, - "name": "i", + "id": 335, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "534:1:0", + "referencedDeclaration": 294, + "src": "724:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, + "id": 336, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "724:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 64, - "nodeType": "ExpressionStatement", - "src": "534:3:0" + "src": "703:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "nodeType": "ForStatement", - "src": "510:76:0" + "src": "696:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { + "id": 339, + "nodeType": "ExpressionStatement", + "src": "696:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 82, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "602:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - ], - "expression": { - "argumentTypes": null, - "id": 79, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 428, - "src": "592:4:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_MagicSquare_$178", - "typeString": "contract MagicSquare" - } - }, - "id": 81, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "save", - "nodeType": "MemberAccess", - "referencedDeclaration": 177, - "src": "592:9:0", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_struct$_MagicSquare_$245_memory_ptr_$returns$__$", - "typeString": "function (struct SquareLib.MagicSquare memory) external" - }, - "name": "save", - "overloadedDeclarations": [] - }, - "id": 83, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "592:17:0", + "id": 340, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "740:5:2", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 84, - "nodeType": "ExpressionStatement", - "src": "592:17:0" - }, - { - "expression": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, - "id": 87, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 343, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "id": 85, - "name": "storedGreeting", + "id": 341, + "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 10, - "src": "615:14:0", + "referencedDeclaration": 300, + "src": "748:1:2", "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { "argumentTypes": null, - "hexValue": "66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521", - "id": 86, + "hexValue": "31", + "id": 342, "isConstant": false, "isLValue": false, "isPure": true, - "kind": "string", + "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "632:48:0", + "src": "752:1:2", "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_stringliteral_661078515cdf36a6c513369103f7a6474ac7bb28ddc3e305eb9bb79e1cb8e423", - "typeString": "literal_string \"finally, a decentralized magic square service!\"" + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" }, - "value": "finally, a decentralized magic square service!" + "value": "1" }, - "src": "615:65:0", + "src": "748:5:2", "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 88, - "nodeType": "ExpressionStatement", - "src": "615:65:0" - } - ] - }, - "documentation": null, - "id": 90, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "generateMagicSquare", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 13, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 12, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 90, - "src": "252:6:0", - "stateVariable": false, - "storageLocation": "default", + "src": "740:13:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 11, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "252:4:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "251:8:0" - }, - "returnParameters": { - "id": 14, - "nodeType": "ParameterList", - "parameters": [], - "src": "273:0:0" - }, - "scope": 178, - "src": "223:462:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 97, - "nodeType": "Block", - "src": "782:30:0", - "statements": [ - { - "assignments": [ - 96 - ], - "declarations": [ + } + }, + "id": 345, + "nodeType": "ExpressionStatement", + "src": "740:13:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ { - "constant": false, - "id": 96, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 168, - "src": "758:9:0", - "stateVariable": false, - "storageLocation": "default", + "argumentTypes": null, + "id": 346, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "769:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 95, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "758:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" + } + }, + { + "argumentTypes": null, + "id": 347, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "775:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 348, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "781:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 96, - "initialValue": null, - "nodeType": "Return", - "src": "788:19:0", + "id": 349, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "768:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 308, + "id": 350, + "nodeType": "Return", + "src": "761:26:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 361, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 95, - "name": "storedSquare", + "id": 353, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "795:12:0", + "referencedDeclaration": 294, + "src": "800:6:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "functionReturnParameters": 94 + "id": 357, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "800:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } }, - { - "assignments": [ - 99 - ], - "declarations": [ - { - "constant": false, - "id": 99, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 168, - "src": "773:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { + "id": 358, + "indexExpression": { + "argumentTypes": null, + "id": 355, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "812:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "800:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 359, + "indexExpression": { + "argumentTypes": null, + "id": 356, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "815:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "800:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 360, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "820:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "800:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 362, + "nodeType": "ExpressionStatement", + "src": "800:21:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 374, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 363, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "827:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 369, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "typeName": { - "id": 98, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "773:7:0", + "id": 367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 364, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "835:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 365, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "835:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "id": 100, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "773:9:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 106, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { "argumentTypes": null, - "id": 101, - "name": "storedSquare", + "id": 366, + "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "789:12:0", + "referencedDeclaration": 296, + "src": "846:1:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 103, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "789:14:0", + "src": "835:12:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 104, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "806:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 105, + "hexValue": "31", + "id": 368, "isConstant": false, - "isLValue": true, - "isPure": false, + "isLValue": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "806:8:0", + "nodeType": "Literal", + "src": "850:1:2", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" }, - "src": "789:25:0", + "src": "835:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "id": 107, - "nodeType": "ExpressionStatement", - "src": "789:25:0" + } + ], + "id": 370, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "834:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 371, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "855:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - { - "expression": { + "id": 372, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "855:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "834:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "827:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 375, + "nodeType": "ExpressionStatement", + "src": "827:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 376, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "869:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 383, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { "argumentTypes": null, - "id": 115, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 379, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 108, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "820:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 111, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "820:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 112, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "820:24:0", + "id": 377, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "877:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 113, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "847:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 114, + "hexValue": "31", + "id": 378, "isConstant": false, - "isLValue": true, - "isPure": false, + "isLValue": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "847:8:0", + "nodeType": "Literal", + "src": "881:1:2", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" }, - "src": "820:35:0", + "src": "877:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "id": 116, - "nodeType": "ExpressionStatement", - "src": "820:35:0" + } + ], + "id": 380, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "876:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 381, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "886:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - { - "body": { - "id": 166, - "nodeType": "Block", - "src": "893:154:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 136, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 128, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "901:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 131, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "901:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 132, - "indexExpression": { - "argumentTypes": null, - "id": 130, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "919:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "901:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 133, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "901:27:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 134, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "931:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 135, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "931:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "901:38:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 137, - "nodeType": "ExpressionStatement", - "src": "901:38:0" - }, - { - "body": { - "id": 164, - "nodeType": "Block", - "src": "979:62:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 162, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 149, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "989:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 153, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "989:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 154, - "indexExpression": { - "argumentTypes": null, - "id": 151, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "1007:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "989:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 155, - "indexExpression": { - "argumentTypes": null, - "id": 152, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "1010:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "989:23:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 156, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "1015:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 157, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 234, - "src": "1015:11:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 159, - "indexExpression": { - "argumentTypes": null, - "id": 158, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "1027:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1015:14:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 161, - "indexExpression": { - "argumentTypes": null, - "id": 160, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "1030:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1015:17:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "989:43:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 163, - "nodeType": "ExpressionStatement", - "src": "989:43:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 145, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 142, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "960:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 143, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "964:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 144, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "964:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "960:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 165, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 140, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 138, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "953:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 139, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "957:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "953:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 141, - "nodeType": "ExpressionStatement", - "src": "953:5:0" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 147, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "974:3:0", - "subExpression": { - "argumentTypes": null, - "id": 146, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "974:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 148, - "nodeType": "ExpressionStatement", - "src": "974:3:0" - }, - "nodeType": "ForStatement", - "src": "948:93:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 382, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "886:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "876:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "869:25:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "869:25:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 388, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 386, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "900:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 387, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "908:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "900:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 389, + "nodeType": "ExpressionStatement", + "src": "900:9:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 390, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "923:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 391, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "929:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 392, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "935:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 393, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "922:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 308, + "id": 394, + "nodeType": "Return", + "src": "915:26:2" + } + ] + }, + "documentation": null, + "id": 396, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "step", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 301, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 294, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "442:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 293, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "442:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 296, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "473:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 295, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "473:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 298, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "488:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 297, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "488:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 300, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "503:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 299, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "503:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "436:80:2" + }, + "returnParameters": { + "id": 308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 303, + "name": "newX", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "559:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 302, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "559:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 305, + "name": "newY", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "579:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 304, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "579:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 307, + "name": "lastI", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "599:13:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 306, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "599:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "551:67:2" + }, + "scope": 397, + "src": "423:523:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 398, + "src": "60:888:2" + } + ], + "src": "0:950:2" + }, + "legacyAST": { + "attributes": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "exportedSymbols": { "SquareLib": [397] } + }, + "children": [ + { + "attributes": { + "literals": ["solidity", ">=", "0.5", ".6"] + }, + "id": 237, + "name": "PragmaDirective", + "src": "0:24:2" + }, + { + "attributes": { + "literals": ["experimental", "ABIEncoderV2"] + }, + "id": 238, + "name": "PragmaDirective", + "src": "25:33:2" + }, + { + "attributes": { + "baseContracts": [null], + "contractDependencies": [null], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "linearizedBaseContracts": [397], + "name": "SquareLib", + "scope": 398 + }, + "children": [ + { + "attributes": { + "canonicalName": "SquareLib.MagicSquare", + "name": "MagicSquare", + "scope": 397, + "visibility": "public" + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "rows", + "scope": 245, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256[][]", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "length": null, + "type": "uint256[][]" + }, + "children": [ + { + "attributes": { + "length": null, + "type": "uint256[]" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" }, - "id": 124, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 121, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "874:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 239, + "name": "ElementaryTypeName", + "src": "107:7:2" + } + ], + "id": 240, + "name": "ArrayTypeName", + "src": "107:9:2" + } + ], + "id": 241, + "name": "ArrayTypeName", + "src": "107:11:2" + } + ], + "id": 242, + "name": "VariableDeclaration", + "src": "107:16:2" + }, + { + "attributes": { + "constant": false, + "name": "n", + "scope": 245, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 243, + "name": "ElementaryTypeName", + "src": "129:7:2" + } + ], + "id": 244, + "name": "VariableDeclaration", + "src": "129:9:2" + } + ], + "id": 245, + "name": "StructDefinition", + "src": "82:61:2" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": [null], + "name": "initialize", + "scope": 397, + "stateMutability": "pure", + "superFunction": null, + "visibility": "external" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "n", + "scope": 292, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 246, + "name": "ElementaryTypeName", + "src": "167:7:2" + } + ], + "id": 247, + "name": "VariableDeclaration", + "src": "167:9:2" + } + ], + "id": 248, + "name": "ParameterList", + "src": "166:11:2" + }, + { + "children": [ + { + "attributes": { + "constant": false, + "name": "square", + "scope": 292, + "stateVariable": false, + "storageLocation": "memory", + "type": "struct SquareLib.MagicSquare", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 249, + "name": "UserDefinedTypeName", + "src": "213:11:2" + } + ], + "id": 250, + "name": "VariableDeclaration", + "src": "213:25:2" + } + ], + "id": 251, + "name": "ParameterList", + "src": "212:27:2" + }, + { + "children": [ + { + "attributes": { + "assignments": [253], + "initialValue": null + }, + "children": [ + { + "attributes": { + "constant": false, + "name": "i", + "scope": 291, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { + "id": 252, + "name": "ElementaryTypeName", + "src": "248:7:2" + } + ], + "id": 253, + "name": "VariableDeclaration", + "src": "248:9:2" + } + ], + "id": 254, + "name": "VariableDeclarationStatement", + "src": "248:9:2" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "struct SquareLib.MagicSquare memory" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 122, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 92, - "src": "878:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 123, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 236, - "src": "878:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "overloadedDeclarations": [null], + "referencedDeclaration": 250, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" }, - "src": "874:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } + "id": 255, + "name": "Identifier", + "src": "264:6:2" }, - "id": 167, - "initializationExpression": { - "expression": { + { + "attributes": { "argumentTypes": null, - "id": 119, "isConstant": false, "isLValue": false, "isPure": false, + "isStructConstructorCall": true, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 117, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "867:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "names": ["rows", "n"], + "type": "struct SquareLib.MagicSquare memory", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 245, + "type": "type(struct SquareLib.MagicSquare storage pointer)", + "value": "MagicSquare" + }, + "id": 256, + "name": "Identifier", + "src": "273:11:2" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 118, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "871:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [null], + "type": "uint256[] memory[] memory", + "type_conversion": false }, - "value": "0" + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "type": "function (uint256) pure returns (uint256[] memory[] memory)" + }, + "children": [ + { + "attributes": { + "length": null, + "type": "uint256[][]" + }, + "children": [ + { + "attributes": { + "length": null, + "type": "uint256[]" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 257, + "name": "ElementaryTypeName", + "src": "303:7:2" + } + ], + "id": 258, + "name": "ArrayTypeName", + "src": "303:9:2" + } + ], + "id": 259, + "name": "ArrayTypeName", + "src": "303:11:2" + } + ], + "id": 260, + "name": "NewExpression", + "src": "299:15:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 247, + "type": "uint256", + "value": "n" + }, + "id": 261, + "name": "Identifier", + "src": "315:1:2" + } + ], + "id": 262, + "name": "FunctionCall", + "src": "299:18:2" }, - "src": "867:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 247, + "type": "uint256", + "value": "n" + }, + "id": 263, + "name": "Identifier", + "src": "328:1:2" } - }, - "id": 120, - "nodeType": "ExpressionStatement", - "src": "867:5:0" - }, - "loopExpression": { - "expression": { + ], + "id": 264, + "name": "FunctionCall", + "src": "273:63:2" + } + ], + "id": 265, + "name": "Assignment", + "src": "264:72:2" + } + ], + "id": 266, + "name": "ExpressionStatement", + "src": "264:72:2" + }, + { + "children": [ + { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 126, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "888:3:0", - "subExpression": { - "argumentTypes": null, - "id": 125, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 96, - "src": "888:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "operator": "=", + "type": "uint256" }, - "id": 127, - "nodeType": "ExpressionStatement", - "src": "888:3:0" - }, - "nodeType": "ForStatement", - "src": "862:185:0" - } - ] - }, - "documentation": null, - "id": 98, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "getSquare", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 91, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 92, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 169, - "src": "702:35:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 91, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 237, - "src": "702:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$237_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "707:2:0" - }, - "returnParameters": { - "id": 94, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 93, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 98, - "src": "743:35:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 92, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "743:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "742:37:0" - }, - "scope": 178, - "src": "689:123:0", - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 176, - "nodeType": "Block", - "src": "880:299:0", - "statements": [ - { - "assignments": [ - 104 - ], - "declarations": [ - { - "constant": false, - "id": 104, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 176, - "src": "886:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 103, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "886:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 105, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "886:9:0" - }, - { - "assignments": [ - 107 - ], - "declarations": [ - { - "constant": false, - "id": 107, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 176, - "src": "901:9:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 106, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "901:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 108, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "901:9:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 109, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "917:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 253, + "type": "uint256", + "value": "i" + }, + "id": 267, + "name": "Identifier", + "src": "348:1:2" }, - "id": 111, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "917:14:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "attributes": { + "argumentTypes": null, + "hexvalue": "30", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 0", + "value": "0" + }, + "id": 268, + "name": "Literal", + "src": "352:1:2" } + ], + "id": 269, + "name": "Assignment", + "src": "348:5:2" + } + ], + "id": 270, + "name": "ExpressionStatement", + "src": "348:5:2" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "<", + "type": "bool" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 253, + "type": "uint256", + "value": "i" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 271, + "name": "Identifier", + "src": "355:1:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 247, + "type": "uint256", + "value": "n" + }, + "id": 272, + "name": "Identifier", + "src": "359:1:2" + } + ], + "id": 273, + "name": "BinaryOperation", + "src": "355:5:2" + }, + { + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 112, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "934:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 113, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "934:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "operator": "++", + "prefix": false, + "type": "uint256" }, - "src": "917:25:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 115, - "nodeType": "ExpressionStatement", - "src": "917:25:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 123, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "expression": { + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 116, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "948:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 253, + "type": "uint256", + "value": "i" }, - "id": 119, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "948:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 120, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "948:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 274, + "name": "Identifier", + "src": "362:1:2" } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 121, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "975:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 122, + ], + "id": 275, + "name": "UnaryOperation", + "src": "362:3:2" + } + ], + "id": 276, + "name": "ExpressionStatement", + "src": "362:3:2" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "type": "uint256[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "rows", + "referencedDeclaration": 242, + "type": "uint256[] memory[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 250, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 277, + "name": "Identifier", + "src": "375:6:2" + } + ], + "id": 280, + "name": "MemberAccess", + "src": "375:11:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 253, + "type": "uint256", + "value": "i" + }, + "id": 279, + "name": "Identifier", + "src": "387:1:2" + } + ], + "id": 281, + "name": "IndexAccess", + "src": "375:14:2" + }, + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "isStructConstructorCall": false, + "lValueRequested": false, + "names": [null], + "type": "uint256[] memory", + "type_conversion": false + }, + "children": [ + { + "attributes": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "type": "function (uint256) pure returns (uint256[] memory)" + }, + "children": [ + { + "attributes": { + "length": null, + "type": "uint256[]" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 282, + "name": "ElementaryTypeName", + "src": "396:7:2" + } + ], + "id": 283, + "name": "ArrayTypeName", + "src": "396:9:2" + } + ], + "id": 284, + "name": "NewExpression", + "src": "392:13:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 247, + "type": "uint256", + "value": "n" + }, + "id": 285, + "name": "Identifier", + "src": "406:1:2" + } + ], + "id": 286, + "name": "FunctionCall", + "src": "392:16:2" + } + ], + "id": 287, + "name": "Assignment", + "src": "375:33:2" + } + ], + "id": 288, + "name": "ExpressionStatement", + "src": "375:33:2" + } + ], + "id": 289, + "name": "Block", + "src": "367:48:2" + } + ], + "id": 290, + "name": "ForStatement", + "src": "343:72:2" + } + ], + "id": 291, + "name": "Block", + "src": "242:177:2" + } + ], + "id": 292, + "name": "FunctionDefinition", + "src": "147:272:2" + }, + { + "attributes": { + "documentation": null, + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": [null], + "name": "step", + "scope": 397, + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + "children": [ + { + "children": [ + { + "attributes": { + "constant": false, + "name": "square", + "scope": 396, + "stateVariable": false, + "storageLocation": "memory", + "type": "struct SquareLib.MagicSquare", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "contractScope": null, + "name": "MagicSquare", + "referencedDeclaration": 245, + "type": "struct SquareLib.MagicSquare" + }, + "id": 293, + "name": "UserDefinedTypeName", + "src": "442:11:2" + } + ], + "id": 294, + "name": "VariableDeclaration", + "src": "442:25:2" + }, + { + "attributes": { + "constant": false, + "name": "x", + "scope": 396, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 295, + "name": "ElementaryTypeName", + "src": "473:7:2" + } + ], + "id": 296, + "name": "VariableDeclaration", + "src": "473:9:2" + }, + { + "attributes": { + "constant": false, + "name": "y", + "scope": 396, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 297, + "name": "ElementaryTypeName", + "src": "488:7:2" + } + ], + "id": 298, + "name": "VariableDeclaration", + "src": "488:9:2" + }, + { + "attributes": { + "constant": false, + "name": "i", + "scope": 396, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 299, + "name": "ElementaryTypeName", + "src": "503:7:2" + } + ], + "id": 300, + "name": "VariableDeclaration", + "src": "503:9:2" + } + ], + "id": 301, + "name": "ParameterList", + "src": "436:80:2" + }, + { + "children": [ + { + "attributes": { + "constant": false, + "name": "newX", + "scope": 396, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 302, + "name": "ElementaryTypeName", + "src": "559:7:2" + } + ], + "id": 303, + "name": "VariableDeclaration", + "src": "559:12:2" + }, + { + "attributes": { + "constant": false, + "name": "newY", + "scope": 396, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 304, + "name": "ElementaryTypeName", + "src": "579:7:2" + } + ], + "id": 305, + "name": "VariableDeclaration", + "src": "579:12:2" + }, + { + "attributes": { + "constant": false, + "name": "lastI", + "scope": 396, + "stateVariable": false, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "internal" + }, + "children": [ + { + "attributes": { + "name": "uint256", + "type": "uint256" + }, + "id": 306, + "name": "ElementaryTypeName", + "src": "599:7:2" + } + ], + "id": 307, + "name": "VariableDeclaration", + "src": "599:13:2" + } + ], + "id": 308, + "name": "ParameterList", + "src": "551:67:2" + }, + { + "children": [ + { + "attributes": { "falseBody": null }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "!=", + "type": "bool" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "975:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "type": "uint256" }, - "src": "948:35:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 124, - "nodeType": "ExpressionStatement", - "src": "948:35:0" - }, - { - "body": { - "id": 174, - "nodeType": "Block", - "src": "1021:154:0", - "statements": [ + "children": [ { - "expression": { + "attributes": { "argumentTypes": null, - "id": 144, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { + "type": "uint256[] memory" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 136, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "1029:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } - }, - "id": 139, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "1029:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } - }, - "id": 140, - "indexExpression": { - "argumentTypes": null, - "id": 138, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1047:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1029:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } + "member_name": "rows", + "referencedDeclaration": 242, + "type": "uint256[] memory[] memory" }, - "id": 141, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1029:27:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 309, + "name": "Identifier", + "src": "631:6:2" + } + ], + "id": 310, + "name": "MemberAccess", + "src": "631:11:2" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { + { + "attributes": { "argumentTypes": null, - "id": 142, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1059:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 296, + "type": "uint256", + "value": "x" }, - "id": 143, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "1059:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1029:38:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 311, + "name": "Identifier", + "src": "643:1:2" } - }, - "id": 145, - "nodeType": "ExpressionStatement", - "src": "1029:38:0" + ], + "id": 312, + "name": "IndexAccess", + "src": "631:14:2" }, { - "body": { - "id": 172, - "nodeType": "Block", - "src": "1107:62:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 170, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 298, + "type": "uint256", + "value": "y" + }, + "id": 313, + "name": "Identifier", + "src": "646:1:2" + } + ], + "id": 314, + "name": "IndexAccess", + "src": "631:17:2" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "30", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 0", + "value": "0" + }, + "id": 315, + "name": "Literal", + "src": "652:1:2" + } + ], + "id": 316, + "name": "BinaryOperation", + "src": "631:22:2" + }, + { + "children": [ + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 303, + "type": "uint256", + "value": "newX" + }, + "id": 317, + "name": "Identifier", + "src": "663:4:2" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "%", + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 157, - "name": "storedSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 8, - "src": "1117:12:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage", - "typeString": "struct SquareLib.MagicSquare storage ref" - } + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "id": 161, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "1117:17:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", - "typeString": "uint256[] storage ref[] storage ref" - } + "operator": "+", + "type": "uint256" }, - "id": 162, - "indexExpression": { - "argumentTypes": null, - "id": 159, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1135:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 296, + "type": "uint256", + "value": "x" + }, + "id": 318, + "name": "Identifier", + "src": "671:1:2" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "32", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 2", + "value": "2" + }, + "id": 319, + "name": "Literal", + "src": "675:1:2" } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1117:20:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 163, - "indexExpression": { - "argumentTypes": null, - "id": 160, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1138:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, + ], + "id": 320, + "name": "BinaryOperation", + "src": "671:5:2" + } + ], + "id": 321, + "name": "TupleExpression", + "src": "670:7:2" + }, + { + "attributes": { + "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1117:23:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 322, + "name": "Identifier", + "src": "680:6:2" + } + ], + "id": 323, + "name": "MemberAccess", + "src": "680:8:2" + } + ], + "id": 324, + "name": "BinaryOperation", + "src": "670:18:2" + } + ], + "id": 325, + "name": "Assignment", + "src": "663:25:2" + } + ], + "id": 326, + "name": "ExpressionStatement", + "src": "663:25:2" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 305, + "type": "uint256", + "value": "newY" + }, + "id": 327, + "name": "Identifier", + "src": "696:4:2" + }, + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "%", + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 164, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1143:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "id": 165, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "1143:11:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 167, - "indexExpression": { - "argumentTypes": null, - "id": 166, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1155:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "operator": "-", + "type": "uint256" }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1143:14:0", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 169, - "indexExpression": { - "argumentTypes": null, - "id": 168, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1158:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "+", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 328, + "name": "Identifier", + "src": "704:6:2" + } + ], + "id": 329, + "name": "MemberAccess", + "src": "704:8:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 298, + "type": "uint256", + "value": "y" + }, + "id": 330, + "name": "Identifier", + "src": "715:1:2" + } + ], + "id": 331, + "name": "BinaryOperation", + "src": "704:12:2" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "31", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 1", + "value": "1" + }, + "id": 332, + "name": "Literal", + "src": "719:1:2" + } + ], + "id": 333, + "name": "BinaryOperation", + "src": "704:16:2" + } + ], + "id": 334, + "name": "TupleExpression", + "src": "703:18:2" + }, + { + "attributes": { + "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1143:17:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" }, - "src": "1117:43:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 171, - "nodeType": "ExpressionStatement", - "src": "1117:43:0" - } - ] - }, - "condition": { + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 335, + "name": "Identifier", + "src": "724:6:2" + } + ], + "id": 336, + "name": "MemberAccess", + "src": "724:8:2" + } + ], + "id": 337, + "name": "BinaryOperation", + "src": "703:29:2" + } + ], + "id": 338, + "name": "Assignment", + "src": "696:36:2" + } + ], + "id": 339, + "name": "ExpressionStatement", + "src": "696:36:2" + }, + { + "children": [ + { + "attributes": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 153, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 150, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1088:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "id": 151, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1092:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 307, + "type": "uint256", + "value": "lastI" }, - "id": 152, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "1092:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 340, + "name": "Identifier", + "src": "740:5:2" }, - "src": "1088:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 173, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 148, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + { + "attributes": { "argumentTypes": null, - "id": 146, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1081:1:0", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 147, + }, "isConstant": false, "isLValue": false, - "isPure": true, - "kind": "number", + "isPure": false, "lValueRequested": false, - "nodeType": "Literal", - "src": "1085:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + "operator": "-", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 300, + "type": "uint256", + "value": "i" + }, + "id": 341, + "name": "Identifier", + "src": "748:1:2" }, - "value": "0" + { + "attributes": { + "argumentTypes": null, + "hexvalue": "31", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 1", + "value": "1" + }, + "id": 342, + "name": "Literal", + "src": "752:1:2" + } + ], + "id": 343, + "name": "BinaryOperation", + "src": "748:5:2" + } + ], + "id": 344, + "name": "Assignment", + "src": "740:13:2" + } + ], + "id": 345, + "name": "ExpressionStatement", + "src": "740:13:2" + }, + { + "attributes": { + "functionReturnParameters": 308 + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "type": "tuple(uint256,uint256,uint256)" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 303, + "type": "uint256", + "value": "newX" }, - "src": "1081:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 346, + "name": "Identifier", + "src": "769:4:2" }, - "id": 149, - "nodeType": "ExpressionStatement", - "src": "1081:5:0" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 155, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "1102:3:0", - "subExpression": { + { + "attributes": { "argumentTypes": null, - "id": 154, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 107, - "src": "1102:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 305, + "type": "uint256", + "value": "newY" }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 347, + "name": "Identifier", + "src": "775:4:2" }, - "id": 156, - "nodeType": "ExpressionStatement", - "src": "1102:3:0" - }, - "nodeType": "ForStatement", - "src": "1076:93:0" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 132, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 129, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1002:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 307, + "type": "uint256", + "value": "lastI" + }, + "id": 348, + "name": "Identifier", + "src": "781:5:2" + } + ], + "id": 349, + "name": "TupleExpression", + "src": "768:19:2" } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { + ], + "id": 350, + "name": "Return", + "src": "761:26:2" + } + ], + "id": 351, + "name": "Block", + "src": "655:139:2" + } + ], + "id": 352, + "name": "IfStatement", + "src": "627:167:2" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 130, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 100, - "src": "1006:6:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 131, "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "1006:8:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "lValueRequested": true, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "type": "uint256[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "rows", + "referencedDeclaration": 242, + "type": "uint256[] memory[] memory" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 353, + "name": "Identifier", + "src": "800:6:2" + } + ], + "id": 357, + "name": "MemberAccess", + "src": "800:11:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 296, + "type": "uint256", + "value": "x" + }, + "id": 355, + "name": "Identifier", + "src": "812:1:2" + } + ], + "id": 358, + "name": "IndexAccess", + "src": "800:14:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 298, + "type": "uint256", + "value": "y" + }, + "id": 356, + "name": "Identifier", + "src": "815:1:2" } + ], + "id": 359, + "name": "IndexAccess", + "src": "800:17:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 300, + "type": "uint256", + "value": "i" }, - "src": "1002:12:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } + "id": 360, + "name": "Identifier", + "src": "820:1:2" + } + ], + "id": 361, + "name": "Assignment", + "src": "800:21:2" + } + ], + "id": 362, + "name": "ExpressionStatement", + "src": "800:21:2" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 303, + "type": "uint256", + "value": "newX" + }, + "id": 363, + "name": "Identifier", + "src": "827:4:2" }, - "id": 175, - "initializationExpression": { - "expression": { + { + "attributes": { "argumentTypes": null, - "id": 127, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 125, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "995:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 126, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "999:1:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + "operator": "%", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "type": "uint256" }, - "value": "0" + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "-", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "+", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 364, + "name": "Identifier", + "src": "835:6:2" + } + ], + "id": 365, + "name": "MemberAccess", + "src": "835:8:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 296, + "type": "uint256", + "value": "x" + }, + "id": 366, + "name": "Identifier", + "src": "846:1:2" + } + ], + "id": 367, + "name": "BinaryOperation", + "src": "835:12:2" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "31", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 1", + "value": "1" + }, + "id": 368, + "name": "Literal", + "src": "850:1:2" + } + ], + "id": 369, + "name": "BinaryOperation", + "src": "835:16:2" + } + ], + "id": 370, + "name": "TupleExpression", + "src": "834:18:2" }, - "src": "995:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 371, + "name": "Identifier", + "src": "855:6:2" + } + ], + "id": 372, + "name": "MemberAccess", + "src": "855:8:2" } + ], + "id": 373, + "name": "BinaryOperation", + "src": "834:29:2" + } + ], + "id": 374, + "name": "Assignment", + "src": "827:36:2" + } + ], + "id": 375, + "name": "ExpressionStatement", + "src": "827:36:2" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 305, + "type": "uint256", + "value": "newY" }, - "id": 128, - "nodeType": "ExpressionStatement", - "src": "995:5:0" + "id": 376, + "name": "Identifier", + "src": "869:4:2" }, - "loopExpression": { - "expression": { + { + "attributes": { "argumentTypes": null, - "id": 134, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "1016:3:0", - "subExpression": { - "argumentTypes": null, - "id": 133, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 104, - "src": "1016:1:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "operator": "%", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "+", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 298, + "type": "uint256", + "value": "y" + }, + "id": 377, + "name": "Identifier", + "src": "877:1:2" + }, + { + "attributes": { + "argumentTypes": null, + "hexvalue": "31", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "subdenomination": null, + "token": "number", + "type": "int_const 1", + "value": "1" + }, + "id": 378, + "name": "Literal", + "src": "881:1:2" + } + ], + "id": 379, + "name": "BinaryOperation", + "src": "877:5:2" + } + ], + "id": 380, + "name": "TupleExpression", + "src": "876:7:2" }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "member_name": "n", + "referencedDeclaration": 244, + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [ + null + ], + "referencedDeclaration": 294, + "type": "struct SquareLib.MagicSquare memory", + "value": "square" + }, + "id": 381, + "name": "Identifier", + "src": "886:6:2" + } + ], + "id": 382, + "name": "MemberAccess", + "src": "886:8:2" } + ], + "id": 383, + "name": "BinaryOperation", + "src": "876:18:2" + } + ], + "id": 384, + "name": "Assignment", + "src": "869:25:2" + } + ], + "id": 385, + "name": "ExpressionStatement", + "src": "869:25:2" + }, + { + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "operator": "=", + "type": "uint256" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 307, + "type": "uint256", + "value": "lastI" }, - "id": 135, - "nodeType": "ExpressionStatement", - "src": "1016:3:0" - }, - "nodeType": "ForStatement", - "src": "990:185:0" - } - ] - }, - "documentation": null, - "id": 177, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "save", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 101, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 100, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 177, - "src": "830:35:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" + "id": 386, + "name": "Identifier", + "src": "900:5:2" }, - "typeName": { - "contractScope": null, - "id": 99, - "name": "SquareLib.MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "830:21:0", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 300, + "type": "uint256", + "value": "i" + }, + "id": 387, + "name": "Identifier", + "src": "908:1:2" + } + ], + "id": 388, + "name": "Assignment", + "src": "900:9:2" + } + ], + "id": 389, + "name": "ExpressionStatement", + "src": "900:9:2" + }, + { + "attributes": { + "functionReturnParameters": 308 + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "type": "tuple(uint256,uint256,uint256)" + }, + "children": [ + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 303, + "type": "uint256", + "value": "newX" + }, + "id": 390, + "name": "Identifier", + "src": "923:4:2" }, - "value": null, - "visibility": "internal" - } - ], - "src": "829:37:0" - }, - "returnParameters": { - "id": 102, - "nodeType": "ParameterList", - "parameters": [], - "src": "880:0:0" - }, - "scope": 178, - "src": "816:363:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 305, + "type": "uint256", + "value": "newY" + }, + "id": 391, + "name": "Identifier", + "src": "929:4:2" + }, + { + "attributes": { + "argumentTypes": null, + "overloadedDeclarations": [null], + "referencedDeclaration": 307, + "type": "uint256", + "value": "lastI" + }, + "id": 392, + "name": "Identifier", + "src": "935:5:2" + } + ], + "id": 393, + "name": "TupleExpression", + "src": "922:19:2" + } + ], + "id": 394, + "name": "Return", + "src": "915:26:2" } ], - "scope": 179, - "src": "88:1093:0" + "id": 395, + "name": "Block", + "src": "621:325:2" } ], - "src": "0:1182:0" - }, - "compiler": { - "name": "solc", - "version": "0.5.8+commit.23d335f2.Emscripten.clang" - }, - "networks": {}, - "schemaVersion": "3.0.9", - "updatedAt": "2019-05-16T17:59:03.210Z", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} + "id": 396, + "name": "FunctionDefinition", + "src": "423:523:2" } + ], + "id": 397, + "name": "ContractDefinition", + "src": "60:888:2" + } + ], + "id": 398, + "name": "SourceUnit", + "src": "0:950:2" + }, + "bytecode": { + "bytes": "6103c5610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063fe4b84df1461003a575b600080fd5b610054600480360361004f9190810190610159565b61006a565b60405161006191906102cd565b60405180910390f35b61007261012a565b60006040518060400160405280846040519080825280602002602001820160405280156100b357816020015b606081526020019060019003908161009e5790505b508152602001848152509150600090505b8281101561012457826040519080825280602002602001820160405280156100fb5781602001602082028038833980820191505090505b508260000151828151811061010c57fe5b602002602001018190525080806001019150506100c4565b50919050565b604051806040016040528060608152602001600081525090565b6000813590506101538161036b565b92915050565b60006020828403121561016b57600080fd5b600061017984828501610144565b91505092915050565b600061018e8383610223565b905092915050565b60006101a283836102be565b60208301905092915050565b60006101b98261030f565b6101c3818561033f565b9350836020820285016101d5856102ef565b8060005b8581101561021157848403895281516101f28582610182565b94506101fd83610325565b925060208a019950506001810190506101d9565b50829750879550505050505092915050565b600061022e8261031a565b6102388185610350565b9350610243836102ff565b8060005b8381101561027457815161025b8882610196565b975061026683610332565b925050600181019050610247565b5085935050505092915050565b6000604083016000830151848203600086015261029e82826101ae565b91505060208301516102b360208601826102be565b508091505092915050565b6102c781610361565b82525050565b600060208201905081810360008301526102e78184610281565b905092915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b61037481610361565b811461037f57600080fd5b5056fea365627a7a723158203d7155f9eadd0f64d2b5b67e3598434ce651ba828359de802d46107902d88d036c6578706572696d656e74616cf564736f6c63430005100040", + "linkReferences": [] + }, + "deployedBytecode": { + "bytes": "73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063fe4b84df1461003a575b600080fd5b610054600480360361004f9190810190610159565b61006a565b60405161006191906102cd565b60405180910390f35b61007261012a565b60006040518060400160405280846040519080825280602002602001820160405280156100b357816020015b606081526020019060019003908161009e5790505b508152602001848152509150600090505b8281101561012457826040519080825280602002602001820160405280156100fb5781602001602082028038833980820191505090505b508260000151828151811061010c57fe5b602002602001018190525080806001019150506100c4565b50919050565b604051806040016040528060608152602001600081525090565b6000813590506101538161036b565b92915050565b60006020828403121561016b57600080fd5b600061017984828501610144565b91505092915050565b600061018e8383610223565b905092915050565b60006101a283836102be565b60208301905092915050565b60006101b98261030f565b6101c3818561033f565b9350836020820285016101d5856102ef565b8060005b8581101561021157848403895281516101f28582610182565b94506101fd83610325565b925060208a019950506001810190506101d9565b50829750879550505050505092915050565b600061022e8261031a565b6102388185610350565b9350610243836102ff565b8060005b8381101561027457815161025b8882610196565b975061026683610332565b925050600181019050610247565b5085935050505092915050565b6000604083016000830151848203600086015261029e82826101ae565b91505060208301516102b360208601826102be565b508091505092915050565b6102c781610361565b82525050565b600060208201905081810360008301526102e78184610281565b905092915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b61037481610361565b811461037f57600080fd5b5056fea365627a7a723158203d7155f9eadd0f64d2b5b67e3598434ce651ba828359de802d46107902d88d036c6578706572696d656e74616cf564736f6c63430005100040", + "linkReferences": [] + }, + "compiler": { + "name": "solc", + "version": "0.5.16+commit.9c3226ce.Emscripten.clang" + } + }, + { + "contractName": "VyperStorage", + "abi": [ + { + "name": "set", + "outputs": [], + "inputs": [ + { + "type": "uint256", + "name": "new_value" + } + ], + "constant": false, + "payable": false, + "type": "function", + "gas": 35295 + }, + { + "name": "get", + "outputs": [ + { + "type": "uint256", + "name": "out" + } + ], + "inputs": [], + "constant": true, + "payable": false, + "type": "function", + "gas": 513 + } + ], + "bytecode": { + "bytes": "6100ed56600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526360fe47b160005114156100bd57602060046101403734156100b457600080fd5b61014051600055005b636d4ce63c60005114156100e35734156100d657600080fd5b60005460005260206000f3005b60006000fd5b6100046100ed036100046000396100046100ed036000f3", + "linkReferences": [] + }, + "deployedBytecode": { + "bytes": "600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526360fe47b160005114156100bd57602060046101403734156100b457600080fd5b61014051600055005b636d4ce63c60005114156100e35734156100d657600080fd5b60005460005260206000f3005b60006000fd", + "linkReferences": [] + }, + "source": "stored_data: uint256\n\n@public\ndef set(new_value : uint256):\n self.stored_data = new_value\n\n@public\n@constant\ndef get() -> uint256:\n return self.stored_data\n", + "sourcePath": "/Users/fainashalts/truffle-six/testing2/contracts/VyperStorage.vy", + "compiler": { + "name": "vyper", + "version": "0.1.0b10" + }, + "networks": {}, + "schemaVersion": "3.0.9", + "updatedAt": "2019-05-26T21:52:51.166Z" + } + ], + "compilations": [ + { + "sourceIndexes": [ + "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol" + ], + "contracts": [ + { + "contractName": "MagicSquare", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "n", + "type": "uint256" + } + ], + "name": "generateMagicSquare", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" }, { - "contractName": "Migrations", - "abi": [ + "constant": true, + "inputs": [ { - "constant": true, - "inputs": [], - "name": "last_completed_migration", - "outputs": [ + "components": [ + { + "name": "rows", + "type": "uint256[][]" + }, { - "name": "", + "name": "n", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, + "name": "square", + "type": "tuple" + } + ], + "name": "getSquare", + "outputs": [ { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ + "components": [ { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": false, - "inputs": [ + "name": "rows", + "type": "uint256[][]" + }, { - "name": "completed", + "name": "n", "type": "uint256" } ], - "name": "setCompleted", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, + "name": "square", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ { - "constant": false, - "inputs": [ + "components": [ { - "name": "new_address", - "type": "address" + "name": "rows", + "type": "uint256[][]" + }, + { + "name": "n", + "type": "uint256" } ], - "name": "upgrade", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" + "name": "square", + "type": "tuple" } ], - "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol\":{\"keccak256\":\"0xc167df84a157f070489992ba46387a783249b5c46b23194e98c379bb13d57d12\",\"urls\":[\"bzzr://a7802f03646845d1c1e27fd82bd8384bd330f025645b72a06eab3178c40297cc\"]}},\"version\":1}", - "bytecode": { - "bytes": "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820fd10a0b0c646daa7f5ee5eac53b76f2ba70ca857df1ac9142366169abaa138490029", - "linkReferences":[] + "name": "save", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"name\":\"save\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSquare\",\"outputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"generateMagicSquare\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol\":\"MagicSquare\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol\":{\"keccak256\":\"0xa54bcd478244f9ed78d698db9e513ef0ef4aeb77874f264e1956770898f00943\",\"urls\":[\"bzzr://49e6ec033a29d3530da13ec679f8854ff9efcb4543f72fa32e93cd176b44a231\"]},\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":{\"keccak256\":\"0xfdd57b714a8ab00ba37fb6875091322e9b014a4ee1df170527a75d3ee8d54add\",\"urls\":[\"bzzr://b62f57a3f7326bfc9025f266d1f9d4e52947adc0e25927b6ea790b5dbae75713\"]}},\"version\":1}", + "bytecode": { + "bytes": "608060405234801561001057600080fd5b50610cf4806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80638b213ffc146100465780638dbbe62514610062578063f117a19314610080575b600080fd5b610060600480360361005b9190810190610940565b61009c565b005b61006a61018a565b6040516100779190610b45565b60405180910390f35b61009a600480360361009591908101906109c2565b61024d565b005b6000808260200151600060010181905550826020015160008001816100c191906104fc565b50600091505b82602001518210156101855782602001516000800183815481106100e757fe5b90600052602060002001816100fc9190610528565b50600090505b8260200151811015610178578260000151828151811061011e57fe5b6020026020010151818151811061013157fe5b602002602001015160008001838154811061014857fe5b90600052602060002001828154811061015d57fe5b90600052602060002001819055508080600101915050610102565b81806001019250506100c7565b505050565b610192610554565b600060405180604001604052908160008201805480602002602001604051908101604052809291908181526020016000905b828210156102365783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561022257602002820191906000526020600020905b81548152602001906001019080831161020e575b5050505050815260200190600101906101c4565b505050508152602001600182015481525050905090565b6060610257610554565b60008060006040518060400160405280602081526020017f6c657420757320636f6e7374727563742061206d61676963207371756172653a815250945073000000000000000000000000000000000000000063fe4b84df876040518263ffffffff1660e01b81526004016102cb9190610b67565b60006040518083038186803b1580156102e357600080fd5b505af41580156102f7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506103209190810190610981565b9350600092506002868161033057fe5b049150600190505b85860281116103715761035883838387610413909392919063ffffffff16565b8093508194508295505050508080600101915050610338565b3073ffffffffffffffffffffffffffffffffffffffff16638b213ffc856040518263ffffffff1660e01b81526004016103aa9190610b45565b600060405180830381600087803b1580156103c457600080fd5b505af11580156103d8573d6000803e3d6000fd5b505050506040518060600160405280602e8152602001610c8d602e91396002908051906020019061040a92919061056e565b50505050505050565b6000806000808760000151878151811061042957fe5b6020026020010151868151811061043c57fe5b602002602001015114610489578660200151600287018161045957fe5b0692508660200151600186896020015101038161047257fe5b0691506001840390508282829250925092506104f2565b838760000151878151811061049a57fe5b602002602001015186815181106104ad57fe5b602002602001018181525050866020015160018789602001510103816104cf57fe5b069250866020015160018601816104e257fe5b0691508390508282829250925092505b9450945094915050565b8154818355818111156105235781836000526020600020918201910161052291906105ee565b5b505050565b81548183558181111561054f5781836000526020600020918201910161054e919061061a565b5b505050565b604051806040016040528060608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105af57805160ff19168380011785556105dd565b828001600101855582156105dd579182015b828111156105dc5782518255916020019190600101906105c1565b5b5090506105ea919061061a565b5090565b61061791905b80821115610613576000818161060a919061063f565b506001016105f4565b5090565b90565b61063c91905b80821115610638576000816000905550600101610620565b5090565b90565b508054600082559060005260206000209081019061065d919061061a565b50565b600082601f83011261067157600080fd5b813561068461067f82610baf565b610b82565b9150818183526020840193506020810190508360005b838110156106ca57813586016106b08882610748565b84526020840193506020830192505060018101905061069a565b5050505092915050565b600082601f8301126106e557600080fd5b81516106f86106f382610baf565b610b82565b9150818183526020840193506020810190508360005b8381101561073e578151860161072488826107cb565b84526020840193506020830192505060018101905061070e565b5050505092915050565b600082601f83011261075957600080fd5b813561076c61076782610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561079157600080fd5b60005b838110156107c157816107a78882610916565b845260208401935060208301925050600181019050610794565b5050505092915050565b600082601f8301126107dc57600080fd5b81516107ef6107ea82610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561081457600080fd5b60005b83811015610844578161082a888261092b565b845260208401935060208301925050600181019050610817565b5050505092915050565b60006040828403121561086057600080fd5b61086a6040610b82565b9050600082013567ffffffffffffffff81111561088657600080fd5b61089284828501610660565b60008301525060206108a684828501610916565b60208301525092915050565b6000604082840312156108c457600080fd5b6108ce6040610b82565b9050600082015167ffffffffffffffff8111156108ea57600080fd5b6108f6848285016106d4565b600083015250602061090a8482850161092b565b60208301525092915050565b60008135905061092581610c75565b92915050565b60008151905061093a81610c75565b92915050565b60006020828403121561095257600080fd5b600082013567ffffffffffffffff81111561096c57600080fd5b6109788482850161084e565b91505092915050565b60006020828403121561099357600080fd5b600082015167ffffffffffffffff8111156109ad57600080fd5b6109b9848285016108b2565b91505092915050565b6000602082840312156109d457600080fd5b60006109e284828501610916565b91505092915050565b60006109f78383610a8c565b905092915050565b6000610a0b8383610b27565b60208301905092915050565b6000610a2282610c19565b610a2c8185610c49565b935083602082028501610a3e85610bff565b8060005b85811015610a7a5784840389528151610a5b85826109eb565b9450610a6683610c2f565b925060208a01995050600181019050610a42565b50829750879550505050505092915050565b6000610a9782610c24565b610aa18185610c5a565b9350610aac83610c0c565b8060005b83811015610add578151610ac488826109ff565b9750610acf83610c3c565b925050600181019050610ab0565b5085935050505092915050565b60006040830160008301518482036000860152610b078282610a17565b9150506020830151610b1c6020860182610b27565b508091505092915050565b610b3081610c6b565b82525050565b610b3f81610c6b565b82525050565b60006020820190508181036000830152610b5f8184610aea565b905092915050565b6000602082019050610b7c6000830184610b36565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610ba557600080fd5b8060405250919050565b600067ffffffffffffffff821115610bc657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610bee57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b610c7e81610c6b565b8114610c8957600080fd5b5056fe66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521a265627a7a723058200f0c3e8fe5a3a1acd916506bf818127749632aa46170ba992760d7e667cbd4c76c6578706572696d656e74616cf50037", + "linkReferences": [{ "offsets": [694], "name": "SquareLib", "length": 20 }] + }, + "deployedBytecode": { + "bytes": "608060405234801561001057600080fd5b50600436106100415760003560e01c80638b213ffc146100465780638dbbe62514610062578063f117a19314610080575b600080fd5b610060600480360361005b9190810190610940565b61009c565b005b61006a61018a565b6040516100779190610b45565b60405180910390f35b61009a600480360361009591908101906109c2565b61024d565b005b6000808260200151600060010181905550826020015160008001816100c191906104fc565b50600091505b82602001518210156101855782602001516000800183815481106100e757fe5b90600052602060002001816100fc9190610528565b50600090505b8260200151811015610178578260000151828151811061011e57fe5b6020026020010151818151811061013157fe5b602002602001015160008001838154811061014857fe5b90600052602060002001828154811061015d57fe5b90600052602060002001819055508080600101915050610102565b81806001019250506100c7565b505050565b610192610554565b600060405180604001604052908160008201805480602002602001604051908101604052809291908181526020016000905b828210156102365783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561022257602002820191906000526020600020905b81548152602001906001019080831161020e575b5050505050815260200190600101906101c4565b505050508152602001600182015481525050905090565b6060610257610554565b60008060006040518060400160405280602081526020017f6c657420757320636f6e7374727563742061206d61676963207371756172653a815250945073000000000000000000000000000000000000000063fe4b84df876040518263ffffffff1660e01b81526004016102cb9190610b67565b60006040518083038186803b1580156102e357600080fd5b505af41580156102f7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506103209190810190610981565b9350600092506002868161033057fe5b049150600190505b85860281116103715761035883838387610413909392919063ffffffff16565b8093508194508295505050508080600101915050610338565b3073ffffffffffffffffffffffffffffffffffffffff16638b213ffc856040518263ffffffff1660e01b81526004016103aa9190610b45565b600060405180830381600087803b1580156103c457600080fd5b505af11580156103d8573d6000803e3d6000fd5b505050506040518060600160405280602e8152602001610c8d602e91396002908051906020019061040a92919061056e565b50505050505050565b6000806000808760000151878151811061042957fe5b6020026020010151868151811061043c57fe5b602002602001015114610489578660200151600287018161045957fe5b0692508660200151600186896020015101038161047257fe5b0691506001840390508282829250925092506104f2565b838760000151878151811061049a57fe5b602002602001015186815181106104ad57fe5b602002602001018181525050866020015160018789602001510103816104cf57fe5b069250866020015160018601816104e257fe5b0691508390508282829250925092505b9450945094915050565b8154818355818111156105235781836000526020600020918201910161052291906105ee565b5b505050565b81548183558181111561054f5781836000526020600020918201910161054e919061061a565b5b505050565b604051806040016040528060608152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105af57805160ff19168380011785556105dd565b828001600101855582156105dd579182015b828111156105dc5782518255916020019190600101906105c1565b5b5090506105ea919061061a565b5090565b61061791905b80821115610613576000818161060a919061063f565b506001016105f4565b5090565b90565b61063c91905b80821115610638576000816000905550600101610620565b5090565b90565b508054600082559060005260206000209081019061065d919061061a565b50565b600082601f83011261067157600080fd5b813561068461067f82610baf565b610b82565b9150818183526020840193506020810190508360005b838110156106ca57813586016106b08882610748565b84526020840193506020830192505060018101905061069a565b5050505092915050565b600082601f8301126106e557600080fd5b81516106f86106f382610baf565b610b82565b9150818183526020840193506020810190508360005b8381101561073e578151860161072488826107cb565b84526020840193506020830192505060018101905061070e565b5050505092915050565b600082601f83011261075957600080fd5b813561076c61076782610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561079157600080fd5b60005b838110156107c157816107a78882610916565b845260208401935060208301925050600181019050610794565b5050505092915050565b600082601f8301126107dc57600080fd5b81516107ef6107ea82610bd7565b610b82565b9150818183526020840193506020810190508385602084028201111561081457600080fd5b60005b83811015610844578161082a888261092b565b845260208401935060208301925050600181019050610817565b5050505092915050565b60006040828403121561086057600080fd5b61086a6040610b82565b9050600082013567ffffffffffffffff81111561088657600080fd5b61089284828501610660565b60008301525060206108a684828501610916565b60208301525092915050565b6000604082840312156108c457600080fd5b6108ce6040610b82565b9050600082015167ffffffffffffffff8111156108ea57600080fd5b6108f6848285016106d4565b600083015250602061090a8482850161092b565b60208301525092915050565b60008135905061092581610c75565b92915050565b60008151905061093a81610c75565b92915050565b60006020828403121561095257600080fd5b600082013567ffffffffffffffff81111561096c57600080fd5b6109788482850161084e565b91505092915050565b60006020828403121561099357600080fd5b600082015167ffffffffffffffff8111156109ad57600080fd5b6109b9848285016108b2565b91505092915050565b6000602082840312156109d457600080fd5b60006109e284828501610916565b91505092915050565b60006109f78383610a8c565b905092915050565b6000610a0b8383610b27565b60208301905092915050565b6000610a2282610c19565b610a2c8185610c49565b935083602082028501610a3e85610bff565b8060005b85811015610a7a5784840389528151610a5b85826109eb565b9450610a6683610c2f565b925060208a01995050600181019050610a42565b50829750879550505050505092915050565b6000610a9782610c24565b610aa18185610c5a565b9350610aac83610c0c565b8060005b83811015610add578151610ac488826109ff565b9750610acf83610c3c565b925050600181019050610ab0565b5085935050505092915050565b60006040830160008301518482036000860152610b078282610a17565b9150506020830151610b1c6020860182610b27565b508091505092915050565b610b3081610c6b565b82525050565b610b3f81610c6b565b82525050565b60006020820190508181036000830152610b5f8184610aea565b905092915050565b6000602082019050610b7c6000830184610b36565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610ba557600080fd5b8060405250919050565b600067ffffffffffffffff821115610bc657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610bee57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b610c7e81610c6b565b8114610c8957600080fd5b5056fe66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521a265627a7a723058200f0c3e8fe5a3a1acd916506bf818127749632aa46170ba992760d7e667cbd4c76c6578706572696d656e74616cf50037", + "linkReferences": [ { "offsets": [662], "name": "SquareLib", "length": 20 }] + }, + "sourceMap": "88:1093:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;88:1093:0;;;;;;;", + "deployedSourceMap": "88:1093:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;88:1093:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;816:363;;;;;;;;;;;;;;;;:::i;:::-;;689:123;;;:::i;:::-;;;;;;;;;;;;;;;;223:462;;;;;;;;;;;;;;;;:::i;:::-;;816:363;886:9;901;934:6;:8;;;917:12;:14;;:25;;;;975:6;:8;;;948:12;:17;;:35;;;;;:::i;:::-;;999:1;995:5;;990:185;1006:6;:8;;;1002:1;:12;990:185;;;1059:6;:8;;;1029:12;:17;;1047:1;1029:20;;;;;;;;;;;;;;;:38;;;;;:::i;:::-;;1085:1;1081:5;;1076:93;1092:6;:8;;;1088:1;:12;1076:93;;;1143:6;:11;;;1155:1;1143:14;;;;;;;;;;;;;;1158:1;1143:17;;;;;;;;;;;;;;1117:12;:17;;1135:1;1117:20;;;;;;;;;;;;;;;1138:1;1117:23;;;;;;;;;;;;;;;:43;;;;1102:3;;;;;;;1076:93;;;1016:3;;;;;;;990:185;;;816:363;;;:::o;689:123::-;743:35;;:::i;:::-;795:12;788:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;689:123;:::o;223:462::-;279:22;307:35;;:::i;:::-;348:9;363;378;394:45;;;;;;;;;;;;;;;;;;;454:9;:20;475:1;454:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;454:23:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;454:23:0;;;;;;39:16:-1;36:1;17:17;2:54;454:23:0;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;454:23:0;;;;;;;;;445:32;;488:1;484:5;;503:1;499;:5;;;;;;495:9;;519:1;515:5;;510:76;531:1;527;:5;522:1;:10;510:76;;559:20;571:1;574;577;559:6;:11;;:20;;;;;;:::i;:::-;547:32;;;;;;;;;;;;534:3;;;;;;;510:76;;;592:4;:9;;;602:6;592:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;592:17:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;592:17:0;;;;615:65;;;;;;;;;;;;;;;;;:14;:65;;;;;;;;;;;;:::i;:::-;;223:462;;;;;;:::o;423:523:2:-;559:12;579;599:13;652:1;631:6;:11;;;643:1;631:14;;;;;;;;;;;;;;646:1;631:17;;;;;;;;;;;;;;:22;627:167;;680:6;:8;;;675:1;671;:5;670:18;;;;;;663:25;;724:6;:8;;;719:1;715;704:6;:8;;;:12;:16;703:29;;;;;;696:36;;752:1;748;:5;740:13;;769:4;775;781:5;761:26;;;;;;;;627:167;820:1;800:6;:11;;;812:1;800:14;;;;;;;;;;;;;;815:1;800:17;;;;;;;;;;;;;:21;;;;;855:6;:8;;;850:1;846;835:6;:8;;;:12;:16;834:29;;;;;;827:36;;886:6;:8;;;881:1;877;:5;876:18;;;;;;869:25;;908:1;900:9;;923:4;929;935:5;915:26;;;;;;423:523;;;;;;;;;:::o;88:1093:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;25:733:-1:-;;159:3;152:4;144:6;140:17;136:27;126:2;;177:1;174;167:12;126:2;214:6;201:20;236:97;251:81;325:6;251:81;;;236:97;;;227:106;;350:5;375:6;368:5;361:21;405:4;397:6;393:17;383:27;;427:4;422:3;418:14;411:21;;480:6;513:1;498:254;523:6;520:1;517:13;498:254;;;606:3;593:17;585:6;581:30;630:58;684:3;672:10;630:58;;;625:3;618:71;712:4;707:3;703:14;696:21;;740:4;735:3;731:14;724:21;;555:197;545:1;542;538:9;533:14;;498:254;;;502:14;119:639;;;;;;;;786:741;;931:3;924:4;916:6;912:17;908:27;898:2;;949:1;946;939:12;898:2;979:6;973:13;1001:97;1016:81;1090:6;1016:81;;;1001:97;;;992:106;;1115:5;1140:6;1133:5;1126:21;1170:4;1162:6;1158:17;1148:27;;1192:4;1187:3;1183:14;1176:21;;1245:6;1278:1;1263:258;1288:6;1285:1;1282:13;1263:258;;;1364:3;1358:10;1350:6;1346:23;1388:69;1453:3;1441:10;1388:69;;;1383:3;1376:82;1481:4;1476:3;1472:14;1465:21;;1509:4;1504:3;1500:14;1493:21;;1320:201;1310:1;1307;1303:9;1298:14;;1263:258;;;1267:14;891:636;;;;;;;;1553:699;;1666:3;1659:4;1651:6;1647:17;1643:27;1633:2;;1684:1;1681;1674:12;1633:2;1721:6;1708:20;1743:76;1758:60;1811:6;1758:60;;;1743:76;;;1734:85;;1836:5;1861:6;1854:5;1847:21;1891:4;1883:6;1879:17;1869:27;;1913:4;1908:3;1904:14;1897:21;;1966:6;2013:3;2005:4;1997:6;1993:17;1988:3;1984:27;1981:36;1978:2;;;2030:1;2027;2020:12;1978:2;2055:1;2040:206;2065:6;2062:1;2059:13;2040:206;;;2123:3;2145:37;2178:3;2166:10;2145:37;;;2140:3;2133:50;2206:4;2201:3;2197:14;2190:21;;2234:4;2229:3;2225:14;2218:21;;2097:149;2087:1;2084;2080:9;2075:14;;2040:206;;;2044:14;1626:626;;;;;;;;2278:714;;2402:3;2395:4;2387:6;2383:17;2379:27;2369:2;;2420:1;2417;2410:12;2369:2;2450:6;2444:13;2472:76;2487:60;2540:6;2487:60;;;2472:76;;;2463:85;;2565:5;2590:6;2583:5;2576:21;2620:4;2612:6;2608:17;2598:27;;2642:4;2637:3;2633:14;2626:21;;2695:6;2742:3;2734:4;2726:6;2722:17;2717:3;2713:27;2710:36;2707:2;;;2759:1;2756;2749:12;2707:2;2784:1;2769:217;2794:6;2791:1;2788:13;2769:217;;;2852:3;2874:48;2918:3;2906:10;2874:48;;;2869:3;2862:61;2946:4;2941:3;2937:14;2930:21;;2974:4;2969:3;2965:14;2958:21;;2826:160;2816:1;2813;2809:9;2804:14;;2769:217;;;2773:14;2362:630;;;;;;;;3035:594;;3152:4;3140:9;3135:3;3131:19;3127:30;3124:2;;;3170:1;3167;3160:12;3124:2;3188:20;3203:4;3188:20;;;3179:29;;3286:1;3275:9;3271:17;3258:31;3309:18;3301:6;3298:30;3295:2;;;3341:1;3338;3331:12;3295:2;3375:91;3462:3;3453:6;3442:9;3438:22;3375:91;;;3369:3;3362:5;3358:15;3351:116;3218:260;3525:2;3558:49;3603:3;3594:6;3583:9;3579:22;3558:49;;;3551:4;3544:5;3540:16;3533:75;3488:131;3118:511;;;;;3671:620;;3799:4;3787:9;3782:3;3778:19;3774:30;3771:2;;;3817:1;3814;3807:12;3771:2;3835:20;3850:4;3835:20;;;3826:29;;3926:1;3915:9;3911:17;3905:24;3949:18;3941:6;3938:30;3935:2;;;3981:1;3978;3971:12;3935:2;4015:102;4113:3;4104:6;4093:9;4089:22;4015:102;;;4009:3;4002:5;3998:15;3991:127;3865:264;4176:2;4209:60;4265:3;4256:6;4245:9;4241:22;4209:60;;;4202:4;4195:5;4191:16;4184:86;4139:142;3765:526;;;;;4298:130;;4378:6;4365:20;4356:29;;4390:33;4417:5;4390:33;;;4350:78;;;;;4435:134;;4519:6;4513:13;4504:22;;4531:33;4558:5;4531:33;;;4498:71;;;;;4576:383;;4708:2;4696:9;4687:7;4683:23;4679:32;4676:2;;;4724:1;4721;4714:12;4676:2;4787:1;4776:9;4772:17;4759:31;4810:18;4802:6;4799:30;4796:2;;;4842:1;4839;4832:12;4796:2;4862:81;4935:7;4926:6;4915:9;4911:22;4862:81;;;4852:91;;4738:211;4670:289;;;;;4966:398;;5109:2;5097:9;5088:7;5084:23;5080:32;5077:2;;;5125:1;5122;5115:12;5077:2;5181:1;5170:9;5166:17;5160:24;5204:18;5196:6;5193:30;5190:2;;;5236:1;5233;5226:12;5190:2;5256:92;5340:7;5331:6;5320:9;5316:22;5256:92;;;5246:102;;5139:215;5071:293;;;;;5371:241;;5475:2;5463:9;5454:7;5450:23;5446:32;5443:2;;;5491:1;5488;5481:12;5443:2;5526:1;5543:53;5588:7;5579:6;5568:9;5564:22;5543:53;;;5533:63;;5505:97;5437:175;;;;;5620:241;;5763:92;5851:3;5843:6;5763:92;;;5749:106;;5742:119;;;;;5870:173;;5957:46;5999:3;5991:6;5957:46;;;6032:4;6027:3;6023:14;6009:28;;5950:93;;;;;6086:980;;6259:71;6324:5;6259:71;;;6343:97;6433:6;6428:3;6343:97;;;6336:104;;6463:3;6505:4;6497:6;6493:17;6488:3;6484:27;6532:73;6599:5;6532:73;;;6625:7;6653:1;6638:389;6663:6;6660:1;6657:13;6638:389;;;6725:9;6719:4;6715:20;6710:3;6703:33;6770:6;6764:13;6792:106;6893:4;6878:13;6792:106;;;6784:114;;6915:77;6985:6;6915:77;;;6905:87;;7015:4;7010:3;7006:14;6999:21;;6695:332;6685:1;6682;6678:9;6673:14;;6638:389;;;6642:14;7040:4;7033:11;;7057:3;7050:10;;6238:828;;;;;;;;;;7105:654;;7236:50;7280:5;7236:50;;;7299:76;7368:6;7363:3;7299:76;;;7292:83;;7396:52;7442:5;7396:52;;;7468:7;7496:1;7481:256;7506:6;7503:1;7500:13;7481:256;;;7573:6;7567:13;7594:63;7653:3;7638:13;7594:63;;;7587:70;;7674:56;7723:6;7674:56;;;7664:66;;7538:199;7528:1;7525;7521:9;7516:14;;7481:256;;;7485:14;7750:3;7743:10;;7215:544;;;;;;;;7834:640;;7991:4;7986:3;7982:14;8074:3;8067:5;8063:15;8057:22;8124:3;8118:4;8114:14;8108:3;8103;8099:13;8092:37;8144:141;8280:4;8266:12;8144:141;;;8136:149;;8011:286;8367:4;8360:5;8356:16;8350:23;8379:63;8436:4;8431:3;8427:14;8413:12;8379:63;;;8307:141;8465:4;8458:11;;7964:510;;;;;;8481:103;8554:24;8572:5;8554:24;;;8549:3;8542:37;8536:48;;;8591:121;8682:24;8700:5;8682:24;;;8677:3;8670:37;8664:48;;;8719:373;;8893:2;8882:9;8878:18;8870:26;;8943:9;8937:4;8933:20;8929:1;8918:9;8914:17;8907:47;8968:114;9077:4;9068:6;8968:114;;;8960:122;;8864:228;;;;;9099:229;;9225:2;9214:9;9210:18;9202:26;;9239:79;9315:1;9304:9;9300:17;9291:6;9239:79;;;9196:132;;;;;9335:256;;9397:2;9391:9;9381:19;;9435:4;9427:6;9423:17;9534:6;9522:10;9519:22;9498:18;9486:10;9483:34;9480:62;9477:2;;;9555:1;9552;9545:12;9477:2;9575:10;9571:2;9564:22;9375:216;;;;;9598:275;;9774:18;9766:6;9763:30;9760:2;;;9806:1;9803;9796:12;9760:2;9835:4;9827:6;9823:17;9815:25;;9863:4;9857;9853:15;9845:23;;9697:176;;;;9880:254;;10035:18;10027:6;10024:30;10021:2;;;10067:1;10064;10057:12;10021:2;10096:4;10088:6;10084:17;10076:25;;10124:4;10118;10114:15;10106:23;;9958:176;;;;10144:140;;10271:4;10263:6;10259:17;10248:28;;10239:45;;;;10297:119;;10403:4;10395:6;10391:17;10380:28;;10371:45;;;;10426:124;;10539:5;10533:12;10523:22;;10517:33;;;;10557:103;;10649:5;10643:12;10633:22;;10627:33;;;;10669:141;;10798:4;10790:6;10786:17;10775:28;;10767:43;;;;10821:120;;10929:4;10921:6;10917:17;10906:28;;10898:43;;;;10951:189;;11092:6;11087:3;11080:19;11129:4;11124:3;11120:14;11105:29;;11073:67;;;;;11149:168;;11269:6;11264:3;11257:19;11306:4;11301:3;11297:14;11282:29;;11250:67;;;;;11325:72;;11387:5;11376:16;;11370:27;;;;11404:117;11473:24;11491:5;11473:24;;;11466:5;11463:35;11453:2;;11512:1;11509;11502:12;11453:2;11447:74;", + "source": "pragma solidity >=0.5.6;\n\npragma experimental ABIEncoderV2;\n\nimport \"./SquareLib.sol\";\n\ncontract MagicSquare {\n using SquareLib for SquareLib.MagicSquare;\n\n SquareLib.MagicSquare storedSquare;\n string storedGreeting;\n\n function generateMagicSquare(uint n)\n public\n {\n string memory greeting;\n SquareLib.MagicSquare memory square;\n uint256 x;\n uint256 y;\n uint256 i;\n\n greeting = \"let us construct a magic square:\";\n square = SquareLib.initialize(n);\n\n x = 0;\n y = n / 2;\n for (i = 1; i <= n * n; i++) {\n (x, y, i) = square.step(x, y, i);\n }\n\n this.save(square);\n storedGreeting = \"finally, a decentralized magic square service!\";\n }\n\n function getSquare()\n public\n view\n returns (SquareLib.MagicSquare memory square)\n {\n return storedSquare;\n }\n\n function save(SquareLib.MagicSquare memory square)\n public\n {\n uint256 x;\n uint256 y;\n\n storedSquare.n = square.n;\n storedSquare.rows.length = square.n;\n\n for (x = 0; x < square.n; x++) {\n storedSquare.rows[x].length = square.n;\n\n for (y = 0; y < square.n; y++) {\n storedSquare.rows[x][y] = square.rows[x][y];\n }\n }\n }\n}\n", + "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "ast": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "exportedSymbols": { + "MagicSquare": [ + 178 + ] + }, + "id": 179, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.5", + ".6" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" }, - "deployedBytecode": { - "bytes": "608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820fd10a0b0c646daa7f5ee5eac53b76f2ba70ca857df1ac9142366169abaa138490029", - "linkReferences": [] + { + "id": 2, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "26:33:0" }, - "sourceMap": "26:480:1:-;;;178:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;178:50:1;213:10;205:5;;:18;;;;;;;;;;;;;;;;;;26:480;;;;;;", - "deployedSourceMap": "26:480:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26:480:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;339:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;339:165:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;74:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;50:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;232:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;232:103:1;;;;;;;;;;;;;;;;;:::i;:::-;;339:165;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;401:19;434:11;401:45;;452:8;:21;;;474:24;;452:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;452:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;452:47:1;;;;168:1;143:26;339:165;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;232:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;321:9;294:24;:36;;;;143:26;232:103;:::o", - "source": "pragma solidity >=0.5.6;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", - "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", - "ast": { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 235 - ] - }, - "id": 236, - "nodeType": "SourceUnit", + { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "file": "./SquareLib.sol", + "id": 3, + "nodeType": "ImportDirective", + "scope": 179, + "sourceUnit": 398, + "src": "61:25:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 178, + "linearizedBaseContracts": [ + 178 + ], + "name": "MagicSquare", + "nodeType": "ContractDefinition", "nodes": [ { - "id": 180, - "literals": [ - "solidity", - ">=", - "0.5", - ".6" - ], - "nodeType": "PragmaDirective", - "src": "0:24:1" + "id": 6, + "libraryName": { + "contractScope": null, + "id": 4, + "name": "SquareLib", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 397, + "src": "119:9:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SquareLib_$397", + "typeString": "library SquareLib" + } + }, + "nodeType": "UsingForDirective", + "src": "113:42:0", + "typeName": { + "contractScope": null, + "id": 5, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "133:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + } }, { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 235, - "linearizedBaseContracts": [ - 235 - ], - "name": "Migrations", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 182, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 235, - "src": "50:20:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 181, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "50:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 184, - "name": "last_completed_migration", - "nodeType": "VariableDeclaration", - "scope": 235, - "src": "74:36:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 183, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "74:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 192, - "nodeType": "Block", - "src": "137:37:1", - "statements": [ + "constant": false, + "id": 8, + "name": "storedSquare", + "nodeType": "VariableDeclaration", + "scope": 178, + "src": "159:34:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 7, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "159:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 10, + "name": "storedGreeting", + "nodeType": "VariableDeclaration", + "scope": 178, + "src": "197:21:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "197:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 89, + "nodeType": "Block", + "src": "273:412:0", + "statements": [ + { + "assignments": [ + 16 + ], + "declarations": [ { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 189, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 186, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 412, - "src": "147:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 187, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "147:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 188, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 182, - "src": "161:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "147:19:1", + "constant": false, + "id": 16, + "name": "greeting", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "279:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 15, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "279:6:0", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" } }, - "falseBody": null, - "id": 191, - "nodeType": "IfStatement", - "src": "143:26:1", - "trueBody": { - "id": 190, - "nodeType": "PlaceholderStatement", - "src": "168:1:1" - } + "value": null, + "visibility": "internal" } - ] - }, - "documentation": null, - "id": 193, - "name": "restricted", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 185, - "nodeType": "ParameterList", - "parameters": [], - "src": "134:2:1" + ], + "id": 17, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "279:22:0" }, - "src": "115:59:1", - "visibility": "internal" - }, - { - "body": { - "id": 201, - "nodeType": "Block", - "src": "199:29:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 199, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 196, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 182, - "src": "205:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 197, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 412, - "src": "213:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 198, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "213:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "205:18:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 200, - "nodeType": "ExpressionStatement", - "src": "205:18:1" - } - ] - }, - "documentation": null, - "id": 202, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 194, - "nodeType": "ParameterList", - "parameters": [], - "src": "189:2:1" - }, - "returnParameters": { - "id": 195, - "nodeType": "ParameterList", - "parameters": [], - "src": "199:0:1" - }, - "scope": 235, - "src": "178:50:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 213, - "nodeType": "Block", - "src": "288:47:1", - "statements": [ + { + "assignments": [ + 21 + ], + "declarations": [ { - "expression": { - "argumentTypes": null, - "id": 211, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 209, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 184, - "src": "294:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 210, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 204, - "src": "321:9:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "294:36:1", + "constant": false, + "id": 21, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "307:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 20, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "307:21:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" } }, - "id": 212, - "nodeType": "ExpressionStatement", - "src": "294:36:1" + "value": null, + "visibility": "internal" } - ] + ], + "id": 22, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "307:35:0" }, - "documentation": null, - "id": 214, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 207, - "modifierName": { - "argumentTypes": null, - "id": 206, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 193, - "src": "277:10:1", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "277:10:1" - } - ], - "name": "setCompleted", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 205, - "nodeType": "ParameterList", - "parameters": [ + { + "assignments": [ + 24 + ], + "declarations": [ { "constant": false, - "id": 204, - "name": "completed", + "id": 24, + "name": "x", "nodeType": "VariableDeclaration", - "scope": 214, - "src": "254:14:1", + "scope": 89, + "src": "348:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -6669,10 +10657,10 @@ "typeString": "uint256" }, "typeName": { - "id": 203, - "name": "uint", + "id": 23, + "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "254:4:1", + "src": "348:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6682,632 +10670,912 @@ "visibility": "internal" } ], - "src": "253:16:1" + "id": 25, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "348:9:0" }, - "returnParameters": { - "id": 208, - "nodeType": "ParameterList", - "parameters": [], - "src": "288:0:1" - }, - "scope": 235, - "src": "232:103:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 233, - "nodeType": "Block", - "src": "395:109:1", - "statements": [ + { + "assignments": [ + 27 + ], + "declarations": [ { - "assignments": [ - 222 - ], - "declarations": [ - { - "constant": false, - "id": 222, - "name": "upgraded", - "nodeType": "VariableDeclaration", - "scope": 233, - "src": "401:19:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - }, - "typeName": { - "contractScope": null, - "id": 221, - "name": "Migrations", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 235, - "src": "401:10:1", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 226, - "initialValue": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 224, - "name": "new_address", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 216, - "src": "434:11:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 223, - "name": "Migrations", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "423:10:1", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$235_$", - "typeString": "type(contract Migrations)" - } - }, - "id": 225, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "423:23:1", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - } + "constant": false, + "id": 27, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "363:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "nodeType": "VariableDeclarationStatement", - "src": "401:45:1" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 230, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 184, - "src": "474:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 227, - "name": "upgraded", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 222, - "src": "452:8:1", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - } - }, - "id": 229, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "setCompleted", - "nodeType": "MemberAccess", - "referencedDeclaration": 214, - "src": "452:21:1", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256) external" - } - }, - "id": 231, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "452:47:1", + "typeName": { + "id": 26, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "363:7:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 232, - "nodeType": "ExpressionStatement", - "src": "452:47:1" + "value": null, + "visibility": "internal" } - ] + ], + "id": 28, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "363:9:0" }, - "documentation": null, - "id": 234, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 219, - "modifierName": { - "argumentTypes": null, - "id": 218, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 193, - "src": "384:10:1", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "384:10:1" - } - ], - "name": "upgrade", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 217, - "nodeType": "ParameterList", - "parameters": [ + { + "assignments": [ + 30 + ], + "declarations": [ { "constant": false, - "id": 216, - "name": "new_address", + "id": 30, + "name": "i", "nodeType": "VariableDeclaration", - "scope": 234, - "src": "356:19:1", + "scope": 89, + "src": "378:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, "typeName": { - "id": 215, - "name": "address", + "id": 29, + "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "356:7:1", - "stateMutability": "nonpayable", + "src": "378:7:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], - "src": "355:21:1" - }, - "returnParameters": { - "id": 220, - "nodeType": "ParameterList", - "parameters": [], - "src": "395:0:1" - }, - "scope": 235, - "src": "339:165:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 236, - "src": "26:480:1" - } - ], - "src": "0:507:1" - }, - "legacyAST": { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 235 - ] - }, - "id": 236, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 180, - "literals": [ - "solidity", - ">=", - "0.5", - ".6" - ], - "nodeType": "PragmaDirective", - "src": "0:24:1" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 235, - "linearizedBaseContracts": [ - 235 - ], - "name": "Migrations", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 182, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 235, - "src": "50:20:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 181, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "50:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 184, - "name": "last_completed_migration", - "nodeType": "VariableDeclaration", - "scope": 235, - "src": "74:36:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 31, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "378:9:0" }, - "typeName": { - "id": 183, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "74:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + { + "expression": { + "argumentTypes": null, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 32, + "name": "greeting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 16, + "src": "394:8:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "6c657420757320636f6e7374727563742061206d61676963207371756172653a", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "405:34:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_6489d3e23108083aeb90c3b69347cd3e9158d4240c395bd3f538f5847904d59c", + "typeString": "literal_string \"let us construct a magic square:\"" + }, + "value": "let us construct a magic square:" + }, + "src": "394:45:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 35, + "nodeType": "ExpressionStatement", + "src": "394:45:0" }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 192, - "nodeType": "Block", - "src": "137:37:1", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 189, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + { + "expression": { + "argumentTypes": null, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 36, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "445:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 186, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 412, - "src": "147:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 187, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "147:10:1", + "id": 39, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "475:1:0", "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { "argumentTypes": null, - "id": 188, - "name": "owner", + "id": 37, + "name": "SquareLib", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 182, - "src": "161:5:1", + "referencedDeclaration": 397, + "src": "454:9:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_type$_t_contract$_SquareLib_$397_$", + "typeString": "type(library SquareLib)" } }, - "src": "147:19:1", + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "initialize", + "nodeType": "MemberAccess", + "referencedDeclaration": 292, + "src": "454:20:0", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_struct$_MagicSquare_$245_memory_ptr_$", + "typeString": "function (uint256) pure returns (struct SquareLib.MagicSquare memory)" } }, - "falseBody": null, - "id": 191, - "nodeType": "IfStatement", - "src": "143:26:1", - "trueBody": { - "id": 190, - "nodeType": "PlaceholderStatement", - "src": "168:1:1" + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "454:23:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } + }, + "src": "445:32:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } - ] + }, + "id": 42, + "nodeType": "ExpressionStatement", + "src": "445:32:0" }, - "documentation": null, - "id": 193, - "name": "restricted", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 185, - "nodeType": "ParameterList", - "parameters": [], - "src": "134:2:1" + { + "expression": { + "argumentTypes": null, + "id": 45, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 43, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "484:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 44, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "488:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "484:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 46, + "nodeType": "ExpressionStatement", + "src": "484:5:0" }, - "src": "115:59:1", - "visibility": "internal" - }, - { - "body": { - "id": 201, - "nodeType": "Block", - "src": "199:29:1", - "statements": [ - { - "expression": { + { + "expression": { + "argumentTypes": null, + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 47, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "495:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 48, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "499:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { "argumentTypes": null, - "id": 199, + "hexValue": "32", + "id": 49, "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 196, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 182, - "src": "205:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } + "nodeType": "Literal", + "src": "503:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "value": "2" + }, + "src": "499:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "495:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 52, + "nodeType": "ExpressionStatement", + "src": "495:9:0" + }, + { + "body": { + "id": 77, + "nodeType": "Block", + "src": "539:47:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 197, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 412, - "src": "213:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 198, + "id": 75, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "213:10:1", + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 65, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "548:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 66, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "551:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 67, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "554:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 68, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "547:9:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 71, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "571:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 72, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "574:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 73, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "577:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 69, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "559:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 70, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "step", + "nodeType": "MemberAccess", + "referencedDeclaration": 396, + "src": "559:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_struct$_MagicSquare_$245_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$bound_to$_t_struct$_MagicSquare_$245_memory_ptr_$", + "typeString": "function (struct SquareLib.MagicSquare memory,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "559:20:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "547:32:0", "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } }, - "src": "205:18:1", + "id": 76, + "nodeType": "ExpressionStatement", + "src": "547:32:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 57, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "522:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 58, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "527:1:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 200, - "nodeType": "ExpressionStatement", - "src": "205:18:1" - } - ] - }, - "documentation": null, - "id": 202, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 194, - "nodeType": "ParameterList", - "parameters": [], - "src": "189:2:1" - }, - "returnParameters": { - "id": 195, - "nodeType": "ParameterList", - "parameters": [], - "src": "199:0:1" - }, - "scope": 235, - "src": "178:50:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 213, - "nodeType": "Block", - "src": "288:47:1", - "statements": [ - { - "expression": { + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "id": 59, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "531:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "527:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "522:10:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 78, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 55, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 53, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "515:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, - "id": 211, + "hexValue": "31", + "id": 54, "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 209, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 184, - "src": "294:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 210, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 204, - "src": "321:9:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "nodeType": "Literal", + "src": "519:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" }, - "src": "294:36:1", + "value": "1" + }, + "src": "515:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 56, + "nodeType": "ExpressionStatement", + "src": "515:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "534:3:0", + "subExpression": { + "argumentTypes": null, + "id": 62, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "534:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 212, - "nodeType": "ExpressionStatement", - "src": "294:36:1" + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 64, + "nodeType": "ExpressionStatement", + "src": "534:3:0" + }, + "nodeType": "ForStatement", + "src": "510:76:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 82, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "602:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 79, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 428, + "src": "592:4:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_MagicSquare_$178", + "typeString": "contract MagicSquare" + } + }, + "id": 81, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "save", + "nodeType": "MemberAccess", + "referencedDeclaration": 177, + "src": "592:9:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_struct$_MagicSquare_$245_memory_ptr_$returns$__$", + "typeString": "function (struct SquareLib.MagicSquare memory) external" + }, + "name": "save", + "overloadedDeclarations": [] + }, + "id": 83, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "592:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ] + }, + "id": 84, + "nodeType": "ExpressionStatement", + "src": "592:17:0" }, - "documentation": null, - "id": 214, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 207, - "modifierName": { + { + "expression": { + "argumentTypes": null, + "id": 87, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "id": 206, - "name": "restricted", + "id": 85, + "name": "storedGreeting", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 193, - "src": "277:10:1", + "referencedDeclaration": 10, + "src": "615:14:0", "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" } }, - "nodeType": "ModifierInvocation", - "src": "277:10:1" - } - ], - "name": "setCompleted", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 205, - "nodeType": "ParameterList", - "parameters": [ + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521", + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "632:48:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_661078515cdf36a6c513369103f7a6474ac7bb28ddc3e305eb9bb79e1cb8e423", + "typeString": "literal_string \"finally, a decentralized magic square service!\"" + }, + "value": "finally, a decentralized magic square service!" + }, + "src": "615:65:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 88, + "nodeType": "ExpressionStatement", + "src": "615:65:0" + } + ] + }, + "documentation": null, + "id": 90, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "generateMagicSquare", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 13, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 12, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 90, + "src": "252:6:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 11, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "252:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "251:8:0" + }, + "returnParameters": { + "id": 14, + "nodeType": "ParameterList", + "parameters": [], + "src": "273:0:0" + }, + "scope": 178, + "src": "223:462:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "782:30:0", + "statements": [ + { + "assignments": [ + 96 + ], + "declarations": [ { "constant": false, - "id": 204, - "name": "completed", + "id": 96, + "name": "x", "nodeType": "VariableDeclaration", - "scope": 214, - "src": "254:14:1", + "scope": 168, + "src": "758:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7315,10 +11583,10 @@ "typeString": "uint256" }, "typeName": { - "id": 203, - "name": "uint", + "id": 95, + "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "254:4:1", + "src": "758:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7328,967 +11596,960 @@ "visibility": "internal" } ], - "src": "253:16:1" - }, - "returnParameters": { - "id": 208, - "nodeType": "ParameterList", - "parameters": [], - "src": "288:0:1" - }, - "scope": 235, - "src": "232:103:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 233, - "nodeType": "Block", - "src": "395:109:1", - "statements": [ - { - "assignments": [ - 222 - ], - "declarations": [ - { - "constant": false, - "id": 222, - "name": "upgraded", - "nodeType": "VariableDeclaration", - "scope": 233, - "src": "401:19:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - }, - "typeName": { - "contractScope": null, - "id": 221, - "name": "Migrations", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 235, - "src": "401:10:1", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 226, - "initialValue": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 224, - "name": "new_address", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 216, - "src": "434:11:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 223, - "name": "Migrations", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "423:10:1", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$235_$", - "typeString": "type(contract Migrations)" - } - }, - "id": 225, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "423:23:1", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "401:45:1" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 230, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 184, - "src": "474:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 227, - "name": "upgraded", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 222, - "src": "452:8:1", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$235", - "typeString": "contract Migrations" - } - }, - "id": 229, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "setCompleted", - "nodeType": "MemberAccess", - "referencedDeclaration": 214, - "src": "452:21:1", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256) external" - } - }, - "id": 231, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "452:47:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 232, - "nodeType": "ExpressionStatement", - "src": "452:47:1" + "id": 96, + "initialValue": null, + "nodeType": "Return", + "src": "788:19:0", + "expression": { + "argumentTypes": null, + "id": 95, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "795:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } - ] - }, - "documentation": null, - "id": 234, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 219, - "modifierName": { - "argumentTypes": null, - "id": 218, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 193, - "src": "384:10:1", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "384:10:1" - } - ], - "name": "upgrade", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 217, - "nodeType": "ParameterList", - "parameters": [ + }, + "functionReturnParameters": 94 + }, + { + "assignments": [ + 99 + ], + "declarations": [ { "constant": false, - "id": 216, - "name": "new_address", + "id": 99, + "name": "y", "nodeType": "VariableDeclaration", - "scope": 234, - "src": "356:19:1", + "scope": 168, + "src": "773:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, "typeName": { - "id": 215, - "name": "address", + "id": 98, + "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "356:7:1", - "stateMutability": "nonpayable", + "src": "773:7:0", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], - "src": "355:21:1" - }, - "returnParameters": { - "id": 220, - "nodeType": "ParameterList", - "parameters": [], - "src": "395:0:1" - }, - "scope": 235, - "src": "339:165:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 236, - "src": "26:480:1" - } - ], - "src": "0:507:1" - }, - "compiler": { - "name": "solc", - "version": "0.5.8+commit.23d335f2.Emscripten.clang" - }, - "networks": {}, - "schemaVersion": "3.0.9", - "updatedAt": "2019-05-16T17:59:03.216Z", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } - }, - { - "contractName": "SquareLib", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "n", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [ - { - "components": [ - { - "name": "rows", - "type": "uint256[][]" + "id": 100, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "773:9:0" }, { - "name": "n", - "type": "uint256" - } - ], - "name": "square", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - } - ], - "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":\"SquareLib\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":{\"keccak256\":\"0xfdd57b714a8ab00ba37fb6875091322e9b014a4ee1df170527a75d3ee8d54add\",\"urls\":[\"bzzr://b62f57a3f7326bfc9025f266d1f9d4e52947adc0e25927b6ea790b5dbae75713\"]}},\"version\":1}", - "bytecode": { - "bytes": "6103b6610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063fe4b84df1461003a575b600080fd5b610054600480360361004f9190810190610159565b61006a565b60405161006191906102cd565b60405180910390f35b61007261012a565b60006040518060400160405280846040519080825280602002602001820160405280156100b357816020015b606081526020019060019003908161009e5790505b508152602001848152509150600090505b8281101561012457826040519080825280602002602001820160405280156100fb5781602001602082028038833980820191505090505b508260000151828151811061010c57fe5b602002602001018190525080806001019150506100c4565b50919050565b604051806040016040528060608152602001600081525090565b60008135905061015381610365565b92915050565b60006020828403121561016b57600080fd5b600061017984828501610144565b91505092915050565b600061018e8383610223565b905092915050565b60006101a283836102be565b60208301905092915050565b60006101b982610309565b6101c38185610339565b9350836020820285016101d5856102ef565b8060005b8581101561021157848403895281516101f28582610182565b94506101fd8361031f565b925060208a019950506001810190506101d9565b50829750879550505050505092915050565b600061022e82610314565b610238818561034a565b9350610243836102fc565b8060005b8381101561027457815161025b8882610196565b97506102668361032c565b925050600181019050610247565b5085935050505092915050565b6000604083016000830151848203600086015261029e82826101ae565b91505060208301516102b360208601826102be565b508091505092915050565b6102c78161035b565b82525050565b600060208201905081810360008301526102e78184610281565b905092915050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b61036e8161035b565b811461037957600080fd5b5056fea265627a7a72305820bdeb36fef4e4e60013e207952dbf47e7cc9299817cd78378be346bc9bb74dc916c6578706572696d656e74616cf50037", - "linkReferences": [] - }, - "deployedBytecode": { - "bytes": "73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063fe4b84df1461003a575b600080fd5b610054600480360361004f9190810190610159565b61006a565b60405161006191906102cd565b60405180910390f35b61007261012a565b60006040518060400160405280846040519080825280602002602001820160405280156100b357816020015b606081526020019060019003908161009e5790505b508152602001848152509150600090505b8281101561012457826040519080825280602002602001820160405280156100fb5781602001602082028038833980820191505090505b508260000151828151811061010c57fe5b602002602001018190525080806001019150506100c4565b50919050565b604051806040016040528060608152602001600081525090565b60008135905061015381610365565b92915050565b60006020828403121561016b57600080fd5b600061017984828501610144565b91505092915050565b600061018e8383610223565b905092915050565b60006101a283836102be565b60208301905092915050565b60006101b982610309565b6101c38185610339565b9350836020820285016101d5856102ef565b8060005b8581101561021157848403895281516101f28582610182565b94506101fd8361031f565b925060208a019950506001810190506101d9565b50829750879550505050505092915050565b600061022e82610314565b610238818561034a565b9350610243836102fc565b8060005b8381101561027457815161025b8882610196565b97506102668361032c565b925050600181019050610247565b5085935050505092915050565b6000604083016000830151848203600086015261029e82826101ae565b91505060208301516102b360208601826102be565b508091505092915050565b6102c78161035b565b82525050565b600060208201905081810360008301526102e78184610281565b905092915050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b61036e8161035b565b811461037957600080fd5b5056fea265627a7a72305820bdeb36fef4e4e60013e207952dbf47e7cc9299817cd78378be346bc9bb74dc916c6578706572696d656e74616cf50037", - "linkReferences": [] - }, - "sourceMap": "60:888:2:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", - "deployedSourceMap": "60:888:2:-;;;;;;;;;;;;;;;;;;;;;;;;147:272;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;213:25;;:::i;:::-;248:9;273:63;;;;;;;;315:1;299:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;273:63;;;;328:1;273:63;;;264:72;;352:1;348:5;;343:72;359:1;355;:5;343:72;;;406:1;392:16;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;392:16:2;;;;375:6;:11;;;387:1;375:14;;;;;;;;;;;;;:33;;;;362:3;;;;;;;343:72;;;147:272;;;;:::o;60:888::-;;;;;;;;;;;;;;;;;;;:::o;5:130:-1:-;;85:6;72:20;63:29;;97:33;124:5;97:33;;;57:78;;;;;142:241;;246:2;234:9;225:7;221:23;217:32;214:2;;;262:1;259;252:12;214:2;297:1;314:53;359:7;350:6;339:9;335:22;314:53;;;304:63;;276:97;208:175;;;;;391:257;;542:100;638:3;630:6;542:100;;;528:114;;521:127;;;;;657:189;;752:54;802:3;794:6;752:54;;;835:4;830:3;826:14;812:28;;745:101;;;;;889:1004;;1070:71;1135:5;1070:71;;;1154:105;1252:6;1247:3;1154:105;;;1147:112;;1282:3;1324:4;1316:6;1312:17;1307:3;1303:27;1351:73;1418:5;1351:73;;;1444:7;1472:1;1457:397;1482:6;1479:1;1476:13;1457:397;;;1544:9;1538:4;1534:20;1529:3;1522:33;1589:6;1583:13;1611:114;1720:4;1705:13;1611:114;;;1603:122;;1742:77;1812:6;1742:77;;;1732:87;;1842:4;1837:3;1833:14;1826:21;;1514:340;1504:1;1501;1497:9;1492:14;;1457:397;;;1461:14;1867:4;1860:11;;1884:3;1877:10;;1049:844;;;;;;;;;;1932:678;;2071:50;2115:5;2071:50;;;2134:84;2211:6;2206:3;2134:84;;;2127:91;;2239:52;2285:5;2239:52;;;2311:7;2339:1;2324:264;2349:6;2346:1;2343:13;2324:264;;;2416:6;2410:13;2437:71;2504:3;2489:13;2437:71;;;2430:78;;2525:56;2574:6;2525:56;;;2515:66;;2381:207;2371:1;2368;2364:9;2359:14;;2324:264;;;2328:14;2601:3;2594:10;;2050:560;;;;;;;;2685:664;;2850:4;2845:3;2841:14;2933:3;2926:5;2922:15;2916:22;2983:3;2977:4;2973:14;2967:3;2962;2958:13;2951:37;3003:149;3147:4;3133:12;3003:149;;;2995:157;;2870:294;3234:4;3227:5;3223:16;3217:23;3246:71;3311:4;3306:3;3302:14;3288:12;3246:71;;;3174:149;3340:4;3333:11;;2823:526;;;;;;3356:111;3437:24;3455:5;3437:24;;;3432:3;3425:37;3419:48;;;3474:389;;3656:2;3645:9;3641:18;3633:26;;3706:9;3700:4;3696:20;3692:1;3681:9;3677:17;3670:47;3731:122;3848:4;3839:6;3731:122;;;3723:130;;3627:236;;;;;3873:140;;4000:4;3992:6;3988:17;3977:28;;3968:45;;;;4026:119;;4132:4;4124:6;4120:17;4109:28;;4100:45;;;;4155:124;;4268:5;4262:12;4252:22;;4246:33;;;;4286:103;;4378:5;4372:12;4362:22;;4356:33;;;;4398:141;;4527:4;4519:6;4515:17;4504:28;;4496:43;;;;4550:120;;4658:4;4650:6;4646:17;4635:28;;4627:43;;;;4680:197;;4829:6;4824:3;4817:19;4866:4;4861:3;4857:14;4842:29;;4810:67;;;;;4886:176;;5014:6;5009:3;5002:19;5051:4;5046:3;5042:14;5027:29;;4995:67;;;;;5070:72;;5132:5;5121:16;;5115:27;;;;5149:117;5218:24;5236:5;5218:24;;;5211:5;5208:35;5198:2;;5257:1;5254;5247:12;5198:2;5192:74;", - "source": "pragma solidity >=0.5.6;\npragma experimental ABIEncoderV2;\n\nlibrary SquareLib {\n struct MagicSquare {\n uint256[][] rows;\n uint256 n;\n }\n\n function initialize(uint256 n)\n external\n pure\n returns (MagicSquare memory square)\n {\n uint256 i;\n\n square = MagicSquare({\n rows: new uint256[][](n),\n n: n\n });\n\n for (i = 0; i < n; i++) {\n square.rows[i] = new uint256[](n);\n }\n }\n\n function step(\n MagicSquare memory square,\n uint256 x,\n uint256 y,\n uint256 i\n )\n internal\n pure\n returns (\n uint256 newX,\n uint256 newY,\n uint256 lastI\n )\n {\n if (square.rows[x][y] != 0) {\n newX = (x + 2) % square.n;\n newY = (square.n + y - 1) % square.n;\n lastI = i - 1;\n return (newX, newY, lastI);\n }\n\n square.rows[x][y] = i;\n newX = (square.n + x - 1) % square.n;\n newY = (y + 1) % square.n;\n lastI = i;\n return (newX, newY, lastI);\n }\n}\n\n", - "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", - "ast": { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", - "exportedSymbols": { - "SquareLib": [ - 397 - ] - }, - "id": 398, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 237, - "literals": [ - "solidity", - ">=", - "0.5", - ".6" - ], - "nodeType": "PragmaDirective", - "src": "0:24:2" - }, - { - "id": 238, - "literals": [ - "experimental", - "ABIEncoderV2" - ], - "nodeType": "PragmaDirective", - "src": "25:33:2", - "baseContracts": [], - "contractDependencies": [], - "contractKind": "library", - "documentation": null, - "fullyImplemented": true, - "linearizedBaseContracts": [ - 394 - ], - "name": "SquareLib", - "nodes": [ - { - "canonicalName": "SquareLib.MagicSquare", - "id": 242, - "members": [ - { - "constant": false, - "id": 239, - "name": "rows", - "nodeType": "VariableDeclaration", - "scope": 242, - "src": "74:16:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 236, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "74:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 237, - "length": null, - "nodeType": "ArrayTypeName", - "src": "74:9:2", + "expression": { + "argumentTypes": null, + "id": 106, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 101, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "789:12:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } }, - "id": 238, - "length": null, - "nodeType": "ArrayTypeName", - "src": "74:11:2", + "id": 103, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "789:14:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 241, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 242, - "src": "96:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 240, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "96:7:2", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 104, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "806:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 105, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "806:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "name": "MagicSquare", - "nodeType": "StructDefinition", - "scope": 394, - "src": "49:61:2", - "visibility": "public" - }, - { - "body": { - "id": 288, - "nodeType": "Block", - "src": "209:177:2", - "statements": [ - { - "assignments": [ - 250 - ], - "declarations": [ - { - "constant": false, - "id": 250, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 288, - "src": "215:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 249, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "215:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 251, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "215:9:2" - }, - { + "src": "789:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 107, + "nodeType": "ExpressionStatement", + "src": "789:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 262, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "expression": { "argumentTypes": null, - "id": 252, - "name": "square", + "id": 108, + "name": "storedSquare", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "231:6:2", + "referencedDeclaration": 8, + "src": "820:12:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 111, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "820:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 112, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "820:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 113, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "847:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 114, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "847:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "820:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 116, + "nodeType": "ExpressionStatement", + "src": "820:35:0" + }, + { + "body": { + "id": 166, + "nodeType": "Block", + "src": "893:154:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "arguments": [ - { + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "arguments": [ - { + "baseExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 258, - "name": "n", + "id": 128, + "name": "storedSquare", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "282:1:2", + "referencedDeclaration": 8, + "src": "901:12:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } - ], - "id": 257, + }, + "id": 131, "isConstant": false, - "isLValue": false, - "isPure": true, + "isLValue": true, + "isPure": false, "lValueRequested": false, - "nodeType": "NewExpression", - "src": "266:15:2", + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "901:17:0", "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 254, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "270:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 255, - "length": null, - "nodeType": "ArrayTypeName", - "src": "270:9:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } - }, - "id": 256, - "length": null, - "nodeType": "ArrayTypeName", - "src": "270:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - } + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 132, + "indexExpression": { + "argumentTypes": null, + "id": 130, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "919:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 259, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "266:18:2", + "nodeType": "IndexAccess", + "src": "901:20:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } }, - { - "argumentTypes": null, - "id": 260, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "295:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 133, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "901:27:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 134, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "931:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } - ], - "id": 253, - "name": "MagicSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 242, - "src": "240:11:2", + }, + "id": 135, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "931:8:0", "typeDescriptions": { - "typeIdentifier": "t_type$_t_struct$_MagicSquare_$242_storage_ptr_$", - "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 261, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "structConstructorCall", - "lValueRequested": false, - "names": [ - "rows", - "n" - ], - "nodeType": "FunctionCall", - "src": "240:63:2", + "src": "901:38:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "231:72:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "id": 137, + "nodeType": "ExpressionStatement", + "src": "901:38:0" }, - "id": 263, - "nodeType": "ExpressionStatement", - "src": "231:72:2" - }, - { - "body": { - "id": 286, - "nodeType": "Block", - "src": "334:48:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 284, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + { + "body": { + "id": 164, + "nodeType": "Block", + "src": "979:62:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "baseExpression": { + "id": 162, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 274, - "name": "square", + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 149, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "989:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 153, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "989:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 154, + "indexExpression": { + "argumentTypes": null, + "id": 151, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "1007:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "989:20:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" + } + }, + "id": 155, + "indexExpression": { + "argumentTypes": null, + "id": 152, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "342:6:2", + "referencedDeclaration": 99, + "src": "1010:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 277, "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 239, - "src": "342:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 278, - "indexExpression": { - "argumentTypes": null, - "id": 276, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "354:1:2", + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "989:23:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "342:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "arguments": [ - { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "id": 282, - "name": "n", + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 156, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "1015:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 157, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "1015:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 159, + "indexExpression": { + "argumentTypes": null, + "id": 158, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "1027:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1015:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 161, + "indexExpression": { + "argumentTypes": null, + "id": 160, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "373:1:2", + "referencedDeclaration": 99, + "src": "1030:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 281, + }, "isConstant": false, - "isLValue": false, - "isPure": true, + "isLValue": true, + "isPure": false, "lValueRequested": false, - "nodeType": "NewExpression", - "src": "359:13:2", + "nodeType": "IndexAccess", + "src": "1015:17:0", "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory)" - }, - "typeName": { - "baseType": { - "id": 279, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "363:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 280, - "length": null, - "nodeType": "ArrayTypeName", - "src": "363:9:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 283, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "359:16:2", + "src": "989:43:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "342:33:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 285, - "nodeType": "ExpressionStatement", - "src": "342:33:2" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 270, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 268, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "322:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 163, + "nodeType": "ExpressionStatement", + "src": "989:43:0" + } + ] }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { + "condition": { "argumentTypes": null, - "id": 269, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "326:1:2", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - "src": "322:5:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 287, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 266, + }, + "id": 145, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "id": 264, - "name": "i", + "id": 142, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "315:1:2", + "referencedDeclaration": 99, + "src": "960:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 143, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "964:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 144, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "964:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "src": "960:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 165, + "initializationExpression": { + "expression": { "argumentTypes": null, - "hexValue": "30", - "id": 265, + "id": 140, "isConstant": false, "isLValue": false, - "isPure": true, - "kind": "number", + "isPure": false, "lValueRequested": false, - "nodeType": "Literal", - "src": "319:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + "leftHandSide": { + "argumentTypes": null, + "id": 138, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 99, + "src": "953:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 139, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "957:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" }, - "value": "0" + "src": "953:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "src": "315:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 141, + "nodeType": "ExpressionStatement", + "src": "953:5:0" }, - "id": 267, - "nodeType": "ExpressionStatement", - "src": "315:5:2" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 272, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "329:3:2", - "subExpression": { + "loopExpression": { + "expression": { "argumentTypes": null, - "id": 271, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "329:1:2", + "id": 147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "974:3:0", + "subExpression": { + "argumentTypes": null, + "id": 146, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 99, + "src": "974:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 148, + "nodeType": "ExpressionStatement", + "src": "974:3:0" }, - "id": 273, - "nodeType": "ExpressionStatement", - "src": "329:3:2" + "nodeType": "ForStatement", + "src": "948:93:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 121, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "874:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 122, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "878:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - "nodeType": "ForStatement", - "src": "310:72:2" + "id": 123, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "878:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "874:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } - ] - }, - "documentation": null, - "id": 289, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "initialize", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 245, - "nodeType": "ParameterList", - "parameters": [ + }, + "id": 167, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 117, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "867:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 118, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "871:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "867:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 120, + "nodeType": "ExpressionStatement", + "src": "867:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "888:3:0", + "subExpression": { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "888:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 127, + "nodeType": "ExpressionStatement", + "src": "888:3:0" + }, + "nodeType": "ForStatement", + "src": "862:185:0" + } + ] + }, + "documentation": null, + "id": 98, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getSquare", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 92, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 169, + "src": "702:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 91, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 237, + "src": "702:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "707:2:0" + }, + "returnParameters": { + "id": 94, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 93, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 98, + "src": "743:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 92, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "743:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "742:37:0" + }, + "scope": 178, + "src": "689:123:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 176, + "nodeType": "Block", + "src": "880:299:0", + "statements": [ + { + "assignments": [ + 104 + ], + "declarations": [ { "constant": false, - "id": 244, - "name": "n", + "id": 104, + "name": "x", "nodeType": "VariableDeclaration", - "scope": 289, - "src": "134:9:2", + "scope": 176, + "src": "886:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -8296,10 +12557,10 @@ "typeString": "uint256" }, "typeName": { - "id": 243, + "id": 103, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "134:7:2", + "src": "886:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8309,1404 +12570,2063 @@ "visibility": "internal" } ], - "src": "133:11:2" + "id": 105, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "886:9:0" }, - "returnParameters": { - "id": 248, - "nodeType": "ParameterList", - "parameters": [ + { + "assignments": [ + 107 + ], + "declarations": [ { "constant": false, - "id": 247, - "name": "square", + "id": 107, + "name": "y", "nodeType": "VariableDeclaration", - "scope": 289, - "src": "180:25:2", + "scope": 176, + "src": "901:9:0", "stateVariable": false, - "storageLocation": "memory", + "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, "typeName": { - "contractScope": null, - "id": 246, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", + "id": 106, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "901:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 108, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "901:9:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 109, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "917:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 111, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "917:14:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 112, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "934:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 113, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "934:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "917:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 115, + "nodeType": "ExpressionStatement", + "src": "917:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 116, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "948:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 119, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", "referencedDeclaration": 242, - "src": "180:11:2", + "src": "948:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 120, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "948:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 121, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "975:6:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "value": null, - "visibility": "internal" + "id": 122, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "975:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "948:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "src": "179:27:2" + }, + "id": 124, + "nodeType": "ExpressionStatement", + "src": "948:35:0" }, - "scope": 394, - "src": "114:272:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "internal" - }, - { - "body": { - "id": 392, - "nodeType": "Block", - "src": "588:325:2", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 313, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + { + "body": { + "id": 174, + "nodeType": "Block", + "src": "1021:154:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "baseExpression": { + "id": 144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "baseExpression": { + "expression": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 306, - "name": "square", + "expression": { + "argumentTypes": null, + "id": 136, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1029:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 139, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1029:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 140, + "indexExpression": { + "argumentTypes": null, + "id": 138, + "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "598:6:2", + "referencedDeclaration": 104, + "src": "1047:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 307, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 239, - "src": "598:11:2", + "nodeType": "IndexAccess", + "src": "1029:20:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } }, - "id": 309, - "indexExpression": { + "id": 141, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1029:27:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 308, - "name": "x", + "id": 142, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "610:1:2", + "referencedDeclaration": 100, + "src": "1059:6:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, + "id": 143, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "598:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 311, - "indexExpression": { - "argumentTypes": null, - "id": 310, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "613:1:2", + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1059:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "598:17:2", + "src": "1029:38:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 312, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "619:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "598:22:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } + "id": 145, + "nodeType": "ExpressionStatement", + "src": "1029:38:0" }, - "falseBody": null, - "id": 349, - "nodeType": "IfStatement", - "src": "594:167:2", - "trueBody": { - "id": 348, - "nodeType": "Block", - "src": "622:139:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 322, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 314, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "630:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 321, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 317, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 315, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "638:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "32", - "id": 316, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "642:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" - }, - "value": "2" - }, - "src": "638:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 318, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "637:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 319, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "647:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 320, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "647:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "637:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "630:25:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 323, - "nodeType": "ExpressionStatement", - "src": "630:25:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 335, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 324, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "663:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + { + "body": { + "id": 172, + "nodeType": "Block", + "src": "1107:62:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 334, + "id": 170, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { + "leftHandSide": { "argumentTypes": null, - "components": [ - { + "baseExpression": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 330, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 328, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 325, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "671:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 326, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "671:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 327, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "682:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "671:12:2", + "id": 157, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1117:12:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 329, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "686:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "671:16:2", + "id": 161, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1117:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 162, + "indexExpression": { + "argumentTypes": null, + "id": 159, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1135:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1117:20:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } - ], - "id": 331, + }, + "id": 163, + "indexExpression": { + "argumentTypes": null, + "id": 160, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1138:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "isConstant": false, - "isInlineArray": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "670:18:2", + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1117:23:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 332, - "name": "square", + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 164, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1143:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 165, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1143:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 167, + "indexExpression": { + "argumentTypes": null, + "id": 166, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1155:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1143:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 169, + "indexExpression": { + "argumentTypes": null, + "id": 168, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "691:6:2", + "referencedDeclaration": 107, + "src": "1158:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 333, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "691:8:2", + "nodeType": "IndexAccess", + "src": "1143:17:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "670:29:2", + "src": "1117:43:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "663:36:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 336, - "nodeType": "ExpressionStatement", - "src": "663:36:2" + "id": 171, + "nodeType": "ExpressionStatement", + "src": "1117:43:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - { - "expression": { - "argumentTypes": null, - "id": 341, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 337, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "707:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 340, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 338, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 297, - "src": "715:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 339, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "719:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "715:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "707:13:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 342, - "nodeType": "ExpressionStatement", - "src": "707:13:2" + "id": 153, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 150, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1088:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 343, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "736:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 344, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "742:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 345, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "748:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 346, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "735:19:2", + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 151, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1092:6:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "functionReturnParameters": 305, - "id": 347, - "nodeType": "Return", - "src": "728:26:2" + "id": 152, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1092:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1088:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } - ] - } - }, - { - "expression": { - "argumentTypes": null, - "id": 358, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { + }, + "id": 173, + "initializationExpression": { + "expression": { "argumentTypes": null, - "baseExpression": { + "id": 148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 350, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "767:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 354, + "id": 146, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1081:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 147, "isConstant": false, - "isLValue": true, - "isPure": false, + "isLValue": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 239, - "src": "767:11:2", + "nodeType": "Literal", + "src": "1085:1:0", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" }, - "id": 355, - "indexExpression": { + "src": "1081:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 149, + "nodeType": "ExpressionStatement", + "src": "1081:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 155, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1102:3:0", + "subExpression": { "argumentTypes": null, - "id": 352, - "name": "x", + "id": 154, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "779:1:2", + "referencedDeclaration": 107, + "src": "1102:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "767:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 356, - "indexExpression": { - "argumentTypes": null, - "id": 353, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "782:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "767:17:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 156, + "nodeType": "ExpressionStatement", + "src": "1102:3:0" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 357, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 297, - "src": "787:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "nodeType": "ForStatement", + "src": "1076:93:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 132, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 129, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1002:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 130, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1006:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 131, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1006:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1002:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 175, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "995:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "999:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "src": "767:21:2", + "value": "0" + }, + "src": "995:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "995:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1016:3:0", + "subExpression": { + "argumentTypes": null, + "id": 133, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1016:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 135, + "nodeType": "ExpressionStatement", + "src": "1016:3:0" + }, + "nodeType": "ForStatement", + "src": "990:185:0" + } + ] + }, + "documentation": null, + "id": 177, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "save", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 101, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 100, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 177, + "src": "830:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 99, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "830:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "829:37:0" + }, + "returnParameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [], + "src": "880:0:0" + }, + "scope": 178, + "src": "816:363:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 179, + "src": "88:1093:0" + } + ], + "src": "0:1182:0" + }, + "legacyAST": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/MagicSquare.sol", + "exportedSymbols": { + "MagicSquare": [ + 178 + ] + }, + "id": 179, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.5", + ".6" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "id": 2, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "26:33:0" + }, + { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "file": "./SquareLib.sol", + "id": 3, + "nodeType": "ImportDirective", + "scope": 179, + "sourceUnit": 398, + "src": "61:25:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 178, + "linearizedBaseContracts": [ + 178 + ], + "name": "MagicSquare", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 6, + "libraryName": { + "contractScope": null, + "id": 4, + "name": "SquareLib", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 397, + "src": "119:9:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SquareLib_$397", + "typeString": "library SquareLib" + } + }, + "nodeType": "UsingForDirective", + "src": "113:42:0", + "typeName": { + "contractScope": null, + "id": 5, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "133:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + } + }, + { + "constant": false, + "id": 8, + "name": "storedSquare", + "nodeType": "VariableDeclaration", + "scope": 178, + "src": "159:34:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 7, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "159:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 10, + "name": "storedGreeting", + "nodeType": "VariableDeclaration", + "scope": 178, + "src": "197:21:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "197:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 89, + "nodeType": "Block", + "src": "273:412:0", + "statements": [ + { + "assignments": [ + 16 + ], + "declarations": [ + { + "constant": false, + "id": 16, + "name": "greeting", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "279:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 15, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "279:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 17, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "279:22:0" + }, + { + "assignments": [ + 21 + ], + "declarations": [ + { + "constant": false, + "id": 21, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "307:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 20, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "307:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 22, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "307:35:0" + }, + { + "assignments": [ + 24 + ], + "declarations": [ + { + "constant": false, + "id": 24, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "348:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "348:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 359, - "nodeType": "ExpressionStatement", - "src": "767:21:2" - }, + "value": null, + "visibility": "internal" + } + ], + "id": 25, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "348:9:0" + }, + { + "assignments": [ + 27 + ], + "declarations": [ { - "expression": { - "argumentTypes": null, - "id": 371, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "constant": false, + "id": 27, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "363:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 26, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "363:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 28, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "363:9:0" + }, + { + "assignments": [ + 30 + ], + "declarations": [ + { + "constant": false, + "id": 30, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 89, + "src": "378:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 29, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "378:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 31, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "378:9:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 32, + "name": "greeting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 16, + "src": "394:8:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "6c657420757320636f6e7374727563742061206d61676963207371756172653a", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "405:34:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_6489d3e23108083aeb90c3b69347cd3e9158d4240c395bd3f538f5847904d59c", + "typeString": "literal_string \"let us construct a magic square:\"" + }, + "value": "let us construct a magic square:" + }, + "src": "394:45:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 35, + "nodeType": "ExpressionStatement", + "src": "394:45:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 36, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "445:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "id": 360, - "name": "newX", + "id": 39, + "name": "n", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "794:4:2", + "referencedDeclaration": 12, + "src": "475:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { + } + ], + "expression": { + "argumentTypes": [ + { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "id": 370, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 366, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 364, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 361, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "802:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 362, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "802:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 363, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "813:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "802:12:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 365, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "817:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "802:16:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 367, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "801:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 368, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "822:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 369, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "822:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "801:29:2", + } + ], + "expression": { + "argumentTypes": null, + "id": 37, + "name": "SquareLib", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 397, + "src": "454:9:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_type$_t_contract$_SquareLib_$397_$", + "typeString": "type(library SquareLib)" } }, - "src": "794:36:2", + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "initialize", + "nodeType": "MemberAccess", + "referencedDeclaration": 292, + "src": "454:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_struct$_MagicSquare_$245_memory_ptr_$", + "typeString": "function (uint256) pure returns (struct SquareLib.MagicSquare memory)" + } + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "454:23:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "src": "445:32:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 42, + "nodeType": "ExpressionStatement", + "src": "445:32:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 45, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 43, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "484:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 44, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "488:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "484:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 46, + "nodeType": "ExpressionStatement", + "src": "484:5:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 47, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "495:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 48, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "499:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 372, - "nodeType": "ExpressionStatement", - "src": "794:36:2" - }, - { - "expression": { + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { "argumentTypes": null, - "id": 381, + "hexValue": "32", + "id": 49, "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 373, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "836:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "nodeType": "Literal", + "src": "503:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "value": "2" + }, + "src": "499:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "495:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 52, + "nodeType": "ExpressionStatement", + "src": "495:9:0" + }, + { + "body": { + "id": 77, + "nodeType": "Block", + "src": "539:47:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 380, + "id": 75, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { + "leftHandSide": { "argumentTypes": null, "components": [ { "argumentTypes": null, - "commonType": { + "id": 65, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "548:1:0", + "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "id": 376, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 374, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "844:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 375, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "848:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "844:5:2", + } + }, + { + "argumentTypes": null, + "id": 66, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "551:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 67, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "554:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], - "id": 377, + "id": 68, "isConstant": false, "isInlineArray": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "lValueRequested": false, + "lValueRequested": true, "nodeType": "TupleExpression", - "src": "843:7:2", + "src": "547:9:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" } }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 71, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "571:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 72, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "574:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 73, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "577:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], "expression": { - "argumentTypes": null, - "id": 378, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "853:6:2", + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 69, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "559:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 70, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "step", + "nodeType": "MemberAccess", + "referencedDeclaration": 396, + "src": "559:11:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_function_internal_pure$_t_struct$_MagicSquare_$245_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$bound_to$_t_struct$_MagicSquare_$245_memory_ptr_$", + "typeString": "function (struct SquareLib.MagicSquare memory,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" } }, - "id": 379, + "id": 74, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "853:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "843:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "836:25:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 382, - "nodeType": "ExpressionStatement", - "src": "836:25:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 385, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 383, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "867:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 384, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 297, - "src": "875:1:2", + "names": [], + "nodeType": "FunctionCall", + "src": "559:20:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "547:32:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } }, - "src": "867:9:2", + "id": 76, + "nodeType": "ExpressionStatement", + "src": "547:32:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 57, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "522:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 58, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "527:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 386, - "nodeType": "ExpressionStatement", - "src": "867:9:2" - }, - { - "expression": { + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 387, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "890:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 388, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "896:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 389, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "902:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 390, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "889:19:2", - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" - } - }, - "functionReturnParameters": 305, - "id": 391, - "nodeType": "Return", - "src": "882:26:2" - } - ] - }, - "documentation": null, - "id": 393, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "step", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 298, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 291, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "409:25:2", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 290, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 242, - "src": "409:11:2", + "id": 59, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12, + "src": "531:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 293, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "440:9:2", - "stateVariable": false, - "storageLocation": "default", + "src": "527:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 292, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "440:7:2", + } + }, + "src": "522:10:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 78, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 55, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 53, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "515:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 295, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "455:9:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "31", + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "519:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "515:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 294, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "455:7:2", + } + }, + "id": 56, + "nodeType": "ExpressionStatement", + "src": "515:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "534:3:0", + "subExpression": { + "argumentTypes": null, + "id": 62, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "534:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 297, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "470:9:2", - "stateVariable": false, - "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 296, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "470:7:2", + } + }, + "id": 64, + "nodeType": "ExpressionStatement", + "src": "534:3:0" + }, + "nodeType": "ForStatement", + "src": "510:76:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 82, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 21, + "src": "602:6:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 79, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 428, + "src": "592:4:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_MagicSquare_$178", + "typeString": "contract MagicSquare" } }, - "value": null, - "visibility": "internal" + "id": 81, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "save", + "nodeType": "MemberAccess", + "referencedDeclaration": 177, + "src": "592:9:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_struct$_MagicSquare_$245_memory_ptr_$returns$__$", + "typeString": "function (struct SquareLib.MagicSquare memory) external" + }, + "name": "save", + "overloadedDeclarations": [] + }, + "id": 83, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "592:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "src": "403:80:2" + }, + "id": 84, + "nodeType": "ExpressionStatement", + "src": "592:17:0" }, - "returnParameters": { - "id": 305, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 300, - "name": "newX", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "526:12:2", - "stateVariable": false, - "storageLocation": "default", + { + "expression": { + "argumentTypes": null, + "id": 87, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 85, + "name": "storedGreeting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10, + "src": "615:14:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 299, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "526:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "66696e616c6c792c206120646563656e7472616c697a6564206d6167696320737175617265207365727669636521", + "id": 86, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "632:48:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_661078515cdf36a6c513369103f7a6474ac7bb28ddc3e305eb9bb79e1cb8e423", + "typeString": "literal_string \"finally, a decentralized magic square service!\"" }, - "value": null, - "visibility": "internal" + "value": "finally, a decentralized magic square service!" }, + "src": "615:65:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 88, + "nodeType": "ExpressionStatement", + "src": "615:65:0" + } + ] + }, + "documentation": null, + "id": 90, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "generateMagicSquare", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 13, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 12, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 90, + "src": "252:6:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 11, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "252:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "251:8:0" + }, + "returnParameters": { + "id": 14, + "nodeType": "ParameterList", + "parameters": [], + "src": "273:0:0" + }, + "scope": 178, + "src": "223:462:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "782:30:0", + "statements": [ + { + "assignments": [ + 96 + ], + "declarations": [ { "constant": false, - "id": 302, - "name": "newY", + "id": 96, + "name": "x", "nodeType": "VariableDeclaration", - "scope": 393, - "src": "546:12:2", + "scope": 168, + "src": "758:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9714,10 +14634,10 @@ "typeString": "uint256" }, "typeName": { - "id": 301, + "id": 95, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "546:7:2", + "src": "758:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9725,14 +14645,39 @@ }, "value": null, "visibility": "internal" - }, + } + ], + "id": 96, + "initialValue": null, + "nodeType": "Return", + "src": "788:19:0", + "expression": { + "argumentTypes": null, + "id": 95, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "795:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "functionReturnParameters": 94 + }, + { + "assignments": [ + 99 + ], + "declarations": [ { "constant": false, - "id": 304, - "name": "lastI", + "id": 99, + "name": "y", "nodeType": "VariableDeclaration", - "scope": 393, - "src": "566:13:2", + "scope": 168, + "src": "773:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9740,10 +14685,10 @@ "typeString": "uint256" }, "typeName": { - "id": 303, + "id": 98, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "566:7:2", + "src": "773:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9753,633 +14698,909 @@ "visibility": "internal" } ], - "src": "518:67:2" + "id": 100, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "773:9:0" }, - "scope": 394, - "src": "390:523:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "internal" - } - ], - "scope": 395 - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "library", - "documentation": null, - "fullyImplemented": true, - "id": 397, - "linearizedBaseContracts": [ - 397 - ], - "name": "SquareLib", - "nodeType": "ContractDefinition", - "nodes": [ - { - "canonicalName": "SquareLib.MagicSquare", - "id": 245, - "members": [ - { - "constant": false, - "id": 242, - "name": "rows", - "nodeType": "VariableDeclaration", - "scope": 245, - "src": "107:16:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 239, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "107:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 240, - "length": null, - "nodeType": "ArrayTypeName", - "src": "107:9:2", + { + "expression": { + "argumentTypes": null, + "id": 106, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 101, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "789:12:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } }, - "id": 241, - "length": null, - "nodeType": "ArrayTypeName", - "src": "107:11:2", + "id": 103, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "789:14:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 244, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 245, - "src": "129:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 243, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "129:7:2", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 104, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "806:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 105, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "806:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "name": "MagicSquare", - "nodeType": "StructDefinition", - "scope": 397, - "src": "82:61:2", - "visibility": "public" - }, - { - "body": { - "id": 291, - "nodeType": "Block", - "src": "242:177:2", - "statements": [ - { - "assignments": [ - 253 - ], - "declarations": [ - { - "constant": false, - "id": 253, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 291, - "src": "248:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 252, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "248:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 254, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "248:9:2" - }, - { + "src": "789:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 107, + "nodeType": "ExpressionStatement", + "src": "789:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 265, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "expression": { "argumentTypes": null, - "id": 255, - "name": "square", + "id": 108, + "name": "storedSquare", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "264:6:2", + "referencedDeclaration": 8, + "src": "820:12:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "id": 111, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "820:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 112, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "820:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 113, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "847:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 114, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "847:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "820:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 116, + "nodeType": "ExpressionStatement", + "src": "820:35:0" + }, + { + "body": { + "id": 166, + "nodeType": "Block", + "src": "893:154:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "arguments": [ - { + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "arguments": [ - { + "baseExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 261, - "name": "n", + "id": 128, + "name": "storedSquare", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "315:1:2", + "referencedDeclaration": 8, + "src": "901:12:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" } - ], - "id": 260, + }, + "id": 131, "isConstant": false, - "isLValue": false, - "isPure": true, + "isLValue": true, + "isPure": false, "lValueRequested": false, - "nodeType": "NewExpression", - "src": "299:15:2", + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "901:17:0", "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 257, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "303:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 258, - "length": null, - "nodeType": "ArrayTypeName", - "src": "303:9:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } - }, - "id": 259, - "length": null, - "nodeType": "ArrayTypeName", - "src": "303:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - } + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 132, + "indexExpression": { + "argumentTypes": null, + "id": 130, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "919:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 262, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "299:18:2", + "nodeType": "IndexAccess", + "src": "901:20:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } }, - { + "id": 133, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "901:27:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 263, - "name": "n", + "id": 134, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "328:1:2", + "referencedDeclaration": 92, + "src": "931:6:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } - ], - "id": 256, - "name": "MagicSquare", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 245, - "src": "273:11:2", + }, + "id": 135, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "931:8:0", "typeDescriptions": { - "typeIdentifier": "t_type$_t_struct$_MagicSquare_$245_storage_ptr_$", - "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 264, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "structConstructorCall", - "lValueRequested": false, - "names": [ - "rows", - "n" - ], - "nodeType": "FunctionCall", - "src": "273:63:2", + "src": "901:38:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "src": "264:72:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 266, - "nodeType": "ExpressionStatement", - "src": "264:72:2" - }, - { - "body": { - "id": 289, - "nodeType": "Block", - "src": "367:48:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 287, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "901:38:0" + }, + { + "body": { + "id": 164, + "nodeType": "Block", + "src": "979:62:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "baseExpression": { + "id": 162, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 277, - "name": "square", + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 149, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "989:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 153, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "989:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 154, + "indexExpression": { + "argumentTypes": null, + "id": 151, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "1007:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "989:20:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" + } + }, + "id": 155, + "indexExpression": { + "argumentTypes": null, + "id": 152, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "375:6:2", + "referencedDeclaration": 99, + "src": "1010:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 280, "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "375:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 281, - "indexExpression": { - "argumentTypes": null, - "id": 279, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "387:1:2", + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "989:23:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "375:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "arguments": [ - { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "id": 285, - "name": "n", + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 156, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "1015:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 157, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 234, + "src": "1015:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 159, + "indexExpression": { + "argumentTypes": null, + "id": 158, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "1027:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1015:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 161, + "indexExpression": { + "argumentTypes": null, + "id": 160, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "406:1:2", + "referencedDeclaration": 99, + "src": "1030:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 284, + }, "isConstant": false, - "isLValue": false, - "isPure": true, + "isLValue": true, + "isPure": false, "lValueRequested": false, - "nodeType": "NewExpression", - "src": "392:13:2", + "nodeType": "IndexAccess", + "src": "1015:17:0", "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory)" - }, - "typeName": { - "baseType": { - "id": 282, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "396:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 283, - "length": null, - "nodeType": "ArrayTypeName", - "src": "396:9:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 286, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "392:16:2", + "src": "989:43:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "375:33:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 288, - "nodeType": "ExpressionStatement", - "src": "375:33:2" - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 273, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 271, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "355:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 163, + "nodeType": "ExpressionStatement", + "src": "989:43:0" + } + ] }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { + "condition": { "argumentTypes": null, - "id": 272, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "359:1:2", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - "src": "355:5:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 290, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 269, + }, + "id": 145, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "id": 267, - "name": "i", + "id": 142, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "348:1:2", + "referencedDeclaration": 99, + "src": "960:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { "argumentTypes": null, - "hexValue": "30", - "id": 268, + "expression": { + "argumentTypes": null, + "id": 143, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "964:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 144, "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", + "isLValue": true, + "isPure": false, "lValueRequested": false, - "nodeType": "Literal", - "src": "352:1:2", - "subdenomination": null, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "964:8:0", "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "src": "348:5:2", + "src": "960:12:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_bool", + "typeString": "bool" } }, - "id": 270, - "nodeType": "ExpressionStatement", - "src": "348:5:2" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 275, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "362:3:2", - "subExpression": { + "id": 165, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 138, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 99, + "src": "953:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 139, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "957:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "953:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 141, + "nodeType": "ExpressionStatement", + "src": "953:5:0" + }, + "loopExpression": { + "expression": { "argumentTypes": null, - "id": 274, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "362:1:2", + "id": 147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "974:3:0", + "subExpression": { + "argumentTypes": null, + "id": 146, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 99, + "src": "974:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 148, + "nodeType": "ExpressionStatement", + "src": "974:3:0" }, - "id": 276, - "nodeType": "ExpressionStatement", - "src": "362:3:2" + "nodeType": "ForStatement", + "src": "948:93:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 121, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "874:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 122, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "878:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 123, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 236, + "src": "878:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "874:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 167, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 117, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "867:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 118, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "871:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "867:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 120, + "nodeType": "ExpressionStatement", + "src": "867:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "888:3:0", + "subExpression": { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "888:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "nodeType": "ForStatement", - "src": "343:72:2" - } - ] - }, - "documentation": null, - "id": 292, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "initialize", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 248, - "nodeType": "ParameterList", - "parameters": [ + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 127, + "nodeType": "ExpressionStatement", + "src": "888:3:0" + }, + "nodeType": "ForStatement", + "src": "862:185:0" + } + ] + }, + "documentation": null, + "id": 98, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getSquare", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 92, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 169, + "src": "702:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 91, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 237, + "src": "702:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$237_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "707:2:0" + }, + "returnParameters": { + "id": 94, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 93, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 98, + "src": "743:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 92, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "743:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "742:37:0" + }, + "scope": 178, + "src": "689:123:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 176, + "nodeType": "Block", + "src": "880:299:0", + "statements": [ + { + "assignments": [ + 104 + ], + "declarations": [ { "constant": false, - "id": 247, - "name": "n", + "id": 104, + "name": "x", "nodeType": "VariableDeclaration", - "scope": 292, - "src": "167:9:2", + "scope": 176, + "src": "886:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10387,10 +15608,10 @@ "typeString": "uint256" }, "typeName": { - "id": 246, + "id": 103, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "167:7:2", + "src": "886:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10400,1345 +15621,2491 @@ "visibility": "internal" } ], - "src": "166:11:2" + "id": 105, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "886:9:0" }, - "returnParameters": { - "id": 251, - "nodeType": "ParameterList", - "parameters": [ + { + "assignments": [ + 107 + ], + "declarations": [ { "constant": false, - "id": 250, - "name": "square", + "id": 107, + "name": "y", "nodeType": "VariableDeclaration", - "scope": 292, - "src": "213:25:2", + "scope": 176, + "src": "901:9:0", "stateVariable": false, - "storageLocation": "memory", + "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, "typeName": { - "contractScope": null, - "id": 249, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "213:11:2", + "id": 106, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "901:7:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], - "src": "212:27:2" + "id": 108, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "901:9:0" }, - "scope": 397, - "src": "147:272:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "external" - }, - { - "body": { - "id": 395, - "nodeType": "Block", - "src": "621:325:2", - "statements": [ - { - "condition": { + { + "expression": { + "argumentTypes": null, + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 109, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "917:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 111, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "917:14:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 112, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "934:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 113, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "934:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "917:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 115, + "nodeType": "ExpressionStatement", + "src": "917:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 116, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "948:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } }, - "id": 316, + "id": 119, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "leftExpression": { + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "948:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 120, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "948:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 121, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "975:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 122, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "975:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "948:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 124, + "nodeType": "ExpressionStatement", + "src": "948:35:0" + }, + { + "body": { + "id": 174, + "nodeType": "Block", + "src": "1021:154:0", + "statements": [ + { + "expression": { "argumentTypes": null, - "baseExpression": { + "id": 144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "baseExpression": { + "expression": { "argumentTypes": null, - "expression": { + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 136, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1029:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } + }, + "id": 139, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1029:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 140, + "indexExpression": { "argumentTypes": null, - "id": 309, - "name": "square", + "id": 138, + "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "631:6:2", + "referencedDeclaration": 104, + "src": "1047:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 310, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "631:11:2", + "nodeType": "IndexAccess", + "src": "1029:20:0", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } }, - "id": 312, - "indexExpression": { + "id": 141, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1029:27:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 311, - "name": "x", + "id": 142, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "643:1:2", + "referencedDeclaration": 100, + "src": "1059:6:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, + "id": 143, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "631:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 314, - "indexExpression": { - "argumentTypes": null, - "id": 313, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "646:1:2", + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1059:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "631:17:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 315, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "652:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "631:22:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 352, - "nodeType": "IfStatement", - "src": "627:167:2", - "trueBody": { - "id": 351, - "nodeType": "Block", - "src": "655:139:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 325, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 317, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "663:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 324, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 320, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 318, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "671:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "32", - "id": 319, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "675:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" - }, - "value": "2" - }, - "src": "671:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 321, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "670:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 322, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "680:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 323, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "680:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "670:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "663:25:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 326, - "nodeType": "ExpressionStatement", - "src": "663:25:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 338, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 327, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "696:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 337, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 333, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 331, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 328, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "704:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 329, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "704:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 330, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "715:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "704:12:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { + }, + "src": "1029:38:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 145, + "nodeType": "ExpressionStatement", + "src": "1029:38:0" + }, + { + "body": { + "id": 172, + "nodeType": "Block", + "src": "1107:62:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 170, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "hexValue": "31", - "id": 332, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "719:1:2", - "subdenomination": null, + "id": 157, + "name": "storedSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1117:12:0", "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" + "typeIdentifier": "t_struct$_MagicSquare_$245_storage", + "typeString": "struct SquareLib.MagicSquare storage ref" + } }, - "src": "704:16:2", + "id": 161, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1117:17:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage", + "typeString": "uint256[] storage ref[] storage ref" + } + }, + "id": 162, + "indexExpression": { + "argumentTypes": null, + "id": 159, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1135:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1117:20:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" } - ], - "id": 334, + }, + "id": 163, + "indexExpression": { + "argumentTypes": null, + "id": 160, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1138:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "isConstant": false, - "isInlineArray": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "703:18:2", + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1117:23:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, - "expression": { + "baseExpression": { "argumentTypes": null, - "id": 335, - "name": "square", + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 164, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1143:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 165, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "1143:11:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 167, + "indexExpression": { + "argumentTypes": null, + "id": 166, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1155:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1143:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 169, + "indexExpression": { + "argumentTypes": null, + "id": 168, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "724:6:2", + "referencedDeclaration": 107, + "src": "1158:1:0", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 336, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "724:8:2", + "nodeType": "IndexAccess", + "src": "1143:17:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "703:29:2", + "src": "1117:43:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "696:36:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 339, - "nodeType": "ExpressionStatement", - "src": "696:36:2" + "id": 171, + "nodeType": "ExpressionStatement", + "src": "1117:43:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - { + "id": 153, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 150, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1088:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 344, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 340, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "740:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 343, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 341, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "748:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 342, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "752:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "748:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "740:13:2", + "id": 151, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1092:6:0", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 345, - "nodeType": "ExpressionStatement", - "src": "740:13:2" + "id": 152, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1092:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 346, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "769:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 347, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "775:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 348, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "781:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 349, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "768:19:2", + "src": "1088:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 173, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 146, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "1081:1:0", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "functionReturnParameters": 308, - "id": 350, - "nodeType": "Return", - "src": "761:26:2" - } - ] - } - }, - { - "expression": { - "argumentTypes": null, - "id": 361, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 353, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "800:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 357, + "hexValue": "30", + "id": 147, "isConstant": false, - "isLValue": true, - "isPure": false, + "isLValue": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "800:11:2", + "nodeType": "Literal", + "src": "1085:1:0", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" }, - "id": 358, - "indexExpression": { + "src": "1081:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 149, + "nodeType": "ExpressionStatement", + "src": "1081:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 155, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1102:3:0", + "subExpression": { "argumentTypes": null, - "id": 355, - "name": "x", + "id": 154, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "812:1:2", + "referencedDeclaration": 107, + "src": "1102:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "800:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 359, - "indexExpression": { - "argumentTypes": null, - "id": 356, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "815:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "800:17:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 156, + "nodeType": "ExpressionStatement", + "src": "1102:3:0" }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 360, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "820:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "nodeType": "ForStatement", + "src": "1076:93:0" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 132, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 129, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1002:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 130, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1006:6:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 131, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "1006:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1002:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 175, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "995:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "999:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "src": "800:21:2", + "value": "0" + }, + "src": "995:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "995:5:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1016:3:0", + "subExpression": { + "argumentTypes": null, + "id": 133, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1016:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 135, + "nodeType": "ExpressionStatement", + "src": "1016:3:0" + }, + "nodeType": "ForStatement", + "src": "990:185:0" + } + ] + }, + "documentation": null, + "id": 177, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "save", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 101, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 100, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 177, + "src": "830:35:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 99, + "name": "SquareLib.MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "830:21:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "829:37:0" + }, + "returnParameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [], + "src": "880:0:0" + }, + "scope": 178, + "src": "816:363:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 179, + "src": "88:1093:0" + } + ], + "src": "0:1182:0" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.0.9", + "updatedAt": "2019-05-16T17:59:03.210Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": {} + } + }, + { + "contractName": "Migrations", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "last_completed_migration", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { + "name": "completed", + "type": "uint256" + } + ], + "name": "setCompleted", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol\":{\"keccak256\":\"0xc167df84a157f070489992ba46387a783249b5c46b23194e98c379bb13d57d12\",\"urls\":[\"bzzr://a7802f03646845d1c1e27fd82bd8384bd330f025645b72a06eab3178c40297cc\"]}},\"version\":1}", + "bytecode": { + "bytes": "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820fd10a0b0c646daa7f5ee5eac53b76f2ba70ca857df1ac9142366169abaa138490029", + "linkReferences":[] + }, + "deployedBytecode": { + "bytes": "608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820fd10a0b0c646daa7f5ee5eac53b76f2ba70ca857df1ac9142366169abaa138490029", + "linkReferences": [] + }, + "sourceMap": "26:480:1:-;;;178:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;178:50:1;213:10;205:5;;:18;;;;;;;;;;;;;;;;;;26:480;;;;;;", + "deployedSourceMap": "26:480:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26:480:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;339:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;339:165:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;74:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;50:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;232:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;232:103:1;;;;;;;;;;;;;;;;;:::i;:::-;;339:165;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;401:19;434:11;401:45;;452:8;:21;;;474:24;;452:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;452:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;452:47:1;;;;168:1;143:26;339:165;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;232:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;321:9;294:24;:36;;;;143:26;232:103;:::o", + "source": "pragma solidity >=0.5.6;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", + "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "ast": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 235 + ] + }, + "id": 236, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 180, + "literals": [ + "solidity", + ">=", + "0.5", + ".6" + ], + "nodeType": "PragmaDirective", + "src": "0:24:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 235, + "linearizedBaseContracts": [ + 235 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 182, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 235, + "src": "50:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 181, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "50:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 184, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 235, + "src": "74:36:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 183, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "74:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 192, + "nodeType": "Block", + "src": "137:37:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 186, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 412, + "src": "147:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "147:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 188, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 182, + "src": "161:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "147:19:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 191, + "nodeType": "IfStatement", + "src": "143:26:1", + "trueBody": { + "id": 190, + "nodeType": "PlaceholderStatement", + "src": "168:1:1" + } + } + ] + }, + "documentation": null, + "id": 193, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 185, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:1" + }, + "src": "115:59:1", + "visibility": "internal" + }, + { + "body": { + "id": 201, + "nodeType": "Block", + "src": "199:29:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 196, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 182, + "src": "205:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 197, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 412, + "src": "213:3:1", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_magic_message", + "typeString": "msg" } }, - "id": 362, - "nodeType": "ExpressionStatement", - "src": "800:21:2" + "id": 198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "213:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "205:18:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 200, + "nodeType": "ExpressionStatement", + "src": "205:18:1" + } + ] + }, + "documentation": null, + "id": 202, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 194, + "nodeType": "ParameterList", + "parameters": [], + "src": "189:2:1" + }, + "returnParameters": { + "id": 195, + "nodeType": "ParameterList", + "parameters": [], + "src": "199:0:1" + }, + "scope": 235, + "src": "178:50:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 213, + "nodeType": "Block", + "src": "288:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 211, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 209, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "294:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 210, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 204, + "src": "321:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, + "src": "294:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 212, + "nodeType": "ExpressionStatement", + "src": "294:36:1" + } + ] + }, + "documentation": null, + "id": 214, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 207, + "modifierName": { + "argumentTypes": null, + "id": 206, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "277:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "277:10:1" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 204, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 214, + "src": "254:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 203, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "254:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "253:16:1" + }, + "returnParameters": { + "id": 208, + "nodeType": "ParameterList", + "parameters": [], + "src": "288:0:1" + }, + "scope": 235, + "src": "232:103:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 233, + "nodeType": "Block", + "src": "395:109:1", + "statements": [ + { + "assignments": [ + 222 + ], + "declarations": [ { - "expression": { + "constant": false, + "id": 222, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 233, + "src": "401:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 221, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 235, + "src": "401:10:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 226, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "id": 374, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 363, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "827:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 373, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 369, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 367, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 364, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "835:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 365, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "835:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 366, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "846:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "835:12:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 368, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "850:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "835:16:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 370, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "834:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 371, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "855:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 372, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "855:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "834:29:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "827:36:2", + "id": 224, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "434:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 223, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 235, + "src": "423:10:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$235_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "423:23:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "401:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 230, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "474:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "id": 375, - "nodeType": "ExpressionStatement", - "src": "827:36:2" - }, - { + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], "expression": { "argumentTypes": null, - "id": 384, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 376, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "869:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 383, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 379, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 377, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "877:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 378, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "881:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "877:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 380, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "876:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 381, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "886:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 382, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "886:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "876:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "869:25:2", + "id": 227, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 222, + "src": "452:8:1", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" } }, - "id": 385, - "nodeType": "ExpressionStatement", - "src": "869:25:2" + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 214, + "src": "452:21:1", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } }, - { + "id": 231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "452:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 232, + "nodeType": "ExpressionStatement", + "src": "452:47:1" + } + ] + }, + "documentation": null, + "id": 234, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 219, + "modifierName": { + "argumentTypes": null, + "id": 218, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "384:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "384:10:1" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 216, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 234, + "src": "356:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 215, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "356:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "355:21:1" + }, + "returnParameters": { + "id": 220, + "nodeType": "ParameterList", + "parameters": [], + "src": "395:0:1" + }, + "scope": 235, + "src": "339:165:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 236, + "src": "26:480:1" + } + ], + "src": "0:507:1" + }, + "legacyAST": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 235 + ] + }, + "id": 236, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 180, + "literals": [ + "solidity", + ">=", + "0.5", + ".6" + ], + "nodeType": "PragmaDirective", + "src": "0:24:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 235, + "linearizedBaseContracts": [ + 235 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 182, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 235, + "src": "50:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 181, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "50:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 184, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 235, + "src": "74:36:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 183, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "74:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 192, + "nodeType": "Block", + "src": "137:37:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 388, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 386, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "900:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 387, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "908:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "900:9:2", + "id": 186, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 412, + "src": "147:3:1", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_magic_message", + "typeString": "msg" } }, - "id": 389, - "nodeType": "ExpressionStatement", - "src": "900:9:2" + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "147:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } }, - { - "expression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 390, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "923:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 391, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "929:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 392, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "935:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 393, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "922:19:2", + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 188, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 182, + "src": "161:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "147:19:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 191, + "nodeType": "IfStatement", + "src": "143:26:1", + "trueBody": { + "id": 190, + "nodeType": "PlaceholderStatement", + "src": "168:1:1" + } + } + ] + }, + "documentation": null, + "id": 193, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 185, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:1" + }, + "src": "115:59:1", + "visibility": "internal" + }, + { + "body": { + "id": 201, + "nodeType": "Block", + "src": "199:29:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 196, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 182, + "src": "205:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 197, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 412, + "src": "213:3:1", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_magic_message", + "typeString": "msg" } }, - "functionReturnParameters": 308, - "id": 394, - "nodeType": "Return", - "src": "915:26:2" - } - ] - }, - "documentation": null, - "id": 396, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "step", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 301, - "nodeType": "ParameterList", - "parameters": [ + "id": 198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "213:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "205:18:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 200, + "nodeType": "ExpressionStatement", + "src": "205:18:1" + } + ] + }, + "documentation": null, + "id": 202, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 194, + "nodeType": "ParameterList", + "parameters": [], + "src": "189:2:1" + }, + "returnParameters": { + "id": 195, + "nodeType": "ParameterList", + "parameters": [], + "src": "199:0:1" + }, + "scope": 235, + "src": "178:50:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 213, + "nodeType": "Block", + "src": "288:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 211, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 209, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "294:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 210, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 204, + "src": "321:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "294:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 212, + "nodeType": "ExpressionStatement", + "src": "294:36:1" + } + ] + }, + "documentation": null, + "id": 214, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 207, + "modifierName": { + "argumentTypes": null, + "id": 206, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "277:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "277:10:1" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 204, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 214, + "src": "254:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 203, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "254:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "253:16:1" + }, + "returnParameters": { + "id": 208, + "nodeType": "ParameterList", + "parameters": [], + "src": "288:0:1" + }, + "scope": 235, + "src": "232:103:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 233, + "nodeType": "Block", + "src": "395:109:1", + "statements": [ + { + "assignments": [ + 222 + ], + "declarations": [ { "constant": false, - "id": 294, - "name": "square", + "id": 222, + "name": "upgraded", "nodeType": "VariableDeclaration", - "scope": 396, - "src": "442:25:2", + "scope": 233, + "src": "401:19:1", "stateVariable": false, - "storageLocation": "memory", + "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" }, "typeName": { "contractScope": null, - "id": 293, - "name": "MagicSquare", + "id": 221, + "name": "Migrations", "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "442:11:2", + "referencedDeclaration": 235, + "src": "401:10:1", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" } }, "value": null, "visibility": "internal" - }, - { - "constant": false, - "id": 296, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "473:9:2", - "stateVariable": false, - "storageLocation": "default", + } + ], + "id": 226, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 224, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "434:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 223, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 235, + "src": "423:10:1", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 295, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "473:7:2", + "typeIdentifier": "t_type$_t_contract$_Migrations_$235_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "423:23:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "401:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 230, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "474:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 227, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 222, + "src": "452:8:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$235", + "typeString": "contract Migrations" + } }, - "value": null, - "visibility": "internal" + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 214, + "src": "452:21:1", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } }, - { - "constant": false, - "id": 298, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "488:9:2", - "stateVariable": false, - "storageLocation": "default", + "id": 231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "452:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 232, + "nodeType": "ExpressionStatement", + "src": "452:47:1" + } + ] + }, + "documentation": null, + "id": 234, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 219, + "modifierName": { + "argumentTypes": null, + "id": 218, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "384:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "384:10:1" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 216, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 234, + "src": "356:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 215, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "356:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "355:21:1" + }, + "returnParameters": { + "id": 220, + "nodeType": "ParameterList", + "parameters": [], + "src": "395:0:1" + }, + "scope": 235, + "src": "339:165:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 236, + "src": "26:480:1" + } + ], + "src": "0:507:1" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.0.9", + "updatedAt": "2019-05-16T17:59:03.216Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": {} + } + }, + { + "contractName": "SquareLib", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "n", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [ + { + "components": [ + { + "name": "rows", + "type": "uint256[][]" + }, + { + "name": "n", + "type": "uint256" + } + ], + "name": "square", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":\"SquareLib\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol\":{\"keccak256\":\"0xfdd57b714a8ab00ba37fb6875091322e9b014a4ee1df170527a75d3ee8d54add\",\"urls\":[\"bzzr://b62f57a3f7326bfc9025f266d1f9d4e52947adc0e25927b6ea790b5dbae75713\"]}},\"version\":1}", + "bytecode": { + "bytes": "6103b6610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063fe4b84df1461003a575b600080fd5b610054600480360361004f9190810190610159565b61006a565b60405161006191906102cd565b60405180910390f35b61007261012a565b60006040518060400160405280846040519080825280602002602001820160405280156100b357816020015b606081526020019060019003908161009e5790505b508152602001848152509150600090505b8281101561012457826040519080825280602002602001820160405280156100fb5781602001602082028038833980820191505090505b508260000151828151811061010c57fe5b602002602001018190525080806001019150506100c4565b50919050565b604051806040016040528060608152602001600081525090565b60008135905061015381610365565b92915050565b60006020828403121561016b57600080fd5b600061017984828501610144565b91505092915050565b600061018e8383610223565b905092915050565b60006101a283836102be565b60208301905092915050565b60006101b982610309565b6101c38185610339565b9350836020820285016101d5856102ef565b8060005b8581101561021157848403895281516101f28582610182565b94506101fd8361031f565b925060208a019950506001810190506101d9565b50829750879550505050505092915050565b600061022e82610314565b610238818561034a565b9350610243836102fc565b8060005b8381101561027457815161025b8882610196565b97506102668361032c565b925050600181019050610247565b5085935050505092915050565b6000604083016000830151848203600086015261029e82826101ae565b91505060208301516102b360208601826102be565b508091505092915050565b6102c78161035b565b82525050565b600060208201905081810360008301526102e78184610281565b905092915050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b61036e8161035b565b811461037957600080fd5b5056fea265627a7a72305820bdeb36fef4e4e60013e207952dbf47e7cc9299817cd78378be346bc9bb74dc916c6578706572696d656e74616cf50037", + "linkReferences": [] + }, + "deployedBytecode": { + "bytes": "73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063fe4b84df1461003a575b600080fd5b610054600480360361004f9190810190610159565b61006a565b60405161006191906102cd565b60405180910390f35b61007261012a565b60006040518060400160405280846040519080825280602002602001820160405280156100b357816020015b606081526020019060019003908161009e5790505b508152602001848152509150600090505b8281101561012457826040519080825280602002602001820160405280156100fb5781602001602082028038833980820191505090505b508260000151828151811061010c57fe5b602002602001018190525080806001019150506100c4565b50919050565b604051806040016040528060608152602001600081525090565b60008135905061015381610365565b92915050565b60006020828403121561016b57600080fd5b600061017984828501610144565b91505092915050565b600061018e8383610223565b905092915050565b60006101a283836102be565b60208301905092915050565b60006101b982610309565b6101c38185610339565b9350836020820285016101d5856102ef565b8060005b8581101561021157848403895281516101f28582610182565b94506101fd8361031f565b925060208a019950506001810190506101d9565b50829750879550505050505092915050565b600061022e82610314565b610238818561034a565b9350610243836102fc565b8060005b8381101561027457815161025b8882610196565b97506102668361032c565b925050600181019050610247565b5085935050505092915050565b6000604083016000830151848203600086015261029e82826101ae565b91505060208301516102b360208601826102be565b508091505092915050565b6102c78161035b565b82525050565b600060208201905081810360008301526102e78184610281565b905092915050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b61036e8161035b565b811461037957600080fd5b5056fea265627a7a72305820bdeb36fef4e4e60013e207952dbf47e7cc9299817cd78378be346bc9bb74dc916c6578706572696d656e74616cf50037", + "linkReferences": [] + }, + "sourceMap": "60:888:2:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", + "deployedSourceMap": "60:888:2:-;;;;;;;;;;;;;;;;;;;;;;;;147:272;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;213:25;;:::i;:::-;248:9;273:63;;;;;;;;315:1;299:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;273:63;;;;328:1;273:63;;;264:72;;352:1;348:5;;343:72;359:1;355;:5;343:72;;;406:1;392:16;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;392:16:2;;;;375:6;:11;;;387:1;375:14;;;;;;;;;;;;;:33;;;;362:3;;;;;;;343:72;;;147:272;;;;:::o;60:888::-;;;;;;;;;;;;;;;;;;;:::o;5:130:-1:-;;85:6;72:20;63:29;;97:33;124:5;97:33;;;57:78;;;;;142:241;;246:2;234:9;225:7;221:23;217:32;214:2;;;262:1;259;252:12;214:2;297:1;314:53;359:7;350:6;339:9;335:22;314:53;;;304:63;;276:97;208:175;;;;;391:257;;542:100;638:3;630:6;542:100;;;528:114;;521:127;;;;;657:189;;752:54;802:3;794:6;752:54;;;835:4;830:3;826:14;812:28;;745:101;;;;;889:1004;;1070:71;1135:5;1070:71;;;1154:105;1252:6;1247:3;1154:105;;;1147:112;;1282:3;1324:4;1316:6;1312:17;1307:3;1303:27;1351:73;1418:5;1351:73;;;1444:7;1472:1;1457:397;1482:6;1479:1;1476:13;1457:397;;;1544:9;1538:4;1534:20;1529:3;1522:33;1589:6;1583:13;1611:114;1720:4;1705:13;1611:114;;;1603:122;;1742:77;1812:6;1742:77;;;1732:87;;1842:4;1837:3;1833:14;1826:21;;1514:340;1504:1;1501;1497:9;1492:14;;1457:397;;;1461:14;1867:4;1860:11;;1884:3;1877:10;;1049:844;;;;;;;;;;1932:678;;2071:50;2115:5;2071:50;;;2134:84;2211:6;2206:3;2134:84;;;2127:91;;2239:52;2285:5;2239:52;;;2311:7;2339:1;2324:264;2349:6;2346:1;2343:13;2324:264;;;2416:6;2410:13;2437:71;2504:3;2489:13;2437:71;;;2430:78;;2525:56;2574:6;2525:56;;;2515:66;;2381:207;2371:1;2368;2364:9;2359:14;;2324:264;;;2328:14;2601:3;2594:10;;2050:560;;;;;;;;2685:664;;2850:4;2845:3;2841:14;2933:3;2926:5;2922:15;2916:22;2983:3;2977:4;2973:14;2967:3;2962;2958:13;2951:37;3003:149;3147:4;3133:12;3003:149;;;2995:157;;2870:294;3234:4;3227:5;3223:16;3217:23;3246:71;3311:4;3306:3;3302:14;3288:12;3246:71;;;3174:149;3340:4;3333:11;;2823:526;;;;;;3356:111;3437:24;3455:5;3437:24;;;3432:3;3425:37;3419:48;;;3474:389;;3656:2;3645:9;3641:18;3633:26;;3706:9;3700:4;3696:20;3692:1;3681:9;3677:17;3670:47;3731:122;3848:4;3839:6;3731:122;;;3723:130;;3627:236;;;;;3873:140;;4000:4;3992:6;3988:17;3977:28;;3968:45;;;;4026:119;;4132:4;4124:6;4120:17;4109:28;;4100:45;;;;4155:124;;4268:5;4262:12;4252:22;;4246:33;;;;4286:103;;4378:5;4372:12;4362:22;;4356:33;;;;4398:141;;4527:4;4519:6;4515:17;4504:28;;4496:43;;;;4550:120;;4658:4;4650:6;4646:17;4635:28;;4627:43;;;;4680:197;;4829:6;4824:3;4817:19;4866:4;4861:3;4857:14;4842:29;;4810:67;;;;;4886:176;;5014:6;5009:3;5002:19;5051:4;5046:3;5042:14;5027:29;;4995:67;;;;;5070:72;;5132:5;5121:16;;5115:27;;;;5149:117;5218:24;5236:5;5218:24;;;5211:5;5208:35;5198:2;;5257:1;5254;5247:12;5198:2;5192:74;", + "source": "pragma solidity >=0.5.6;\npragma experimental ABIEncoderV2;\n\nlibrary SquareLib {\n struct MagicSquare {\n uint256[][] rows;\n uint256 n;\n }\n\n function initialize(uint256 n)\n external\n pure\n returns (MagicSquare memory square)\n {\n uint256 i;\n\n square = MagicSquare({\n rows: new uint256[][](n),\n n: n\n });\n\n for (i = 0; i < n; i++) {\n square.rows[i] = new uint256[](n);\n }\n }\n\n function step(\n MagicSquare memory square,\n uint256 x,\n uint256 y,\n uint256 i\n )\n internal\n pure\n returns (\n uint256 newX,\n uint256 newY,\n uint256 lastI\n )\n {\n if (square.rows[x][y] != 0) {\n newX = (x + 2) % square.n;\n newY = (square.n + y - 1) % square.n;\n lastI = i - 1;\n return (newX, newY, lastI);\n }\n\n square.rows[x][y] = i;\n newX = (square.n + x - 1) % square.n;\n newY = (y + 1) % square.n;\n lastI = i;\n return (newX, newY, lastI);\n }\n}\n\n", + "sourcePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "ast": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "exportedSymbols": { + "SquareLib": [ + 397 + ] + }, + "id": 398, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 237, + "literals": [ + "solidity", + ">=", + "0.5", + ".6" + ], + "nodeType": "PragmaDirective", + "src": "0:24:2" + }, + { + "id": 238, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "25:33:2", + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "linearizedBaseContracts": [ + 394 + ], + "name": "SquareLib", + "nodes": [ + { + "canonicalName": "SquareLib.MagicSquare", + "id": 242, + "members": [ + { + "constant": false, + "id": 239, + "name": "rows", + "nodeType": "VariableDeclaration", + "scope": 242, + "src": "74:16:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 236, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "74:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 297, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "488:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" + } }, + "id": 237, + "length": null, + "nodeType": "ArrayTypeName", + "src": "74:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "id": 238, + "length": null, + "nodeType": "ArrayTypeName", + "src": "74:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 241, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 242, + "src": "96:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 240, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "96:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "MagicSquare", + "nodeType": "StructDefinition", + "scope": 394, + "src": "49:61:2", + "visibility": "public" + }, + { + "body": { + "id": 288, + "nodeType": "Block", + "src": "209:177:2", + "statements": [ + { + "assignments": [ + 250 + ], + "declarations": [ { "constant": false, - "id": 300, + "id": 250, "name": "i", "nodeType": "VariableDeclaration", - "scope": 396, - "src": "503:9:2", + "scope": 288, + "src": "215:9:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -11746,10 +18113,10 @@ "typeString": "uint256" }, "typeName": { - "id": 299, + "id": 249, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "503:7:2", + "src": "215:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11759,2140 +18126,4198 @@ "visibility": "internal" } ], - "src": "436:80:2" + "id": 251, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "215:9:2" }, - "returnParameters": { - "id": 308, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 303, - "name": "newX", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "559:12:2", - "stateVariable": false, - "storageLocation": "default", + { + "expression": { + "argumentTypes": null, + "id": 262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 252, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "231:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 302, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "559:7:2", + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 258, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "282:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 257, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "266:15:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 254, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "270:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 255, + "length": null, + "nodeType": "ArrayTypeName", + "src": "270:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "id": 256, + "length": null, + "nodeType": "ArrayTypeName", + "src": "270:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + } + }, + "id": 259, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "266:18:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + { + "argumentTypes": null, + "id": 260, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "295:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 253, + "name": "MagicSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 242, + "src": "240:11:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_type$_t_struct$_MagicSquare_$242_storage_ptr_$", + "typeString": "type(struct SquareLib.MagicSquare storage pointer)" } }, - "value": null, - "visibility": "internal" + "id": 261, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [ + "rows", + "n" + ], + "nodeType": "FunctionCall", + "src": "240:63:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - { - "constant": false, - "id": 305, - "name": "newY", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "579:12:2", - "stateVariable": false, - "storageLocation": "default", + "src": "231:72:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 263, + "nodeType": "ExpressionStatement", + "src": "231:72:2" + }, + { + "body": { + "id": 286, + "nodeType": "Block", + "src": "334:48:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 274, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "342:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 277, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 239, + "src": "342:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 278, + "indexExpression": { + "argumentTypes": null, + "id": 276, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "354:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "342:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 282, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "373:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "359:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 279, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "363:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 280, + "length": null, + "nodeType": "ArrayTypeName", + "src": "363:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "359:16:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "src": "342:33:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 285, + "nodeType": "ExpressionStatement", + "src": "342:33:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 270, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 268, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "322:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 304, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "579:7:2", + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 269, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "326:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "322:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 287, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 264, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "315:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 307, - "name": "lastI", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "599:13:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 265, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "319:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "315:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 306, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "599:7:2", + } + }, + "id": 267, + "nodeType": "ExpressionStatement", + "src": "315:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "329:3:2", + "subExpression": { + "argumentTypes": null, + "id": 271, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "329:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 273, + "nodeType": "ExpressionStatement", + "src": "329:3:2" + }, + "nodeType": "ForStatement", + "src": "310:72:2" + } + ] + }, + "documentation": null, + "id": 289, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "initialize", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 245, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 244, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "134:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 243, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "134:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "src": "551:67:2" - }, - "scope": 397, - "src": "423:523:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "internal" - } - ], - "scope": 398, - "src": "60:888:2" - } - ], - "src": "0:950:2" - }, - "legacyAST": { - "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", - "exportedSymbols": { - "SquareLib": [ - 397 - ] - }, - "id": 398, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 237, - "literals": [ - "solidity", - ">=", - "0.5", - ".6" - ], - "nodeType": "PragmaDirective", - "src": "0:24:2" + }, + "value": null, + "visibility": "internal" + } + ], + "src": "133:11:2" + }, + "returnParameters": { + "id": 248, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 247, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "180:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 246, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 242, + "src": "180:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "179:27:2" + }, + "scope": 394, + "src": "114:272:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" }, { - "id": 238, - "literals": [ - "experimental", - "ABIEncoderV2" - ], - "nodeType": "PragmaDirective", - "src": "25:33:2", - "baseContracts": [], - "contractDependencies": [], - "contractKind": "library", - "documentation": null, - "fullyImplemented": true, - "linearizedBaseContracts": [ - 394 - ], - "name": "SquareLib", - "nodes": [ - { - "canonicalName": "SquareLib.MagicSquare", - "id": 242, - "members": [ - { - "constant": false, - "id": 239, - "name": "rows", - "nodeType": "VariableDeclaration", - "scope": 242, - "src": "74:16:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 236, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "74:7:2", + "body": { + "id": 392, + "nodeType": "Block", + "src": "588:325:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 306, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "598:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 307, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 239, + "src": "598:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 309, + "indexExpression": { + "argumentTypes": null, + "id": 308, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "610:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 237, - "length": null, - "nodeType": "ArrayTypeName", - "src": "74:9:2", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "598:14:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" } }, - "id": 238, - "length": null, - "nodeType": "ArrayTypeName", - "src": "74:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 241, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 242, - "src": "96:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 240, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "96:7:2", + "id": 311, + "indexExpression": { + "argumentTypes": null, + "id": 310, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "613:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "598:17:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "name": "MagicSquare", - "nodeType": "StructDefinition", - "scope": 394, - "src": "49:61:2", - "visibility": "public" - }, - { - "body": { - "id": 288, - "nodeType": "Block", - "src": "209:177:2", - "statements": [ - { - "assignments": [ - 250 - ], - "declarations": [ - { - "constant": false, - "id": 250, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 288, - "src": "215:9:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 312, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "619:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "598:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 349, + "nodeType": "IfStatement", + "src": "594:167:2", + "trueBody": { + "id": 348, + "nodeType": "Block", + "src": "622:139:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 314, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "630:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 315, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "638:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 316, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "642:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "638:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 318, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "637:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 319, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "647:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 320, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "647:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "637:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "630:25:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 249, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "215:7:2", + } + }, + "id": 323, + "nodeType": "ExpressionStatement", + "src": "630:25:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 335, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 324, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "663:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "id": 251, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "215:9:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 262, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 252, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "231:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "arguments": [ - { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "arguments": [ + "components": [ { "argumentTypes": null, - "id": 258, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "282:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - ], - "id": 257, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "NewExpression", - "src": "266:15:2", - "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 254, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "270:7:2", + }, + "id": 330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 325, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "671:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 326, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "671:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 327, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "682:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 255, - "length": null, - "nodeType": "ArrayTypeName", - "src": "270:9:2", + "src": "671:12:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 256, - "length": null, - "nodeType": "ArrayTypeName", - "src": "270:11:2", + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 329, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "686:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "671:16:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } } - }, - "id": 259, + ], + "id": 331, "isConstant": false, + "isInlineArray": false, "isLValue": false, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "266:18:2", + "nodeType": "TupleExpression", + "src": "670:18:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, - "id": 260, - "name": "n", + "expression": { + "argumentTypes": null, + "id": 332, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "691:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 333, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "691:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "670:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "663:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 336, + "nodeType": "ExpressionStatement", + "src": "663:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 337, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "707:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 338, + "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "295:1:2", + "referencedDeclaration": 297, + "src": "715:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "719:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" }, - { + "value": "1" + }, + "src": "715:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "707:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 342, + "nodeType": "ExpressionStatement", + "src": "707:13:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 343, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "736:4:2", + "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - ], - "id": 253, - "name": "MagicSquare", + }, + { + "argumentTypes": null, + "id": 344, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "742:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 345, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "748:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 346, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "735:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 305, + "id": 347, + "nodeType": "Return", + "src": "728:26:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 350, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 242, - "src": "240:11:2", + "referencedDeclaration": 291, + "src": "767:6:2", "typeDescriptions": { - "typeIdentifier": "t_type$_t_struct$_MagicSquare_$242_storage_ptr_$", - "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 261, + "id": 354, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "structConstructorCall", "lValueRequested": false, - "names": [ - "rows", - "n" - ], - "nodeType": "FunctionCall", - "src": "240:63:2", + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 239, + "src": "767:11:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 355, + "indexExpression": { + "argumentTypes": null, + "id": 352, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "779:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "231:72:2", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "767:14:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" } }, - "id": 263, - "nodeType": "ExpressionStatement", - "src": "231:72:2" + "id": 356, + "indexExpression": { + "argumentTypes": null, + "id": 353, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "782:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "767:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "body": { - "id": 286, - "nodeType": "Block", - "src": "334:48:2", - "statements": [ + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 357, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 297, + "src": "787:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "767:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 359, + "nodeType": "ExpressionStatement", + "src": "767:21:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 360, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "794:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ { - "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "id": 284, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 364, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 274, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "342:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 277, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 239, - "src": "342:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 278, - "indexExpression": { + "expression": { "argumentTypes": null, - "id": 276, - "name": "i", + "id": 361, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "354:1:2", + "referencedDeclaration": 291, + "src": "802:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, + "id": 362, "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "342:14:2", + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "802:8:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 282, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "373:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 281, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "NewExpression", - "src": "359:13:2", - "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory)" - }, - "typeName": { - "baseType": { - "id": 279, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "363:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 280, - "length": null, - "nodeType": "ArrayTypeName", - "src": "363:9:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } - } - }, - "id": 283, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "359:16:2", + "id": 363, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "813:1:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "342:33:2", + "src": "802:12:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 365, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "817:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "802:16:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 367, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "801:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 368, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "822:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 369, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "822:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "801:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "794:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 372, + "nodeType": "ExpressionStatement", + "src": "794:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 381, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 373, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "836:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 380, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 374, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "844:1:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 285, - "nodeType": "ExpressionStatement", - "src": "342:33:2" + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "848:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "844:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 270, + ], + "id": 377, "isConstant": false, + "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 268, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "322:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { + "nodeType": "TupleExpression", + "src": "843:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 269, - "name": "n", + "id": 378, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 244, - "src": "326:1:2", + "referencedDeclaration": 291, + "src": "853:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "322:5:2", + "id": 379, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "853:8:2", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 287, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 266, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 264, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "315:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 265, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "319:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "315:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 267, - "nodeType": "ExpressionStatement", - "src": "315:5:2" + "src": "843:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "836:25:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 382, + "nodeType": "ExpressionStatement", + "src": "836:25:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 385, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 383, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "867:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 384, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 297, + "src": "875:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "867:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 386, + "nodeType": "ExpressionStatement", + "src": "867:9:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 387, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "890:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 272, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "329:3:2", - "subExpression": { - "argumentTypes": null, - "id": 271, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "329:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 273, - "nodeType": "ExpressionStatement", - "src": "329:3:2" + { + "argumentTypes": null, + "id": 388, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "896:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "nodeType": "ForStatement", - "src": "310:72:2" + { + "argumentTypes": null, + "id": 389, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "902:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 390, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "889:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 305, + "id": 391, + "nodeType": "Return", + "src": "882:26:2" + } + ] + }, + "documentation": null, + "id": 393, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "step", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 298, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 291, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "409:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 290, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 242, + "src": "409:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 293, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "440:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 292, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "440:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 295, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "455:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "455:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 297, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "470:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 296, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "470:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "403:80:2" + }, + "returnParameters": { + "id": 305, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "name": "newX", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "526:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 299, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "526:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "name": "newY", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "546:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 301, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "546:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 304, + "name": "lastI", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "566:13:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 303, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "566:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ] + }, + "value": null, + "visibility": "internal" + } + ], + "src": "518:67:2" + }, + "scope": 394, + "src": "390:523:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 395 + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 397, + "linearizedBaseContracts": [ + 397 + ], + "name": "SquareLib", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "SquareLib.MagicSquare", + "id": 245, + "members": [ + { + "constant": false, + "id": 242, + "name": "rows", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "107:16:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" }, - "documentation": null, - "id": 289, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "initialize", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 245, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 244, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 289, - "src": "134:9:2", - "stateVariable": false, - "storageLocation": "default", + "typeName": { + "baseType": { + "baseType": { + "id": 239, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "107:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 243, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "134:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "133:11:2" - }, - "returnParameters": { - "id": 248, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 247, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 289, - "src": "180:25:2", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 246, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 242, - "src": "180:11:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" + } + }, + "id": 240, + "length": null, + "nodeType": "ArrayTypeName", + "src": "107:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" } - ], - "src": "179:27:2" + }, + "id": 241, + "length": null, + "nodeType": "ArrayTypeName", + "src": "107:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } }, - "scope": 394, - "src": "114:272:2", - "stateMutability": "pure", - "superFunction": null, + "value": null, "visibility": "internal" }, { - "body": { - "id": 392, - "nodeType": "Block", - "src": "588:325:2", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 313, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 306, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "598:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 307, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 239, - "src": "598:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 309, - "indexExpression": { - "argumentTypes": null, - "id": 308, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "610:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "598:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 311, - "indexExpression": { - "argumentTypes": null, - "id": 310, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "613:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "598:17:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 312, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "619:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "598:22:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 349, - "nodeType": "IfStatement", - "src": "594:167:2", - "trueBody": { - "id": 348, - "nodeType": "Block", - "src": "622:139:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 322, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 314, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "630:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 321, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 317, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 315, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "638:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "32", - "id": 316, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "642:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" - }, - "value": "2" - }, - "src": "638:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 318, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "637:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 319, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "647:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 320, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "647:8:2", + "constant": false, + "id": 244, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "129:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 243, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "129:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "MagicSquare", + "nodeType": "StructDefinition", + "scope": 397, + "src": "82:61:2", + "visibility": "public" + }, + { + "body": { + "id": 291, + "nodeType": "Block", + "src": "242:177:2", + "statements": [ + { + "assignments": [ + 253 + ], + "declarations": [ + { + "constant": false, + "id": 253, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 291, + "src": "248:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 252, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "248:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 254, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "248:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 255, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "264:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 261, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "315:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "299:15:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 257, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "303:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "637:18:2", + "id": 258, + "length": null, + "nodeType": "ArrayTypeName", + "src": "303:9:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" } }, - "src": "630:25:2", + "id": 259, + "length": null, + "nodeType": "ArrayTypeName", + "src": "303:11:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" } - }, - "id": 323, - "nodeType": "ExpressionStatement", - "src": "630:25:2" + } + }, + "id": 262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "299:18:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + { + "argumentTypes": null, + "id": 263, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "328:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" }, { - "expression": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 256, + "name": "MagicSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 245, + "src": "273:11:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_MagicSquare_$245_storage_ptr_$", + "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [ + "rows", + "n" + ], + "nodeType": "FunctionCall", + "src": "273:63:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "src": "264:72:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 266, + "nodeType": "ExpressionStatement", + "src": "264:72:2" + }, + { + "body": { + "id": 289, + "nodeType": "Block", + "src": "367:48:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "id": 335, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "expression": { "argumentTypes": null, - "id": 324, - "name": "newY", + "id": 277, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "663:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 334, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 330, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 328, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 325, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "671:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 326, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "671:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 327, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "682:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "671:12:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 329, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "686:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "671:16:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 331, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "670:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 332, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "691:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 333, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "691:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "670:29:2", + "referencedDeclaration": 250, + "src": "375:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "663:36:2", + "id": 280, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "375:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 281, + "indexExpression": { + "argumentTypes": null, + "id": 279, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "387:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 336, - "nodeType": "ExpressionStatement", - "src": "663:36:2" + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "375:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } }, - { - "expression": { - "argumentTypes": null, - "id": 341, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "id": 337, - "name": "lastI", + "id": 285, + "name": "n", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "707:5:2", + "referencedDeclaration": 247, + "src": "406:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { + } + ], + "expression": { + "argumentTypes": [ + { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "id": 340, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 338, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 297, - "src": "715:1:2", + } + ], + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "392:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 282, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "396:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 339, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "719:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "715:5:2", + "id": 283, + "length": null, + "nodeType": "ArrayTypeName", + "src": "396:9:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" } - }, - "src": "707:13:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" } }, - "id": 342, - "nodeType": "ExpressionStatement", - "src": "707:13:2" + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "392:16:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "src": "375:33:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 288, + "nodeType": "ExpressionStatement", + "src": "375:33:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 271, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "355:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 272, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "359:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "355:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 290, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 267, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "348:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 268, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "352:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "348:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "348:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "362:3:2", + "subExpression": { + "argumentTypes": null, + "id": 274, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "362:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 276, + "nodeType": "ExpressionStatement", + "src": "362:3:2" + }, + "nodeType": "ForStatement", + "src": "343:72:2" + } + ] + }, + "documentation": null, + "id": 292, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "initialize", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 248, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 247, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 292, + "src": "167:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 246, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "167:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "166:11:2" + }, + "returnParameters": { + "id": 251, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 250, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 292, + "src": "213:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 249, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "213:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "212:27:2" + }, + "scope": 397, + "src": "147:272:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "external" + }, + { + "body": { + "id": 395, + "nodeType": "Block", + "src": "621:325:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 309, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "631:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 310, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "631:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 312, + "indexExpression": { + "argumentTypes": null, + "id": 311, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "643:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "631:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 314, + "indexExpression": { + "argumentTypes": null, + "id": 313, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "646:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "631:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 315, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "652:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "631:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 352, + "nodeType": "IfStatement", + "src": "627:167:2", + "trueBody": { + "id": 351, + "nodeType": "Block", + "src": "655:139:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 317, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "663:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, - "id": 343, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "736:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 344, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "742:4:2", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 345, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "748:5:2", + }, + "id": 320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 318, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "671:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 319, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "675:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "671:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], - "id": 346, + "id": 321, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", - "src": "735:19:2", + "src": "670:7:2", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "functionReturnParameters": 305, - "id": 347, - "nodeType": "Return", - "src": "728:26:2" - } - ] - } - }, - { - "expression": { - "argumentTypes": null, - "id": 358, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 350, + "id": 322, "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "767:6:2", + "referencedDeclaration": 294, + "src": "680:6:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 354, + "id": 323, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "rows", + "memberName": "n", "nodeType": "MemberAccess", - "referencedDeclaration": 239, - "src": "767:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 355, - "indexExpression": { - "argumentTypes": null, - "id": 352, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "779:1:2", + "referencedDeclaration": 244, + "src": "680:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "767:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 356, - "indexExpression": { - "argumentTypes": null, - "id": 353, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "782:1:2", + "src": "670:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "767:17:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 357, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 297, - "src": "787:1:2", + "src": "663:25:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "767:21:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 326, + "nodeType": "ExpressionStatement", + "src": "663:25:2" }, - "id": 359, - "nodeType": "ExpressionStatement", - "src": "767:21:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 371, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 360, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "794:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 370, + "id": 338, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { + "leftHandSide": { "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 366, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "id": 327, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "696:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 364, + "id": 333, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 361, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "802:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "id": 362, + "id": 331, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "802:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 363, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 293, - "src": "813:1:2", + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 328, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "704:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 329, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "704:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 330, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "715:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "704:12:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "802:12:2", + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "719:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "704:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 365, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "817:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "802:16:2", + } + ], + "id": 334, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "703:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 335, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "724:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } + }, + "id": 336, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "724:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 367, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "801:18:2", + }, + "src": "703:29:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { + "src": "696:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 339, + "nodeType": "ExpressionStatement", + "src": "696:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "expression": { + "id": 340, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "740:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "id": 368, - "name": "square", + "id": 341, + "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "822:6:2", + "referencedDeclaration": 300, + "src": "748:1:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 369, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "822:8:2", + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 342, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "752:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "748:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "801:29:2", + "src": "740:13:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "794:36:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 345, + "nodeType": "ExpressionStatement", + "src": "740:13:2" }, - "id": 372, - "nodeType": "ExpressionStatement", - "src": "794:36:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 381, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + { + "expression": { "argumentTypes": null, - "id": 373, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "836:4:2", + "components": [ + { + "argumentTypes": null, + "id": 346, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "769:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 347, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "775:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 348, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "781:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 349, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "768:19:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "functionReturnParameters": 308, + "id": 350, + "nodeType": "Return", + "src": "761:26:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 361, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "expression": { + "argumentTypes": null, + "id": 353, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "800:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - "id": 380, + "id": 357, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "leftExpression": { + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "800:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 358, + "indexExpression": { + "argumentTypes": null, + "id": 355, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "812:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "800:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 359, + "indexExpression": { + "argumentTypes": null, + "id": 356, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "815:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "800:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 360, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "820:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "800:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 362, + "nodeType": "ExpressionStatement", + "src": "800:21:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 374, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 363, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "827:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { "argumentTypes": null, - "components": [ - { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 369, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 376, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "expression": { "argumentTypes": null, - "id": 374, - "name": "y", + "id": 364, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 295, - "src": "844:1:2", + "referencedDeclaration": 294, + "src": "835:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 375, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "848:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "844:5:2", + "id": 365, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "835:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 366, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "846:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + }, + "src": "835:12:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 377, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "843:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { "argumentTypes": null, - "id": 378, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 291, - "src": "853:6:2", + "hexValue": "31", + "id": 368, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "850:1:2", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" }, - "id": 379, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 241, - "src": "853:8:2", + "src": "835:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "src": "843:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" } - }, - "src": "836:25:2", + ], + "id": 370, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "834:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 382, - "nodeType": "ExpressionStatement", - "src": "836:25:2" - }, - { - "expression": { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, - "id": 385, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 383, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "867:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "expression": { "argumentTypes": null, - "id": 384, - "name": "i", + "id": 371, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 297, - "src": "875:1:2", + "referencedDeclaration": 294, + "src": "855:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "867:9:2", + "id": 372, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "855:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 386, - "nodeType": "ExpressionStatement", - "src": "867:9:2" + "src": "834:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { + "src": "827:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 375, + "nodeType": "ExpressionStatement", + "src": "827:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 376, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "869:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 383, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, - "id": 387, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "890:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 388, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "896:4:2", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 389, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "902:5:2", + }, + "id": 379, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 377, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "877:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "881:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "877:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } - ], - "id": 390, + ], + "id": 380, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "876:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 381, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "886:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 382, "isConstant": false, - "isInlineArray": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "889:19:2", + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "886:8:2", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "functionReturnParameters": 305, - "id": 391, - "nodeType": "Return", - "src": "882:26:2" + "src": "876:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "869:25:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ] + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "869:25:2" }, - "documentation": null, - "id": 393, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "step", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 298, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 291, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "409:25:2", - "stateVariable": false, - "storageLocation": "memory", + { + "expression": { + "argumentTypes": null, + "id": 388, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 386, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "900:5:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 290, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 242, - "src": "409:11:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "constant": false, - "id": 293, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "440:9:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 387, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "908:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 292, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "440:7:2", + } + }, + "src": "900:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 389, + "nodeType": "ExpressionStatement", + "src": "900:9:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 390, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "923:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 295, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "455:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 294, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "455:7:2", + { + "argumentTypes": null, + "id": 391, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "929:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 297, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "470:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 296, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "470:7:2", + { + "argumentTypes": null, + "id": 392, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "935:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "value": null, - "visibility": "internal" + } + ], + "id": 393, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "922:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 308, + "id": 394, + "nodeType": "Return", + "src": "915:26:2" + } + ] + }, + "documentation": null, + "id": 396, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "step", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 301, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 294, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "442:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 293, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "442:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 296, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "473:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 295, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "473:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 298, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "488:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 297, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "488:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 300, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "503:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 299, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "503:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "436:80:2" + }, + "returnParameters": { + "id": 308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 303, + "name": "newX", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "559:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 302, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "559:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 305, + "name": "newY", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "579:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 304, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "579:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 307, + "name": "lastI", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "599:13:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 306, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "599:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "551:67:2" + }, + "scope": 397, + "src": "423:523:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 398, + "src": "60:888:2" + } + ], + "src": "0:950:2" + }, + "legacyAST": { + "absolutePath": "/Users/fainashalts/solidity-magic-square/contracts/SquareLib.sol", + "exportedSymbols": { + "SquareLib": [ + 397 + ] + }, + "id": 398, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 237, + "literals": [ + "solidity", + ">=", + "0.5", + ".6" + ], + "nodeType": "PragmaDirective", + "src": "0:24:2" + }, + { + "id": 238, + "literals": [ + "experimental", + "ABIEncoderV2" + ], + "nodeType": "PragmaDirective", + "src": "25:33:2", + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "linearizedBaseContracts": [ + 394 + ], + "name": "SquareLib", + "nodes": [ + { + "canonicalName": "SquareLib.MagicSquare", + "id": 242, + "members": [ + { + "constant": false, + "id": 239, + "name": "rows", + "nodeType": "VariableDeclaration", + "scope": 242, + "src": "74:16:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 236, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "74:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 237, + "length": null, + "nodeType": "ArrayTypeName", + "src": "74:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" } + }, + "id": 238, + "length": null, + "nodeType": "ArrayTypeName", + "src": "74:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 241, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 242, + "src": "96:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 240, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "96:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "MagicSquare", + "nodeType": "StructDefinition", + "scope": 394, + "src": "49:61:2", + "visibility": "public" + }, + { + "body": { + "id": 288, + "nodeType": "Block", + "src": "209:177:2", + "statements": [ + { + "assignments": [ + 250 ], - "src": "403:80:2" - }, - "returnParameters": { - "id": 305, - "nodeType": "ParameterList", - "parameters": [ + "declarations": [ { "constant": false, - "id": 300, - "name": "newX", + "id": 250, + "name": "i", "nodeType": "VariableDeclaration", - "scope": 393, - "src": "526:12:2", + "scope": 288, + "src": "215:9:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -13900,10 +22325,10 @@ "typeString": "uint256" }, "typeName": { - "id": 299, + "id": 249, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "526:7:2", + "src": "215:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -13911,687 +22336,2079 @@ }, "value": null, "visibility": "internal" + } + ], + "id": 251, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "215:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 252, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "231:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - { - "constant": false, - "id": 302, - "name": "newY", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "546:12:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 258, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "282:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 257, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "266:15:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 254, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "270:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 255, + "length": null, + "nodeType": "ArrayTypeName", + "src": "270:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "id": 256, + "length": null, + "nodeType": "ArrayTypeName", + "src": "270:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + } + }, + "id": 259, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "266:18:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + { + "argumentTypes": null, + "id": 260, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "295:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 253, + "name": "MagicSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 242, + "src": "240:11:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_MagicSquare_$242_storage_ptr_$", + "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + } + }, + "id": 261, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [ + "rows", + "n" + ], + "nodeType": "FunctionCall", + "src": "240:63:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "src": "231:72:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 263, + "nodeType": "ExpressionStatement", + "src": "231:72:2" + }, + { + "body": { + "id": 286, + "nodeType": "Block", + "src": "334:48:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 274, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "342:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 277, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 239, + "src": "342:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 278, + "indexExpression": { + "argumentTypes": null, + "id": 276, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "354:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "342:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 282, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "373:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "359:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 279, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "363:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 280, + "length": null, + "nodeType": "ArrayTypeName", + "src": "363:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "359:16:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "src": "342:33:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 285, + "nodeType": "ExpressionStatement", + "src": "342:33:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 270, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 268, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "322:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 301, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "546:7:2", + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 269, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 244, + "src": "326:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "322:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 287, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 264, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "315:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 304, - "name": "lastI", - "nodeType": "VariableDeclaration", - "scope": 393, - "src": "566:13:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 265, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "319:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "315:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 303, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "566:7:2", + } + }, + "id": 267, + "nodeType": "ExpressionStatement", + "src": "315:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "329:3:2", + "subExpression": { + "argumentTypes": null, + "id": 271, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "329:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 273, + "nodeType": "ExpressionStatement", + "src": "329:3:2" + }, + "nodeType": "ForStatement", + "src": "310:72:2" + } + ] + }, + "documentation": null, + "id": 289, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "initialize", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 245, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 244, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "134:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 243, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "134:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "src": "518:67:2" - }, - "scope": 394, - "src": "390:523:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "internal" - } - ], - "scope": 395 + }, + "value": null, + "visibility": "internal" + } + ], + "src": "133:11:2" + }, + "returnParameters": { + "id": 248, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 247, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "180:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 246, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 242, + "src": "180:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "179:27:2" + }, + "scope": 394, + "src": "114:272:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" }, { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "library", - "documentation": null, - "fullyImplemented": true, - "id": 397, - "linearizedBaseContracts": [ - 397 - ], - "name": "SquareLib", - "nodeType": "ContractDefinition", - "nodes": [ - { - "canonicalName": "SquareLib.MagicSquare", - "id": 245, - "members": [ - { - "constant": false, - "id": 242, - "name": "rows", - "nodeType": "VariableDeclaration", - "scope": 245, - "src": "107:16:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 239, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "107:7:2", + "body": { + "id": 392, + "nodeType": "Block", + "src": "588:325:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 306, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "598:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 307, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 239, + "src": "598:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 309, + "indexExpression": { + "argumentTypes": null, + "id": 308, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "610:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 240, - "length": null, - "nodeType": "ArrayTypeName", - "src": "107:9:2", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "598:14:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" } }, - "id": 241, - "length": null, - "nodeType": "ArrayTypeName", - "src": "107:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 244, - "name": "n", - "nodeType": "VariableDeclaration", - "scope": 245, - "src": "129:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 243, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "129:7:2", + "id": 311, + "indexExpression": { + "argumentTypes": null, + "id": 310, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "613:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "598:17:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "name": "MagicSquare", - "nodeType": "StructDefinition", - "scope": 397, - "src": "82:61:2", - "visibility": "public" - }, - { - "body": { - "id": 291, - "nodeType": "Block", - "src": "242:177:2", - "statements": [ - { - "assignments": [ - 253 - ], - "declarations": [ - { - "constant": false, - "id": 253, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 291, - "src": "248:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 312, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "619:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "598:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 349, + "nodeType": "IfStatement", + "src": "594:167:2", + "trueBody": { + "id": 348, + "nodeType": "Block", + "src": "622:139:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 314, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "630:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "typeName": { - "id": 252, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "248:7:2", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 315, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "638:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 316, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "642:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "638:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 318, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "637:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 319, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "647:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 320, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "647:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "637:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - } - ], - "id": 254, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "248:9:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 265, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 255, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "264:6:2", + "src": "630:25:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 323, + "nodeType": "ExpressionStatement", + "src": "630:25:2" + }, + { + "expression": { "argumentTypes": null, - "arguments": [ - { + "id": 335, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 324, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "663:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "arguments": [ + "components": [ { "argumentTypes": null, - "id": 261, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "315:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - ], - "id": 260, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "NewExpression", - "src": "299:15:2", - "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" - }, - "typeName": { - "baseType": { - "baseType": { - "id": 257, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "303:7:2", + }, + "id": 330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 325, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "671:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 326, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "671:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 258, - "length": null, - "nodeType": "ArrayTypeName", - "src": "303:9:2", + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 327, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "682:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "671:12:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 259, - "length": null, - "nodeType": "ArrayTypeName", - "src": "303:11:2", + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 329, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "686:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "671:16:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", - "typeString": "uint256[][]" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } } - }, - "id": 262, + ], + "id": 331, "isConstant": false, + "isInlineArray": false, "isLValue": false, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "299:18:2", + "nodeType": "TupleExpression", + "src": "670:18:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, - "id": 263, - "name": "n", + "expression": { + "argumentTypes": null, + "id": 332, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "691:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 333, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "691:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "670:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "663:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 336, + "nodeType": "ExpressionStatement", + "src": "663:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 337, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "707:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 338, + "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "328:1:2", + "referencedDeclaration": 297, + "src": "715:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "719:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" }, - { + "value": "1" + }, + "src": "715:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "707:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 342, + "nodeType": "ExpressionStatement", + "src": "707:13:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 343, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "736:4:2", + "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - ], - "id": 256, - "name": "MagicSquare", + }, + { + "argumentTypes": null, + "id": 344, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "742:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 345, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "748:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 346, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "735:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 305, + "id": 347, + "nodeType": "Return", + "src": "728:26:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 350, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 245, - "src": "273:11:2", + "referencedDeclaration": 291, + "src": "767:6:2", "typeDescriptions": { - "typeIdentifier": "t_type$_t_struct$_MagicSquare_$245_storage_ptr_$", - "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 264, + "id": 354, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "kind": "structConstructorCall", "lValueRequested": false, - "names": [ - "rows", - "n" - ], - "nodeType": "FunctionCall", - "src": "273:63:2", + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 239, + "src": "767:11:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 355, + "indexExpression": { + "argumentTypes": null, + "id": 352, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "779:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "264:72:2", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "767:14:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" } }, - "id": 266, - "nodeType": "ExpressionStatement", - "src": "264:72:2" + "id": 356, + "indexExpression": { + "argumentTypes": null, + "id": 353, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "782:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "767:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "body": { - "id": 289, - "nodeType": "Block", - "src": "367:48:2", - "statements": [ + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 357, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 297, + "src": "787:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "767:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 359, + "nodeType": "ExpressionStatement", + "src": "767:21:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 360, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "794:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ { - "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "id": 287, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 364, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftHandSide": { + "leftExpression": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 277, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 250, - "src": "375:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 280, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "375:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 281, - "indexExpression": { + "expression": { "argumentTypes": null, - "id": 279, - "name": "i", + "id": 361, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "387:1:2", + "referencedDeclaration": 291, + "src": "802:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, + "id": 362, "isConstant": false, "isLValue": true, "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "375:14:2", + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "802:8:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 285, - "name": "n", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "406:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 284, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "NewExpression", - "src": "392:13:2", - "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", - "typeString": "function (uint256) pure returns (uint256[] memory)" - }, - "typeName": { - "baseType": { - "id": 282, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "396:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 283, - "length": null, - "nodeType": "ArrayTypeName", - "src": "396:9:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } - } - }, - "id": 286, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "392:16:2", + "id": 363, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 293, + "src": "813:1:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "375:33:2", + "src": "802:12:2", "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 288, - "nodeType": "ExpressionStatement", - "src": "375:33:2" + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 365, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "817:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "802:16:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 273, + ], + "id": 367, "isConstant": false, + "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 271, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "355:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { + "nodeType": "TupleExpression", + "src": "801:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 272, - "name": "n", + "id": 368, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 247, - "src": "359:1:2", + "referencedDeclaration": 291, + "src": "822:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "355:5:2", + "id": 369, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "822:8:2", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 290, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 269, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 267, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "348:1:2", - "typeDescriptions": { + "src": "801:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "794:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 372, + "nodeType": "ExpressionStatement", + "src": "794:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 381, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 373, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "836:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 380, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 268, + }, + "id": 376, "isConstant": false, "isLValue": false, - "isPure": true, - "kind": "number", + "isPure": false, "lValueRequested": false, - "nodeType": "Literal", - "src": "352:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" + "leftExpression": { + "argumentTypes": null, + "id": 374, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 295, + "src": "844:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "value": "0" - }, - "src": "348:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 270, - "nodeType": "ExpressionStatement", - "src": "348:5:2" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 275, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "362:3:2", - "subExpression": { - "argumentTypes": null, - "id": 274, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 253, - "src": "362:1:2", + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "848:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "844:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, + } + ], + "id": 377, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "843:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 378, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 291, + "src": "853:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 276, - "nodeType": "ExpressionStatement", - "src": "362:3:2" + "id": 379, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 241, + "src": "853:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "843:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "836:25:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 382, + "nodeType": "ExpressionStatement", + "src": "836:25:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 385, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 383, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "867:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 384, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 297, + "src": "875:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "867:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 386, + "nodeType": "ExpressionStatement", + "src": "867:9:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 387, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "890:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "nodeType": "ForStatement", - "src": "343:72:2" - } - ] - }, - "documentation": null, - "id": 292, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "initialize", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 248, - "nodeType": "ParameterList", - "parameters": [ + { + "argumentTypes": null, + "id": 388, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "896:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 389, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "902:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 390, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "889:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 305, + "id": 391, + "nodeType": "Return", + "src": "882:26:2" + } + ] + }, + "documentation": null, + "id": 393, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "step", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 298, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 291, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "409:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 290, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 242, + "src": "409:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$242_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 293, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "440:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 292, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "440:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 295, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "455:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "455:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 297, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "470:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 296, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "470:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "403:80:2" + }, + "returnParameters": { + "id": 305, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "name": "newX", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "526:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 299, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "526:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "name": "newY", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "546:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 301, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "546:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 304, + "name": "lastI", + "nodeType": "VariableDeclaration", + "scope": 393, + "src": "566:13:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 303, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "566:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "518:67:2" + }, + "scope": 394, + "src": "390:523:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 395 + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 397, + "linearizedBaseContracts": [ + 397 + ], + "name": "SquareLib", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "SquareLib.MagicSquare", + "id": 245, + "members": [ + { + "constant": false, + "id": 242, + "name": "rows", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "107:16:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 239, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "107:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 240, + "length": null, + "nodeType": "ArrayTypeName", + "src": "107:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "id": 241, + "length": null, + "nodeType": "ArrayTypeName", + "src": "107:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 244, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "129:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 243, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "129:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "MagicSquare", + "nodeType": "StructDefinition", + "scope": 397, + "src": "82:61:2", + "visibility": "public" + }, + { + "body": { + "id": 291, + "nodeType": "Block", + "src": "242:177:2", + "statements": [ + { + "assignments": [ + 253 + ], + "declarations": [ { "constant": false, - "id": 247, - "name": "n", + "id": 253, + "name": "i", "nodeType": "VariableDeclaration", - "scope": 292, - "src": "167:9:2", + "scope": 291, + "src": "248:9:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -14599,1550 +24416,2060 @@ "typeString": "uint256" }, "typeName": { - "id": 246, + "id": 252, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "167:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "166:11:2" - }, - "returnParameters": { - "id": 251, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 250, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 292, - "src": "213:25:2", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 249, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "213:11:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "212:27:2" - }, - "scope": 397, - "src": "147:272:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "external" - }, - { - "body": { - "id": 395, - "nodeType": "Block", - "src": "621:325:2", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 316, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 309, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "631:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 310, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "rows", - "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "631:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 312, - "indexExpression": { - "argumentTypes": null, - "id": 311, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "643:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "631:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 314, - "indexExpression": { - "argumentTypes": null, - "id": 313, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "646:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "631:17:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "!=", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 315, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "652:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "631:22:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 352, - "nodeType": "IfStatement", - "src": "627:167:2", - "trueBody": { - "id": 351, - "nodeType": "Block", - "src": "655:139:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 325, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 317, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "663:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 324, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 320, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 318, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "671:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "32", - "id": 319, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "675:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" - }, - "value": "2" - }, - "src": "671:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 321, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "670:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 322, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "680:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 323, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "680:8:2", + "src": "248:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 254, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "248:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 255, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "264:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 261, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "315:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "299:15:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory[] memory)" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 257, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "303:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "670:18:2", + "id": 258, + "length": null, + "nodeType": "ArrayTypeName", + "src": "303:9:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" } }, - "src": "663:25:2", + "id": 259, + "length": null, + "nodeType": "ArrayTypeName", + "src": "303:11:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_storage_$dyn_storage_ptr", + "typeString": "uint256[][]" } - }, - "id": 326, - "nodeType": "ExpressionStatement", - "src": "663:25:2" + } + }, + "id": 262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "299:18:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + { + "argumentTypes": null, + "id": 263, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "328:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" }, { - "expression": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 256, + "name": "MagicSquare", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 245, + "src": "273:11:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_MagicSquare_$245_storage_ptr_$", + "typeString": "type(struct SquareLib.MagicSquare storage pointer)" + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [ + "rows", + "n" + ], + "nodeType": "FunctionCall", + "src": "273:63:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "src": "264:72:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 266, + "nodeType": "ExpressionStatement", + "src": "264:72:2" + }, + { + "body": { + "id": 289, + "nodeType": "Block", + "src": "367:48:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "id": 338, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "expression": { "argumentTypes": null, - "id": 327, - "name": "newY", + "id": 277, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "696:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 337, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 333, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 331, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 328, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "704:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 329, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "704:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 330, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "715:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "704:12:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 332, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "719:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "704:16:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "id": 334, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "703:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 335, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "724:6:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } - }, - "id": 336, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "724:8:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "703:29:2", + "referencedDeclaration": 250, + "src": "375:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "696:36:2", + "id": 280, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "375:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 281, + "indexExpression": { + "argumentTypes": null, + "id": 279, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "387:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 339, - "nodeType": "ExpressionStatement", - "src": "696:36:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 344, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "375:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "id": 340, - "name": "lastI", + "id": 285, + "name": "n", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "740:5:2", + "referencedDeclaration": 247, + "src": "406:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { + } + ], + "expression": { + "argumentTypes": [ + { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "id": 343, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 341, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "748:1:2", + } + ], + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "392:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 282, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "396:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 342, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "752:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "748:5:2", + "id": 283, + "length": null, + "nodeType": "ArrayTypeName", + "src": "396:9:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" } - }, - "src": "740:13:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" } }, - "id": 345, - "nodeType": "ExpressionStatement", - "src": "740:13:2" + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "392:16:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } }, - { - "expression": { - "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "id": 346, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "769:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, + "src": "375:33:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 288, + "nodeType": "ExpressionStatement", + "src": "375:33:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 271, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "355:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 272, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "359:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "355:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 290, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 267, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "348:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 268, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "352:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "348:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "348:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "362:3:2", + "subExpression": { + "argumentTypes": null, + "id": 274, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "362:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 276, + "nodeType": "ExpressionStatement", + "src": "362:3:2" + }, + "nodeType": "ForStatement", + "src": "343:72:2" + } + ] + }, + "documentation": null, + "id": 292, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "initialize", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 248, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 247, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 292, + "src": "167:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 246, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "167:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "166:11:2" + }, + "returnParameters": { + "id": 251, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 250, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 292, + "src": "213:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 249, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "213:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "212:27:2" + }, + "scope": 397, + "src": "147:272:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "external" + }, + { + "body": { + "id": 395, + "nodeType": "Block", + "src": "621:325:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 309, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "631:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 310, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "631:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 312, + "indexExpression": { + "argumentTypes": null, + "id": 311, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "643:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "631:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 314, + "indexExpression": { + "argumentTypes": null, + "id": 313, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "646:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "631:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 315, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "652:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "631:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 352, + "nodeType": "IfStatement", + "src": "627:167:2", + "trueBody": { + "id": 351, + "nodeType": "Block", + "src": "655:139:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 317, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "663:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ { "argumentTypes": null, - "id": 347, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "775:4:2", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 348, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "781:5:2", + }, + "id": 320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 318, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "671:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 319, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "675:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "671:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], - "id": 349, + "id": 321, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", - "src": "768:19:2", + "src": "670:7:2", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "functionReturnParameters": 308, - "id": 350, - "nodeType": "Return", - "src": "761:26:2" - } - ] - } - }, - { - "expression": { - "argumentTypes": null, - "id": 361, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, - "id": 353, + "id": 322, "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 294, - "src": "800:6:2", + "src": "680:6:2", "typeDescriptions": { "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", "typeString": "struct SquareLib.MagicSquare memory" } }, - "id": 357, + "id": 323, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberName": "rows", + "memberName": "n", "nodeType": "MemberAccess", - "referencedDeclaration": 242, - "src": "800:11:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", - "typeString": "uint256[] memory[] memory" - } - }, - "id": 358, - "indexExpression": { - "argumentTypes": null, - "id": 355, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "812:1:2", + "referencedDeclaration": 244, + "src": "680:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "800:14:2", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_memory", - "typeString": "uint256[] memory" - } - }, - "id": 359, - "indexExpression": { - "argumentTypes": null, - "id": 356, - "name": "y", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "815:1:2", + "src": "670:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "800:17:2", + "src": "663:25:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 360, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "820:1:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "800:21:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 326, + "nodeType": "ExpressionStatement", + "src": "663:25:2" }, - "id": 362, - "nodeType": "ExpressionStatement", - "src": "800:21:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 374, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 363, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "827:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 373, + "id": 338, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "leftExpression": { + "leftHandSide": { "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 369, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "id": 327, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "696:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 367, + "id": 333, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 328, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "704:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 329, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "704:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { "argumentTypes": null, - "id": 364, - "name": "square", + "id": 330, + "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "835:6:2", + "referencedDeclaration": 298, + "src": "715:1:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 365, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "835:8:2", + "src": "704:12:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", - "operator": "+", + "operator": "-", "rightExpression": { "argumentTypes": null, - "id": 366, - "name": "x", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 296, - "src": "846:1:2", + "hexValue": "31", + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "719:1:2", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" }, - "src": "835:12:2", + "src": "704:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 368, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "850:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "835:16:2", + } + ], + "id": 334, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "703:18:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 335, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "724:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } + }, + "id": 336, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "724:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 370, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "834:18:2", + }, + "src": "703:29:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { + "src": "696:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 339, + "nodeType": "ExpressionStatement", + "src": "696:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "expression": { + "id": 340, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "740:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "id": 371, - "name": "square", + "id": 341, + "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "855:6:2", + "referencedDeclaration": 300, + "src": "748:1:2", "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 372, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "855:8:2", + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 342, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "752:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "748:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "834:29:2", + "src": "740:13:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "827:36:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "id": 345, + "nodeType": "ExpressionStatement", + "src": "740:13:2" }, - "id": 375, - "nodeType": "ExpressionStatement", - "src": "827:36:2" - }, - { - "expression": { - "argumentTypes": null, - "id": 384, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { + { + "expression": { "argumentTypes": null, - "id": 376, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "869:4:2", + "components": [ + { + "argumentTypes": null, + "id": 346, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "769:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 347, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "775:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 348, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "781:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 349, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "768:19:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" } }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "functionReturnParameters": 308, + "id": 350, + "nodeType": "Return", + "src": "761:26:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 361, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "expression": { + "argumentTypes": null, + "id": 353, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "800:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } }, - "id": 383, + "id": 357, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "leftExpression": { + "memberName": "rows", + "nodeType": "MemberAccess", + "referencedDeclaration": 242, + "src": "800:11:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$dyn_memory_$dyn_memory", + "typeString": "uint256[] memory[] memory" + } + }, + "id": 358, + "indexExpression": { + "argumentTypes": null, + "id": 355, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "812:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "800:14:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory", + "typeString": "uint256[] memory" + } + }, + "id": 359, + "indexExpression": { + "argumentTypes": null, + "id": 356, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "815:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "800:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 360, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "820:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "800:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 362, + "nodeType": "ExpressionStatement", + "src": "800:21:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 374, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 363, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "827:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { "argumentTypes": null, - "components": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 379, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 369, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "id": 377, - "name": "y", + "id": 364, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 298, - "src": "877:1:2", + "referencedDeclaration": 294, + "src": "835:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "hexValue": "31", - "id": 378, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "881:1:2", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "877:5:2", + "id": 365, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "835:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 366, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 296, + "src": "846:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } + }, + "src": "835:12:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 380, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "876:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "%", - "rightExpression": { - "argumentTypes": null, - "expression": { + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { "argumentTypes": null, - "id": 381, - "name": "square", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 294, - "src": "886:6:2", + "hexValue": "31", + "id": 368, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "850:1:2", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare memory" - } + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" }, - "id": 382, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "n", - "nodeType": "MemberAccess", - "referencedDeclaration": 244, - "src": "886:8:2", + "src": "835:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - }, - "src": "876:18:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" } - }, - "src": "869:25:2", + ], + "id": 370, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "834:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 385, - "nodeType": "ExpressionStatement", - "src": "869:25:2" - }, - { - "expression": { + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { "argumentTypes": null, - "id": 388, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 386, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "900:5:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { + "expression": { "argumentTypes": null, - "id": 387, - "name": "i", + "id": 371, + "name": "square", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 300, - "src": "908:1:2", + "referencedDeclaration": 294, + "src": "855:6:2", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" } }, - "src": "900:9:2", + "id": 372, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "855:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 389, - "nodeType": "ExpressionStatement", - "src": "900:9:2" + "src": "834:29:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { + "src": "827:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 375, + "nodeType": "ExpressionStatement", + "src": "827:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 376, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "869:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 383, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, - "id": 390, - "name": "newX", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 303, - "src": "923:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 391, - "name": "newY", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 305, - "src": "929:4:2", - "typeDescriptions": { + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - }, - { - "argumentTypes": null, - "id": 392, - "name": "lastI", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 307, - "src": "935:5:2", + }, + "id": 379, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 377, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 298, + "src": "877:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "881:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "877:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } - } - ], - "id": 393, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "922:19:2", - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", - "typeString": "tuple(uint256,uint256,uint256)" - } - }, - "functionReturnParameters": 308, - "id": 394, - "nodeType": "Return", - "src": "915:26:2" - } - ] - }, - "documentation": null, - "id": 396, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "step", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 301, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 294, - "name": "square", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "442:25:2", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", - "typeString": "struct SquareLib.MagicSquare" - }, - "typeName": { - "contractScope": null, - "id": 293, - "name": "MagicSquare", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 245, - "src": "442:11:2", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", - "typeString": "struct SquareLib.MagicSquare" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 296, - "name": "x", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "473:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 295, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "473:7:2", + } + ], + "id": 380, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "876:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 298, - "name": "y", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "488:9:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 297, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "488:7:2", + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 381, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 294, + "src": "886:6:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare memory" + } + }, + "id": 382, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "n", + "nodeType": "MemberAccess", + "referencedDeclaration": 244, + "src": "886:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 300, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "503:9:2", - "stateVariable": false, - "storageLocation": "default", + "src": "876:18:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 299, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "503:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" + } + }, + "src": "869:25:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "src": "436:80:2" + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "869:25:2" }, - "returnParameters": { - "id": 308, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 303, - "name": "newX", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "559:12:2", - "stateVariable": false, - "storageLocation": "default", + { + "expression": { + "argumentTypes": null, + "id": 388, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 386, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "900:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 302, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "559:7:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" + } }, - { - "constant": false, - "id": 305, - "name": "newY", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "579:12:2", - "stateVariable": false, - "storageLocation": "default", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 387, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "908:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 304, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "579:7:2", + } + }, + "src": "900:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 389, + "nodeType": "ExpressionStatement", + "src": "900:9:2" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 390, + "name": "newX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 303, + "src": "923:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 307, - "name": "lastI", - "nodeType": "VariableDeclaration", - "scope": 396, - "src": "599:13:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 306, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "599:7:2", + { + "argumentTypes": null, + "id": 391, + "name": "newY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 305, + "src": "929:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "value": null, - "visibility": "internal" + { + "argumentTypes": null, + "id": 392, + "name": "lastI", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "935:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 393, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "922:19:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" } - ], - "src": "551:67:2" + }, + "functionReturnParameters": 308, + "id": 394, + "nodeType": "Return", + "src": "915:26:2" + } + ] + }, + "documentation": null, + "id": 396, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "step", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 301, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 294, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "442:25:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_memory_ptr", + "typeString": "struct SquareLib.MagicSquare" + }, + "typeName": { + "contractScope": null, + "id": 293, + "name": "MagicSquare", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 245, + "src": "442:11:2", + "typeDescriptions": { + "typeIdentifier": "t_struct$_MagicSquare_$245_storage_ptr", + "typeString": "struct SquareLib.MagicSquare" + } + }, + "value": null, + "visibility": "internal" }, - "scope": 397, - "src": "423:523:2", - "stateMutability": "pure", - "superFunction": null, - "visibility": "internal" - } - ], - "scope": 398, - "src": "60:888:2" + { + "constant": false, + "id": 296, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "473:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 295, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "473:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 298, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "488:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 297, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "488:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 300, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "503:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 299, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "503:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "436:80:2" + }, + "returnParameters": { + "id": 308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 303, + "name": "newX", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "559:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 302, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "559:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 305, + "name": "newY", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "579:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 304, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "579:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 307, + "name": "lastI", + "nodeType": "VariableDeclaration", + "scope": 396, + "src": "599:13:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 306, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "599:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "551:67:2" + }, + "scope": 397, + "src": "423:523:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" } ], - "src": "0:950:2" - }, - "compiler": { - "name": "solc", - "version": "0.5.8+commit.23d335f2.Emscripten.clang" - }, - "networks": {}, - "schemaVersion": "3.0.9", - "updatedAt": "2019-05-16T17:59:03.225Z", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} + "scope": 398, + "src": "60:888:2" } - } - ] - }, - "vyper": { - "sourceIndexes": [ - "/Users/fainashalts/truffle-six/testing2/contracts/VyperStorage.vy" - ], - "contracts": [ + ], + "src": "0:950:2" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.0.9", + "updatedAt": "2019-05-16T17:59:03.225Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": {} + } + } + ], + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + } + }, + { + "sourceIndexes": [ + "/Users/fainashalts/truffle-six/testing2/contracts/VyperStorage.vy" + ], + "contracts": [ + { + "contractName": "VyperStorage", + "abi": [ { - "contractName": "VyperStorage", - "abi": [ + "name": "set", + "outputs": [], + "inputs": [ { - "name": "set", - "outputs": [], - "inputs": [ - { - "type": "uint256", - "name": "new_value" - } - ], - "constant": false, - "payable": false, - "type": "function", - "gas": 35295 - }, + "type": "uint256", + "name": "new_value" + } + ], + "constant": false, + "payable": false, + "type": "function", + "gas": 35295 + }, + { + "name": "get", + "outputs": [ { - "name": "get", - "outputs": [ - { - "type": "uint256", - "name": "out" - } - ], - "inputs": [], - "constant": true, - "payable": false, - "type": "function", - "gas": 513 + "type": "uint256", + "name": "out" } ], - "bytecode": { - "bytes": "6100ed56600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526360fe47b160005114156100bd57602060046101403734156100b457600080fd5b61014051600055005b636d4ce63c60005114156100e35734156100d657600080fd5b60005460005260206000f3005b60006000fd5b6100046100ed036100046000396100046100ed036000f3", - "linkReferences": [] - }, - "deployedBytecode": { - "bytes": "600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526360fe47b160005114156100bd57602060046101403734156100b457600080fd5b61014051600055005b636d4ce63c60005114156100e35734156100d657600080fd5b60005460005260206000f3005b60006000fd", - "linkReferences": [] - }, - "source": "stored_data: uint256\n\n@public\ndef set(new_value : uint256):\n self.stored_data = new_value\n\n@public\n@constant\ndef get() -> uint256:\n return self.stored_data\n", - "sourcePath": "/Users/fainashalts/truffle-six/testing2/contracts/VyperStorage.vy", - "compiler": { - "name": "vyper", - "version": "0.1.0b10" - }, - "networks": {}, - "schemaVersion": "3.0.9", - "updatedAt": "2019-05-26T21:52:51.166Z" + "inputs": [], + "constant": true, + "payable": false, + "type": "function", + "gas": 513 } - ] + ], + "bytecode": { + "bytes": "6100ed56600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526360fe47b160005114156100bd57602060046101403734156100b457600080fd5b61014051600055005b636d4ce63c60005114156100e35734156100d657600080fd5b60005460005260206000f3005b60006000fd5b6100046100ed036100046000396100046100ed036000f3", + "linkReferences": [] + }, + "deployedBytecode": { + "bytes": "600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526360fe47b160005114156100bd57602060046101403734156100b457600080fd5b61014051600055005b636d4ce63c60005114156100e35734156100d657600080fd5b60005460005260206000f3005b60006000fd", + "linkReferences": [] + }, + "source": "stored_data: uint256\n\n@public\ndef set(new_value : uint256):\n self.stored_data = new_value\n\n@public\n@constant\ndef get() -> uint256:\n return self.stored_data\n", + "sourcePath": "/Users/fainashalts/truffle-six/testing2/contracts/VyperStorage.vy", + "compiler": { + "name": "vyper", + "version": "0.1.0b10" + }, + "networks": {}, + "schemaVersion": "3.0.9", + "updatedAt": "2019-05-26T21:52:51.166Z" } + ], + "compiler": { + "name": "vyper", + "version": "0.1.0b10" } + } + ] } From a48c882fd0828182755d8c8328ff9d74b20e9b08 Mon Sep 17 00:00:00 2001 From: fainashalts Date: Wed, 23 Sep 2020 08:30:48 -0700 Subject: [PATCH 6/9] Fix imports from compile-common --- packages/db/src/artifacts/json/resolvers.ts | 10 +++++++--- packages/db/src/artifacts/test/index.ts | 16 +++++++++++----- packages/db/src/db.ts | 4 ++-- packages/db/src/loaders/commands/compile.ts | 14 ++++++++------ .../src/loaders/resources/bytecodes/index.ts | 3 +-- .../src/loaders/resources/contracts/index.ts | 2 +- packages/db/src/loaders/schema/test/index.ts | 18 ++++++++++++------ .../db/src/workspace/test/bytecode.spec.ts | 4 ++-- .../db/src/workspace/test/contract.spec.ts | 4 ++-- .../workspace/test/contractInstance.spec.ts | 4 ++-- 10 files changed, 48 insertions(+), 31 deletions(-) diff --git a/packages/db/src/artifacts/json/resolvers.ts b/packages/db/src/artifacts/json/resolvers.ts index df3c995a73d..8b91c83e8c5 100644 --- a/packages/db/src/artifacts/json/resolvers.ts +++ b/packages/db/src/artifacts/json/resolvers.ts @@ -1,5 +1,5 @@ import * as fse from "fs-extra"; -import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; +import { Shims } from "@truffle/compile-common"; const TruffleResolver = require("@truffle/resolver"); @@ -23,8 +23,12 @@ export const resolvers = { const artifact = truffleResolver.require(name)._json; - const linkedBytecodeCreate = forBytecode(artifact.bytecode); - const linkedBytecodeCall = forBytecode(artifact.deployedBytecode); + const linkedBytecodeCreate = Shims.LegacyToNew.forBytecode( + artifact.bytecode + ); + const linkedBytecodeCall = Shims.LegacyToNew.forBytecode( + artifact.deployedBytecode + ); const result = { ...artifact, diff --git a/packages/db/src/artifacts/test/index.ts b/packages/db/src/artifacts/test/index.ts index 5514fc52f99..7be63871563 100644 --- a/packages/db/src/artifacts/test/index.ts +++ b/packages/db/src/artifacts/test/index.ts @@ -1,7 +1,7 @@ import path from "path"; import { TruffleDB } from "@truffle/db"; -import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import tmp from "tmp"; +import { Shims } from "@truffle/compile-common"; const fixturesDirectory = path.join( __dirname, // db/src/test @@ -160,8 +160,12 @@ describe("Artifacts queries", () => { callBytecode } = contract; expect(name).toEqual(Migrations.contractName); - expect(createBytecode).toEqual(forBytecode(Migrations.bytecode)); - expect(callBytecode).toEqual(forBytecode(Migrations.deployedBytecode)); + expect(createBytecode).toEqual( + Shims.LegacyToNew.forBytecode(Migrations.bytecode) + ); + expect(callBytecode).toEqual( + Shims.LegacyToNew.forBytecode(Migrations.deployedBytecode) + ); expect(processedSource).toHaveProperty("source"); const { source } = processedSource; @@ -237,9 +241,11 @@ describe("Artifacts queries", () => { const { bytecode } = callBytecode; const { bytes, linkReferences } = bytecode; - expect(bytes).toEqual(forBytecode(Migrations.deployedBytecode).bytes); + expect(bytes).toEqual( + Shims.LegacyToNew.forBytecode(Migrations.deployedBytecode).bytes + ); expect(linkReferences).toEqual( - forBytecode(Migrations.deployedBytecode).linkReferences + Shims.LegacyToNew.forBytecode(Migrations.deployedBytecode).linkReferences ); }); }); diff --git a/packages/db/src/db.ts b/packages/db/src/db.ts index 25e018f515e..d95b0a47097 100644 --- a/packages/db/src/db.ts +++ b/packages/db/src/db.ts @@ -1,9 +1,8 @@ import { GraphQLSchema, DocumentNode, parse, execute } from "graphql"; - import { schema } from "@truffle/db/data"; import { generateCompileLoad } from "@truffle/db/loaders/commands"; import { WorkspaceRequest } from "@truffle/db/loaders/types"; -import { WorkflowCompileResult } from "@truffle/compile-common/src/types"; +import { WorkflowCompileResult } from "@truffle/compile-common"; import { Workspace } from "@truffle/db/workspace"; interface IConfig { @@ -52,6 +51,7 @@ export class TruffleDB { }); let cur = saga.next(); + while (!cur.done) { // HACK not sure why this is necessary; TS knows we're not done, so // cur.value should only be WorkspaceRequest (first Generator param), diff --git a/packages/db/src/loaders/commands/compile.ts b/packages/db/src/loaders/commands/compile.ts index 68226d2fbcb..9f6528f15f8 100644 --- a/packages/db/src/loaders/commands/compile.ts +++ b/packages/db/src/loaders/commands/compile.ts @@ -1,11 +1,14 @@ import { CompilationData, - CompiledContract, toIdObject, WorkspaceRequest, WorkspaceResponse } from "@truffle/db/loaders/types"; -import { WorkflowCompileResult } from "@truffle/compile-common/src/types"; +import { + WorkflowCompileResult, + Compilation, + CompiledContract +} from "@truffle/compile-common/src/types"; import { generateBytecodesLoad } from "@truffle/db/loaders/resources/bytecodes"; import { generateCompilationsLoad } from "@truffle/db/loaders/resources/compilations"; @@ -110,10 +113,9 @@ function processResultCompilations( .map(processResultCompilation); } -function processResultCompilation({ - sourceIndexes, - contracts -}: WorkflowCompileResult["compilations"][string]): CompilationData { +function processResultCompilation(compilation: Compilation): CompilationData { + const { sourceIndexes, contracts } = compilation; + const contractsBySourcePath: { [sourcePath: string]: CompiledContract[]; } = contracts diff --git a/packages/db/src/loaders/resources/bytecodes/index.ts b/packages/db/src/loaders/resources/bytecodes/index.ts index de95505afb3..bf3771bebc0 100644 --- a/packages/db/src/loaders/resources/bytecodes/index.ts +++ b/packages/db/src/loaders/resources/bytecodes/index.ts @@ -1,12 +1,11 @@ import { CompilationData, - CompiledContract, toIdObject, LoadedBytecodes, WorkspaceRequest, WorkspaceResponse } from "@truffle/db/loaders/types"; - +import { CompiledContract } from "@truffle/compile-common"; import { AddBytecodes } from "./add.graphql"; export { AddBytecodes }; diff --git a/packages/db/src/loaders/resources/contracts/index.ts b/packages/db/src/loaders/resources/contracts/index.ts index 0c6bc1185e5..d0f50309b8f 100644 --- a/packages/db/src/loaders/resources/contracts/index.ts +++ b/packages/db/src/loaders/resources/contracts/index.ts @@ -1,10 +1,10 @@ import { - CompiledContract, LoadedBytecodes, IdObject, WorkspaceRequest, WorkspaceResponse } from "@truffle/db/loaders/types"; +import { CompiledContract } from "@truffle/compile-common"; import { AddContracts } from "./add.graphql"; export { AddContracts }; diff --git a/packages/db/src/loaders/schema/test/index.ts b/packages/db/src/loaders/schema/test/index.ts index da962ff288c..828c2dd9514 100644 --- a/packages/db/src/loaders/schema/test/index.ts +++ b/packages/db/src/loaders/schema/test/index.ts @@ -16,8 +16,8 @@ import Config from "@truffle/config"; import Ganache from "ganache-core"; import Web3 from "web3"; import * as fse from "fs-extra"; -import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import * as tmp from "tmp"; +import { Shims } from "@truffle/compile-common"; let server; const port = 8545; @@ -349,8 +349,10 @@ describe("Compilation", () => { sourcePath: contract["sourcePath"] }); sourceIds.push({ id: sourceId }); - const shimBytecodeObject = forBytecode(contract["bytecode"]); - const shimCallBytecodeObject = forBytecode( + const shimBytecodeObject = Shims.LegacyToNew.forBytecode( + contract["bytecode"] + ); + const shimCallBytecodeObject = Shims.LegacyToNew.forBytecode( contract["deployedBytecode"] ); let bytecodeId = generateId(shimBytecodeObject); @@ -619,7 +621,9 @@ describe("Compilation", () => { } } = await db.query(GetWorkspaceBytecode, bytecodeIds[index]); - let shimmedBytecode = forBytecode(artifacts[index].bytecode); + let shimmedBytecode = Shims.LegacyToNew.forBytecode( + artifacts[index].bytecode + ); expect(bytes).toEqual(shimmedBytecode.bytes); } }); @@ -683,10 +687,12 @@ describe("Compilation", () => { } } = await db.query(GetWorkspaceContract, contractIds[index]); - const artifactsCreateBytecode = forBytecode(artifacts[index].bytecode); + const artifactsCreateBytecode = Shims.LegacyToNew.forBytecode( + artifacts[index].bytecode + ); expect(createBytecode.bytes).toEqual(artifactsCreateBytecode.bytes); - const artifactsCallBytecode = forBytecode( + const artifactsCallBytecode = Shims.LegacyToNew.forBytecode( artifacts[index].deployedBytecode ); expect(callBytecode.bytes).toEqual(artifactsCallBytecode.bytes); diff --git a/packages/db/src/workspace/test/bytecode.spec.ts b/packages/db/src/workspace/test/bytecode.spec.ts index a4ae87c1b87..34db08f2624 100644 --- a/packages/db/src/workspace/test/bytecode.spec.ts +++ b/packages/db/src/workspace/test/bytecode.spec.ts @@ -1,6 +1,6 @@ import { generateId, Migrations, WorkspaceClient } from "./utils"; import { AddBytecode, GetAllBytecodes, GetBytecode } from "./bytecode.graphql"; -import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; +import { Shims } from "@truffle/compile-common"; describe("Bytecode", () => { let wsClient; @@ -9,7 +9,7 @@ describe("Bytecode", () => { beforeEach(async () => { wsClient = new WorkspaceClient(); - shimmedBytecode = forBytecode(Migrations.bytecode); + shimmedBytecode = Shims.LegacyToNew.forBytecode(Migrations.bytecode); expectedId = generateId(shimmedBytecode); addBytecodeResult = await wsClient.execute(AddBytecode, shimmedBytecode); }); diff --git a/packages/db/src/workspace/test/contract.spec.ts b/packages/db/src/workspace/test/contract.spec.ts index f2aded4ab13..79fec70eeca 100644 --- a/packages/db/src/workspace/test/contract.spec.ts +++ b/packages/db/src/workspace/test/contract.spec.ts @@ -1,5 +1,4 @@ import { generateId, Migrations, WorkspaceClient } from "./utils"; -import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import { AddSource } from "./source.graphql"; import { AddBytecode } from "./bytecode.graphql"; import { @@ -7,6 +6,7 @@ import { GetCompilationWithContracts } from "./compilation.graphql"; import { AddContracts, GetContract, GetAllContracts } from "./contract.graphql"; +import { Shims } from "@truffle/compile-common"; describe("Contract", () => { let wsClient; @@ -28,7 +28,7 @@ describe("Contract", () => { sourceId = sourceResult.sourcesAdd.sources[0].id; //add bytecode and get id - const shimmedBytecode = forBytecode(Migrations.bytecode); + const shimmedBytecode = Shims.LegacyToNew.forBytecode(Migrations.bytecode); const bytecodeResult = await wsClient.execute(AddBytecode, shimmedBytecode); bytecodeId = bytecodeResult.bytecodesAdd.bytecodes[0].id; diff --git a/packages/db/src/workspace/test/contractInstance.spec.ts b/packages/db/src/workspace/test/contractInstance.spec.ts index 0ead1242eaa..dd573ff2334 100644 --- a/packages/db/src/workspace/test/contractInstance.spec.ts +++ b/packages/db/src/workspace/test/contractInstance.spec.ts @@ -1,11 +1,11 @@ import { generateId, Migrations, WorkspaceClient } from "./utils"; -import { forBytecode } from "@truffle/compile-common/src/shims/LegacyToNew"; import { AddNetworks } from "./network.graphql"; import { AddContractInstances, GetContractInstance, GetAllContractInstances } from "./contractInstance.graphql"; +import { Shims } from "@truffle/compile-common"; describe("Contract Instance", () => { const wsClient = new WorkspaceClient(); @@ -26,7 +26,7 @@ describe("Contract Instance", () => { address: address, network: { id: addNetworkResult.networksAdd.networks[0].id } }); - let shimmedBytecode = forBytecode(Migrations.bytecode); + let shimmedBytecode = Shims.LegacyToNew.forBytecode(Migrations.bytecode); variables = [ { From 01dcabf3c66c04596055b38604637da43a14a0eb Mon Sep 17 00:00:00 2001 From: fainashalts Date: Wed, 23 Sep 2020 08:31:31 -0700 Subject: [PATCH 7/9] Remove CompiledContract type from db in favor of duplicate in compile-common --- packages/db/src/loaders/types.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/packages/db/src/loaders/types.ts b/packages/db/src/loaders/types.ts index 276f89533f4..68c53e1ef5f 100644 --- a/packages/db/src/loaders/types.ts +++ b/packages/db/src/loaders/types.ts @@ -1,23 +1,4 @@ -import { ContractObject } from "@truffle/contract-schema/spec"; - -// NOTE we do not use the regular ContractObject type here because -// @truffle/workflow-compile/new provides a different bytecode format than -// @truffle/contract-schema defines -export interface CompiledContract { - contractName: string; - abi: ContractObject["abi"]; - bytecode: DataModel.IBytecode; - deployedBytecode: DataModel.IBytecode; - sourceMap: string; - deployedSourceMap: string; - source: string; - sourcePath: string; - ast: object; - compiler: { - name: string; - version: string; - }; -} +import { CompiledContract } from "@truffle/compile-common"; export interface CompilationData { compiler: { From de3d74595b51199e706d161cbc9e518b6cf77ef6 Mon Sep 17 00:00:00 2001 From: fainashalts Date: Wed, 23 Sep 2020 08:33:38 -0700 Subject: [PATCH 8/9] Rework compile loading to reflect new workflow compile output --- .../db/src/loaders/schema/artifactsLoader.ts | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/db/src/loaders/schema/artifactsLoader.ts b/packages/db/src/loaders/schema/artifactsLoader.ts index 7f883e81ef3..bff7b268eef 100644 --- a/packages/db/src/loaders/schema/artifactsLoader.ts +++ b/packages/db/src/loaders/schema/artifactsLoader.ts @@ -1,6 +1,4 @@ import { TruffleDB } from "@truffle/db/db"; -import { WorkflowCompile } from "@truffle/workflow-compile"; -import { ContractObject } from "@truffle/contract-schema/spec"; import * as fse from "fs-extra"; import path from "path"; import Config from "@truffle/config"; @@ -15,6 +13,11 @@ import { AssignProjectNames, ResolveProjectName } from "@truffle/db/loaders/resources/projects"; +import { + WorkflowCompileResult, + CompiledContract +} from "@truffle/compile-common/src/types"; +import WorkflowCompile from "@truffle/workflow-compile"; type NetworkLinkObject = { [name: string]: string; @@ -84,24 +87,26 @@ export class ArtifactsLoader { } async load(): Promise { - const result = await WorkflowCompile.compile(this.config); + const result: WorkflowCompileResult = await WorkflowCompile.compile( + this.config + ); const { project, compilations } = await this.db.loadCompilations(result); //map contracts and contract instances to compiler await Promise.all( - compilations.map(async ({ id }) => { + compilations.map(async ({ id }, index) => { const { data: { workspace: { - compilation: { compiler, processedSources } + compilation: { processedSources } } } } = await this.db.query(GetCompilation, { id }); const networks = await this.loadNetworks( project.id, - result.compilations[compiler.name].contracts, + result.compilations[index].contracts, this.config["artifacts_directory"], this.config["contracts_directory"] ); @@ -110,10 +115,11 @@ export class ArtifactsLoader { .map(processedSource => processedSource.contracts) .flat(); - const contracts = result.compilations[ - compiler.name - ].contracts.map(({ contractName }) => - processedSourceContracts.find(({ name }) => name === contractName) + let contracts = []; + result.compilations[index].contracts.map(({ contractName }) => + contracts.push( + processedSourceContracts.find(({ name }) => name === contractName) + ) ); if (networks[0].length) { @@ -164,7 +170,7 @@ export class ArtifactsLoader { async loadNetworks( projectId: string, - contracts: Array, + contracts: Array, artifacts: string, workingDirectory: string ) { From 03c8e2b982db2235efe9255f6bf1d8484e763d40 Mon Sep 17 00:00:00 2001 From: fainashalts Date: Wed, 23 Sep 2020 08:57:32 -0700 Subject: [PATCH 9/9] Remove console.debug statement --- packages/db/src/artifacts/test/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/db/src/artifacts/test/index.ts b/packages/db/src/artifacts/test/index.ts index 7be63871563..0e2e7d07fe6 100644 --- a/packages/db/src/artifacts/test/index.ts +++ b/packages/db/src/artifacts/test/index.ts @@ -94,7 +94,6 @@ afterAll(() => { describe("Artifacts queries", () => { it("lists artifact contract names", async () => { const result = await db.query(GetContractNames); - console.debug("contract names result " + JSON.stringify(result)); expect(result).toHaveProperty("data"); const { data } = result;