Skip to content

Commit

Permalink
improve code compare
Browse files Browse the repository at this point in the history
  • Loading branch information
rise1507 committed Jan 24, 2024
1 parent 1f82c9d commit ba432e8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CONTRACT-VERSIONS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
vesting-v0.98 - BETA (NOT FOR PRODUCTION)
code = 'b5ee9c7241021a010003ba000114ff00f4a413f4bcf2c80b01020120030203b8f28308d71820d31fd31fd31f02f823bbf264ed44d0d31fd31fd3ff305abaf2a15033baf2a202f9014033f910f2a3f800db3c20d74ac0018e99ed44ed45ed47915bed67ed65ed648e82db3ced41edf101f2ff9130e2f841a4f861db3c191413020148110402012008050201200706020db9846db3cdb3c819180129ba329db3cf845f846f847f848f849f84af84bf8448190201200e090201620d0a02016a0c0b012fa2c76cf3e9100723281f2fff2743e112040423d029be84c619000fa25fb513435c2c7e014bad346d9e36fc22470d4080847a4937d29910ce6903e9ff9837812801b7810148987159f318401902016e100f0019af1df6a26840106b90eb858fc00019adce76a26840206b90eb85ffc003b0d06c2220d749c160915be001d0d3030171b0915be0fa4030db3cf84b5210c7058eb401d31f018210a7733acdba8ea4d33fdb3c8210f7733acd01708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00915be2e30e19141201daf84a5210c7058ee201d31f0182107258a69bba8ed2d33f8e2afa407fc8ca0002fa4401c8ca07cbffc9d0f8441023810108f441f86420d74ac200209501d430d001deb3e6308210f258a69b01708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00db3c915be2915be2130066f848f847f846f845c8cb3fcb1fcb1fcb1ff849fa02f84acf16f84bcf16c9f844f843f842f841c8cb1fcb1fcbfff400ccc9ed54025cd307d4d1f823db3c20c2008e9b22c003f2e06421d0d303fa4031fa40f84a5220c705b3925f04e30d9130e201fb00181502e021fa4401c8ca07cbffc9d0f844810108f40a6fa1318f4b330172b0c002f2e06501fa003171d721fa0031fa0031d33f31d31f31d30001c000f2e066d3000193d430d0de01db3c8e17d31f302082104e73744bba01821047657424bab1f2e067e30e70925f03e220c2009372fb029130e2171600a420d749c2008e48d31f21c00022830bbab122811001bab122821047d54391bab1228210595f07bcbab1f2e06701c00021d749c200b08e15d3073020c06421c077b121c044b101c057b1f2e0689130e29130e2004871f833206e925b70e0d020d7498307b9925b70e0d70bff7f74c8cb02ca07cbffc9d0c7050060f845f846a05210bc923070e0f845f848a05210b99330f849e0f849f849f84513a1f847a904f846f847a9041023a984a1007eed44d0d31f01f861d31f01f862d3ff01f863f40401f864d401d0d33f01f865d31f01f866d31f01f867d31f01f868fa0001f869fa4001f86afa4001f86bd1d1b0decadd';
code_hash = '28030eb57f905fda5cbdc1b08955faf53065759063b958f36c6f861b2bcfc7be'

vesting-v0.99 - BETA (NOT FOR PRODUCTION)
code = 'b5ee9c7241021a010003ba000114ff00f4a413f4bcf2c80b01020120030203b8f28308d71820d31fd31fd31f02f823bbf264ed44d0d31fd31fd3ff305abaf2a15033baf2a202f9014033f910f2a3f800db3c20d74ac0018e99ed44ed45ed47915bed67ed65ed648e82db3ced41edf101f2ff9130e2f841a4f861db3c191413020148110402012008050201200706020db9846db3cdb3c819180129ba462db3cf845f846f847f848f849f84af84bf8448190201200e090201620d0a02016a0c0b012fa2c76cf3e9100723281f2fff2743e112040423d029be84c619000fa25fb513435c2c7e014bad346d9e36fc22470d4080847a4937d29910ce6903e9ff9837812801b7810148987159f318401902016e100f0019af1df6a26840106b90eb858fc00019adce76a26840206b90eb85ffc003b0d06c2220d749c160915be001d0d3030171b0915be0fa4030db3cf84b5210c7058eb401d31f018210a7733acdba8ea4d33fdb3c8210f7733acd01708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00915be2e30e19141201daf84a5210c7058ee201d31f0182107258a69bba8ed2d33f8e2afa407fc8ca0002fa4401c8ca07cbffc9d0f8441023810108f441f86420d74ac200209501d430d001deb3e6308210f258a69b01708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00db3c915be2915be2130066f848f847f846f845c8cb3fcb1fcb1fcb1ff849fa02f84acf16f84bcf16c9f844f843f842f841c8cb1fcb1fcbfff400ccc9ed54025cd307d4d1f823db3c20c2008e9b22c003f2e06421d0d303fa4031fa40f84a5220c705b3925f04e30d9130e201fb00181502e021fa4401c8ca07cbffc9d0f844810108f40a6fa1318f4b330172b0c002f2e06501fa003171d721fa0031fa0031d33f31d31f31d30001c000f2e066d3000193d430d0de01db3c8e17d31f302082104e73744bba01821047657424bab1f2e067e30e70925f03e220c2009372fb029130e2171600a420d749c2008e48d31f21c00022830bbab122811001bab122821047d54391bab1228210595f07bcbab1f2e06701c00021d749c200b08e15d3073020c06421c077b121c044b101c057b1f2e0689130e29130e2004871f833206e925b70e0d020d7498307b9925b70e0d70bff7f74c8cb02ca07cbffc9d0c7050060f845f846a05210bc923070e0f845f848a05210b99330f849e0f849f849f84513a1f847a904f846f847a9041023a984a1007eed44d0d31f01f861d31f01f862d3ff01f863f40401f864d401d0d33f01f865d31f01f866d31f01f867d31f01f868fa0001f869fa4001f86afa4001f86bd1d176f5e0f5';
code_hash = '320ae22be268161d685a7900de30dfec797b797ec9801069ac5b7850750254a2'

vesting-v1.00 - RELEASE
code = 'b5ee9c7241021c010003fb000114ff00f4a413f4bcf2c80b01020120030203b8f28308d71820d31fd31fd31f02f823bbf264ed44d0d31fd31fd3ff305abaf2a15033baf2a202f9014033f910f2a3f800db3c20d74ac0018e99ed44ed45ed47915bed67ed65ed648e82db3ced41edf101f2ff9130e2f841a4f861db3c1b1413020148110402012008050201200706020db9846db3cdb3c81b1a0129ba462db3cf845f846f847f848f849f84af84bf84481b0201200e090201620d0a02016a0c0b012fa2c76cf3e9100723281f2fff2743e112040423d029be84c61b000fa25fb513435c2c7e014bad346d9e36fc22470d4080847a4937d29910ce6903e9ff9837812801b7810148987159f318401b02016e100f0019af1df6a26840106b90eb858fc00019adce76a26840206b90eb85ffc003acd06c2220d749c160915be001d0d3030171b0915be0fa4030db3c01d31fd33ff84b5240c705238210a7733acdbab08ea46c12db3c8210f7733acd01708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00e30e1b141201cef84a5240c7050382107258a69bba13b08ed18e2c01fa407fc8ca0002fa4401c8ca07cbffc9d0f8441023810108f441f86420d74ac200209501d430d001deb312e68210f258a69b32708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00db3c925f03e2130066f848f847f846f845c8cb3fcb1fcb1fcb1ff849fa02f84acf16f84bcf16c9f844f843f842f841c8cb1fcb1fcbfff400ccc9ed54025cd307d4d1f823db3c20c2008e9b22c003f2e06421d0d303fa4031fa40f84a5220c705b3925f04e30d9130e201fb001a1503fa21fa4401c8ca07cbffc9d0f844810108f40a6fa1318f5f330172b0c002f2e06501fa003171d721fa0031fa0031d33f31d31f31d30001c000f2e066d3000193d430d0de2171db3c8e2a31d31f302082104e73744bba21821047657424bab121821056744370bab1018210566f7465bab1f2e067e30e70925f03e220c200191716000e9372fb029130e202ea0170db3c8e6d20d749c2008e63d31f21c00022830bbab122811001bab122821047d54391bab1228210595f07bcbab122821069fb306cbab1228210566f7465bab122821056744370bab1f2e06701c00021d749c200b08e15d3073020c06421c077b121c044b101c057b1f2e0689130e29130e2e30d1918001ad31f308210566f7465baf2e067004401fa4401c3ff925b70e001f833206e925b70e0d020d7498307b9925b70e0d70bffba0060f845f846a05210bc923070e0f845f848a05210b99330f849e0f849f849f84513a1f847a904f846f847a9041023a984a1007eed44d0d31f01f861d31f01f862d3ff01f863f40401f864d401d0d33f01f865d31f01f866d31f01f867d31f01f868fa0001f869fa4001f86afa4001f86bd1d10a20c6a7';
code_hash = 'b48b531abec3b714638291f7d77ed6dc9f6a2729efca20477137374d4ae8b590'
30 changes: 26 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,36 @@
const addressInfo = await tonweb.provider.getAddressInfo(address);
if (address !== currentAddress) return;

/** @type {string} */
const code098hash = '28030eb57f905fda5cbdc1b08955faf53065759063b958f36c6f861b2bcfc7be';
/** @type {string} */
const code099hash = '320ae22be268161d685a7900de30dfec797b797ec9801069ac5b7850750254a2';

/**
* @param codeHexOrBytes {string | Uint8Array}
* @return {Promise<string>} hash hex
*/
const getCodeHash = async (codeHexOrBytes) => {
/** @type {Cell} */
const codeCell = TonWeb.boc.Cell.oneFromBoc(codeHexOrBytes);
return TonWeb.utils.bytesToHex(await codeCell.hash());
}

const VestingWalletClass = TonWeb.LockupWallets.VestingWalletV1;
let vestingWalletCode = TonWeb.utils.bytesToBase64(TonWeb.utils.hexToBytes(VestingWalletClass.codeHex));
/** @type {string} */
const vestingWalletCodeHash = await getCodeHash(VestingWalletClass.codeHex);

vestingWalletCode = 'te6cckECHAEAA/sAART/APSkE/S88sgLAQIBIAIDAgFIBAUDuPKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T/zBauvKhUDO68qIC+QFAM/kQ8qP4ANs8INdKwAGOme1E7UXtR5Fb7WftZe1kjoLbPO1B7fEB8v+RMOL4QaT4Yds8ExQVA6zQbCIg10nBYJFb4AHQ0wMBcbCRW+D6QDDbPAHTH9M/+EtSQMcFI4IQp3M6zbqwjqRsEts8ghD3czrNAXCAGMjLBVAEzxYj+gITy2rLH8s/yYBA+wDjDhMUBgIBIAcIAc74SlJAxwUDghByWKabuhOwjtGOLAH6QH/IygAC+kQByMoHy//J0PhEECOBAQj0QfhkINdKwgAglQHUMNAB3rMS5oIQ8limmzJwgBjIywVQBM8WI/oCE8tqyx/LP8mAQPsA2zySXwPiFQIBIAkKAgEgERICAW4LDAIBYg0OABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAUutNG2eNvwiRw1AgIR6STfSmRDOaQPp/5g3gSgBt4EBSJhxWfMYQBMCAWoPEAAPol+1E0NcLH4BL6LHbPPpEAcjKB8v/ydD4RIEBCPQKb6ExhMBKbpGLbPPhF+Eb4R/hI+En4SvhL+ESBMCDbmEbbPNs8gTFgB+7UTQ0x8B+GHTHwH4YtP/Afhj9AQB+GTUAdDTPwH4ZdMfAfhm0x8B+GfTHwH4aPoAAfhp+kAB+Gr6QAH4a9HRAlzTB9TR+CPbPCDCAI6bIsAD8uBkIdDTA/pAMfpA+EpSIMcFs5JfBOMNkTDiAfsAFhcAZvhI+Ef4RvhFyMs/yx/LH8sf+En6AvhKzxb4S88WyfhE+EP4QvhByMsfyx/L//QAzMntVABg+EX4RqBSELySMHDg+EX4SKBSELmTMPhJ4PhJ+En4RROh+EepBPhG+EepBBAjqYShA/oh+kQByMoHy//J0PhEgQEI9ApvoTGPXzMBcrDAAvLgZQH6ADFx1yH6ADH6ADHTPzHTHzHTAAHAAPLgZtMAAZPUMNDeIXHbPI4qMdMfMCCCEE5zdEu6IYIQR2V0JLqxIYIQVnRDcLqxAYIQVm90Zbqx8uBn4w5wkl8D4iDCABoYGQLqAXDbPI5tINdJwgCOY9MfIcAAIoMLurEigRABurEighBH1UORurEighBZXwe8urEighBp+zBsurEighBWb3RlurEighBWdENwurHy4GcBwAAh10nCALCOFdMHMCDAZCHAd7EhwESxAcBXsfLgaJEw4pEw4uMNGhsADpNy+wKRMOIARAH6RAHD/5JbcOAB+DMgbpJbcODQINdJgwe5kltw4NcL/7oAGtMfMIIQVm90Zbry4GcGwSgk';
/** @type {string} */
const addressInfoCodeHash = await getCodeHash(TonWeb.utils.base64ToBytes(addressInfo.code));

console.log(addressInfo.code);
if (addressInfoCodeHash === code098hash) {
console.log('Its not production vesting-v0.98 smart contract. Please use vesting-v1.00');
}
if (addressInfoCodeHash === code099hash) {
console.log('Its not production vesting-v0.99 smart contract. Please use vesting-v1.00');
}

if (addressInfo.code === vestingWalletCode) {
if (vestingWalletCodeHash === addressInfoCodeHash) {

const newVestingWallet = new VestingWalletClass(tonweb.provider, {
address: new TonWeb.utils.Address(address)
Expand Down

0 comments on commit ba432e8

Please sign in to comment.