caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

51 lines
1.1 KiB
JavaScript
Executable File

const format = require('../format-lines');
const { range } = require('../../helpers');
const LENGTHS = range(8, 256, 8).reverse(); // 248 → 8 (in steps of 8)
const header = `\
pragma solidity ^0.8.0;
import "../utils/math/SafeCast.sol";
`;
const toInt = length => `\
function toInt${length}(uint${length} a) public pure returns (int${length}) {
return a.toInt${length}();
}
`;
const toUint = length => `\
function toUint${length}(int${length} a) public pure returns (uint${length}) {
return a.toUint${length}();
}
`;
const toIntDownCast = length => `\
function toInt${length}(int256 a) public pure returns (int${length}) {
return a.toInt${length}();
}
`;
const toUintDownCast = length => `\
function toUint${length}(uint256 a) public pure returns (uint${length}) {
return a.toUint${length}();
}
`;
// GENERATE
module.exports = format(
header,
'contract SafeCastMock {',
[
'using SafeCast for uint256;',
'using SafeCast for int256;',
'',
toUint(256),
...LENGTHS.map(toUintDownCast),
toInt(256),
...LENGTHS.map(toIntDownCast),
].flatMap(fn => fn.split('\n')).slice(0, -1),
'}',
);