Closed jafri closed 2 years ago
commit aa450d7555d001b908a4d3c44147d8624abdb404 should satisfy your need.
Yup that works!
One interesting thing though is that WASM from ascdk
here is 4KB while same code from blanc++ is 124 bytes. Roughly 30-40x larger.
ascdk
code
import { Name, requireRecipient } from "as-chain"
@contract
class ForwardedContract {}
export function apply(receiver: u64, firstReceiver: u64, action: u64): void {
if (receiver != firstReceiver) {
requireRecipient(Name.fromString("sf"))
}
return;
}
blanc++
#include <eosio/eosio.hpp>
class [[eosio::contract]] forwarder : public eosio::contract {
public:
using contract::contract;
};
extern "C" {
[[eosio::wasm_entry]]
void apply( uint64_t receiver, uint64_t code, uint64_t action ) {
if(code != receiver) {
require_recipient("sf"_n);
}
}
}
Ah I can achieve same result with this:
import * as env from 'as-chain/env'
@contract
class ForwardedContract {}
export function apply(receiver: u64, firstReceiver: u64, action: u64): void {
if (receiver != firstReceiver) {
env.require_recipient(14033216438886465536); // proton encode:name sf
}
}
In some cases it would be very useful to provide a custom
apply
function that the contract uses instead of the generated oneFor example a contract with just this: