({
callDataOffset,
gasForwardedOffset,
amountOffset,
assetIdOffset,
}: CallOpcodeParamsOffset)
| 56 | // |
| 57 | // These are arbitrary non-reserved registers, no special meaning |
| 58 | const getSingleCallInstructions = ({ |
| 59 | callDataOffset, |
| 60 | gasForwardedOffset, |
| 61 | amountOffset, |
| 62 | assetIdOffset, |
| 63 | }: CallOpcodeParamsOffset): InstructionSet => { |
| 64 | const inst = new InstructionSet( |
| 65 | asm.movi(0x10, callDataOffset), |
| 66 | asm.movi(0x11, amountOffset), |
| 67 | asm.lw(0x11, 0x11, 0), |
| 68 | asm.movi(0x12, assetIdOffset) |
| 69 | ); |
| 70 | |
| 71 | if (gasForwardedOffset) { |
| 72 | inst.push( |
| 73 | asm.movi(0x13, gasForwardedOffset), |
| 74 | asm.lw(0x13, 0x13, 0), |
| 75 | asm.call(0x10, 0x11, 0x12, 0x13) |
| 76 | ); |
| 77 | } else { |
| 78 | inst.push(asm.call(0x10, 0x11, 0x12, asm.RegId.cgas().to_u8())); |
| 79 | } |
| 80 | |
| 81 | return inst; |
| 82 | }; |
| 83 | // Given a list of contract calls, create the actual opcodes used to call the contract |
| 84 | function getInstructions(offsets: CallOpcodeParamsOffset[]): Uint8Array { |
| 85 | if (!offsets.length) { |
no test coverage detected