Whoops! 😨 Something unexpected happened...
[Error Code: 1101] error caused by: 1 error occurred:
* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:
error: cannot deploy invalid contract
--> 61c4cca98b6f4d80acb387a3c7409fb717bfc338c1d26c2d87d26930ad58f6b8:4:3
|
4 | signer.contracts.add(name: name, code: code.decodeHex() )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: cannot find variable in this scope: `UFix64ToScaledUInt256`
--> 9829c926abe95d7c.SwapConfig:148:16
|
148 | let f = UFix64ToScaledUInt256(0.997);
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `UFix64ToScaledUInt256`
--> 9829c926abe95d7c.SwapConfig:149:18
|
149 | let r1s = UFix64ToScaledUInt256(r1)
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `UFix64ToScaledUInt256`
--> 9829c926abe95d7c.SwapConfig:150:18
|
150 | let r2s = UFix64ToScaledUInt256(r2)
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `UFix64ToScaledUInt256`
--> 9829c926abe95d7c.SwapConfig:151:22
|
151 | let B = r1s * UFix64ToScaledUInt256(1.997) / f;
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `UFix64ToScaledUInt256`
--> 9829c926abe95d7c.SwapConfig:153:29
|
153 | let C2 = r1s * r2s / UFix64ToScaledUInt256(t)
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error: cannot apply binary operation * to types: `Int`, `UInt256`
--> 9829c926abe95d7c.SwapConfig:154:46
|
154 | if (C1 < C2 || B * B / scaleFactor >= 4 * (C1-C2)*scaleFactor/f) {
| ^^^^^^^^^^^^^^^^^^^^^^^
error: cannot find variable in this scope: `sqrt`
--> 9829c926abe95d7c.SwapConfig:156:31
|
156 | if (C1 < C2) { D = sqrt(B * B / scaleFactor + 4 * (C2-C1)*scaleFactor/f) }
| ^^^^ not found in this scope
error: cannot apply binary operation * to types: `Int`, `UInt256`
--> 9829c926abe95d7c.SwapConfig:156:58
|
156 | if (C1 < C2) { D = sqrt(B * B / scaleFactor + 4 * (C2-C1)*scaleFactor/f) }
| ^^^^^^^^^^^^^^^^^^^^^^^
error: cannot find variable in this scope: `sqrt`
--> 9829c926abe95d7c.SwapConfig:157:23
|
157 | else { D = sqrt(B * B / scaleFactor - 4 * (C1-C2)*scaleFactor/f) }
| ^^^^ not found in this scope
error: cannot apply binary operation * to types: `Int`, `UInt256`
--> 9829c926abe95d7c.SwapConfig:157:50
|
157 | else { D = sqrt(B * B / scaleFactor - 4 * (C1-C2)*scaleFactor/f) }
| ^^^^^^^^^^^^^^^^^^^^^^^
error: cannot find variable in this scope: `ScaledUInt256ToUFix64`
--> 9829c926abe95d7c.SwapConfig:159:19
|
159 | return ScaledUInt256ToUFix64((D - B)/2)
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `sl`
--> 9829c926abe95d7c.SwapConfig:173:16
|
173 | plist = sl(plist, tokenInKey, tokenOutKey)
| ^^ not found in this scope
error: cannot find variable in this scope: `gtt`
--> 9829c926abe95d7c.SwapConfig:187:23
|
187 | ntot = gtt(t, sumrin, sumrout)
| ^^^ not found in this scope
error: cannot find variable in this scope: `getAmountOut`
--> 9829c926abe95d7c.SwapConfig:204:31
|
204 | let aout = getAmountOut(amountIn: ain, reserveIn: plist[j][tokenInKey]! as! UFix64, reserveOut: plist[j][tokenOutKey]! as! UFix64)
| ^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `sl`
--> 9829c926abe95d7c.SwapConfig:224:16
|
224 | plist = sl(plist, tokenInKey, tokenOutKey)
| ^^ not found in this scope
error: cannot find variable in this scope: `gtt`
--> 9829c926abe95d7c.SwapConfig:239:25
|
239 | nintot = gtt(t, sumrin, sumrout)
| ^^^ not found in this scope
error: cannot find variable in this scope: `getAmountOut`
--> 9829c926abe95d7c.SwapConfig:241:26
|
241 | nouttot = getAmountOut(amountIn: nintot, reserveIn: sumrin, reserveOut: sumrout);
| ^^^^^^^^^^^^ not found in this scope
error: cannot find variable in this scope: `getAmountIn`
--> 9829c926abe95d7c.SwapConfig:255:30
|
255 | let ain = getAmountIn(amountOut: aout, reserveIn: plist[j][tokenInKey]! as! UFix64, reserveOut: plist[j][tokenOutKey]! as! UFix64)
| ^^^^^^^^^^^ not found in this scope