declared_constructor.adl
1 program test.alpha { 2 mapping expected: bool => [u8; 32]; 3 mapping admin: bool => address; 4 5 async transition set_expected(checksum: [u8; 32]) -> Future { 6 return set_expected_(self.caller, checksum); 7 } 8 9 async function set_expected_(addr: address, checksum: [u8; 32]) { 10 assert_eq(addr, admin.get(true)); 11 expected.set(true, checksum); 12 } 13 14 @custom 15 async constructor() { 16 let current_edition: u16 = self.edition; 17 if current_edition > 0u16 { 18 let expected_checksum: [u8; 32] = expected.get(true); 19 let current_checksum: [u8; 32] = self.checksum; 20 assert_eq(expected_checksum, current_checksum); 21 } else { 22 admin.set(true, self.program_owner); 23 } 24 } 25 }