Skip to content

Instantly share code, notes, and snippets.

@shingonu
Last active April 12, 2018 02:30
Show Gist options
  • Select an option

  • Save shingonu/4c177743a12d5be6e25195536bde7eb8 to your computer and use it in GitHub Desktop.

Select an option

Save shingonu/4c177743a12d5be6e25195536bde7eb8 to your computer and use it in GitHub Desktop.

참고

sending a transaction costs 21000 gas

A recipient contract's fallback function only gets a 2300 gas stipend if it was invoked with recipient.transfer or recipient.send

fallback 함수가 호출되는 여러 경우가 있는데 그 중 receiver.send 함수 또는 receiver.transfer 함수로 인해 receiver의 fallback 함수가 호출된다. 이 때 fallback 함수 호출과 함께 2300gas를 봉급으로 주어지게 된다.

This is the same as an external account paying recipient with web3.eth.sendTransaction({to:recipient, gas:21000, ...}).

To obtain the same effects (2300 gas stipend), callers must explicitly limit the gas to zero when invoking the recipient by: recipient.call.gas(0).value(...)

fallback 함수에 봉급받은 2300gas가 있기 때문에 recipient.call.gas(0).value(...)을 호출해도 2300gas를 이용해 fallback에서 send, 또는 transfer 함수를 처리할 있다.

approve and transferFrom

solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment